From 828b5662b77be0a48c5695a2bfaa1e8619457833 Mon Sep 17 00:00:00 2001 From: David Wettstein Date: Thu, 11 Nov 2021 21:52:31 +0100 Subject: [PATCH] fix: escape spaces in expanded paths --- 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 2cb4caf6..c27cf97b 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 e108c303..68d71f3e 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 e07045aa..fc935f8f 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 "=================================================================================