diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-16 01:22:54 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-16 01:29:15 +1200 |
commit | 3f52145bbedc8d291567d41e29805c6bd5d3a467 (patch) | |
tree | 73d2ab8dcf5d6efbfd47c21615eb92931da8c92a /vim/vimrc | |
parent | Switch XDG semantics to functions not global var (diff) | |
download | dotfiles-3f52145bbedc8d291567d41e29805c6bd5d3a467.tar.gz dotfiles-3f52145bbedc8d291567d41e29805c6bd5d3a467.zip |
Write out over-engineered path creation function
Diffstat (limited to 'vim/vimrc')
-rw-r--r-- | vim/vimrc | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -162,21 +162,6 @@ if xdg#ConfigHome() !=# '' || !empty(xdg#ConfigDirs()) \), ',')) endif -" We need a command to reliably establish a full path, whether or not the -" directories already exist. We create a wrapper for the autoloaded function -" path#Create() with similar calling conventions to mkdir(), but with the ‘p’ -" value for the second parameter {prot} forced on. Calling it with a bang -" like :CreatePath! creates a private directory (permissions 0700). -" -command! -bang -bar -complete=dir -nargs=1 CreatePath - \ call path#Create(expand(<q-args>), <q-bang> ==# '!') - -" Now that we have a way to create directories if they don’t already exist, -" let’s apply it for the first time to the user runtime directory. Note that -" we aren’t checking whether this actually succeeded. We do want errors -" raised if there were problems with the creation, but we’ll barrel on ahead -" regardless after warning the user about our failure. -" " Using a logical but non-default location for viminfo has the nice benefit of " preventing command and search history from getting clobbered when something " runs Vim without using this vimrc, because such an instance will safely @@ -1373,8 +1358,7 @@ nnoremap <Leader>D \ :PutDate!<CR> " This group contains mappings that are to do with file and path management -" relative to the current buffer. The Leader,P mapping that creates -" directory hierarchies uses the :CreatePath command created earlier. +" relative to the current buffer. "" Leader,g shows the current file’s fully expanded path nnoremap <Leader>g @@ -1384,7 +1368,7 @@ nnoremap <Leader>G \ :<C-U>cd %:h<Bar>pwd<CR> "" Leader,P creates the path to the current file if it doesn’t exist nnoremap <Leader>P - \ :<C-U>CreatePath %:h<CR> + \ :<C-U>call mkdir(expand('%:h'), 'p')<CR> " This group contains mappings that show information about Vim’s internals: " marks, registers, variables, and the like. |