dotfiles

Cross platform dotfiles for linux, mac and windows

commit ad7b25b8a5677aef535d660d7e2f1dc71e4f0b19
parent e4a68d4bb9325bfa1137b134f475f67ba29cca65
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Mon, 4 Jul 2022 22:57:29 +0530

USE XDG paths instead of ~ for vim

Use if exists for new options in vim, some features are not working in
some supported Ubuntu LTS release(16.04)
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim
@@ -2,8 +2,8 @@
 nnoremap <Leader>l :ls<CR>:b<space>
 nnoremap <leader>F :GFiles<cr>
 nnoremap <leader>co :copen<cr>
-nnoremap <leader>ec :edit ~/.config/vim/vimrc<cr>
-nnoremap <leader>ek :edit ~/.config/vim/keybindings/keybindings.vim<cr>
+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 :vimgrep<space>
 nnoremap <leader>p :Rg<cr>

@@ -61,8 +61,8 @@ map <leader>c :!ctags -R -f ./.git/tags .<CR>
 nnoremap <CR> :noh<CR><CR>:<backspace>
 
 " Plugin keybindings
-source ~/.config/vim/keybindings/vimspector.vim
-source ~/.config/vim/keybindings/markdown.vim
+source $XDG_CONFIG_HOME/vim/keybindings/vimspector.vim
+source $XDG_CONFIG_HOME/vim/keybindings/markdown.vim
 
 " Development keybindings
 " TODO Have a default build hotkey keybinding, maybe bb,br?
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
@@ -1,4 +1,8 @@
-if !has('nvim') | set viminfofile=$XDG_CACHE_DIR/vim/viminfo | endif
+if !has('nvim')
+	if has("&viminfofile")
+		set viminfofile=$XDG_CACHE_DIR/vim/viminfo
+	endif
+endif
 
 " General
 set number

@@ -95,4 +99,6 @@ if has("win32")
 	set shellxquote=  
 endif
 
-set fillchars+=eob:\ 
+if exists('+fillchars')
+	set fillchars+=eob:\ 
+endif