From 7096ef11bf9d706f0e69994ae783ccc428004918 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 14 Dec 2023 13:01:40 -0700 Subject: Shell escape some commands to work with filenames with spaces --- init.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.vim b/init.vim index eec97d3..cbb6d59 100644 --- a/init.vim +++ b/init.vim @@ -144,7 +144,7 @@ if isdirectory(printf('%s/.config/nvim/after', $HOME)) endif noremap nt NvimTreeToggle -noremap :e =expand('%:h')/ +noremap :e =escape(expand('%:h'), ' \')/ noremap . lua require('windownav').goto_terminal() noremap I lua require('windownav').goto_initvim() noremap ' lua require('windownav').goto_lastwin() @@ -167,7 +167,7 @@ if has('rneovim') endif " Opens a terminal in the directory of the current file. -command! TERM exec "term sh -c 'cd " . expand('%:p:h') . " && exec $SHELL'" +command! TERM exec "term sh -c " . shellescape(printf("cd %s && exec ", shellescape(expand('%:p:h')))) . '$SHELL' " W = w. I often click when typing :w command! W w -- cgit