Skip to content

Instantly share code, notes, and snippets.

@termosa
Last active July 3, 2019 09:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save termosa/ba60eb29500a0d3f543b to your computer and use it in GitHub Desktop.
Save termosa/ba60eb29500a0d3f543b to your computer and use it in GitHub Desktop.
" Before using this configuration follow the instruction below
"
" Check the requirements for plugins:
" * highlight (brew) required for preview FZF
" * livedown (npm) required for vim-livedown
" * standard (npm) required for syntastic check of javascript
" * tslint (npm) required for syntastic check of typescript
" * typescript (npm) required for Quramy/tsuquyomi
"
" Create folders for storing temporary files
" $ mkdir ~/.vim/backup && mkdir ~/.vim/tmp
"
" Download Vim-Plug:
" $ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
" Install Vim plugins with the command:
" :PlugInstall
"
" Install Go lang tools
" :GoInstallBinaries
"
call plug#begin('~/.vim/plugged')
" Improvements
Plug 'ConradIrwin/vim-bracketed-paste' " Normalize text pasted with OS hotkeys
" TODO: When Git opens Vim UltiSnips failing
"Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " Generating code with snippets
Plug 'itchyny/lightline.vim' | Plug 'yarisgutierrez/ayu-lightline', { 'dir': 'plugged/lightline.vim/plugin/ayu-colorscheme' } " Sexy status bar
Plug 'mhinz/vim-startify' " Fancy start screen
Plug 'scrooloose/nerdcommenter' " Fast commenting
Plug 'tmhedberg/matchit' " Jump to the end or beginning of xml tag
Plug 'tpope/vim-repeat' | Plug 'tpope/vim-surround' " Commands for modifying surround quotes, brackets and etc
Plug 'gcmt/taboo.vim' " Rename tabs
Plug 'mattn/emmet-vim' " Emmet support
" Themes
Plug 'morhetz/gruvbox'
Plug 'ayu-theme/ayu-vim'
" Syntax & Highlight
Plug 'aklt/plantuml-syntax' " Syntax for Plantuml
Plug 'dart-lang/dart-vim-plugin' " Syntax for Dart
Plug 'digitaltoad/vim-pug' " Syntax for Pug
Plug 'ekalinin/Dockerfile.vim' " Syntax for Dockerfile
Plug 'gabrielelana/vim-markdown' " Syntax for Markdown
Plug 'jelera/vim-javascript-syntax' " Javascript syntax highlighting
Plug 'junegunn/goyo.vim' " Distraction free editing
Plug 'junegunn/limelight.vim' " Focus on paragraph under cursor
Plug 'leafgarland/typescript-vim' " TypeScript syntax
Plug 'markcornick/vim-vagrant' " Vafrantfile syntax
Plug 'nathanaelkane/vim-indent-guides' " Tabs highlighting
Plug 'nikvdp/ejs-syntax' " Support for EJS syntax
Plug 'pangloss/vim-javascript' " Better indentation (jason0x43/vim-js-indent doesn't work with semi-less syntax)
Plug 'posva/vim-vue' " Syntax for VueJS
Plug 'scrooloose/syntastic' " Check syntax with linters (for example: eslint)
Plug 'stephenway/postcss.vim' " Syntax for PostCSS
Plug 'stephpy/vim-yaml' " Yaml syntax
Plug 'timakro/vim-searchant' " Highlight search match under cursor
Plug 'tomlion/vim-solidity' " Support of Solidity syntax
" Language & Framework Tools
"Plug 'Quramy/tsuquyomi' " TypeScript client
Plug 'fatih/vim-go' " Support for Go lang
Plug 'reisub0/hot-reload.vim' " Flutter hot reload
" External Tools
Plug 'Shougo/vimproc.vim', {'do' : 'make'} | Plug 'Shougo/vimshell.vim' " Shell in Vim editor
Plug 'airblade/vim-gitgutter' " Inline Git information
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " Dependency of fzf.vim
Plug 'junegunn/fzf.vim' " Searching through files
Plug 'scrooloose/vim-slumlord' " Write UML's and render them
Plug 'tpope/vim-fugitive' " Working with Git
Plug 'shime/vim-livedown' " Markdown previewer
Plug 'rizzatti/dash.vim' " :Dash search
" Tools
"Plug 'Valloric/YouCompleteMe', {'do' : './install.sh --clang-completer --system-libclang --omnisharp-completer'} " Powerfull autocompletion
Plug 'dhruvasagar/vim-table-mode' " Managing ASCII tables
Plug 'easymotion/vim-easymotion' " Improved motions
Plug 'gagoar/StripWhiteSpaces' " Strips whitespaces buy running :StripWhiteSpaces
Plug 'gavinbeatty/dragvisuals.vim' " Drag and duplicate visual blocks
Plug 'xolox/vim-misc' | Plug 'xolox/vim-notes' " Fancy notes via Vim
" Plugins
Plug 'editorconfig/editorconfig-vim' " Support editorconfig.org
call plug#end()
" Hack to fix reloading .vimrc
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost $MYVIMRC nested source $MYVIMRC
augroup END " }
" Enable using local .vimrc files
set exrc
set secure " disable using dangerous commands in local .vimrc files
" Custom directories
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
" Enable pretty colorscheme
syntax enable
set termguicolors " enable true colors support
set background=dark
colorscheme ayu
" Patch ayu colorscheme for transparency
hi Normal guibg=none
hi TabLine guibg=#BBBBBB guifg=#666666
hi TabLineFill guifg=#666666
hi TabLineSel guibg=#DDDDDD guifg=#484848
hi CursorLine guibg=#484848
hi CursorColumn guibg=#484848
hi LineNr guibg=none guifg=#AAAAAA
hi CursorLineNr guibg=#484848 guifg=#FFFFFF
hi Cursor guibg=#000000 guifg=#FFFFFF
hi lCursor guibg=#000000 guifg=#FFFFFF
hi TermCursor guibg=#000000 guifg=#FFFFFF
hi Folded guifg=#AAAAAA guibg=none
hi FoldColumn guibg=none
hi Comment guifg=#AAAAAA
hi SignColumn guibg=none
hi Directory guifg=#5EACD3
hi StatusLine guibg=#666666 guifg=#FFFFFF
" Map Leader key
let mapleader=","
" Improve vim file completion
set path+=**
set wildmenu
" Trigger autocomplete when enter dot (.)
if !exists("g:ycm_semantic_triggers")
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers['typescript'] = ['.']
"let g:ycm_server_python_interpreter="/usr/local/bin/python2"
" Display whitespaces
set list
exec "set listchars=tab:\u2023\uB7,trail:\uB0,nbsp:\uB0"
" Print typed command
set showcmd
"# Setup UltiSnips
let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', 'UltiSnips']
let g:UltiSnipsExpandTrigger="<C-j>"
let g:UltiSnipsJumpForwardTrigger="<C-f>"
let g:UltiSnipsJumpBackwardTrigger="<C-d>"
"# Managing windows and tabs
" Close window with Alt-w
nnoremap <A-w> :q<CR>
" Split window with Alt-s
nnoremap <A-s> :split<CR>
" Split window vertically with Alt-d
nnoremap <A-d> :vsplit<CR>
" Horizontal split add new window to below
set splitbelow
" Vertical split add new window to right
set splitright
" Resize windows with Alt-{h,j,k,l}
nnoremap <A-h> :vertical resize +1<CR>
nnoremap <A-j> :resize -1<CR>
nnoremap <A-k> :resize +1<CR>
nnoremap <A-l> :vertical resize -1<CR>
" Navigation through panes with Ctrl-{h,j,k,l}
nnoremap <C-h> <C-w>h " Left pane
nnoremap <C-j> <C-w>j " Down pane
nnoremap <C-k> <C-w>k " Up pane
nnoremap <C-l> <C-w>l " Right pane
" Navigation through tabs
nnoremap th :tabprev<CR>
nnoremap tl :tabnext<CR>
nnoremap tn :tabnew<CR>
nnoremap td :tabclose<CR>
nnoremap tm :tabmove
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]
execute 'nnoremap t' . i . ' ' . i . 'gt'
endfor
" File browsing
" :help netrw-browse-maps
set modifiable
autocmd FileType netrw nmap <silent> <buffer> <C><CR> :bd<CR>
let g:netrw_banner=0 " disable annoying banner
"let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=1 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^|\s\s\)\zs\.\S\+'
nnoremap tx :Texplore<CR>:TabooRename Explore<CR>
nnoremap zx :Explore<CR>:TabooRename Explore<CR>
" do not let to map "t" so it can be used for tab navigation
augroup netrw_mapping
autocmd!
autocmd filetype netrw call NetrwMapping()
augroup END
function! NetrwMapping()
nunmap <buffer> t
endfunction
" Folding
set foldmethod=indent
set foldnestmax=9
set foldlevel=99
" Show line numbers
set relativenumber
set number
" Prevent poll when opening a file with existing swap
augroup NoSimultaneousEdits
let ErrorMsg = 'Duplicate edit session (readonly)'
autocmd!
autocmd SwapExists * let v:swapchoice = 'o'
"autocmd SwapExists * echoerr ErrorMsg
autocmd SwapExists * echomsg ErrorMsg
autocmd SwapExists * echo ErrorMsg
autocmd SwapExists * echohl None
augroup END
" Padding settings
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smarttab
set expandtab
set smartindent
set autoindent
set pastetoggle=<f5> " to stop indenting when pasting from GUI
set linebreak
set showbreak=··>
set nowrap
" Search settings
set incsearch
set hlsearch
" Screen follows cursor
set scrolloff=12
" Highlight cursor position
set cursorline
set cursorcolumn
" Expand history
set history=200
" Add options to build tags file
command! MTags !ctags -R .
"# Setup Lightline (itchyny/lightline.vim)
set laststatus=2
set noshowmode
let g:lightline = {
\ 'colorscheme': 'ayu',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"☓":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"∗":&modifiable?"":"ø"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ }
\ }
if !has('gui_running')
set t_Co=256
endif
"# Setup Syntatic (scrooloose/syntastic)
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
function! s:syntastic()
SyntasticCheck
call lightline#update()
endfunction
" Configure behavior
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
let g:syntastic_echo_current_error = 1 " Show error message in the command line when cursor hovers on the error
let g:syntastic_enable_signs = 1 " Show errors on the side
let g:syntastic_error_symbol = "#" " For syntax errors, defaults to '>>'
let g:syntastic_warning_symbol = "*" " For syntax warnings, defaults to '>>'
let g:syntastic_style_error_symbol = ">" " For style errors, defaults to 'S>'
let g:syntastic_style_warning_symbol = "-" " For style warnings, defaults to 'S>'
let g:syntastic_enable_balloons = 0 " Turn off tooltips
let g:syntastic_auto_loc_list = 2 " Close list automatically
let g:syntastic_loc_list_height = 5
" Setup linters
let g:syntastic_javascript_checkers = ['standard']
let g:syntastic_typescript_checkers = ['tslint']
let g:syntastic_html_checkers = ['tidy']
let g:syntastic_dart_checkers = []
" Setup bindings
nnoremap tj :lnext<CR> " Go to next error
nnoremap tk :lprevious<CR> " Go to previous error
" Toggle location list by Ctrl-e
function! ToggleErrors()
if empty(filter(tabpagebuflist(), 'getbufvar(v:val, "&buftype") is# "quickfix"'))
" No location/quickfix list shown, open syntastic error location panel
Errors
else
lclose
endif
endfunction
nnoremap <silent> <C-e> :<C-u>call ToggleErrors()<CR><Paste><C-w><C-j>
"# Setup DragVisuals (gavinbeatty/dragvisuals.vim)
vmap <expr> <LEFT> DVB_Drag('left')
vmap <expr> <RIGHT> DVB_Drag('right')
vmap <expr> <DOWN> DVB_Drag('down')
vmap <expr> <UP> DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
"# Setup FZF (junegunn/fzf.vim)
" plain files list in current directory
nnoremap <C-f>f :Files<CR>
" look through all system
nnoremap <C-f>l :Locate
" search inside of files
nnoremap <C-f><S-a> :Ag
" Ag with preview
nnoremap <C-f>a :call fzf#vim#ag('', fzf#vim#with_preview('right'))<CR>
" list of opened buffers
nnoremap <C-f>b :Buffers<CR>
nnoremap <C-f>m :Marks<CR>
" recent files
nnoremap <C-f>h :History<CR>
nnoremap <C-f>s :Snippets<CR>
nnoremap <C-f>t :Tags<CR>
nnoremap <C-f>C :Commits<CR>
nnoremap <C-f>c :Commands<CR>
nnoremap <C-f>e :BCommits<CR>
nnoremap <C-f><S-m> :Maps<CR>
nnoremap <C-f>? :Helptags<CR>
nnoremap <C-f><S-s> :Filetypes<CR>
" GitFiles with preview
nnoremap <C-f>g :call fzf#vim#gitfiles('--exclude-standard -cmo', fzf#vim#with_preview('right'))<CR>
" FZF with preview
let g:fzf_files_options =
\ "--preview 'highlight --force -qO ansi {}' --bind alt-n:preview-down,alt-m:preview-up"
"# Livedown
nnoremap lmd :LivedownToggle<CR>
"# Setup StripWhiteSpaces (gagoar/StripWhiteSpaces)
let g:loaded_StripWhiteSpaces = 1
"# Setup Goyo (junegunn/goyo.vim)
nnoremap zf :Goyo<CR>
let g:goyo_width = 80
" Goyo.vim integration with Limelight (got broken for now)
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
" Color name (:help cterm-colors) or ANSI code
let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240
" Color name (:help gui-colors) or RGB color
let g:limelight_conceal_guifg = 'DarkGray'
let g:limelight_conceal_guifg = '#777777'
"# Setup Go lang
"fix imports on save
let g:go_fmt_command = "goimports"
"linting on save
let g:go_metalinter_autosave = 0
"# Set runtime shell
"set shell=/usr/local/bin/zsh
"# Setup VimShell (Shougo/vimshell.vim)
nnoremap ts :VimShellTab<CR>
nnoremap tp :VimShellPop<CR>
let g:vimshell_prompt = "# "
"let g:vimshell_user_prompt = '"@>> " . fnamemodify(getcwd(), ":~")'
let g:vimshell_force_overwrite_statusline = 1
let g:vimshell_vimshrc_path = "expand('~/.vimshrc')"
"# NeoVim configuration
if has("nvim")
"let $NVIM_TUI_ENABLE_TRUE_COLOR=1 "not sure if it is needed, it breaks Limelight
" Python support
let g:python2_host_prog = '/usr/local/bin/python'
let g:python3_host_prog = '/usr/local/bin/python3'
nnoremap tt :tabnew term://zsh<CR>:setlocal nonumber<CR>:setlocal norelativenumber<CR>:startinsert<CR>
nnoremap tr :TabooRename
nnoremap ti :terminal<CR>:setlocal nonumber<CR>:setlocal norelativenumber<CR>:startinsert<CR>
tnoremap <Esc> <C-\><C-n>
" Navigation through panes with Alt {h,j,k,l}
tnoremap <A-h> <C-\><C-n><C-w>h
tnoremap <A-j> <C-\><C-n><C-w>j
tnoremap <A-k> <C-\><C-n><C-w>k
tnoremap <A-l> <C-\><C-n><C-w>l
endif
source ~/.vimrc
autocmd VimEnter * terminal
autocmd VimEnter * setlocal nonumber
autocmd VimEnter * setlocal norelativenumber
" Before using this configuration follow the instruction below
"
" Create folders for storing temporary files
" $ mkdir ~/.vim/backup && mkdir ~/.vim/tmp && mkdir ~/.vim/undo
"
" Download Vim-Plug:
" $ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
" Download Solarized colorscheme
" $ curl -fLo ~/.vim/colors/solarized.vim --create-dirs \
" https://raw.githubusercontent.com/altercation/vim-colors-solarized/master/colors/solarized.vim
"
" Install Vim plugins with the command:
" :PlugInstall
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-repeat' | Plug 'tpope/vim-surround' " Commands for modifying surround quotes, brackets and etc
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' " Generating code with snippets
Plug 'junegunn/vim-github-dashboard' " See activity on GH
Plug 'jelera/vim-javascript-syntax' " Javascript syntax
Plug 'nathanaelkane/vim-indent-guides' " Tabs highlighting
Plug 'scrooloose/syntastic' " Check syntax with linters (for example: npm i -g eslint)
Plug 'stephpy/vim-yaml' " Yaml syntax
Plug 'itchyny/lightline.vim' " Sexy status bar
Plug 'tpope/vim-fugitive' " Working with Git
Plug 'ConradIrwin/vim-bracketed-paste' " Normalize text pasted with OS hotkeys
Plug 'posva/vim-vue' " Syntax for VueJS
call plug#end()
" Hack to fix reloading .vimrc
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost $MYVIMRC nested source $MYVIMRC
augroup END " }
" Enable using local .vimrc files
set exrc
set secure " disable using dangerous commands in local .vimrc files
" Custom directories
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set undodir=~/.vim/undo
" Backups
set backup
set undofile
set undolevels=100
set undoreload=200
" Enable pretty colorscheme
syntax on
set background=dark
colorscheme solarized
syntax enable
au BufRead,BufNewFile *.es6 set filetype=javaScript
" Better navigation
map <C-h> <C-w>h " Left pane
map <C-j> <C-w>j " Down pane
map <C-k> <C-w>k " Up pane
map <C-l> <C-w>l " Right pane
nnoremap th :tabprev<CR>
nnoremap tl :tabnext<CR>
nnoremap tn :tabnew<CR>
nnoremap td :tabclose<CR>
nnoremap tm :tabmove
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]
execute 'nnoremap t' . i . ' ' . i . 'gt'
endfor
" Folding
set foldmethod=indent
set foldnestmax=5
highlight Folded cterm=none ctermbg=59 ctermfg=15 gui=none guibg=#3B3B3B guifg=#90AB41
" Show line numbers
set number
set relativenumber
" Padding settings
set tabstop=2
set shiftwidth=2
set softtabstop=2
set smarttab
set expandtab
set smartindent
set autoindent
set linebreak
set showbreak=+++\
" Search settings
set incsearch
set hlsearch
" Screen follows cursor
set scrolloff=3
" Expand history
set history=100
" Setup Lightline (itchyny/lightline.vim)
set laststatus=2
set noshowmode
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component': {
\ 'readonly': '%{&filetype=="help"?"":&readonly?"☓":""}',
\ 'modified': '%{&filetype=="help"?"":&modified?"∗":&modifiable?"":"ø"}',
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
\ },
\ 'component_visible_condition': {
\ 'readonly': '(&filetype!="help"&& &readonly)',
\ 'modified': '(&filetype!="help"&&(&modified||!&modifiable))',
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
\ }
\ }
if !has('gui_running')
set t_Co=256
endif
" Setup Syntatic (scrooloose/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
@allexcd
Copy link

allexcd commented Jun 21, 2017

I've added the default color scheme to plugins section. See this: https://gist.github.com/allexcd/80ee3ff511b0ee58e050031c015e3591/revisions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment