Created
July 8, 2019 17:18
-
-
Save caderek/1580b268eac0864d3ee32592b0da47db to your computer and use it in GitHub Desktop.
Configs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.vim/plugged') | |
Plug 'scrooloose/nerdTree' | |
Plug 'mattn/emmet-vim' | |
Plug 'tpope/vim-surround' | |
Plug 'bling/vim-airline' | |
Plug 'HerringtonDarkholme/yats.vim' | |
call plug#end() | |
nmap <C-n> :NERDTreeToggle<CR> | |
set title "change the terminal's title | |
set number "Line numbers are good | |
set relativenumber "Show numbers relative to current line | |
set gdefault "Set global flag for search and replace | |
set cursorline "Highlight current line | |
set smartcase "Smart case search if there is uppercase | |
set ignorecase "case insensitive search | |
set mouse=a "Enable mouse usage | |
set showmatch "Highlight matching bracket | |
set nostartofline "Jump to first non-blank character | |
set timeoutlen=1000 ttimeoutlen=0 "Reduce Command timeout for faster escape and O | |
set fileencoding=utf-8 "Set utf-8 encoding on write | |
set wrap "Enable word wrap | |
set linebreak "Wrap lines at convenient points | |
set undofile "Keep undo history across sessions, by storing in file | |
set noswapfile "Disable creating swap file | |
set nobackup "Disable saving backup file | |
set nowritebackup "Disable writing backup file | |
set breakindent "Preserve indent on line wrap | |
set smartindent "Use smarter indenting | |
set expandtab "Use spaces for indentation | |
set shiftwidth=2 "Use 2 spaces for indentation | |
set nofoldenable "Disable folding by default | |
set colorcolumn=80 "Highlight 80th column for easier wrapping | |
set foldmethod=syntax "When folding enabled, use syntax method | |
set diffopt+=vertical "Always use vertical layout for diffs | |
set scrolloff=8 "Start scrolling when we're 8 lines away from margins | |
set sidescrolloff=15 | |
set sidescroll=5 | |
augroup vimrc | |
autocmd! | |
autocmd QuickFixCmdPost [^l]* cwindow "Open quickfix window after grepping | |
autocmd BufWritePre * call s:strip_trailing_whitespace() "Auto-remove trailing spaces | |
autocmd InsertEnter * set nocul "Remove cursorline highlight | |
autocmd InsertLeave * set cul "Add cursorline highlight in normal mode | |
autocmd FocusGained,BufEnter * checktime "Refresh file when vim gets focus | |
autocmd FileType vim inoremap <buffer><silent><C-Space> <C-x><C-v> | |
autocmd FileType markdown setlocal spell | |
autocmd FileType json setlocal equalprg=python\ -m\ json.tool | |
augroup END | |
augroup numbertoggle | |
autocmd! | |
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif | |
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif | |
augroup END | |
function! s:strip_trailing_whitespace() | |
if &modifiable | |
let l:l = line('.') | |
let l:c = col('.') | |
call execute('%s/\s\+$//e') | |
call histdel('/', -1) | |
call cursor(l:l, l:c) | |
endif | |
endfunction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment