From cbe069367bf41b53a68a3846588d63e1390e1a73 Mon Sep 17 00:00:00 2001 From: Pratik Tripathy Date: Thu, 21 Dec 2023 21:04:41 +0530 Subject: [PATCH] Vim Configuration updates - Add more configs to make VIM a lot more like an IDE. - Removed unnecessary configs. - Collapsed some settings together. - Split configs to facilitate NVIM migration. - Added spell files to git. - Added .swp VIM files to gitignore. - Configured NVIM to pick VIM selected configurations. --- common/.config/nvim/autoload | 1 + common/.config/nvim/init.vim | 28 ++++ common/.config/nvim/spell | 1 + common/.config/nvim/spell/en.utf-8.add | 3 - common/.config/nvim/spell/en.utf-8.add.spl | Bin 49 -> 0 bytes common/.gitignore | 4 + common/.vim/configs.vim | 65 ++++++++ common/.vim/key_maps.vim | 50 ++++++ common/.vim/plugins.vim | 28 ++++ common/.vim/spell/en.utf-8.add | 9 + common/.vim/spell/en.utf-8.add.spl | Bin 0 -> 148 bytes common/.vim/vimrc | 185 +++------------------ 12 files changed, 212 insertions(+), 162 deletions(-) create mode 120000 common/.config/nvim/autoload create mode 100644 common/.config/nvim/init.vim create mode 120000 common/.config/nvim/spell delete mode 100644 common/.config/nvim/spell/en.utf-8.add delete mode 100644 common/.config/nvim/spell/en.utf-8.add.spl create mode 100644 common/.vim/configs.vim create mode 100644 common/.vim/key_maps.vim create mode 100644 common/.vim/plugins.vim create mode 100644 common/.vim/spell/en.utf-8.add create mode 100644 common/.vim/spell/en.utf-8.add.spl diff --git a/common/.config/nvim/autoload b/common/.config/nvim/autoload new file mode 120000 index 0000000..568e63f --- /dev/null +++ b/common/.config/nvim/autoload @@ -0,0 +1 @@ +../../.vim/autoload \ No newline at end of file diff --git a/common/.config/nvim/init.vim b/common/.config/nvim/init.vim new file mode 100644 index 0000000..6a4b1fd --- /dev/null +++ b/common/.config/nvim/init.vim @@ -0,0 +1,28 @@ +"""""""""""""""""""""""""""""""""""""" +" +" Get source common configs from VIM +" +"""""""""""""""""""""""""""""""""""""" +let $VIMDIR="$HOME/.vim" +let $NVIMDIR="$HOME/.config/nvim" + +" Load plugins +source $VIMDIR/plugins.vim + +" Load VIM Configurations +source $VIMDIR/configs.vim + +" Load Keybindings from VIM +source $VIMDIR/key_maps.vim + +" Save session files to $HOME/.vim/session directory +let g:session_dir="$VIMDIR/session" + +"""""""""""""""""""""""""""""""" +" +" LOOKS +" +"""""""""""""""""""""""""""""""" +let g:lightline = { 'colorscheme': 'deepspace' } +colorscheme deep-space + diff --git a/common/.config/nvim/spell b/common/.config/nvim/spell new file mode 120000 index 0000000..6ee6c95 --- /dev/null +++ b/common/.config/nvim/spell @@ -0,0 +1 @@ +../../.vim/spell \ No newline at end of file diff --git a/common/.config/nvim/spell/en.utf-8.add b/common/.config/nvim/spell/en.utf-8.add deleted file mode 100644 index 5ce9286..0000000 --- a/common/.config/nvim/spell/en.utf-8.add +++ /dev/null @@ -1,3 +0,0 @@ -#trl -Ctrl -youtube diff --git a/common/.config/nvim/spell/en.utf-8.add.spl b/common/.config/nvim/spell/en.utf-8.add.spl deleted file mode 100644 index a027687246084171088c0500578c67d10811caad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 49 wcmWIZ^erw(&B-zP&%nSS$&_5lSi)Gun8V1##F)=m3gnbBCNZWm0wtjU04`$*DgXcg diff --git a/common/.gitignore b/common/.gitignore index 75f039c..04cf3b4 100644 --- a/common/.gitignore +++ b/common/.gitignore @@ -47,6 +47,9 @@ Temporary Items *.dylib # ---- IDE ---- +# Vim Artifacts +*.swp + # VS Code Artifacts .vscode **state.vscdb @@ -96,3 +99,4 @@ lerna-debug.log* **/contents/images **/contents/fonts *kpluginindex.json + diff --git a/common/.vim/configs.vim b/common/.vim/configs.vim new file mode 100644 index 0000000..462817d --- /dev/null +++ b/common/.vim/configs.vim @@ -0,0 +1,65 @@ +" Better autocompletes +filetype plugin indent on +set omnifunc=syntaxcomplete#Complete +set complete+=kspell + +" Make sure tabs are 4 character wide +set shiftwidth=4 tabstop=4 softtabstop=4 expandtab +set autoindent smartindent + +syntax on " syntax highlighting. +set showmatch " Highlight matching braces +set ls=2 " Show a status line +set wrap " Wrap text +set wildmenu " Makes the ex command mode autocomplete paths with Tab +set number " Show line numbers +set relativenumber " Relative line numbers +set shortmess+=I " Disable the default Vim startup message. +set noerrorbells visualbell t_vb= " Disable audible bell because it's annoying. +set mouse+=a " Enable mouse support +set encoding=utf-8 " Encoding + +" Vim, by default, won't let you jump to a different file without saving the +" current one. With the below, unsaved files are just hidden. +set hidden + +" Enable searching as you type, rather than waiting till you press enter. +" Highlight search pattern +" Intelligently handle cases in search +set incsearch hlsearch ignorecase smartcase + +" Comments in Grey color and italic +hi Comment guifg=#5C6370 ctermfg=50 cterm=italic + +" Highlight and remove trailing blank spaces on save +highlight ExtraWhitespace ctermbg=red guibg=red +match ExtraWhitespace /\s\+$/ +autocmd BufWritePre * %s/\s\+$//e + +" Vim is based on Vi. Setting `nocompatible` switches from the default +" Vi-compatibility mode and enables useful Vim functionality. This +" configuration option turns out not to be necessary for the file named +" '~/.vimrc', because Vim automatically enters nocompatible mode if that file +" is present. But we're including it here just in case this config file is +" loaded some other way (e.g. saved as `foo`, and then Vim started with +" `vim -u foo`). +set nocompatible + +" Normally, backspace works only if you have made an edit. This fixes that. +set backspace=indent,eol,start + +" Sync vim clipboard with system clipboard +" Works across Linux, MacOS & Windows +if has("mac") + set clipboard+=unnamed +else + set clipboard^=unnamed,unnamedplus +endif + +" Set color +if !has('gui_running') + set t_Co=256 + set termguicolors + hi LineNr ctermbg=NONE guibg=NONE +endif + diff --git a/common/.vim/key_maps.vim b/common/.vim/key_maps.vim new file mode 100644 index 0000000..7d54ba3 --- /dev/null +++ b/common/.vim/key_maps.vim @@ -0,0 +1,50 @@ +" Disable left, right, up and down keys +" In normal mode... +nnoremap :echoe "Use h" +nnoremap :echoe "Use l" +nnoremap :echoe "Use k" +nnoremap :echoe "Use j" +" ...and in insert mode +inoremap :echoe "Use h" +inoremap :echoe "Use l" +inoremap :echoe "Use k" +inoremap :echoe "Use j" + +" Unbind some useless/annoying default key bindings. +nmap Q + +" Center the cursor when moving through document +nnoremap zz +nnoremap zz +nnoremap g; g;zz +nnoremap g, g,zz +nnoremap zz +nnoremap zz +nnoremap ]s ]szz +nnoremap n nzzzv +nnoremap N Nzzzv + +" Better window/split navigation +map j +map k +map h +map l + +" Clear searches +nnoremap / :call clearmatches():noh + +" Make space-bar the leader-key +let mapleader = " " + +" Map easymotion Plugin to j +map j (easymotion-s) + +" Map nerdtree to e +" Changes the pwd and opens the VCS root +nnoremap e :lcd %:h :NERDTreeToggleVCS +let g:NERDTreeShowHidden = 1 +let g:NERDTreeWinSize = 20 + +" Changes the pwd to the opened file's directory +nnoremap cd :lcd %:h + diff --git a/common/.vim/plugins.vim b/common/.vim/plugins.vim new file mode 100644 index 0000000..d31fb74 --- /dev/null +++ b/common/.vim/plugins.vim @@ -0,0 +1,28 @@ +"""""""""""""""""""""""""""""""" +" +" Plugins +" +""""""""""""""""""""""""""""""""" +" This being the 1st line in the config file, +" makes it possible to configure plugins any place in the file. +call plug#begin('~/.vim/plugged') + Plug 'tpope/vim-fugitive' "Fugitive Vim GitHub Wrapper + Plug 'tpope/vim-surround' "Surround Plugin + Plug 'tpope/vim-repeat' "Repeat for the surround plugin + Plug 'tpope/vim-commentary' "Comments Plugin + Plug 'tpope/vim-sensible' "Sensible options + Plug 'rstacruz/vim-closer' "Auto-close brackets + Plug 'machakann/vim-highlightedyank' "Highlight Yank + Plug 'dbakker/vim-paragraph-motion' "Paragraph Motion + Plug 'airblade/vim-gitgutter' "Git in the left-side gutter + Plug 'junegunn/rainbow_parentheses.vim' "Rainbow parenthesis + Plug 'easymotion/vim-easymotion' "Easy Motion to quickly jump across the buffer + Plug 'preservim/nerdtree' "Nerd Tree + "------------Style Plugins------------" + " Status Styles + Plug 'itchyny/lightline.vim' + Plug 'challenger-deep-theme/vim', { 'as': 'challenger-deep' } "ColorScheme - Challenger-deep + Plug 'cocopon/iceberg.vim' "Color Scheme - Iceberg + Plug 'tyrannicaltoucan/vim-deep-space' "Color Scheme - Deep-space +call plug#end() + diff --git a/common/.vim/spell/en.utf-8.add b/common/.vim/spell/en.utf-8.add new file mode 100644 index 0000000..7c012d9 --- /dev/null +++ b/common/.vim/spell/en.utf-8.add @@ -0,0 +1,9 @@ +Bhubaneswar +Kolkata +Holi +Rakhi +Subrat +Ghosh +Tussar +Patra +Ctrl \ No newline at end of file diff --git a/common/.vim/spell/en.utf-8.add.spl b/common/.vim/spell/en.utf-8.add.spl new file mode 100644 index 0000000000000000000000000000000000000000..42e77d30cba7fb2ac95264ab3604f59f25b502ec GIT binary patch literal 148 zcmWIZ^erw(&B-zP&%nSC! " 'Q' in normal mode enters Ex mode. You almost never want this. - -" Vim is based on Vi. Setting `nocompatible` switches from the default -" Vi-compatibility mode and enables useful Vim functionality. This -" configuration option turns out not to be necessary for the file named -" '~/.vimrc', because Vim automatically enters nocompatible mode if that file -" is present. But we're including it here just in case this config file is -" loaded some other way (e.g. saved as `foo`, and then Vim started with -" `vim -u foo`). -set nocompatible - -" Disable the default Vim startup message. -set shortmess+=I - -" Normally, backspace works only if you have made an edit. This fixes that. -set backspace=indent,eol,start - -" A line to specify 80 column limit -" setlocal colorcolumn=80 - -" Vim, by default, won't let you jump to a different file without saving the -" current one. With the below, unsaved files are just hidden. -set hidden - -" This setting makes search case-insensitive when all characters in the string -" being searched are lowercase. However, the search becomes case-sensitive if -" it contains any capital letters. This makes searching more convenient. -set ignorecase -set smartcase - -" Enable searching as you type, rather than waiting till you press enter. -set incsearch - -" Highlight search pattern -set hlsearch - -" Disable audible bell because it's annoying. -set noerrorbells visualbell t_vb= - -" Enable mouse support. You should avoid relying on this too much, but it can -" sometimes be convenient. -set mouse+=a - -" No header spam in netrw -let g:netrw_banner=0 - -" Display directory in tree style in netrw -let g:netrw_liststyle=3 - -" Sync vim clipboard with system clipboard -" Works across Linux, MacOS & Windows -set clipboard^=unnamed,unnamedplus - -" ------- Remap Keybindings ---------------- -" Disable left, right, up and down keys -" In normal mode... -nnoremap :echoe "Use h" -nnoremap :echoe "Use l" -nnoremap :echoe "Use k" -nnoremap :echoe "Use j" -" ...and in insert mode -inoremap :echoe "Use h" -inoremap :echoe "Use l" -inoremap :echoe "Use k" -inoremap :echoe "Use j" - -" Center the cursor when moving through file -nnoremap zz -nnoremap zz -nnoremap g; g;zz -nnoremap g, g,zz -nnoremap zz -nnoremap zz -nnoremap ]s ]szz - -" Make space-bar the leader-key -let mapleader = " " - -" Map easymotion Plugin to j -map j (easymotion-s) - -" Map nerdtree to e -map e :NERDTreeToggle