dotfiles

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

commit d00b438d041a50df788031f309f6f2064c215634
parent 3f4a2f3548a2a30e5199361f8c9d4b48732f0bf3
Author: Bharatvaj <bharatvaj@yahoo.com>
Date:   Wed,  2 Feb 2022 01:56:17 +0530

Have seperate configurations for vim and neovim

Neovim seems to be a different beast when compared with vim, having the
same config file seems to limit both of them.

Vim
---
Removed packages from vimrc and moved them to .local/share/vim/pack
utilizing vim-8 packages.

Essential packages are sourced by default. Heavy packages are added but
require explicit sourcing at runtime.

Added .config/vim/hyper.vim

Quit keybindings is now mapped to <leader>:qq instead of <leader>:q
because I keep hitting it accidentally.

Neovim
------
Removed init.vim
Added init.lua!
Add useful keybindings in init.lua

Diffstat:
M.config/.gitignore | 3+++
A.config/nvim/init.lua | 12++++++++++++
D.config/nvim/init.vim | 3---
A.config/nvim/utils.lua | 11+++++++++++
A.config/vim/hyper.vim | 4++++
M.config/vim/keybindings/keybindings.vim | 13+++++++++----
M.config/vim/keybindings/rust.vim | 3+--
D.config/vim/plugin/development.vim | 13-------------
M.config/vim/vimrc | 52++++++++++++++++++----------------------------------
A.local/share/.gitignore | 2++
A.local/share/vim/pack/development/start/emmet-vim | 1+
A.local/share/vim/pack/development/start/rust.vim | 1+
A.local/share/vim/pack/development/start/vim-cmake | 1+
A.local/share/vim/pack/development/start/vim-msbuild | 1+
A.local/share/vim/pack/general/start/editorconfig-vim | 1+
A.local/share/vim/pack/general/start/vim-better-whitespace | 1+
A.local/share/vim/pack/general/start/vim-codepainter | 1+
A.local/share/vim/pack/general/start/vim-commentary | 1+
A.local/share/vim/pack/general/start/vim-easymotion | 1+
A.local/share/vim/pack/general/start/vim-fugitive | 1+
A.local/share/vim/pack/general/start/vim-ninja-feet | 1+
A.local/share/vim/pack/general/start/vim-repeat | 1+
A.local/share/vim/pack/general/start/vim-surround | 1+
A.local/share/vim/pack/general/start/vim-textobj-user | 1+
A.local/share/vim/pack/general/start/vim-textobj-xmlattr | 1+
A.local/share/vim/pack/general/start/vim-unimpaired | 1+
A.local/share/vim/pack/themes/start/gruvbox-material | 1+
27 files changed, 77 insertions(+), 56 deletions(-)

