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.
This commit is contained in:
Pratik Tripathy
2023-12-21 21:04:41 +05:30
parent 1e97adef39
commit cbe069367b
12 changed files with 212 additions and 162 deletions

View File

@@ -0,0 +1 @@
../../.vim/autoload

View File

@@ -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

1
common/.config/nvim/spell Symbolic link
View File

@@ -0,0 +1 @@
../../.vim/spell

View File

@@ -1,3 +0,0 @@
#trl
Ctrl
youtube

4
common/.gitignore vendored
View File

@@ -47,6 +47,9 @@ Temporary Items
*.dylib *.dylib
# ---- IDE ---- # ---- IDE ----
# Vim Artifacts
*.swp
# VS Code Artifacts # VS Code Artifacts
.vscode .vscode
**state.vscdb **state.vscdb
@@ -96,3 +99,4 @@ lerna-debug.log*
**/contents/images **/contents/images
**/contents/fonts **/contents/fonts
*kpluginindex.json *kpluginindex.json

65
common/.vim/configs.vim Normal file
View File

@@ -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

50
common/.vim/key_maps.vim Normal file
View File

@@ -0,0 +1,50 @@
" Disable left, right, up and down keys
" In normal mode...
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" ...and in insert mode
inoremap <Left> <ESC>:echoe "Use h"<CR>
inoremap <Right> <ESC>:echoe "Use l"<CR>
inoremap <Up> <ESC>:echoe "Use k"<CR>
inoremap <Down> <ESC>:echoe "Use j"<CR>
" Unbind some useless/annoying default key bindings.
nmap Q <Nop>
" Center the cursor when moving through document
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
nnoremap g; g;zz
nnoremap g, g,zz
nnoremap <C-o> <C-o>zz
nnoremap <C-i> <C-i>zz
nnoremap ]s ]szz
nnoremap n nzzzv
nnoremap N Nzzzv
" Better window/split navigation
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-h> <C-w>h
map <C-l> <C-w>l
" Clear searches
nnoremap <Leader>/ :call clearmatches()<CR>:noh<CR>
" Make space-bar the leader-key
let mapleader = " "
" Map easymotion Plugin to <Leader>j
map <leader>j <Plug>(easymotion-s)
" Map nerdtree to <Leader>e
" Changes the pwd and opens the VCS root
nnoremap <leader>e :lcd %:h<CR> :NERDTreeToggleVCS<CR>
let g:NERDTreeShowHidden = 1
let g:NERDTreeWinSize = 20
" Changes the pwd to the opened file's directory
nnoremap <leader>cd :lcd %:h<CR>

28
common/.vim/plugins.vim Normal file
View File

@@ -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()

View File

@@ -0,0 +1,9 @@
Bhubaneswar
Kolkata
Holi
Rakhi
Subrat
Ghosh
Tussar
Patra
Ctrl

Binary file not shown.

View File

@@ -1,34 +1,24 @@
" Load the plugins let $VIMDIR="$HOME/.vim"
" This being the 1st line in the config file, let $VIMRC="$VIMDIR/vimrc"
" 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' "Surround 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
Plug 'kshenoy/vim-signature' "Show gutter icons for Vim marks
" Plug 'unblevable/quick-scope' "Quick Scope
" Plug 'bronson/vim-trailing-whitespace' "Highlight trailing spaces, remove them all with :FixWhitespace
"------------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 'whatyouhide/vim-gotham' "Color Scheme - Gotham
Plug 'tyrannicaltoucan/vim-deep-space' "Color Scheme - Deep-space
call plug#end()
" ------- Look and Feel ---------------- " Load plugins
" let g:lightline = { 'colorscheme': 'gotham'} source $VIMDIR/plugins.vim
let g:lightline = { 'colorscheme': 'deepspace'}
" Load VIM Configurations
source $VIMDIR/configs.vim
" Load Keybindings
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 colorscheme deep-space
" Set color " Set color
@@ -38,135 +28,12 @@ if !has('gui_running')
hi LineNr ctermbg=NONE guibg=NONE hi LineNr ctermbg=NONE guibg=NONE
endif endif
" ------- Making Vim an IDE ---------------- """"""""""""""""""""""""""""""""
" Better autocompletes "
filetype plugin indent on " Quality of life improvements
set omnifunc=syntaxcomplete#Complete "
set complete+=kspell """"""""""""""""""""""""""""""""
" 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
" Turn on syntax highlighting.
syntax on
" Highlight matching pairs of [] {} ()
set showmatch
" Make sure tabs are 4 character wide
set shiftwidth=4
set tabstop=4
set softtabstop=4
set expandtab
set autoindent
set smartindent
" ------- Vim Related ----------------
" Auto reload .vimrc " Auto reload .vimrc
autocmd! bufwritepost ~/.vim/.vimrc source % autocmd! bufwritepost $VIMRC source %
" Show line numbers
set number
" Relative line numbers
set relativenumber
" Wrap text
set wrap
" Status bar
" set laststatus=2
" set noshowmode
" Encoding
set encoding=utf-8
" Unbind some useless/annoying default key bindings.
nmap Q <Nop> " '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 <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" ...and in insert mode
inoremap <Left> <ESC>:echoe "Use h"<CR>
inoremap <Right> <ESC>:echoe "Use l"<CR>
inoremap <Up> <ESC>:echoe "Use k"<CR>
inoremap <Down> <ESC>:echoe "Use j"<CR>
" Center the cursor when moving through file
nnoremap <C-d> <C-d>zz
nnoremap <C-u> <C-u>zz
nnoremap g; g;zz
nnoremap g, g,zz
nnoremap <C-o> <C-o>zz
nnoremap <C-i> <C-i>zz
nnoremap ]s ]szz
" Make space-bar the leader-key
let mapleader = " "
" Map easymotion Plugin to <Leader>j
map <leader>j <Plug>(easymotion-s)
" Map nerdtree to <Leader>e
map <leader>e :NERDTreeToggle<CR>