commit 7ee1204516da85b0282fa39d893e77c9e80c5448
parent b789e49ea6102801bc2da14cdf59db1084ec571c
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Fri, 5 Nov 2021 17:37:49 +0530
Removing annoying search highlight after search
Turn off backup for swap files
Enable auto save for files
Enable cursor line
Use :find instead of :Files from fzf
Diffstat:
4 files changed, 73 insertions(+), 15 deletions(-)
diff --git a/.config/vim/keybindings/keybindings.vim b/.config/vim/keybindings/keybindings.vim
@@ -1,6 +1,21 @@
" General keybindings
nnoremap <leader>t :tabnew<cr>
nnoremap <leader>p :Rg<cr>
+nnoremap <leader>f :find
+
+" Buffer Navigation
+nnoremap <C-J> <C-W><C-J>
+nnoremap <C-K> <C-W><C-K>
+nnoremap <C-L> <C-W><C-L>
+nnoremap <C-H> <C-W><C-H>
+
+" Buffer Creation
+nnoremap <Leader>v :vsplit<enter>
+nnoremap <Leader>s :split<enter>
+
+" Quick save and write
+nnoremap <leader>w :w<cr>
+nnoremap <leader>q :q<cr>
" Plugin keybindings
source $XDG_CONFIG_HOME/vim/keybindings/vimspector.vim
diff --git a/.config/vim/keybindings/markdown.vim b/.config/vim/keybindings/markdown.vim
@@ -2,3 +2,11 @@ autocmd FileType markdown set cursorline
" Hide and format markdown elements like **bold**
autocmd FileType markdown set conceallevel=2
+
+function QuickUnderline(n)
+ if a:n == 1
+ normal! yypv$r=
+ else
+ normal! yypv$r-
+ endif
+endfunction
diff --git a/.config/vim/plugin/plugin.vim b/.config/vim/plugin/plugin.vim
@@ -8,21 +8,33 @@ function DownloadPlug()
endfunction
call plug#begin($XDG_DATA_HOME."/vim/plugged")
- Plug 'tpope/vim-commentary'
- Plug 'tpope/vim-surround'
- Plug 'tpope/vim-fugitive'
- Plug 'ap/vim-css-color'
- Plug 'itchyny/lightline.vim'
- Plug 'wellle/context.vim'
- Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
- Plug 'junegunn/fzf.vim'
+ 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 'itchyny/lightline.vim'
+ Plug 'wellle/context.vim'
+ Plug 'easymotion/vim-easymotion'
+ Plug 'SirVer/ultisnips'
+ Plug 'sainnhe/gruvbox-material'
+ Plug 'ntpeters/vim-better-whitespace'
+ Plug 'lpinilla/vim-codepainter'
+ Plug '907th/vim-auto-save'
+ Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
+ Plug 'junegunn/fzf.vim'
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
" fzf
nmap <leader>F :GFiles<cr>
-nmap <leader>f :Files<cr>
nnoremap <leader>cc :ChecklistToggleCheckbox<cr>
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
@@ -16,8 +16,7 @@ set undodir=$XDG_CACHE_HOME/vim/undo | call mkdir(&undodir, 'p')
if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
-" General
-
+" Line number
"Adapted from https://jeffkreeftmeijer.com/vim-number/
:set number
:augroup numbertoggle
@@ -26,14 +25,23 @@ if !has('nvim') | set viminfofile=$XDG_CACHE_HOME/vim/viminfo | endif
: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
:augroup END
+" General
set mouse=a
+set cursorline
syntax on
set exrc
+" Turn backup off
+set nobackup
+set nowb
+set noswapfile
" Map leader to space
nnoremap <SPACE> <Nop>
let mapleader = " "
+" Enable hidden buffers
+set hidden
+
" Disable auto fixing end of line
" Useful when opening binary files
set nofixendofline
@@ -44,22 +52,37 @@ set shortmess=Iat
" Search
set hlsearch
set incsearch
-
-" Anti-tab
+" Disable highlight after a search
+augroup vimrc-incsearch-highlight
+ autocmd!
+ autocmd CmdlineEnter /,\? :set hlsearch
+ autocmd CmdlineLeave /,\? :set nohlsearch
+augroup END
+
+" Pro tab
filetype plugin indent on
set tabstop=4
set shiftwidth=4
-set expandtab
" Netrw customization
let g:netrw_banner = 0
-" Hard vim
+" 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
" Plugins
source $XDG_CONFIG_HOME/vim/plugin/plugin.vim