diff --git a/.config/.gitignore b/.config/.gitignore @@ -3,6 +3,7 @@ !.gitignore !X11 +!X11 !alacritty/ !alacritty/** !bash/ @@ -14,6 +15,8 @@ !lynx/lynx.cfg !lynx/lynx.lss !nvim +!nvim +!nvim/** !sh/ !sh/** !tmux/ diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua @@ -0,0 +1,12 @@ +vim.g.mapleader = ' ' +local set = vim.opt + +local map = require("utils").map + +map("n", "<Leader>ww", ":w<CR>", { silent = true }) +map("n", "<Leader>wq", ":wq<CR>", { silent = true }) +map("n", "<Leader>qq", ":q<CR>", { silent = true }) +map("n", "<CR>", ":noh<CR>", { silent = true }) + + +set.tabstop=4 diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -1,3 +0,0 @@ -set runtimepath^=$XDG_CONFIG_HOME/vim/.vimrc runtimepath+=$XDG_CONFIG_HOME/vim/after -let &packpath=&runtimepath -" source $XDG_CONFIG_HOME/vim/.vimrc diff --git a/.config/nvim/utils.lua b/.config/nvim/utils.lua @@ -0,0 +1,11 @@ +local M = {} + +function M.map(mode, lhs, rhs, opts) + local options = { noremap = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.api.nvim_set_keymap(mode, lhs, rhs, options) +end + +return M diff --git a/.config/vim/hyper.vim b/.config/vim/hyper.vim @@ -0,0 +1,4 @@ +hi LineNr guifg=DarkGray ctermfg=DarkGray +hi LineNrAbove guifg=LightGray ctermfg=LightGray +hi LineNrBelow guifg=LightGray ctermfg=LightGray + diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim @@ -2,6 +2,7 @@ nnoremap <leader>t :tabnew<cr> nnoremap <leader>p :Rg<cr> nnoremap <leader>f :find +nnoremap <Leader>l :ls<CR>:b<space> nmap <leader>F :GFiles<cr> " Buffer Creation @@ -11,13 +12,17 @@ nnoremap <Leader>s :split<enter> " Quick save and write nnoremap <leader>wq :wq<cr> nnoremap <leader>ww :w<cr> -nnoremap <leader>q :q<cr> +nnoremap <leader>qq :q<cr> nnoremap <CR> :noh<CR><CR>:<backspace> " Plugin keybindings -source $XDG_CONFIG_HOME/vim/keybindings/vimspector.vim -source $XDG_CONFIG_HOME/vim/keybindings/markdown.vim +source ~/.config/vim/keybindings/vimspector.vim +source ~/.config/vim/keybindings/markdown.vim " Development keybindings -source $XDG_CONFIG_HOME/vim/keybindings/rust.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. +nnoremap <leader>cb :Cargo build<cr> +nnoremap <leader>cr :Cargo run<cr> diff --git a/.config/vim/keybindings/rust.vim b/.config/vim/keybindings/rust.vim @@ -1,2 +1 @@ -nnoremap <leader>cb :Cargo build<cr> -nnoremap <leader>cr :Cargo run<cr> + diff --git a/.config/vim/plugin/development.vim b/.config/vim/plugin/development.vim @@ -1,13 +0,0 @@ -Plug 'editorconfig/editorconfig-vim' -Plug 'cdelledonne/vim-cmake' -Plug 'vim-syntastic/syntastic' -Plug 'rust-lang/rust.vim' -if has('python') - " Enable if required, manually - "Plug 'puremourning/vimspector' -endif -"TODO add windows check -if has('win32') - Plug 'heaths/vim-msbuild' -endif -Plug 'mattn/emmet-vim' diff --git a/.config/vim/vimrc b/.config/vim/vimrc @@ -1,20 +1,19 @@ " Use XDG Paths for vim -set runtimepath^=$XDG_CONFIG_HOME/vim -set runtimepath+=$XDG_DATA_HOME/vim -set runtimepath+=$XDG_CONFIG_HOME/vim/after +set runtimepath^='$XDG_CONFIG_HOME/vim' +set runtimepath+='$XDG_DATA_HOME/vim' +set runtimepath+='$XDG_CONFIG_HOME/vim/after' -set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim -set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after +set packpath^=$XDG_DATA_HOME/vim -let g:netrw_home = $XDG_DATA_HOME."/vim" -call mkdir($XDG_DATA_HOME."/vim/spell", 'p') +let g:netrw_home = $XDG_DATA_HOME . "/vim" +call mkdir($XDG_DATA_HOME . "/vim/spell", 'p') set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p') set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p') set directory=$XDG_CACHE_HOME/vim/swap | call mkdir(&directory, 'p') set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p') -if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif +if !has('nvim') | set viminfofile=$XDG_CACHE_DIR/vim/viminfo | endif " Line number "Adapted from https://jeffkreeftmeijer.com/vim-number/ @@ -62,33 +61,18 @@ set shiftwidth=4 " Netrw customization let g:netrw_banner = 0 -" Harder vim -" Disable arrow keys -for key in ['<Up>', '<Down>', '<Left>', '<Right>'] - exec 'noremap' key '<Nop>' - exec 'inoremap' key '<Nop>' - exec 'cnoremap' key '<Nop>' -endfor -" Disable h and l -for key in ['h', 'l'] - exec 'noremap' key '<Nop>' -endfor - -" Visual Tweaks -hi VertSplit term=NONE cterm=NONE gui=NONE - -"TODO use inverse colors from fg and bg instead of hardcoding black and white values -hi LineNr ctermbg=Black ctermfg=White - -" Prominent Cursor Line -hi CursorLineNr ctermbg=White ctermfg=Black - " Disable status -set laststatus=0 -set nowrapscan - -" Plugins -source $XDG_CONFIG_HOME/vim/plugin/plugin.vim +set laststatus=1 " Keybindings source $XDG_CONFIG_HOME/vim/keybindings/keybindings.vim + +if has("win32") + if executable("pwsh") + set shell=pwsh + set shellcmdflag=-ExecutionPolicy\ RemoteSigned\ -Command + set shellquote=\" + " shellxquote must be a literal space character. + set shellxquote= + endif +endif diff --git a/.local/share/.gitignore b/.local/share/.gitignore @@ -0,0 +1,2 @@ +!vim/pack/ +!vim/pack/* diff --git a/.local/share/vim/pack/development/start/emmet-vim b/.local/share/vim/pack/development/start/emmet-vim @@ -0,0 +1 @@ +Subproject commit 1b7e460de071b7ed45cae3b5bec47310e7d12ed5 diff --git a/.local/share/vim/pack/development/start/rust.vim b/.local/share/vim/pack/development/start/rust.vim @@ -0,0 +1 @@ +Subproject commit c06a17151c69b9d61e60a28274932a28fd37c453 diff --git a/.local/share/vim/pack/development/start/vim-cmake b/.local/share/vim/pack/development/start/vim-cmake @@ -0,0 +1 @@ +Subproject commit 844b85677d52d932432eb115236d9173ebe3664d diff --git a/.local/share/vim/pack/development/start/vim-msbuild b/.local/share/vim/pack/development/start/vim-msbuild @@ -0,0 +1 @@ +Subproject commit 4766d9a225c433e7ce2625bcc6263bfd028c4a50 diff --git a/.local/share/vim/pack/general/start/editorconfig-vim b/.local/share/vim/pack/general/start/editorconfig-vim @@ -0,0 +1 @@ +Subproject commit 3078cd10b28904e57d878c0d0dab42aa0a9fdc89 diff --git a/.local/share/vim/pack/general/start/vim-better-whitespace b/.local/share/vim/pack/general/start/vim-better-whitespace @@ -0,0 +1 @@ +Subproject commit c5afbe91d29c5e3be81d5125ddcdc276fd1f1322 diff --git a/.local/share/vim/pack/general/start/vim-codepainter b/.local/share/vim/pack/general/start/vim-codepainter @@ -0,0 +1 @@ +Subproject commit 1ae0ee4f48e7e196ef90bc84ecbc56cad231e9df diff --git a/.local/share/vim/pack/general/start/vim-commentary b/.local/share/vim/pack/general/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit 349340debb34f6302931f0eb7139b2c11dfdf427 diff --git a/.local/share/vim/pack/general/start/vim-easymotion b/.local/share/vim/pack/general/start/vim-easymotion @@ -0,0 +1 @@ +Subproject commit d75d9591e415652b25d9e0a3669355550325263d diff --git a/.local/share/vim/pack/general/start/vim-fugitive b/.local/share/vim/pack/general/start/vim-fugitive @@ -0,0 +1 @@ +Subproject commit 6f07d7e6cd23b7a76dc461fdfb1984717d233806 diff --git a/.local/share/vim/pack/general/start/vim-ninja-feet b/.local/share/vim/pack/general/start/vim-ninja-feet @@ -0,0 +1 @@ +Subproject commit cb9b448dd468a338255aed474e6113ed115612c1 diff --git a/.local/share/vim/pack/general/start/vim-repeat b/.local/share/vim/pack/general/start/vim-repeat @@ -0,0 +1 @@ +Subproject commit 24afe922e6a05891756ecf331f39a1f6743d3d5a diff --git a/.local/share/vim/pack/general/start/vim-surround b/.local/share/vim/pack/general/start/vim-surround @@ -0,0 +1 @@ +Subproject commit f51a26d3710629d031806305b6c8727189cd1935 diff --git a/.local/share/vim/pack/general/start/vim-textobj-user b/.local/share/vim/pack/general/start/vim-textobj-user @@ -0,0 +1 @@ +Subproject commit 41a675ddbeefd6a93664a4dc52f302fe3086a933 diff --git a/.local/share/vim/pack/general/start/vim-textobj-xmlattr b/.local/share/vim/pack/general/start/vim-textobj-xmlattr @@ -0,0 +1 @@ +Subproject commit 694a297f1d75fd527e87da9769f3c6519a87ebb1 diff --git a/.local/share/vim/pack/general/start/vim-unimpaired b/.local/share/vim/pack/general/start/vim-unimpaired @@ -0,0 +1 @@ +Subproject commit e4006d68cd4f390efef935bc09be0ce3bd022e72 diff --git a/.local/share/vim/pack/themes/start/gruvbox-material b/.local/share/vim/pack/themes/start/gruvbox-material @@ -0,0 +1 @@ +Subproject commit fb27ccbd20cc1eda04e181f22c722977bdf9c934