dotfiles

Cross platform dotfiles for linux, mac and windows

commit 19dc654340b5319938efd8bbe2c54469c908e3d5
parent 1ada52acfa06d35024b4feb7c0972edd896c9a9b
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Wed, 6 Jul 2022 14:52:48 +0530

vim: Add function FileMvHelper

Rearrange contents of keybindings.vim and move
some of them to plugin.vim for better readability.

git: Add alias for push -u origin, puuo
4 files changed, 42 insertions(+), 32 deletions(-)
M
.config/git/config
|
1
+
M
.config/vim/keybindings/keybindings.vim
|
51
+++++++++++++++++++++------------------------------
M
.config/vim/keybindings/markdown.vim
|
3
+++
M
.config/vim/plugin/plugin.vim
|
19
+++++++++++++++++--
diff --git a/.config/git/config b/.config/git/config
@@ -17,6 +17,7 @@
 	lss = log --show-signature
 	p = pull
 	pu = push
+	puuo = push -u origin
 	rs = remote set-url
 	rso = remote set-url origin
 	rv = remote --verbose
diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim
@@ -4,6 +4,7 @@ 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>et :set expandtab<cr>
 nnoremap <leader>f :find *
 nnoremap <leader>lo :lopen<cr>
 nnoremap <leader>ls :ldo<space>s/

@@ -11,15 +12,10 @@ nnoremap <leader>p :Rg<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>
+" Buffer Creation
+nnoremap <Leader>sc :source ~/.config/vim/vimrc<enter>
+nnoremap <Leader>ss :split<enter>
+nnoremap <Leader>vv :vsplit<enter>
 
 " Behave vim
 nnoremap Y y$

@@ -33,20 +29,9 @@ call SetupCommandAlias("W","w")
 call SetupCommandAlias("Wq","wq")
 call SetupCommandAlias("man","help")
 
-function! ToggleList()
-	if &list == "nolist"
-		set list
-	else
-		set nolist
-	endif
-endfunction
-
 nnoremap <leader>tl :call ToggleList()<CR>
-
-" Buffer Creation
-nnoremap <Leader>vv :vsplit<enter>
-nnoremap <Leader>ss :split<enter>
-nnoremap <Leader>sc :source ~/.config/vim/vimrc<enter>
+nnoremap <leader>bb :call SaveAndBuild()<CR>
+nnoremap <leader>fmv :call FileMvHelper()<CR>
 
 " Quick save and write
 nnoremap <leader>wq :wq<cr>

@@ -56,14 +41,6 @@ nnoremap <leader>qq :q<cr>
 " Fugitive
 nnoremap <space>gd :Gvdiff<CR>
 
-" Run Make
-
-function SaveAndBuild()
-		wall
-		Make
-endfunction
-
-nnoremap <leader>bb :call SaveAndBuild()<CR>
 
 " Generate ctags
 map <leader>gt :!sh -c "ctags `rg --files`"<CR>

@@ -79,5 +56,19 @@ source $XDG_CONFIG_HOME/vim/keybindings/markdown.vim
 " TODO Have a default build hotkey keybinding, maybe bb,br?
 " And make it based on the project
 " Make it as a filetype plugin. This should cover most cases.
+" Cargo
 nnoremap <leader>cb :Cargo build<cr>
 nnoremap <leader>cr :Cargo run<cr>
+" Markdown
+nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
+
+"ctrlp.vim
+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>
+" vim-fugitive
+nnoremap <leader>gg :Ggrep<space>
+nnoremap <leader>lg :Glgrep<space>
+
diff --git a/.config/vim/keybindings/markdown.vim b/.config/vim/keybindings/markdown.vim
@@ -14,3 +14,6 @@ endfunction
 function ReverseDate()
 	normal! dt/wwpldeBP
 endfunction
+
+nnoremap <leader>h1 :call QuickUnderline(1)<cr>
+nnoremap <leader>h2 :call QuickUnderline(2)<cr>
diff --git a/.config/vim/plugin/plugin.vim b/.config/vim/plugin/plugin.vim
@@ -1,2 +1,17 @@
-" Plugin Keybindings
-nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
+function! ToggleList()
+	if &list == "nolist"
+		set list
+	else
+		set nolist
+	endif
+endfunction
+
+function! FileMvHelper()
+	:normal! 0i"A"0y$A p0imv j0
+endfunction
+" Run Make
+
+function SaveAndBuild()
+		wall
+		Make
+endfunction