Skip to content

Instantly share code, notes, and snippets.

@christoomey
Last active August 29, 2015 13:56
Show Gist options
  • Save christoomey/9040167 to your computer and use it in GitHub Desktop.
Save christoomey/9040167 to your computer and use it in GitHub Desktop.
" Change the current working directory to the directory that the current file you are editing is in.
nnoremap <Leader>cd :cd <C-R>=escape(expand('%:p:h'), ' ')<CR><CR>
" Opens a file with the current working directory already filled in so you have to specify only the filename.
nnoremap <Leader>e :e <C-R>=escape(expand('%:p:h'), ' ')<CR>/
nnoremap <Leader>s :split <C-R>=escape(expand('%:p:h'), ' ')<CR>/
nnoremap <Leader>v :vsplit <C-R>=escape(expand('%:p:h'), ' ')<CR>/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment