From 1697ca4ec53da059785f5f7805fd973947ef38c6 Mon Sep 17 00:00:00 2001 From: Konstantin Bukley Date: Sun, 24 Jan 2021 16:27:46 +0200 Subject: [PATCH] vim: cleanup .vimrc --- vim/.vimrc | 228 ++++++++++++++++------------------------------------- 1 file changed, 68 insertions(+), 160 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index 27cfafc..dbba62e 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -9,21 +9,16 @@ " Turn off vi-compatible mode set nocompatible - " Encoding set encoding=utf-8 set fileencoding=utf-8 - " History length set history=1000 - " Remap the to nnoremap let mapleader=' ' - " Includes ftplugin.vim which is responsible for filetype detection filetype plugin indent on - " Set syntax highlighting syntax on @@ -60,7 +55,6 @@ Plug 'benmills/vimux' Plug 'janko-m/vim-test' Plug 'dyng/ctrlsf.vim' Plug 'terryma/vim-expand-region' -" Plug 'terryma/vim-multiple-cursors' Plug 'mg979/vim-visual-multi' Plug 'bogado/file-line' Plug 'vim-utils/vim-interruptless' @@ -72,7 +66,6 @@ Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " ======== Appearence =================================== -" Plug 'altercation/vim-colors-solarized' Plug 'airblade/vim-gitgutter' Plug 'machakann/vim-highlightedyank' Plug 'arcticicestudio/nord-vim' @@ -193,12 +186,6 @@ let g:UltiSnipsExpandTrigger = '' let g:UltiSnipsJumpForwardTrigger = '' let g:UltiSnipsJumpBackwardTrigger = '' -" --- scratch - -" let g:scratch_persistence_file = '~/iCloud/Notebook/index.md' -" let g:scratch_no_mappings = 1 - - " --- gitgutter let g:gitgutter_sign_added = '│' @@ -291,33 +278,18 @@ if has("autocmd") au filetype help nnoremap au filetype help set nonumber - au BufNewFile,BufRead Capfile,Gemfile,Vagrantfile setl ft=ruby - au BufNewFile,BufRead *.rabl,*.jbuilder setl ft=ruby - au BufNewFile,BufRead *.docker setl ft=Dockerfile + au BufNewFile,BufRead *.docker setl ft=Dockerfile " Hide statusline - autocmd! FileType fzf - autocmd FileType fzf set laststatus=0 noshowmode noruler - \| autocmd BufLeave set laststatus=2 showmode ruler - - " NB: ! cursorline seems to be slow https://github.com/tmux/tmux/issues/353#issuecomment-364588634 - " Only show cursorline in the current window and in normal mode. - " augroup cline - " au! - " au WinLeave,InsertEnter * set nocursorline - " au WinEnter,InsertLeave * set cursorline - " augroup END + au! FileType fzf + au FileType fzf set laststatus=0 noshowmode noruler + \| autocmd BufLeave set laststatus=2 showmode ruler " Close tab if only NERDTree left au WinEnter * call CloseNERDTree() " Resize when the host window resized - " NB: I remember it being laggy or something - " There was some curlpit here don't remember au VimResized * wincmd = - - " Prevent CtrlP or NERDTree from opening a split in Startify - au User Startified setl buftype= endif @@ -326,8 +298,6 @@ endif " -> Colors & Fonts " ======================================================== -" Solarized is love solarized is life -" colorscheme solarized colorscheme nord set background=dark @@ -352,56 +322,55 @@ endif " -> User Interface " ======================================================== -" enables menu at the bottom +" Enables menu at the bottom set wildmenu -" highlight search +" Highlight search set hlsearch -" nicer separators +" Nicer separators set fillchars=diff:⣿,vert:│ -" don't try to highlight lines longer than 800 characters. +" Don't try to highlight lines longer than 800 characters. set synmaxcol=200 -" when a file has been detected to have been changed outside of Vim and +" When a file has been detected to have been changed outside of Vim and " it has not been changed inside of Vim, automatically read it again. set autoread -" do not redraw while running macros +" Do not redraw while running macros set lazyredraw -" tab label - requires vim-madundead +" Tab label - requires vim-madundead set tabline=%!Tabline() -" show status even for single buffer displayed +" Show status even for single buffer displayed set laststatus=2 " NB: cursorline seems to slow down things quite a bit " highlight current line https://github.com/tmux/tmux/issues/353#issuecomment-364588634 " set cursorline " number rows set number -" disable welcome message +" Disable welcome message set shortmess+=I -" show matching braces +" Show matching braces set showmatch -" shows when you are in insert mode +" Shows when you are in insert mode set showmode -" shows commands in right bottom corner +" Shows commands in right bottom corner set showcmd -" show cursor position all the tiem +" Show cursor position all the tiem set ruler -" show title in console status bar +" Show title in console status bar set title -" dont wrap lines +" Dont wrap lines set nowrap -" when I scroll up or down, there are 2 lines between the line I'm on and the bottom or top of the screen. +" When I scroll up or down, there are 2 lines between the line I'm on and the bottom or top of the screen. set scrolloff=5 -" how many tenths of a second to blink on matching brackets +" How many tenths of a second to blink on matching brackets set mat=2 -" disable cursor blink +" Disable cursor blink set gcr=a:blinkon0 -" hide the mouse pointer while typing +" Hide the mouse pointer while typing set mousehide -" conceal mostly for markdown +" Conceal mostly for markdown set conceallevel=2 - " Highlight VCS conflict markers match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' - +" Statusline set statusline=%<%f " ======================================================== @@ -420,67 +389,51 @@ set wildignore+=*.gem set wildignore+=log/** set wildignore+=tmp/** set wildignore+=*.png,*.jpg,*.gif - " Russian keymap support set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯЖ;ABCDEFGHIJKLMNOPQRSTUVWXYZ:,фисвуапршолдьтщзйкыегмцчня;abcdefghijklmnopqrstuvwxyz - " W invokes sudo command! W w !sudo tee % > /dev/null - " Use the OS clipboard by default (requires `+clipboard`) set clipboard=unnamed - -" Dunno +" Tenths of a second to show the matching paren set matchtime=2 - " Force backspace to behave like in any other editor set backspace=2 - " Start searching as soon as you type first letter set incsearch - " Turn off visualbell set novisualbell - " Fuck backups set nobackup set nowb set noswapfile - " Doesn't select lines number in vim set mouse=a - " Fancy whitespace characters set list listchars=tab:→\ ,trail:· - " Abbrev. of messages (avoids 'hit enter') set shortmess+=filmnrxoOtT - " Start scrolling when we're 8 lines away from margins set scrolloff=8 - " The minimal number of screen columns to keep to the left and to the " right of the cursor if 'nowrap' is set. set sidescrolloff=15 - " The minimal number of columns to scroll horizontally set sidescroll=1 - " Vertical splits in diff mode set diffopt+=vertical - " Reduce delay between modes set timeoutlen=1000 ttimeoutlen=0 - " Delete comment character when joining commented lines if v:version > 703 || v:version == 703 && has("patch541") set formatoptions+=j endif - " Use ripgrep if possible if executable('rg') set grepprg=rg\ -i\ --vimgrep endif +" Enables aliases from .bashrc in :! commands +set shellcmdflag=-ic @@ -514,44 +467,44 @@ nnoremap j nnoremap k nnoremap l -cnoremap -cnoremap - nnoremap ,, -nnoremap f (expand('%') =~ 'NERD_tree' ? "\\" : '').":Files\" -nnoremap b (expand('%') =~ 'NERD_tree' ? "\\" : '').":Buffers\" +nnoremap f (expand('%') =~ 'NERD_tree' ? "\\" : '').":Files\" +nnoremap b (expand('%') =~ 'NERD_tree' ? "\\" : '').":Buffers\" +nnoremap gl (expand('%') =~ 'NERD_tree' ? "\\" : '').":Commits\" -nnoremap a :A -nnoremap s :Switch -nnoremap x :ALEFix -nnoremap n :NERDTreeToggle -nnoremap N :NERDTreeFind -nnoremap c /\v^[<=>]{7}( .*\|$) -nnoremap t :tabnew -nnoremap d orequire 'pry'; binding.pry -nnoremap D oit { require 'pry'; binding.pry } -nnoremap r :TestFile -nnoremap R :TestSuite -nnoremap J :%!python -m json.tool -nnoremap w :w -nnoremap q :q! -nnoremap e :e! -nnoremap = = -nnoremap :nohlsearch +nnoremap a :A +nnoremap s :Switch +nnoremap x :ALEFix +nnoremap n :NERDTreeToggle +nnoremap N :NERDTreeFind +nnoremap c /\v^[<=>]{7}( .*\|$) +nnoremap t :tabnew +nnoremap d orequire 'pry'; binding.pry +nnoremap D oit { require 'pry'; binding.pry } +nnoremap r :TestFile +nnoremap R :TestSuite +nnoremap J :%!python -m json.tool +nnoremap w :w +nnoremap q :q! +nnoremap e :e! +nnoremap = = +nnoremap :nohlsearch -nnoremap ga :Gwrite -nnoremap gc :Gcommit -nnoremap gp :Gpush -nnoremap gup :Gpull -nnoremap gs :Gstatus -nnoremap gd :Gvdiff -nnoremap gl (expand('%') =~ 'NERD_tree' ? "\\" : '').":Commits\" - -nnoremap p :echo @% +nnoremap ga :Gwrite +nnoremap gc :Gcommit +nnoremap gp :Gpush +nnoremap gup :Gpull +nnoremap gs :Gstatus +nnoremap gd :Gvdiff +nnoremap gb :Gblame nnoremap :tabnext nnoremap :tabprevious +nnoremap vv v +nnoremap :call StripTrailingWhitespace() + +nnoremap S :%s/\<\>//g nnoremap yy Y nnoremap Y y$ @@ -562,6 +515,7 @@ nnoremap k gk nnoremap H ^ nnoremap L $ nnoremap J mzJ`z +nnoremap K nnoremap gQ vnoremap . :normal . @@ -570,61 +524,15 @@ vnoremap K :m '<-2gv=gv vnoremap < >gv -xmap \ Commentary -nmap \ Commentary -nmap \\ CommentaryLine +inoremap +vnoremap +cnoremap +inoremap +vnoremap +cnoremap -nnoremap :tabnew ~/iCloud/Notebook/index.md - -nnoremap vv v -" nnoremap ss s TODO: - -nmap CtrlSFPrompt -nnoremap :call StripTrailingWhitespace() - -inoremap -vnoremap -cnoremap -inoremap -vnoremap -cnoremap - -" ===================================== -" TODO: DEAL WITH THIS -" -" this is taken already -" nnoremap = gg=G - -" TODO: this requires double C-b for some reason -nnoremap :Gblame - -nnoremap :%s//g - -" ,rh -> hashrocket to : TODO: think about it -" nnoremap rh :%s/\v:(\w+) \=\>/\1:/g - -" ,s -> reload vimrc TODO: do something useful instead -" nnoremap s :so ~/.vimrc -" -" nnoremap :Gitv TODO: No longer have gitv - -" Start interactive EasyAlign in visual mode +nmap CtrlSFPrompt +vmap CtrlSFVwordPath vmap (EasyAlign) -" Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) -" Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) - -" Ctrl + e for emmet -imap , - -" I don't use it -nnoremap K -" K reverse of J -" nnoremap K fr - -" replace the word under the cursor -nnoremap S :%s/\<\>//g - -" this might be bad, but enables aliases from .bashrc -set shellcmdflag=-ic