Last active
December 11, 2019 17:07
-
-
Save telnet2/048a582b5a3354ad70cab9c6f787390c to your computer and use it in GitHub Desktop.
VIM RC file
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
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/Vundle.vim/ | |
call vundle#rc() | |
" let Vundle manage Vundle | |
" required! | |
Plugin 'gmarik/vundle' | |
" Code Completions | |
Plugin 'Shougo/neocomplcache' | |
Plugin 'Raimondi/delimitMate' | |
" Fast navigation | |
Plugin 'jwhitley/vim-matchit' | |
" Fast editing | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'sjl/gundo.vim' | |
Plugin 'roxma/vim-tmux-clipboard' | |
Plugin 'tmux-plugins/vim-tmux-focus-events' | |
Plugin 'nathanaelkane/vim-indent-guides' | |
" IDE features | |
Plugin 'yegappan/mru' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'nvie/vim-togglemouse' | |
" Syntax/Indent for language enhancement | |
" markup language | |
Plugin 'tpope/vim-markdown' | |
" Golang | |
Plugin 'fatih/vim-go' | |
" FPs | |
Plugin 'kien/rainbow_parentheses.vim' | |
" Color Schemes | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'tomasr/molokai' | |
Plugin 'chriskempson/vim-tomorrow-theme' | |
" ==== Typescript Plugins | |
Plugin 'quramy/tsuquyomi' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'Quramy/vim-js-pretty-template' | |
Plugin 'peitalin/vim-jsx-typescript' | |
" Javascript Plugins | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'mxw/vim-jsx' | |
let g:jsx_ext_required = 0 | |
Plugin 'leshill/vim-json' | |
Plugin 'prettier/vim-prettier' | |
Plugin 'dart-lang/dart-vim-plugin' | |
" ==== Code Formatter | |
" Add maktaba and codefmt to the runtimepath. | |
" (The latter must be installed before it can be used.) | |
Plugin 'google/maktaba' | |
Plugin 'google/vim-codefmt' | |
" Also add Glaive, which is used to configure codefmt's maktaba flags. See | |
" `:help :Glaive` for usage. | |
Plugin 'google/vim-glaive'", | |
" encoding dectection | |
set fileencodings=utf-8,euc-kr,gb2312,gb18030,gbk,ucs-bom,cp936,latin1 | |
" enable filetype dectection and ft specific plugin/indent | |
filetype plugin indent on | |
" enable syntax hightlight and completion | |
syntax on | |
" Vim UI | |
"-------- | |
" color scheme | |
set background=dark | |
colorscheme molokai | |
" highlight current line | |
" au WinLeave * set nocursorline nocursorcolumn | |
" au WinEnter * set cursorline cursorcolumn | |
" set cursorline cursorcolumn | |
set cursorline | |
" Visual bell no beep | |
set visualbell | |
" search | |
set incsearch | |
"set highlight " conflict with highlight current line | |
set ignorecase | |
set smartcase | |
" editor settings | |
set history=1000 | |
set nocompatible | |
set nofoldenable " disable folding" | |
set confirm " prompt when existing from an unsaved file | |
set backspace=indent,eol,start " More powerful backspacing | |
set t_Co=256 " Explicitly tell vim that the terminal has 256 colors " | |
set mouse=a " use mouse in all modes | |
set report=0 " always report number of lines changed " | |
set nowrap " dont wrap lines | |
set scrolloff=5 " 5 lines above/below cursor when scrolling | |
set number " show line numbers | |
" set relativenumber " show relativenumber | |
set showmatch " show matching bracket (briefly jump) | |
set showcmd " show typed command in status bar | |
set title " show file in titlebar | |
set laststatus=2 " use 2 lines for the status bar | |
set matchtime=2 " show matching bracket for 0.2 seconds | |
" Default Indentation | |
set autoindent | |
set expandtab " expand tab to space | |
set smartindent " indent when | |
set tabstop=4 " tab width | |
set softtabstop=4 " backspace | |
set shiftwidth=4 " indent width | |
" set textwidth=79 | |
" set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop | |
autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=120 | |
autocmd FileType cpp setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=120 | |
" syntax support | |
"----------------- | |
" Plugin settings | |
"----------------- | |
" Rainbow parentheses for Lisp and variants | |
let g:rbpt_colorpairs = [ | |
\ ['brown', 'RoyalBlue3'], | |
\ ['Darkblue', 'SeaGreen3'], | |
\ ['darkgray', 'DarkOrchid3'], | |
\ ['darkgreen', 'firebrick3'], | |
\ ['darkcyan', 'RoyalBlue3'], | |
\ ['darkred', 'SeaGreen3'], | |
\ ['darkmagenta', 'DarkOrchid3'], | |
\ ['brown', 'firebrick3'], | |
\ ['gray', 'RoyalBlue3'], | |
\ ['black', 'SeaGreen3'], | |
\ ['darkmagenta', 'DarkOrchid3'], | |
\ ['Darkblue', 'firebrick3'], | |
\ ['darkgreen', 'RoyalBlue3'], | |
\ ['darkcyan', 'SeaGreen3'], | |
\ ['darkred', 'DarkOrchid3'], | |
\ ['red', 'firebrick3'], | |
\ ] | |
let g:rbpt_max = 16 | |
autocmd Syntax lisp,scheme,clojure,racket RainbowParenthesesToggle | |
" tabbar | |
let g:Tb_MaxSize = 2 | |
let g:Tb_TabWrap = 1 | |
hi Tb_Normal guifg=white ctermfg=white | |
hi Tb_Changed guifg=green ctermfg=green | |
hi Tb_VisibleNormal ctermbg=252 ctermfg=235 | |
hi Tb_VisibleChanged guifg=green ctermbg=252 ctermfg=white | |
" easy-motion | |
" let g:EasyMotion_leader_key = '<Leader>' | |
" Tagbar | |
let g:tagbar_left=1 | |
let g:tagbar_width=30 | |
let g:tagbar_autofocus = 1 | |
let g:tagbar_sort = 0 | |
let g:tagbar_compact = 1 | |
" tag for markdown | |
let g:tagbar_type_markdown = { | |
\ 'ctagstype' : 'markdown', | |
\ 'kinds' : [ | |
\ 'h:Heading_L1', | |
\ 'i:Heading_L2', | |
\ 'k:Heading_L3' | |
\ ] | |
\ } | |
" | |
" " | Typescript | |
" " |------------------------ | |
let g:typescript_compiler_binary = 'tsc' | |
let g:typescript_compiler_options = '' | |
autocmd QuickFixCmdPost [^l]* nested cwindow | |
autocmd QuickFixCmdPost l* nested lwindow | |
" | |
" " | JS Pretty Templates | |
" " |------------------------ | |
"autocmd FileType typescript JsPreTmpl html | |
"autocmd FileType typescript syn clear foldBraces | |
" | |
" " | Tsuquyomi | |
" " |------------------------ | |
let g:tsuquyomi_disable_quickfix = 1 | |
let g:syntastic_typescript_checkers = ['tsuquyomi'] | |
let g:syntastic_javascript_checkers = ['eslint'] | |
" | |
" Python | |
"let g:autopep8_disable_show_diff=1 | |
"nmap <leader>o :Autopep8<cr> | |
" Nerd Tree | |
let NERDChristmasTree=0 | |
let NERDTreeWinSize=30 | |
let NERDTreeChDirMode=2 | |
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$'] | |
" let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\~$'] | |
let NERDTreeShowBookmarks=1 | |
let NERDTreeWinPos = "left" | |
" nerdcommenter | |
let NERDSpaceDelims=1 | |
" nmap <D-/> :NERDComToggleComment<cr> | |
let NERDCompactSexyComs=1 | |
" powerline | |
"let g:Powerline_symbols = 'fancy' | |
" NeoComplCache | |
let g:neocomplcache_enable_at_startup=1 | |
let g:neoComplcache_disableautocomplete=1 | |
"let g:neocomplcache_enable_underbar_completion = 1 | |
"let g:neocomplcache_enable_camel_case_completion = 1 | |
let g:neocomplcache_enable_smart_case=1 | |
let g:neocomplcache_min_syntax_length = 3 | |
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' | |
set completeopt-=preview | |
imap <C-k> <Plug>(neocomplcache_snippets_force_expand) | |
smap <C-k> <Plug>(neocomplcache_snippets_force_expand) | |
imap <C-l> <Plug>(neocomplcache_snippets_force_jump) | |
smap <C-l> <Plug>(neocomplcache_snippets_force_jump) | |
" Enable omni completion. | |
autocmd FileType markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType c setlocal omnifunc=ccomplete#Complete | |
if !exists('g:neocomplcache_omni_patterns') | |
let g:neocomplcache_omni_patterns = {} | |
endif | |
let g:neocomplcache_omni_patterns.erlang = '[a-zA-Z]\|:' | |
" SuperTab | |
" let g:SuperTabDefultCompletionType='context' | |
" let g:SuperTabDefaultCompletionType = '<C-X><C-U>' | |
" let g:SuperTabRetainCompletionType=2 | |
" ctrlp | |
set wildignore+=*/tmp/*,*.so,*.o,*.a,*.obj,*.swp,*.zip,*.pyc,*.pyo,*.class,.DS_Store " MacOSX/Linux | |
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|build' | |
" Keybindings for plugin toggle | |
nnoremap <F2> :set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
nmap <leader>t :TagbarToggle<cr> | |
nmap <leader>o :NERDTreeToggle<cr> | |
nmap <leader>g :GundoToggle<cr> | |
nmap <leader>i :IndentGuidesToggle<cr> | |
nmap <leader>r :MRU<cr> | |
nmap <leader>] :q<cr> | |
nmap <leader>q :q<cr> | |
nmap <D-/> : | |
nnoremap <leader>a :Ack | |
nnoremap <leader>v V`] | |
" Useful Functions | |
"------------------ | |
" easier navigation between split windows | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
" When editing a file, always jump to the last cursor position | |
autocmd BufReadPost * | |
\ if ! exists("g:leave_my_cursor_position_alone") | | |
\ if line("'\"") > 0 && line ("'\"") <= line("$") | | |
\ exe "normal g'\"" | | |
\ endif | | |
\ endif | |
" w!! to sudo & write a file | |
cmap w!! %!sudo tee >/dev/null % | |
" Quickly edit/reload the vimrc file | |
nmap <silent> <leader>ev :e $MYVIMRC<CR> | |
nmap <silent> <leader>sv :so $MYVIMRC<CR> | |
" sublime key bindings | |
nmap <D-]> >> | |
nmap <D-[> << | |
vmap <D-[> <gv | |
vmap <D-]> >gv | |
" eggcache vim | |
nnoremap ; : | |
:command W w | |
:command WQ wq | |
:command Wq wq | |
:command Q q | |
:command Qa qa | |
:command QA qa | |
" Redraw the screen | |
nnoremap <c-o> :redraw!<CR> | |
" Move the current directory to the file directory | |
nnoremap <leader>cd :lcd %:p:h<CR>:pwd<CR> | |
"autocmd StdinReadPre * let s:std_in=1 | |
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
augroup autoformat_settings | |
autocmd FileType bzl AutoFormatBuffer buildifier | |
autocmd FileType c,cpp,proto AutoFormatBuffer clang-format | |
autocmd FileType dart AutoFormatBuffer dartfmt | |
autocmd FileType go AutoFormatBuffer gofmt | |
autocmd FileType gn AutoFormatBuffer gn | |
autocmd FileType html,css,sass,scss,less,json AutoFormatBuffer prettier | |
" autocmd FileType html,css,sass,scss,less,json AutoFormatBuffer js-beautify | |
" autocmd FileType java AutoFormatBuffer google-java-format | |
" autocmd FileType python AutoFormatBuffer yapf | |
" Alternative: autocmd FileType python AutoFormatBuffer autopep8 | |
" autocmd FileType vue AutoFormatBuffer prettier | |
augroup END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment