Skip to content

Instantly share code, notes, and snippets.

@jeanPokou
Created October 16, 2017 12:07
Show Gist options
  • Save jeanPokou/8152b9013a22ba53e05a49c6838c8789 to your computer and use it in GitHub Desktop.
Save jeanPokou/8152b9013a22ba53e05a49c6838c8789 to your computer and use it in GitHub Desktop.
Window .virmc
set encoding=utf-8
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()
Bundle 'jiangmiao/auto-pairs'
Bundle 'tpope/vim-commentary'
Bundle 'vim-airline/vim-airline'
Bundle 'vim-airline/vim-airline-themes'
Bundle 'ervandew/supertab'
Bundle 'honza/vim-snippets'
" Bundle 'valloric/youcompleteme'
" Bundle 'xleng/YCM_WIN_X86'
Bundle 'Rip-Rip/clang_complete'
Bundle 'SirVer/ultisnips'
Bundle 'gavocanov/vim-js-indent'
Bundle 'othree/html5.vim'
Bundle 'othree/es.next.syntax.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdcommenter'
Bundle 'maksimr/vim-jsbeautify'
Bundle 'mattn/emmet-vim'
Bundle 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Bundle 'kien/ctrlp.vim'
Bundle 'dracula/vim'
Bundle 'junegunn/goyo.vim'
Bundle 'tpope/vim-sleuth'
Bundle 'benekastah/neomake'
Bundle 'jaxbot/browserlink.vim'
Bundle 'hsanson/vim-android'
Bundle 'tpope/vim-surround'
Bundle 'yazug/vim-taglist-plus'
Bundle 'terryma/vim-expand-region'
Bundle 'pablobfonseca/vim-dragvisuals'
Bundle 'dkprice/vim-easygrep'
Bundle 'rhysd/vim-grammarous'
Bundle 'easymotion/vim-easymotion'
" Bundle 'justmao945/vim-clang'
Bundle 'ryanoasis/vim-devicons'
" Bundle 'majutsushi/tagbar'
Bundle 'leafgarland/typescript-vim'
Bundle 'Quramy/tsuquyomi'
Bundle 'mbbill/undotree'
Bundle 'othree/xml.vim'
" Bundle 'w0ng/vim-hybrid'
Bundle 'flazz/vim-colorschemes'
Bundle 'jdkanani/vim-material-theme'
" Bundle 'joshdick/onedark'
" c++ plugins
" Bundle 'LucHermitte/lh-vim-lib'
" Bundle 'LucHermitte/lh-tags'
" Bundle 'LucHermitte/lh-dev'
" Bundle 'LucHermitte/lh-brackets'
" Bundle 'LucHermitte/searchInRuntime'
" Bundle 'LucHermitte/mu-template'
" Bundle 'tomtom/stakeholders_vim'
" Bundle 'LucHermitte/lh-cpp'
Bundle 'suan/vim-instant-markdown'
call vundle#end() " required
set background=dark
" colorscheme hybrid
" set codes for dynamic cursor type with vim modes
let &t_te="\e[0 q"
let &t_ti="\e[1 q"
let &t_EI="\e[1 q"
let &t_SI="\e[5 q"
let &t_SR="\e[3 q"
" let g:ycm_path_to_python_interpreter="/usr/bin/python"
" let g:clang_exec='/c/Program Files/LLVM/bin'
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <space><space> <Plug>(easymotion-bd-w)
nmap <space><space> <Plug>(easymotion-overwin-w)
vmap <expr> <C-h> DVB_Drag('left')
vmap <expr> <C-l> DVB_Drag('right')
vmap <expr> <C-j> DVB_Drag('down')
vmap <expr> <C-k> DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
"leader + w for saving
nnoremap <Leader>w :w<CR>
nnoremap <Leader><Leader> :w<CR>
"expand region on visual mode
vmap v <Plug>(expand_region_expand)
vmap <S-v> <Plug>(expand_region_shrink)
" apply macro to selection
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
" let g:expand_region_use_select_mode = 1
filetype plugin indent on " required
let g:android_sdk_path = 'C:\Users\User1\AppData\Local\Android\sdk\tools'
autocmd FileType javascript noremap <buffer> <c-b> :call JsBeautify()<cr>
" for json
autocmd FileType json noremap <buffer> <c-b> :call JsonBeautify()<cr>
" for jsx
autocmd FileType jsx noremap <buffer> <c-b> :call JsxBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-b> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <c-b> :call CSSBeautify()<cr>
let g:IndentLine_char='|'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
"set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = 'bower_modules'
let g:ctrlp_custom_ignore = 'bower_components'
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist|.cordova|bower_modules|bower_components)|(\.(swp|ico|git|svn))$'
hi SpellBad ctermfg=124 ctermbg=015 guifg=#af0000 guibg=#af0000
hi SpellCap ctermfg=208 ctermbg=015 guifg=#ff8700 guibg=#ff8700
"============================== Syntastic ============================{{
"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
"==================================== UtilsSnip======================{{
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabCrMapping = 0
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
let g:ycm_key_list_select_completion = ['<C-j>', '<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-k>', '<C-p>', '<Up>']
"====================================================================}}
"=============================GitGutter configs======================={{
let g:gitgutter_max_signs = 1000
"=====================================================================}}
"
"========================== vim-airline=============================={{
let g:airline#extensions#tabline#enable = 1
set hidden
let g:airline#extension#tabline#fnamedmode = ':t'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts=1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = ''
let g:airline_right_sep = '«'
let g:airline_right_sep = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" set guifont=Operator\ Mono\ Light\ Italic\ Nerd\ Font
" airline symbols
"jlet g:airline_left_sep = ''
"let g:airline_left_alt_sep = ''
" let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
"let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = 'ro'
"let g:airline_symbols.linenr = ''
set hidden
nmap <leader>t :term<cr>
nmap <leader>n :bnext<CR>
nmap <leader>. :bprevious<CR>
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
"let g:airline_theme="luna"
" if has('gui_macvim')
" set guifont=Ubuntu\ Mono\ Nerd\ Font\ Complete\ Mono\ Windows\ Compatible:h15
" else
" set guifont=UbuntuMono_NF:h12:cANSI:qDRAFT
" endif
" " set guifont=RobotoMono\ NF
"====================================================================}}
nnoremap <leader> f :buffers<CR>:buffer<Space>
"========================== IndentLine==================================
let g:IndentLine_char='|'
"==================== Remember cursor position between vim sessions ====================
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" center buffer around cursor when opening files
"========================== Section General========================= {{{
" Abbreviations
abbr funciton function
abbr teh the
abbr tempalte template
abbr fitler filter
set nocompatible " not compatible with vi
set autoread " detect when a file is changed
set history=1000 " change history to 1000
set textwidth=120
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" }}}
" Section User Interface {{{
syntax on " switch syntax highlighting on
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors"
colorscheme dracula " Set the colorscheme
" set background=dark
" colorscheme material-theme
" make the highlighting of tabs and other non-text less annoying
highlight SpecialKey ctermbg=none ctermfg=8
highlight NonText ctermbg=none ctermfg=8
" make comments and HTML attributes italic
highlight Comment cterm=italic
highlight htmlArg cterm=italic
set number " show line numbers
set relativenumber " show relative line numbers
set wrap " turn on line wrapping
set wrapmargin=8 " wrap lines when coming within n characters from side
set linebreak " set soft wrapping
set showbreak=… " show ellipsis at breaking
set autoindent " automatically set indent of new line
set smartindent
" toggle invisible characters
set list
set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮
set showbreak=↪
" highlight conflicts
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
" make backspace behave in a sane manner
set backspace=indent,eol,start
" Tab control
set noexpandtab " insert tabs rather than spaces for <Tab>
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop'
set tabstop=4 " the visible width of tabs
set softtabstop=4 " edit as if the tabs are 4 characters wide
set shiftwidth=4 " number of spaces to use for indent and unindent
set shiftround " round indent to a multiple of 'shiftwidth'
set completeopt+=longest
" code folding settings
set foldmethod=syntax " fold based on indent
set foldnestmax=10 " deepest fold is 10 levels
set nofoldenable " don't fold by default
set foldlevel=1
set clipboard=unnamed
set ttyfast " faster redrawing
set diffopt+=vertical
set laststatus=2 " show the satus line all the time
set so=7 " set 7 lines to the cursors - when moving vertical
set wildmenu " enhanced command line completion
set hidden " current buffer can be put into background
set showcmd " show incomplete commands
set noshowmode " don't show which mode disabled for PowerLine
set wildmode=list:longest " complete files like a shell
set scrolloff=3 " lines of text around cursor
set shell=$SHELL
set cmdheight=1 " command bar height
set title " set terminal title
" Searching
set ignorecase " case insensitive searching
set smartcase " case-sensitive if expresson contains a capital letter
set hlsearch " highlight search results
set incsearch " set incremental search, like modern browsers
set nolazyredraw " don't redraw while executing macros
set magic " Set magic on, for regex
set showmatch " show matching braces
set mat=2 " how many tenths of a second to blink
" error bells
set noerrorbells
set visualbell
set t_vb=
set tm=500
if has('mouse')
set mouse=a
" set ttymouse=xterm2
endif
"=========================================================================== }}}
" Section Mappings {{{
" set a map leader for more key combos
let mapleader = ','
" remap esc
inoremap jk <esc>
" wipout buffer
nmap <silent> <leader>b :bw<cr>
" shortcut to save
nmap <leader>, :w<cr>
" set paste toggle
set pastetoggle=<leader>v
" toggle paste mode
" map <leader>v :set paste!<cr>
" edit ~/.config/nvim/init.vim
map <leader>ev :e! ~/.config/nvim/init.vim<cr>
" edit gitconfig
map <leader>eg :e! ~/.gitconfig<cr>
" clear highlighted search
noremap <space> :set hlsearch! hlsearch?<cr>
" activate spell-checking alternatives
nmap ;s :set invspell spelllang=en<cr>
" markdown to html
nmap <leader>md :%!markdown --html4tags <cr>
" remove extra whitespace
nmap <leader><space> :%s/\s\+$<cr>
nmap <leader>l :set list!<cr>
" Textmate style indentation
vmap <leader>[ <gv
vmap <leader>] >gv
nmap <leader>[ <<
nmap <leader>] >>
" switch between current and last buffer
nmap <leader>. <c-^>
" enable . command in visual mode
vnoremap . :normal .<cr>
map <silent> <C-h> :call functions#WinMove('h')<cr>
map <silent> <C-j> :call functions#WinMove('j')<cr>
map <silent> <C-k> :call functions#WinMove('k')<cr>
map <silent> <C-l> :call functions#WinMove('l')<cr>
"
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr()) "we havent moved
if (match(a:key,'[jk]')) "were we going up/down
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction
map <leader>wc :wincmd q<cr>
" toggle cursor line
nnoremap <leader>i :set cursorline!<cr>
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" moving up and down work as you would expect
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
" search for word under the cursor
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
" inoremap <tab> <c-r>=Smart_TabComplete()<CR>
map <leader>r :call RunCustomCommand()<cr>
" map <leader>s :call SetCustomCommand()<cr>
let g:silent_custom_command = 0
" helpers for dealing with other people's code
nmap \t :set ts=4 sts=4 sw=4 noet<cr>
nmap \s :set ts=4 sts=4 sw=4 et<cr>
" nmap <leader>w :setf textile<cr> :Goyo<cr>
nnoremap <silent> <leader>u :call functions#HtmlUnEscape()<cr>
" }}}
" Section AutoGroups {{{
" file type specific settings
augroup configgroup
autocmd!
" automatically resize panes on resize
autocmd VimResized * exe 'normal! \<c-w>='
autocmd BufWritePost .vimrc,.vimrc.local,init.vim source %
autocmd BufWritePost .vimrc.local source %
" save all files on focus lost, ignoring warnings about untitled buffers
autocmd FocusLost * silent! wa
" make quickfix windows take all the lower section of the screen
" when there are multiple windows open
autocmd FileType qf wincmd J
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
" autocmd! BufEnter * call functions#ApplyLocalSettings(expand('<afile>:p:h'))
autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
"autocmd! BufWritePost * Neomake
augroup END
" }}}
" Section Plugins {{{
" FZF
"""""""""""""""""""""""""""""""""""""
let g:fzf_layout = { 'down': '~25%' }
if isdirectory(".git")
" if in a git project, use :GFiles
nmap <silent> <leader>t :GFiles<cr>
else
" otherwise, use :FZF
nmap <silent> <leader>t :FZF<cr>
endif
nmap <silent> <leader>r :Buffers<cr>
nmap <silent> <leader>e :FZF<cr>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
nnoremap <silent> <Leader>C :call fzf#run({
\ 'source':
\ map(split(globpath(&rtp, "colors/*.vim"), "\n"),
\ "substitute(fnamemodify(v:val, ':t'), '\\..\\{-}$', '', '')"),
\ 'sink': 'colo',
\ 'options': '+m',
\ 'left': 30
\ })<CR>
command! FZFMru call fzf#run({
\ 'source': v:oldfiles,
\ 'sink': 'e',
\ 'options': '-m -x +s',
\ 'down': '40%'})
"Adding deoplete on startup
"let g:deoplete#enable_at_startup = 1
" Fugitive Shortcuts
"""""""""""""""""""""""""""""""""""""
nmap <silent> <leader>gs :Gstatus<cr>
nmap <leader>ge :Gedit<cr>
nmap <silent><leader>gr :Gread<cr>
nmap <silent><leader>gb :Gblame<cr>
nmap <leader>m :MarkedOpen!<cr>
nmap <leader>mq :MarkedQuit<cr>
nmap <leader>* *<c-o>:%s///gn<cr>
"=======================Configuration for NERDTree============{{
"
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', '#141e23')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#141e23')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#141e23')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#141e23')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#141e23')
call NERDTreeHighlightFile('js', 'yellow', 'none', '#f0da50', '#141e23')
call NERDTreeHighlightFile('ts', 'Blue', 'none', '#6699cc', '#141e23')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#141e23')
call NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('gitignore', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('bashrc', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('bashprofile', 'Gray', 'none', '#686868', '#141e23')
"Toogle NERDTree
nmap <silent> <leader>k :NERDTreeToggle<cr>
"Expand to the path of the file in the current buffer
nmap <silent> <leader>j :NERDTreeFind<cr>
"Start NERDTree om startup of nvim or vim
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
"============================================================}}
function! GetColorFromHighlightGroup(group, color, env)
return synIDattr(synIDtrans(hlID(a:group)), a:color, a:env)
endfunction
function! GetBackgroundColors(group)
return
\ ' ctermbg=' . GetColorFromHighlightGroup(a:group, 'bg', 'cterm') .
\ ' guibg=' . GetColorFromHighlightGroup(a:group, 'bg', 'gui')
endfunction
function! GetFrontgroundColors(group)
return
\ ' ctermfg=' . GetColorFromHighlightGroup(a:group, 'fg', 'cterm') .
\ ' guifg=' . GetColorFromHighlightGroup(a:group, 'fg', 'gui')
endfunction
function! NeoMakeDefaults()
let l:sign_bg = GetBackgroundColors('SignColumn')
let l:error_sign_fg = GetFrontgroundColors('ErrorMsg')
let l:warning_sign_fg = GetFrontgroundColors('Todo')
let l:information_sign_fg = GetFrontgroundColors('Question')
let l:default_sign_fg = GetFrontgroundColors('ModeMsg')
execute 'highlight NeomakeErrorDefault' . l:error_sign_fg . l:sign_bg
execute 'highlight NeomakeWarningDefault' . l:warning_sign_fg . l:sign_bg
execute 'highlight NeomakeInformationalDefault' . l:information_sign_fg . l:sign_bg
"execute 'highlight NeomakeMessageDefault' . l:default_sign_fg . l:sign_bg
endfunction
call NeoMakeDefaults()
let g:neomake_error_sign = { 'text': "\uF057", 'texthl': 'NeomakeErrorDefault' }
let g:neomake_warning_sign = { 'text': "\uF056", 'texthl': 'NeomakeWarningDefault' }
let g:neomake_informational_sign = { 'text': "\uF05A", 'texthl': 'NeomakeInformationDefault' }
"let g:neomake_message_sign = { 'text': "\uF09A", 'texthl': 'NeomakeMessageDefault' }
let g:neomake_javascript_enabled_mmakers=['jscs','jshint']
let g:neomake_javascript_jshint_maker = {
\ 'args': ['--verbose'],
\ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
\ }
let g:neomake_typescript_tsc_maker = {
\ 'args': ['-m', 'commonjs', '--noEmit' ],
\ 'append_file': 0,
\ 'errorformat':
\ '%E%f %#(%l\,%c): error %m,' .
\ '%E%f %#(%l\,%c): %m,' .
\ '%Eerror %m,' .
\ '%C%\s%\+%m'
\ }
"" don't hide quotes in json files
let g:vim_json_syntax_conceal = 0
let g:SuperTabCrMapping = 0
" }}}
" vim:foldmethod=marker:foldlevel=0
set encoding=utf-8
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()
Bundle 'jiangmiao/auto-pairs'
Bundle 'tpope/vim-commentary'
Bundle 'vim-airline/vim-airline'
Bundle 'vim-airline/vim-airline-themes'
Bundle 'ervandew/supertab'
Bundle 'honza/vim-snippets'
" Bundle 'valloric/youcompleteme'
" Bundle 'xleng/YCM_WIN_X86'
Bundle 'Rip-Rip/clang_complete'
Bundle 'SirVer/ultisnips'
Bundle 'gavocanov/vim-js-indent'
Bundle 'othree/html5.vim'
Bundle 'othree/es.next.syntax.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdcommenter'
Bundle 'maksimr/vim-jsbeautify'
Bundle 'mattn/emmet-vim'
Bundle 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Bundle 'kien/ctrlp.vim'
Bundle 'dracula/vim'
Bundle 'junegunn/goyo.vim'
Bundle 'tpope/vim-sleuth'
Bundle 'benekastah/neomake'
Bundle 'jaxbot/browserlink.vim'
Bundle 'hsanson/vim-android'
Bundle 'tpope/vim-surround'
Bundle 'yazug/vim-taglist-plus'
Bundle 'terryma/vim-expand-region'
Bundle 'pablobfonseca/vim-dragvisuals'
Bundle 'dkprice/vim-easygrep'
Bundle 'rhysd/vim-grammarous'
Bundle 'easymotion/vim-easymotion'
" Bundle 'justmao945/vim-clang'
Bundle 'ryanoasis/vim-devicons'
" Bundle 'majutsushi/tagbar'
Bundle 'leafgarland/typescript-vim'
Bundle 'Quramy/tsuquyomi'
Bundle 'mbbill/undotree'
Bundle 'othree/xml.vim'
" Bundle 'w0ng/vim-hybrid'
Bundle 'flazz/vim-colorschemes'
Bundle 'jdkanani/vim-material-theme'
" Bundle 'joshdick/onedark'
" c++ plugins
" Bundle 'LucHermitte/lh-vim-lib'
" Bundle 'LucHermitte/lh-tags'
" Bundle 'LucHermitte/lh-dev'
" Bundle 'LucHermitte/lh-brackets'
" Bundle 'LucHermitte/searchInRuntime'
" Bundle 'LucHermitte/mu-template'
" Bundle 'tomtom/stakeholders_vim'
" Bundle 'LucHermitte/lh-cpp'
Bundle 'suan/vim-instant-markdown'
call vundle#end() " required
set background=dark
" colorscheme hybrid
" set codes for dynamic cursor type with vim modes
let &t_te="\e[0 q"
let &t_ti="\e[1 q"
let &t_EI="\e[1 q"
let &t_SI="\e[5 q"
let &t_SR="\e[3 q"
" let g:ycm_path_to_python_interpreter="/usr/bin/python"
" let g:clang_exec='/c/Program Files/LLVM/bin'
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <space><space> <Plug>(easymotion-bd-w)
nmap <space><space> <Plug>(easymotion-overwin-w)
vmap <expr> <C-h> DVB_Drag('left')
vmap <expr> <C-l> DVB_Drag('right')
vmap <expr> <C-j> DVB_Drag('down')
vmap <expr> <C-k> DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
"leader + w for saving
nnoremap <Leader>w :w<CR>
nnoremap <Leader><Leader> :w<CR>
"expand region on visual mode
vmap v <Plug>(expand_region_expand)
vmap <S-v> <Plug>(expand_region_shrink)
" apply macro to selection
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
" let g:expand_region_use_select_mode = 1
filetype plugin indent on " required
let g:android_sdk_path = 'C:\Users\User1\AppData\Local\Android\sdk\tools'
autocmd FileType javascript noremap <buffer> <c-b> :call JsBeautify()<cr>
" for json
autocmd FileType json noremap <buffer> <c-b> :call JsonBeautify()<cr>
" for jsx
autocmd FileType jsx noremap <buffer> <c-b> :call JsxBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-b> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <c-b> :call CSSBeautify()<cr>
let g:IndentLine_char='|'
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
"set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = 'bower_modules'
let g:ctrlp_custom_ignore = 'bower_components'
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist|.cordova|bower_modules|bower_components)|(\.(swp|ico|git|svn))$'
hi SpellBad ctermfg=124 ctermbg=015 guifg=#af0000 guibg=#af0000
hi SpellCap ctermfg=208 ctermbg=015 guifg=#ff8700 guibg=#ff8700
"============================== Syntastic ============================{{
"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
"==================================== UtilsSnip======================{{
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabCrMapping = 0
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
let g:ycm_key_list_select_completion = ['<C-j>', '<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-k>', '<C-p>', '<Up>']
"====================================================================}}
"=============================GitGutter configs======================={{
let g:gitgutter_max_signs = 1000
"=====================================================================}}
"
"========================== vim-airline=============================={{
let g:airline#extensions#tabline#enable = 1
set hidden
let g:airline#extension#tabline#fnamedmode = ':t'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts=1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = ''
let g:airline_right_sep = '«'
let g:airline_right_sep = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" set guifont=Operator\ Mono\ Light\ Italic\ Nerd\ Font
" airline symbols
"jlet g:airline_left_sep = ''
"let g:airline_left_alt_sep = ''
" let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
"let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = 'ro'
"let g:airline_symbols.linenr = ''
set hidden
nmap <leader>t :term<cr>
nmap <leader>n :bnext<CR>
nmap <leader>. :bprevious<CR>
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
"let g:airline_theme="luna"
" if has('gui_macvim')
" set guifont=Ubuntu\ Mono\ Nerd\ Font\ Complete\ Mono\ Windows\ Compatible:h15
" else
" set guifont=UbuntuMono_NF:h12:cANSI:qDRAFT
" endif
" " set guifont=RobotoMono\ NF
"====================================================================}}
nnoremap <leader> f :buffers<CR>:buffer<Space>
"========================== IndentLine==================================
let g:IndentLine_char='|'
"==================== Remember cursor position between vim sessions ====================
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" center buffer around cursor when opening files
"========================== Section General========================= {{{
" Abbreviations
abbr funciton function
abbr teh the
abbr tempalte template
abbr fitler filter
set nocompatible " not compatible with vi
set autoread " detect when a file is changed
set history=1000 " change history to 1000
set textwidth=120
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" }}}
" Section User Interface {{{
syntax on " switch syntax highlighting on
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors"
colorscheme dracula " Set the colorscheme
" set background=dark
" colorscheme material-theme
" make the highlighting of tabs and other non-text less annoying
highlight SpecialKey ctermbg=none ctermfg=8
highlight NonText ctermbg=none ctermfg=8
" make comments and HTML attributes italic
highlight Comment cterm=italic
highlight htmlArg cterm=italic
set number " show line numbers
set relativenumber " show relative line numbers
set wrap " turn on line wrapping
set wrapmargin=8 " wrap lines when coming within n characters from side
set linebreak " set soft wrapping
set showbreak=… " show ellipsis at breaking
set autoindent " automatically set indent of new line
set smartindent
" toggle invisible characters
set list
set listchars=tab:→\ ,eol:¬,trail:⋅,extends:❯,precedes:❮
set showbreak=↪
" highlight conflicts
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
" make backspace behave in a sane manner
set backspace=indent,eol,start
" Tab control
set noexpandtab " insert tabs rather than spaces for <Tab>
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop'
set tabstop=4 " the visible width of tabs
set softtabstop=4 " edit as if the tabs are 4 characters wide
set shiftwidth=4 " number of spaces to use for indent and unindent
set shiftround " round indent to a multiple of 'shiftwidth'
set completeopt+=longest
" code folding settings
set foldmethod=syntax " fold based on indent
set foldnestmax=10 " deepest fold is 10 levels
set nofoldenable " don't fold by default
set foldlevel=1
set clipboard=unnamed
set ttyfast " faster redrawing
set diffopt+=vertical
set laststatus=2 " show the satus line all the time
set so=7 " set 7 lines to the cursors - when moving vertical
set wildmenu " enhanced command line completion
set hidden " current buffer can be put into background
set showcmd " show incomplete commands
set noshowmode " don't show which mode disabled for PowerLine
set wildmode=list:longest " complete files like a shell
set scrolloff=3 " lines of text around cursor
set shell=$SHELL
set cmdheight=1 " command bar height
set title " set terminal title
" Searching
set ignorecase " case insensitive searching
set smartcase " case-sensitive if expresson contains a capital letter
set hlsearch " highlight search results
set incsearch " set incremental search, like modern browsers
set nolazyredraw " don't redraw while executing macros
set magic " Set magic on, for regex
set showmatch " show matching braces
set mat=2 " how many tenths of a second to blink
" error bells
set noerrorbells
set visualbell
set t_vb=
set tm=500
if has('mouse')
set mouse=a
" set ttymouse=xterm2
endif
"=========================================================================== }}}
" Section Mappings {{{
" set a map leader for more key combos
let mapleader = ','
" remap esc
inoremap jk <esc>
" wipout buffer
nmap <silent> <leader>b :bw<cr>
" shortcut to save
nmap <leader>, :w<cr>
" set paste toggle
set pastetoggle=<leader>v
" toggle paste mode
" map <leader>v :set paste!<cr>
" edit ~/.config/nvim/init.vim
map <leader>ev :e! ~/.config/nvim/init.vim<cr>
" edit gitconfig
map <leader>eg :e! ~/.gitconfig<cr>
" clear highlighted search
noremap <space> :set hlsearch! hlsearch?<cr>
" activate spell-checking alternatives
nmap ;s :set invspell spelllang=en<cr>
" markdown to html
nmap <leader>md :%!markdown --html4tags <cr>
" remove extra whitespace
nmap <leader><space> :%s/\s\+$<cr>
nmap <leader>l :set list!<cr>
" Textmate style indentation
vmap <leader>[ <gv
vmap <leader>] >gv
nmap <leader>[ <<
nmap <leader>] >>
" switch between current and last buffer
nmap <leader>. <c-^>
" enable . command in visual mode
vnoremap . :normal .<cr>
map <silent> <C-h> :call functions#WinMove('h')<cr>
map <silent> <C-j> :call functions#WinMove('j')<cr>
map <silent> <C-k> :call functions#WinMove('k')<cr>
map <silent> <C-l> :call functions#WinMove('l')<cr>
"
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr()) "we havent moved
if (match(a:key,'[jk]')) "were we going up/down
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction
map <leader>wc :wincmd q<cr>
" toggle cursor line
nnoremap <leader>i :set cursorline!<cr>
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" moving up and down work as you would expect
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
" search for word under the cursor
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
" inoremap <tab> <c-r>=Smart_TabComplete()<CR>
map <leader>r :call RunCustomCommand()<cr>
" map <leader>s :call SetCustomCommand()<cr>
let g:silent_custom_command = 0
" helpers for dealing with other people's code
nmap \t :set ts=4 sts=4 sw=4 noet<cr>
nmap \s :set ts=4 sts=4 sw=4 et<cr>
" nmap <leader>w :setf textile<cr> :Goyo<cr>
nnoremap <silent> <leader>u :call functions#HtmlUnEscape()<cr>
" }}}
" Section AutoGroups {{{
" file type specific settings
augroup configgroup
autocmd!
" automatically resize panes on resize
autocmd VimResized * exe 'normal! \<c-w>='
autocmd BufWritePost .vimrc,.vimrc.local,init.vim source %
autocmd BufWritePost .vimrc.local source %
" save all files on focus lost, ignoring warnings about untitled buffers
autocmd FocusLost * silent! wa
" make quickfix windows take all the lower section of the screen
" when there are multiple windows open
autocmd FileType qf wincmd J
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
" autocmd! BufEnter * call functions#ApplyLocalSettings(expand('<afile>:p:h'))
autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
"autocmd! BufWritePost * Neomake
augroup END
" }}}
" Section Plugins {{{
" FZF
"""""""""""""""""""""""""""""""""""""
let g:fzf_layout = { 'down': '~25%' }
if isdirectory(".git")
" if in a git project, use :GFiles
nmap <silent> <leader>t :GFiles<cr>
else
" otherwise, use :FZF
nmap <silent> <leader>t :FZF<cr>
endif
nmap <silent> <leader>r :Buffers<cr>
nmap <silent> <leader>e :FZF<cr>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
imap <c-x><c-l> <plug>(fzf-complete-line)
nnoremap <silent> <Leader>C :call fzf#run({
\ 'source':
\ map(split(globpath(&rtp, "colors/*.vim"), "\n"),
\ "substitute(fnamemodify(v:val, ':t'), '\\..\\{-}$', '', '')"),
\ 'sink': 'colo',
\ 'options': '+m',
\ 'left': 30
\ })<CR>
command! FZFMru call fzf#run({
\ 'source': v:oldfiles,
\ 'sink': 'e',
\ 'options': '-m -x +s',
\ 'down': '40%'})
"Adding deoplete on startup
"let g:deoplete#enable_at_startup = 1
" Fugitive Shortcuts
"""""""""""""""""""""""""""""""""""""
nmap <silent> <leader>gs :Gstatus<cr>
nmap <leader>ge :Gedit<cr>
nmap <silent><leader>gr :Gread<cr>
nmap <silent><leader>gb :Gblame<cr>
nmap <leader>m :MarkedOpen!<cr>
nmap <leader>mq :MarkedQuit<cr>
nmap <leader>* *<c-o>:%s///gn<cr>
"=======================Configuration for NERDTree============{{
"
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', '#141e23')
call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#141e23')
call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#141e23')
call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#141e23')
call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#141e23')
call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#141e23')
call NERDTreeHighlightFile('js', 'yellow', 'none', '#f0da50', '#141e23')
call NERDTreeHighlightFile('ts', 'Blue', 'none', '#6699cc', '#141e23')
call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#141e23')
call NERDTreeHighlightFile('ds_store', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('gitconfig', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('gitignore', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('bashrc', 'Gray', 'none', '#686868', '#141e23')
call NERDTreeHighlightFile('bashprofile', 'Gray', 'none', '#686868', '#141e23')
"Toogle NERDTree
nmap <silent> <leader>k :NERDTreeToggle<cr>
"Expand to the path of the file in the current buffer
nmap <silent> <leader>j :NERDTreeFind<cr>
"Start NERDTree om startup of nvim or vim
"autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
"============================================================}}
function! GetColorFromHighlightGroup(group, color, env)
return synIDattr(synIDtrans(hlID(a:group)), a:color, a:env)
endfunction
function! GetBackgroundColors(group)
return
\ ' ctermbg=' . GetColorFromHighlightGroup(a:group, 'bg', 'cterm') .
\ ' guibg=' . GetColorFromHighlightGroup(a:group, 'bg', 'gui')
endfunction
function! GetFrontgroundColors(group)
return
\ ' ctermfg=' . GetColorFromHighlightGroup(a:group, 'fg', 'cterm') .
\ ' guifg=' . GetColorFromHighlightGroup(a:group, 'fg', 'gui')
endfunction
function! NeoMakeDefaults()
let l:sign_bg = GetBackgroundColors('SignColumn')
let l:error_sign_fg = GetFrontgroundColors('ErrorMsg')
let l:warning_sign_fg = GetFrontgroundColors('Todo')
let l:information_sign_fg = GetFrontgroundColors('Question')
let l:default_sign_fg = GetFrontgroundColors('ModeMsg')
execute 'highlight NeomakeErrorDefault' . l:error_sign_fg . l:sign_bg
execute 'highlight NeomakeWarningDefault' . l:warning_sign_fg . l:sign_bg
execute 'highlight NeomakeInformationalDefault' . l:information_sign_fg . l:sign_bg
"execute 'highlight NeomakeMessageDefault' . l:default_sign_fg . l:sign_bg
endfunction
call NeoMakeDefaults()
let g:neomake_error_sign = { 'text': "\uF057", 'texthl': 'NeomakeErrorDefault' }
let g:neomake_warning_sign = { 'text': "\uF056", 'texthl': 'NeomakeWarningDefault' }
let g:neomake_informational_sign = { 'text': "\uF05A", 'texthl': 'NeomakeInformationDefault' }
"let g:neomake_message_sign = { 'text': "\uF09A", 'texthl': 'NeomakeMessageDefault' }
let g:neomake_javascript_enabled_mmakers=['jscs','jshint']
let g:neomake_javascript_jshint_maker = {
\ 'args': ['--verbose'],
\ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
\ }
let g:neomake_typescript_tsc_maker = {
\ 'args': ['-m', 'commonjs', '--noEmit' ],
\ 'append_file': 0,
\ 'errorformat':
\ '%E%f %#(%l\,%c): error %m,' .
\ '%E%f %#(%l\,%c): %m,' .
\ '%Eerror %m,' .
\ '%C%\s%\+%m'
\ }
"" don't hide quotes in json files
let g:vim_json_syntax_conceal = 0
let g:SuperTabCrMapping = 0
" }}}
" vim:foldmethod=marker:foldlevel=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment