Skip to content

Instantly share code, notes, and snippets.

@chjj
Created February 12, 2019 07:11
Show Gist options
  • Save chjj/59fa349dee2d9d3f5b0709b62f9cdd3d to your computer and use it in GitHub Desktop.
Save chjj/59fa349dee2d9d3f5b0709b62f9cdd3d to your computer and use it in GitHub Desktop.
mini vimrc
"
" ~/.vimrc
"
set nocompatible
set hidden
set ruler
set visualbell
set noerrorbells
set nostartofline
set t_vb=
set autoindent
set backspace=2
set ttimeoutlen=100
set shiftwidth=2
set tabstop=2
set expandtab
set hlsearch
set laststatus=2
set undolevels=1000
set nobackup
if exists('&undodir') | set undodir= | end
set noswapfile
set noundofile
set nowritebackup
set viminfo=
syntax on
nnoremap Y y$
if exists("&cryptmethod")
set cm=blowfish2
end
if exists("&autochdir")
set autochdir
end
nnoremap gb :bnext<cr>
nnoremap gB :bprev<cr>
nnoremap <leader>a :ls<cr>:b<space>
nnoremap <leader>/ :noh<cr>
set clipboard=unnamed,exclude:linux\|cons
nnoremap <silent> <leader>c
\ :if stridx(&clipboard, 'unnamedplus', 0) == 0
\ \| let &clipboard = substitute(&clipboard, 'unnamedplus', 'unnamed', '')
\ \| echo 'Selection: primary'
\ \| else
\ \| let &clipboard = substitute(&clipboard, 'unnamed', 'unnamedplus', '')
\ \| echo 'Selection: clipboard'
\ \| end
\ <cr>
set pastetoggle=<leader>q
hi StatusLine term=reverse,bold cterm=none ctermbg=none ctermfg=lightgrey
hi StatusLineNC term=reverse cterm=none ctermbg=none
autocmd BufWinEnter * match ErrorMsg /\%>80v.\%<83v/
autocmd BufWritePre * if !&bin | %s/\s\+$//ge | end
autocmd BufEnter * if &ft == 'help' | wincmd o | end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment