Skip to content

Instantly share code, notes, and snippets.

@beovulf
Last active February 22, 2017 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beovulf/d82eda2f88c288ca09f4708c2b53d485 to your computer and use it in GitHub Desktop.
Save beovulf/d82eda2f88c288ca09f4708c2b53d485 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'scrooloose/nerdtree.git'
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'posva/vim-vue'
Plugin 'scrooloose/syntastic'
Plugin 'gcorne/vim-sass-lint'
Plugin 'mhinz/vim-startify'
Plugin 'easymotion/vim-easymotion'
Plugin 'mattn/emmet-vim'
Plugin 'tpope/vim-sensible'
Plugin 'othree/csscomplete.vim'
Plugin 'itchyny/lightline.vim'
Plugin 'tmhedberg/matchit'
Plugin 'rhysd/clever-f.vim'
Plugin 'raimondi/delimitmate'
Plugin 'justinmk/vim-gtfo'
Plugin 'szw/vim-maximizer'
Plugin 'matze/vim-move'
Plugin 'jwalton512/vim-blade'
Plugin 'vim-scripts/AutoComplPop'
Plugin 'morhetz/gruvbox'
Plugin 'scrooloose/nerdcommenter'
Plugin 'datawraith/auto_mkdir'
Plugin 'sickill/vim-pasta'
" All of your Plugins must be added before the following line
call vundle#end() " required
" filetype plugin indent on " required
filetype on
filetype plugin on
filetype indent on
syntax enable
set showmode
set showcmd
set wildmenu
set ruler<
runtime ftplugin/man.vim
set linebreak
set hlsearch
set breakindent
" set showmatch
set ignorecase
set smartcase
set path=.,..,/usr/include/**,/usr/share/**
set spelllang=en_us
set tabstop=4
set shiftwidth=4
set expandtab
set shiftround
set noswapfile
set number
set background=dark
set noshowmode
set regexpengine=1
set hidden " buffer can remember undo history
set clipboard=unnamed
set autoindent
set lazyredraw
set autoread
colorscheme gruvbox
" autoindent correction
autocmd BufNewFile,BufRead *.blade.php set ft=html | set ft=phtml | set ft=blade " Fix blade auto-indent
" Nerd tree
autocmd StdinReadPre * let s:std_in=1
let NERDTreeShowHidden=1
let NERDTreeMapActivateNode='<space>'
silent! nmap <F4> :NERDTreeToggle<CR>
autocmd VimEnter * NERDTree
" Ctrlp config
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
let g:NERDTreeChDirMode = 2
let g:ctrlp_working_path_mode = 'rw'
let g:ctrlp_cmd = 'CtrlPBuffer'
nmap <Leader>r :NERDTreeFocus<cr>R<c-w><c-p>:CtrlPClearCache<cr>
" Syntastic
let g:syntastic_sass_checkers=["sasslint"]
let g:syntastic_scss_checkers=["sasslint"]
let g:syntastic_always_populate_loc_list = 1
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_loc_list_height = 5
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_error_symbol = '❌'
let g:syntastic_style_error_symbol = '⁉️'
let g:syntastic_warning_symbol = '⚠️'
let g:syntastic_style_warning_symbol = '💩'
highlight link SyntasticErrorSign SignColumn
highlight link SyntasticWarningSign SignColumn
highlight link SyntasticStyleErrorSign SignColumn
highlight link SyntasticStyleWarningSign SignColumn
" Relative numbers
set rnu
function! ToggleNumbersOn()
set nu!
set rnu
endfunction
function! ToggleRelativeOn()
set rnu!
set nu
endfunction
autocmd FocusLost * call ToggleRelativeOn()
autocmd FocusGained * call ToggleRelativeOn()
autocmd InsertEnter * call ToggleRelativeOn()
autocmd InsertLeave * call ToggleRelativeOn()
" Map keys
noremap <silent> <F10> :cal VimCommanderToggle()<CR>
noremap <silent> <F3> :NERDTreeToggle<CR>
noremap <silent> <F2> :Startify<CR>
map <F7> mzgg=G`z
nmap <S-Enter> O<Esc>
nmap <CR> <S-A><CR><Esc>
nmap <Leader>b :b# <CR>
" Set ctrlp relative to nerdTree
let g:NERDTreeChDirMode = 2
let g:ctrlp_working_path_mode = 'rw'
" Startify
let g:startify_bookmarks = [ '~/.vimrc', '~/.zshrc', '~/.NERDTreeBookmarks' ]
" Go to right split at vim start
autocmd VimEnter * wincmd l
" Easy motion config
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap s <Plug>(easymotion-overwin-f)
" or
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
nmap s <Plug>(easymotion-overwin-f2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
" Emmet
let g:user_emmet_expandabbr_key='<Tab>'
imap <expr> <tab> emmet#expandAbbrIntelligent("\<tab>")
" Show invisibles
" set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:•
" set list
" gitgutter config
let g:gitgutter_sign_added = '•'
let g:gitgutter_sign_modified = '•'
let g:gitgutter_sign_removed = '•'
let g:gitgutter_sign_removed_first_line = '•'
let g:gitgutter_sign_modified_removed = '•'
" lightline config
let g:lightline = {
\ 'colorscheme': 'solarized',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ],
\ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ]
\ },
\ 'component_function': {
\ 'fugitive': 'LightlineFugitive',
\ 'filename': 'LightlineFilename',
\ 'fileformat': 'LightlineFileformat',
\ 'filetype': 'LightlineFiletype',
\ 'fileencoding': 'LightlineFileencoding',
\ 'mode': 'LightlineMode',
\ 'ctrlpmark': 'CtrlPMark',
\ },
\ 'component_expand': {
\ 'syntastic': 'SyntasticStatuslineFlag',
\ },
\ 'component_type': {
\ 'syntastic': 'error',
\ },
\ 'subseparator': { 'left': '|', 'right': '|' }
\ }
function! LightlineModified()
return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-'
endfunction
function! LightlineReadonly()
return &ft !~? 'help' && &readonly ? 'RO' : ''
endfunction
function! LightlineFilename()
let fname = expand('%:t')
return fname == 'ControlP' && has_key(g:lightline, 'ctrlp_item') ? g:lightline.ctrlp_item :
\ fname == '__Tagbar__' ? g:lightline.fname :
\ fname =~ '__Gundo\|NERD_tree' ? '' :
\ &ft == 'vimfiler' ? vimfiler#get_status_string() :
\ &ft == 'unite' ? unite#get_status_string() :
\ &ft == 'vimshell' ? vimshell#get_status_string() :
\ ('' != LightlineReadonly() ? LightlineReadonly() . ' ' : '') .
\ ('' != fname ? fname : '[No Name]') .
\ ('' != LightlineModified() ? ' ' . LightlineModified() : '')
endfunction
function! LightlineFugitive()
try
if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head')
let mark = '' " edit here for cool mark
let branch = fugitive#head()
return branch !=# '' ? mark.branch : ''
endif
catch
endtry
return ''
endfunction
function! LightlineFileformat()
return winwidth(0) > 70 ? &fileformat : ''
endfunction
function! LightlineFiletype()
return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''
endfunction
function! LightlineFileencoding()
return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''
endfunction
function! LightlineMode()
let fname = expand('%:t')
return fname == '__Tagbar__' ? 'Tagbar' :
\ fname == 'ControlP' ? 'CtrlP' :
\ fname == '__Gundo__' ? 'Gundo' :
\ fname == '__Gundo_Preview__' ? 'Gundo Preview' :
\ fname =~ 'NERD_tree' ? 'NERDTree' :
\ &ft == 'unite' ? 'Unite' :
\ &ft == 'vimfiler' ? 'VimFiler' :
\ &ft == 'vimshell' ? 'VimShell' :
\ winwidth(0) > 60 ? lightline#mode() : ''
endfunction
function! CtrlPMark()
if expand('%:t') =~ 'ControlP' && has_key(g:lightline, 'ctrlp_item')
call lightline#link('iR'[g:lightline.ctrlp_regex])
return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item
\ , g:lightline.ctrlp_next], 0)
else
return ''
endif
endfunction
let g:ctrlp_status_func = {
\ 'main': 'CtrlPStatusFunc_1',
\ 'prog': 'CtrlPStatusFunc_2',
\ }
function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked)
let g:lightline.ctrlp_regex = a:regex
let g:lightline.ctrlp_prev = a:prev
let g:lightline.ctrlp_item = a:item
let g:lightline.ctrlp_next = a:next
return lightline#statusline(0)
endfunction
function! CtrlPStatusFunc_2(str)
return lightline#statusline(0)
endfunction
augroup AutoSyntastic
autocmd!
autocmd BufWritePost *.c,*.cpp call s:syntastic()
augroup END
function! s:syntastic()
SyntasticCheck
call lightline#update()
endfunction
let g:unite_force_overwrite_statusline = 0
let g:vimfiler_force_overwrite_statusline = 0
let g:vimshell_force_overwrite_statusline = 0
" Disable arrows
map <Left> <Nop>
map <Right> <Nop>
map <Up> <Nop>
map <Down> <Nop>
" vim move
let g:move_key_modifier = 'C'
" delimitmate settings
let delimitMate_expand_cr = 2
let delimitMate_expand_space = 1
let g:yankring_replace_n_pkey = '<S-p>'
let g:yankring_replace_n_nkey = '<S-n>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment