Skip to content

Instantly share code, notes, and snippets.

@criloz
Last active October 30, 2016 19:24
Show Gist options
  • Save criloz/5bac70c4e0851b7c580c92a0cf63bd7a to your computer and use it in GitHub Desktop.
Save criloz/5bac70c4e0851b7c580c92a0cf63bd7a to your computer and use it in GitHub Desktop.
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'junegunn/vim-easy-align'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'fatih/vim-go', { 'tag': '*' }
Plug 'wavded/vim-stylus'
Plug 'mattn/emmet-vim'
Plug 'airblade/vim-gitgutter'
Plug 'majutsushi/tagbar'
Plug 'scrooloose/syntastic'
Plug 'ryanoasis/vim-devicons'
Plug 'Yggdroot/indentLine'
Plug 'bling/vim-airline'
Plug 'powerline/powerline'
Plug 'tpope/vim-surround'
Plug 'easymotion/vim-easymotion'
Plug 'szw/vim-ctrlspace'
Plug 'tell-k/vim-autoflake'
Plug 'rking/ag.vim'
Plug 'Chiel92/vim-autoformat'
Plug 'lifepillar/vim-solarized8'
Plug 'rakr/vim-one'
Plug 'mhinz/vim-startify'
Plug 'sheerun/vim-polyglot'
"Plug 'neomake/neomake'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-go', { 'do': 'make'}
Plug 'cloudhead/neovim-fuzzy'
Plug 'tomtom/quickfixsigns_vim'
"gist
Plug 'mattn/webapi-vim'
Plug 'mattn/gist-vim'
Plug 'jacoborus/tender.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'dcharbon/vim-flatbuffers'
"Plug 'romainl/vim-qf'
" Add plugins to &runtimepath
call plug#end()
nnoremap <C-s> :FuzzyOpen<CR>
let g:fuzzy_find_command = "ag --silent --nocolor -g '' -Q --path-to-agignore %s"
"autocmd! BufWritePost * Neomake
" Required:
filetype plugin indent on
let g:go_bin_path = "/root/.gotools"
map <C-f> :NERDTreeToggle<CR>
" vim devicons
let g:airline_powerline_fonts = 1
set encoding=utf8
" NERDTress File highlighting
function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
endfunction
call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('py', 'green', 'none', 'green', '#151515')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
call NERDTreeHighlightFile('go', 'Red', 'none', 'red', '#151515')
set number
let g:molokai_original = 1
let g:rehash256 = 1
nmap <F8> :TagbarToggle<CR>
nmap q <c-v>
" set terminal title
autocmd BufEnter * let &titlestring = ' ' . expand("%:t")
set title
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
"set backupdir=~/.config/nvim/backup/
"set directory=~/.config/nvim/swap/
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:airline_powerline_fonts = 1
let g:gruvbox_contrast_dark = 'hard'
set termguicolors
set background=dark
let g:one_allow_italics = 1 " I love italic for comments
let g:airline_theme='one'
nnoremap { :IndentationGoUp<CR>
nnoremap } :IndentationGoDown<CR>
nnoremap <F2> :on<CR>
let g:tmux_navigator_save_on_switch = 1
set undodir=~/.config/nvim/undodir
set undofile
let g:BASH_Ctrl_j = 'off'
let g:syntastic_html_tidy_exec = 'tidy'
" tmux_navigator in insert mode
imap <c-h> <c-o><c-h><i>
imap <c-j> <c-o><c-j><i>
imap <c-k> <c-o><c-k><i>
imap <c-l> <c-o><c-l><i>
imap <c-\> <c-o><c-\>
tnoremap <c-h> <C-\><C-n><C-w>h<i>
tnoremap <c-j> <C-\><C-n><C-w>j<i>
tnoremap <c-k> <C-\><C-n><C-w>k<i>
tnoremap <c-l> <C-\><C-n><C-w>l<i>
set autowrite
syntax on
set clipboard+=unnamedplus
" easymotions
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Bi-directional find motion
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap / <Plug>(easymotion-tn)
nmap f <Plug>(easymotion-sn)
nmap c <Plug>(easymotion-repeat)
let g:EasyMotion_smartcase = 1
nmap s <Plug>(easymotion-j)
nmap w <Plug>(easymotion-k)
nmap a <Plug>(easymotion-w)
nmap n <Plug>(easymotion-next)
nmap N <Plug>(easymotion-prev)
set nocompatible
set hidden
set showtabline=0
let g:airline#extensions#ctrlspace#enabled = 1
let g:CtrlSpaceLoadLastWorkspaceOnStart = 1
let g:CtrlSpaceSaveWorkspaceOnSwitch = 1
let g:CtrlSpaceSaveWorkspaceOnExit = 1
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#tagbar#enabled = 1
" Autoformat
"function Autoformat (command)
" execute "w"
" execute "!clear;time " . a:command . " " . expand("%")
"endfunction
let g:autoflake_remove_unused_variables=1
let g:autoflake_disable_show_diff=1
let g:autoflake_imports="django,requests,urllib3"
let mapleader = "\<Space>"
nnoremap <leader>h :leftabove vnew<CR>:FuzzyOpen<CR>
nnoremap <leader>l :rightbelow vnew<CR>:FuzzyOpen<CR>
nnoremap <leader>k :leftabove new<CR>:FuzzyOpen<CR>
nnoremap <leader>j :rightbelow new<CR>:FuzzyOpen<CR>
set cursorline
set spell
set autoread
let g:user_emmet_install_global = 0
autocmd FileType html,css,styl EmmetInstall
inoremap <Esc> <Esc>:w<CR>
vnoremap <Esc> <Esc>:w<CR>
nnoremap <Esc> <Esc>:w<CR>
let syntastic_typescript_tsc_args = "--target es6 --jsx"
let g:tagbar_type_typescript = {
\ 'ctagstype': 'typescript',
\ 'kinds': [
\ 'c:classes',
\ 'n:modules',
\ 'f:functions',
\ 'v:variables',
\ 'v:varlambdas',
\ 'm:members',
\ 'i:interfaces',
\ 'e:enums',
\ ]
\ }
set completeopt+=noselect
let g:deoplete#enable_at_startup = 1
" deoplete tab-complete
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" vim go
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
" By default the mapping gd is enabled, which opens the target identifier in current buffer. You can also open the definition/declaration, in a new vertical, horizontal, or tab, for the wordunder your cursor:
au FileType go nmap <Leader>ds <Plug>(go-def-split)
au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" Open the relevant Godoc for the word under the cursor with <leader>gd or open it vertically with <leader>gv
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gv <Plug>(go-doc-vertical)
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
au FileType go nmap <Leader>s <Plug>(go-implements)
au FileType go nmap <Leader>i <Plug>(go-info)
au FileType go nmap <Leader>e <Plug>(go-rename)
au FileType go nmap <Leader>a <Plug>(go-alternate-edit)
au FileType go nmap <leader>rt <Plug>(go-run-tab)
au FileType go nmap <Leader>rs <Plug>(go-run-split)
au FileType go nmap <Leader>rv <Plug>(go-run-vertical)
let g:go_term_mode = "split"
let g:go_fmt_command = "goimports"
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set noswapfile
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_metalinter_autosave = 1
let g:go_metalinter_autosave_enabled = ["deadcode", "dupl", "errcheck", "goconst", "golint", "gosimple",
\"ineffassign", "interfacer","misspell","staticcheck","structcheck","testify","unused", 'gocyclo', "unused", "vet", "vetshadow", 'lll']
colorscheme one
let g:gitgutter_sign_column_always = 1
set updatetime=250
nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
fun! CycleList(nextcom, firstcom)
try
try
execute a:nextcom
catch /^Vim\%((\a\+)\)\=:E553/
execute a:firstcom
catch /^Vim\%((\a\+)\)\=:E776/
endtry
catch /^Vim\%((\a\+)\)\=:E42/
endtry
endfun
nnoremap <silent> <F1> :call CycleList("lnext", "lfirst")<CR>
nnoremap <silent> <F2> :call CycleList("lprev", "llast")<CR>
nnoremap <silent> <F3> :call CycleList("cnext", "cfirst")<CR>
nnoremap <silent> <F4> :call CycleList("cprev", "clast")<CR>
autocmd WinEnter * match ErrorMsg '\%>80v.\+'
let $GOPATH = "/root"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment