Skip to content

Commit

Permalink
fix: escape spaces in expanded paths (#676)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwettstein authored Oct 15, 2022
1 parent 88f64a0 commit bbab457
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Useful mappings for managing tabs:

" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <C-r>=expand("%:p:h")<cr>/
map <leader>te :tabedit <C-r>=escape(expand("%:p:h"), " ")<cr>/

Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer:

Expand Down
2 changes: 1 addition & 1 deletion vimrcs/basic.vim
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ au TabLeave * let g:lasttab = tabpagenr()

" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <C-r>=expand("%:p:h")<cr>/
map <leader>te :tabedit <C-r>=escape(expand("%:p:h"), " ")<cr>/
" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
Expand Down
2 changes: 1 addition & 1 deletion vimrcs/extended.vim
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func! DeleteTillSlash()
endfunc

func! CurrentFileDir(cmd)
return a:cmd . " " . expand("%:p:h") . "/"
return a:cmd . " " . escape(expand("%:p:h"), " ") . "/"
endfunc

"=================================================================================
Expand Down

0 comments on commit bbab457

Please sign in to comment.