Thu, 07 Feb 2019 12:54:10 -0600
I don't really use these except for the cd shortcuts
.vim/autoload/vimrc.vim | file | annotate | diff | comparison | revisions | |
.vimrc | file | annotate | diff | comparison | revisions |
--- a/.vim/autoload/vimrc.vim +++ b/.vim/autoload/vimrc.vim @@ -30,3 +30,20 @@ func! vimrc#AutoSessionConfig() abort exec 'UniteSessionLoad ' . tolower(v:servername) endif endfunc + +func! vimrc#Gcd() abort + let root = system('git rev-parse --show-toplevel 2>/dev/null')[:-2] + if ! v:shell_error + exec 'cd ' . root + endif + pwd +endfunc + +func! vimrc#Hgcd() abort + let root = system('hg root 2>/dev/null')[:-2] + if ! v:shell_error + exec 'cd ' . root + endif + pwd +endfunc +
--- a/.vimrc +++ b/.vimrc @@ -41,9 +41,6 @@ let s:filename = expand('<sfile>') Plug 'vimwiki/vimwiki' - Plug 'tpope/vim-fugitive' - Plug 'ludovicchabant/vim-lawrencium' - Plug 'Shougo/vinarise.vim' Plug 'asciidoc/vim-asciidoc' Plug 'vim-perl/vim-perl' @@ -126,11 +123,17 @@ noremap <leader>tm :Tabularize methods<C noremap <silent> <leader>a :call vimrc#AutoFmtToggle()<CR> -" Command Aliases {{{ +" Commands & Aliases {{{ command! -nargs=+ CAlias call vimrc#CommandAlias(<f-args>) +command! Gcd call vimrc#Gcd() +command! Hgcd call vimrc#Hgcd() + CAlias Q q CAlias W w +CAlias gcd Gcd +CAlias hgcd Hgcd + " make these default to one window/buffer too CAlias doc ViewDoc! CAlias help ViewDocHelp!