Skip to content

Instantly share code, notes, and snippets.

@tuananh170489
Created July 14, 2020 06:56
Show Gist options
  • Save tuananh170489/aab056766f2d53ffbd65ab562817411e to your computer and use it in GitHub Desktop.
Save tuananh170489/aab056766f2d53ffbd65ab562817411e to your computer and use it in GitHub Desktop.
syntax enable
filetype indent on
filetype indent plugin on
set nocompatible
set wildmenu
set showcmd
set linebreak
set showbreak=+++
set textwidth=100
set showmatch
set smartcase
set ignorecase
set incsearch
set autoindent
set shiftwidth=2
set smartindent
set smarttab
set expandtab
set tabstop=2
set softtabstop=2
set ruler
set undolevels=1000
set backspace=2
set backspace=indent,eol,start
set ttyfast
set ttymouse=xterm2
map <C-a> <ESC>^
imap <C-a> <ESC>I
map <C-e> <ESC>$
imap <C-e> <ESC>A
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$\| \+\ze\t/
match ExtraWhitespace /[^\t]\zs\t\+/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
" add yaml stuffs
au BufNewFile,BufRead *.{yaml,yml} so /etc/vim/yaml.vim
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
" add json stuffs
au BufNewFile,BufRead *.json so /etc/vim/json.vim
autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment