LoginSignup
0
0

More than 3 years have passed since last update.

早く書き始めたい

Last updated at Posted at 2021-01-19

Rangerがとても便利だったので,主にそれの紹介です.
私がファイルに書き始めるまでをその時系列に沿って説明します.

1. Ranger

  • 1.1 直接ファイルを開く場合.コマンドはlです.lにはnvimが登録されています.
  • 1.2 作業ディレクトリを開く場合 Sで移動した後に$nvim hoge.txtとファイルを開くこともあります.その場合,以下の操作はいりません.
  • 1.3 Gvim(nvim-qtなど)の場合 ranger-vimを使用して,1.1と同様にファイルを開きます.

2. 作業ディレクトリの移動(1.1, 1.3)

1.1, 1.3の場合vim内の作業ディレクトリを移動する必要があります.自作コマンド:CD(以下)を実行します.

init.vim
    " define current directory {{{
    " 参考: https://vim-jp.org/vim-users-jp/2009/09/08/Hack-69.html
    command! -nargs=? -complete=dir CD  call s:ChangeCurrentDir('<args>')
    function! s:ChangeCurrentDir(directory)
        if a:directory == ''
            lcd %:p:h
        else
            execute 'lcd' . a:directory
        endif

        if exists("g:NERDTree")
            exe "normal \<Plug>NerdTreeCWD"
        endif
    endfunction
    " }}}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0