From bbab4579f69376446fdbc375cbdcb1e0f5af69d4 Mon Sep 17 00:00:00 2001 From: David Wettstein Date: Sat, 15 Oct 2022 21:17:55 +0200 Subject: [PATCH] fix: escape spaces in expanded paths (#676) --- README.md | 2 +- vimrcs/basic.vim | 2 +- vimrcs/extended.vim | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 42bcec15..afe4498c 100644 --- a/README.md +++ b/README.md @@ -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 te :tabedit =expand("%:p:h")/ + map te :tabedit =escape(expand("%:p:h"), " ")/ Switch [CWD](http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file) to the directory of the open buffer: diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 055c6efd..062ec71c 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -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 te :tabedit =expand("%:p:h")/ +map te :tabedit =escape(expand("%:p:h"), " ")/ " Switch CWD to the directory of the open buffer map cd :cd %:p:h:pwd diff --git a/vimrcs/extended.vim b/vimrcs/extended.vim index f6ff4503..8b1284fd 100644 --- a/vimrcs/extended.vim +++ b/vimrcs/extended.vim @@ -170,7 +170,7 @@ func! DeleteTillSlash() endfunc func! CurrentFileDir(cmd) - return a:cmd . " " . expand("%:p:h") . "/" + return a:cmd . " " . escape(expand("%:p:h"), " ") . "/" endfunc "=================================================================================