dotfiles

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

commit 30ee557df3a30e1b4c50913ee9e58bb7bf5cae62
parent 03e8497fe4cb2500bb1f2ef3af21b4d440f0288e
Author: Bharatvaj <bharatvaj@yahoo.com>
Date:   Wed,  2 Feb 2022 02:26:54 +0530

Merge pull request #26 from bharatvaj/windows

Have seperate configurations for vim and neovim
Diffstat:
M.config/.gitignore | 1+
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/plugin/plugin.vim | 32--------------------------------
M.config/vim/vimrc | 66++++++++++++++++++++++++------------------------------------------
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+
28 files changed, 81 insertions(+), 96 deletions(-)

diff --git a/.config/.gitignore b/.config/.gitignore @@ -10,6 +10,7 @@ !sh/** !i3 !nvim +!nvim/** !vim/ !vim/** !X11 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 Navigation @@ -17,13 +18,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/plugin/plugin.vim b/.config/vim/plugin/plugin.vim @@ -1,34 +1,2 @@ -" Plugin Management -function DownloadPlug() - let data_dir = has('nvim') ? stdpath('data') . '/site' : "${XDG_DATA_HOME}/vim" - if empty(glob(data_dir . '/autoload/plug.vim')) - silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - PlugInstall --sync | source $MYVIMRC - endif -endfunction - -call plug#begin($XDG_DATA_HOME."/vim/plugged") - Plug 'tpope/vim-commentary' - Plug 'tpope/vim-surround' - Plug 'tpope/vim-fugitive' - Plug 'tpope/vim-repeat' - Plug 'tommcdo/vim-ninja-feet' - Plug 'ap/vim-css-color' - Plug 'wellle/context.vim' - Plug 'easymotion/vim-easymotion' - Plug 'kana/vim-textobj-user' | Plug 'whatyouhide/vim-textobj-xmlattr' - Plug 'msanders/snipmate.vim' - Plug 'sainnhe/gruvbox-material' - Plug 'ntpeters/vim-better-whitespace' - Plug 'lpinilla/vim-codepainter' - Plug '907th/vim-auto-save' - source $XDG_CONFIG_HOME/vim/plugin/development.vim -call plug#end() - -" Enable auto save only if backups are disabled -if exists("nowb") - let g:auto_save = 1 -endif - " Plugin Keybindings nnoremap <leader>cc :ChecklistToggleCheckbox<cr> diff --git a/.config/vim/vimrc b/.config/vim/vimrc @@ -1,33 +1,32 @@ " 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/ -:set number -:augroup numbertoggle -: autocmd! -: autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif -: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif -:augroup END +set number +augroup numbertoggle + autocmd! + autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif + autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif +augroup END " General set mouse=a -set cursorline +set nocursorline syntax on set exrc set scrolloff=8 @@ -62,35 +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 -" Remove the ugly splits separator -set fillchars=vert:\│ -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 - -" 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