dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit 1ada52acfa06d35024b4feb7c0972edd896c9a9b
parent 0cea58ecb659f952d3654f7d92ef2ed5ac99698a
Author: Bharatvaj <bharatvaj@yahoo.com>
Date:   Tue,  5 Jul 2022 13:04:35 +0530

Add useful vim keybindings

Add CtrlP to vim

Just choosing a simple file from fzf and piping to vim is hard to
configure and finally I had to rely on plugins like CtrlP.

Going in the UNIX way is being a uphill battle when most software written
is without direction. Making them integrate "perfectly" is giving me headaches.
Going to choose my battles from now on. I am cheating temporarily, so I can build better tools.

Neovim is no better. It is bulding a whole lot of community around
it's plugin ecosystem instead of the availble tools, but it'll serve my
purpose for now.

Making the dotfiles based on neovim first to make work a little
bit easier. Not leaning towards neovim. I feel both vim and neovim
equally suck in their own ways.

Diffstat:
M.config/vim/keybindings/keybindings.vim | 30+++++++++++++++++++-----------
M.gitmodules | 3+++
A.local/share/vim/pack/general/start/ctrlp.vim | 1+
3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim @@ -1,23 +1,29 @@ " General keybindings -nmap <leader>F :GFiles<cr> -nnoremap <Leader>l :ls<CR>:b<space> -nnoremap <leader><leader> :grep -nnoremap <leader>F :GFiles<cr> +nnoremap <Leader>lb :ls<CR>:b<space> nnoremap <leader>co :copen<cr> +nnoremap <leader>cs :cdo<space>s/ nnoremap <leader>ec :edit $XDG_CONFIG_HOME/vim/vimrc<cr> nnoremap <leader>ek :edit $XDG_CONFIG_HOME/vim/keybindings/keybindings.vim<cr> nnoremap <leader>f :find * -nnoremap <leader>gg :grep<space> -nnoremap <leader>vg :vimgrep<space> +nnoremap <leader>lo :lopen<cr> +nnoremap <leader>ls :ldo<space>s/ nnoremap <leader>p :Rg<cr> -nnoremap <leader>t :tabnew<cr> +nnoremap <leader>so :source %<cr> +nnoremap <leader>tt :tabnew<cr> +nnoremap <leader>vg :vimgrep<space> + +" Plugin dependent +let g:ctrlp_map = '<tab><tab>' +let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] +let g:ctrlp_working_path_mode = 'r' +let g:gutentags_file_list_command = 'rg --files' +nnoremap <leader><leader> :CtrlPTag<cr> +nnoremap <leader>gg :Ggrep<space> +nnoremap <leader>lg :Glgrep<space> " Behave vim nnoremap Y y$ -fun! GitFind() -endfun - fun! SetupCommandAlias(from, to) exec 'cnoreabbrev <expr> '.a:from \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")' @@ -25,6 +31,7 @@ fun! SetupCommandAlias(from, to) endfun call SetupCommandAlias("W","w") call SetupCommandAlias("Wq","wq") +call SetupCommandAlias("man","help") function! ToggleList() if &list == "nolist" @@ -59,7 +66,8 @@ endfunction nnoremap <leader>bb :call SaveAndBuild()<CR> " Generate ctags -map <leader>c :!ctags -R -f ./.git/tags .<CR> +map <leader>gt :!sh -c "ctags `rg --files`"<CR> +set tags+=.git/tags nnoremap <CR> :noh<CR><CR>:<backspace> diff --git a/.gitmodules b/.gitmodules @@ -61,3 +61,6 @@ [submodule ".local/share/vim/pack/general/start/mru"] path = .local/share/vim/pack/general/start/mru url = https://github.com/yegappan/mru +[submodule ".local/share/vim/pack/general/start/ctrlp.vim"] + path = .local/share/vim/pack/general/start/ctrlp.vim + url = https://github.com/kien/ctrlp.vim diff --git a/.local/share/vim/pack/general/start/ctrlp.vim b/.local/share/vim/pack/general/start/ctrlp.vim @@ -0,0 +1 @@ +Subproject commit 564176f01d7f3f7f8ab452ff4e1f5314de7b0981