Skip to content

Commit

Permalink
Fix opening directory not working in Windows (#26)
Browse files Browse the repository at this point in the history
* Fix opening directory not working in Windows

* Check if path is directory
  • Loading branch information
sitiom authored Feb 15, 2021
1 parent c808017 commit 4211761
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions autoload/floaterm/wrapper/lf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ function! floaterm#wrapper#lf#(cmd) abort
endif

exe "lcd " . original_dir
let cmd = [&shell, &shellcmdflag, cmd]
return [cmd, {'on_exit': funcref('LfCallback', [lf_tmpfile, lastdir_tmpfile])}, v:false]
endfunction
4 changes: 2 additions & 2 deletions plugin/lf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ else
endif

function! OpenLfIn(path, edit_cmd)
let currentPath = shellescape(expand(a:path))
let currentPath = shellescape(isdirectory(a:path) ? fnamemodify(expand(a:path), ":p:h") : expand(a:path))
let s:edit_cmd = a:edit_cmd
if exists(":FloatermNew")
exec 'FloatermNew ' . '--height=' . string(get(g:, 'lf_height', g:floaterm_height)) . ' --width=' . string(get(g:, 'lf_width', g:floaterm_width)) . ' ' . s:lf_command . ' ' . currentPath
exec 'FloatermNew' . ' --height=' . string(get(g:, 'lf_height', g:floaterm_height)) . ' --width=' . string(get(g:, 'lf_width', g:floaterm_width)) . ' ' . s:lf_command . ' ' . currentPath
else
echoerr "Failed to open a floating terminal. Make sure `voldikss/vim-floaterm` is installed."
endif
Expand Down

0 comments on commit 4211761

Please sign in to comment.