@@ -36,25 +36,25 @@ Oil.nvim のバッファ上で `<Leader>o` を押すと、その位置のパス
3636
3737``` lua
3838vim .api .nvim_create_autocmd (' FileType' , {
39- pattern = ' oil' ,
40- callback = function (args )
41- vim .keyma .set (' n' ,
42- ' <Leader>o' ,
43- function ()
44- local entry = oil .get_cursor_entry ()
45- local current_dir = oil .get_current_dir (args .buf ) or vim .fn .getcwd ()
39+ pattern = ' oil' ,
40+ callback = function (args )
41+ vim .keyma .set (' n' ,
42+ ' <Leader>o' ,
43+ function ()
44+ local entry = oil .get_cursor_entry ()
45+ local current_dir = oil .get_current_dir (args .buf ) or vim .fn .getcwd ()
4646
47- if entry then
48- -- -reveal でカーソル位置のエントリにフォーカス
49- local reveal_path = current_dir .. entry .name
50- vim .cmd (string.format (' Fern %s -reveal=%s' ,
51- vim .fn .fnameescape (current_dir ),
52- vim .fn .fnameescape (reveal_path )))
53- else
54- vim .cmd (string.format (' Fern %s' , vim .fn .fnameescape (current_dir )))
55- end
56- end , { buffer = args .buf })
57- end ,
47+ if entry then
48+ -- -reveal でカーソル位置のエントリにフォーカス
49+ local reveal_path = current_dir .. entry .name
50+ vim .cmd (string.format (' Fern %s -reveal=%s' ,
51+ vim .fn .fnameescape (current_dir ),
52+ vim .fn .fnameescape (reveal_path )))
53+ else
54+ vim .cmd (string.format (' Fern %s' , vim .fn .fnameescape (current_dir )))
55+ end
56+ end , { buffer = args .buf })
57+ end ,
5858})
5959```
6060
0 commit comments