Skip to content

Instantly share code, notes, and snippets.

@badosu
Created June 19, 2019 22:48
Show Gist options
  • Save badosu/d41fb52530f872edcff4fa922188626a to your computer and use it in GitHub Desktop.
Save badosu/d41fb52530f872edcff4fa922188626a to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
set number
set noswapfile
"time waited for key press(es) to complete. It makes for a faster key response
set ttimeout
set ttimeoutlen=50
set ignorecase " search ignores case
set smartcase " unless contains capitalized chars
set autoread " automatically read changes in the file
set nowrap
"set colorcolumn=101
set formatoptions-=cro " disable automatic comments on newline
set splitbelow
set splitright
set autoindent
" Better display for messages
set hidden
set cmdheight=2
" Smaller updatetime for CursorHold & CursorHoldI
set updatetime=200
" don't give |ins-completion-menu| messages.
set shortmess+=c
" Enable GUI mouse behavior
set mouse=a
set list
set listchars=trail:·
set diffopt+=vertical
set sw=2
set ts=2
set softtabstop=2
set expandtab
"
let mapleader = ","
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-dispatch'
Plug 'radenling/vim-dispatch-neovim'
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'rhysd/git-messenger.vim'
Plug 'junegunn/fzf.vim'
Plug 'liuchengxu/eleline.vim'
Plug 'neoclide/coc.nvim', {'tag': '*', 'do': './install.sh'}
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
Plug 'joshdick/onedark.vim'
Plug 'm00qek/nvim-contabs'
call plug#end()
let g:netrw_banner=0
let g:netrw_altv=1
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
let g:netrw_liststyle = 3
"let g:netrw_browse_split = 3
let g:netrw_winsize = 20
let g:gitgutter_sign_added = '┃'
let g:gitgutter_sign_modified = '┃'
let g:gitgutter_sign_removed = '━'
let g:gitgutter_sign_modified_removed = '╋━'
let g:gitgutter_sign_removed_first_line = '^'
let g:eleline_powerline_fonts = 1
let test#ruby#rspec#executable = 'bin/rspec'
" fzf {{{
" Similarly, we can apply it to fzf#vim#grep. To use ripgrep instead of ag:
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --no-heading --pretty --smart-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
copen
cc
endfunction
let g:fzf_action = {
\ 'ctrl-q': function('s:build_quickfix_list'),
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all'
nnoremap <leader>f :GFiles<CR>
nnoremap <leader>g :Rg!<CR>
" }}}
"
" git-messenger {{{
let g:git_messenger_no_default_mappings=v:true
nmap <Leader>m <Plug>(git-messenger)
" }}}
" coc {{{
function! s:show_documentation()
if &filetype == 'vim'
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
nmap <leader>qf <Plug>(coc-fix-current)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gd <Plug>(coc-definition)
nnoremap <silent> K :call <SID>show_documentation()<CR>
nnoremap <leader>v :call CocAction('format')<CR>
"au BufWrite * call CocAction('format')
" }}}
"
nnoremap <C-h> :tabprevious<CR>
nnoremap <C-l> :tabnext<CR>
nnoremap <leader>s :Gstatus <CR>
nnoremap <leader>h :Ggrep
nnoremap <leader>t :belowright<Space>split<Space><bar><Space>resize<Space>10<Space><bar><Space>terminal<CR>ivmux<CR>
nnoremap <leader>T :belowright<Space>split<Space><bar><Space>resize<Space>10<Space><bar><Space>terminal<CR>i
"
tnoremap <Esc> <C-\><C-N>:q<CR>
" "
" Move between splits
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
inoremap <A-h> <C-\><C-N><C-w>h
inoremap <A-j> <C-\><C-N><C-w>j
inoremap <A-k> <C-\><C-N><C-w>k
inoremap <A-l> <C-\><C-N><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
" Move between tabs
tnoremap <A-h> <C-\><C-N>gT
tnoremap <A-l> <C-\><C-N>gt
inoremap <S-A-h> <C-\><C-N>gT
inoremap <S-A-l> <C-\><C-N>gt
nnoremap <S-A-h> gT
nnoremap <S-A-l> gt
let g:onedark_terminal_italics=1
colorscheme onedark
highlight ColorColumn guibg=Grey
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%101v.\+/
" typescript higlight {{{
hi tsxTagName guifg=#E06C75
hi tsxCloseString guifg=#F99575
hi tsxCloseTag guifg=#F99575
hi tsxAttributeBraces guifg=#F99575
hi tsxEqual guifg=#F99575
hi tsxAttrib guifg=#F8BD7F cterm=italic
hi ReactState guifg=#C176A7
hi ReactProps guifg=#D19A66
hi Events ctermfg=204 guifg=#56B6C2
hi ReduxKeywords ctermfg=204 guifg=#C678DD
hi WebBrowser ctermfg=204 guifg=#56B6C2
hi ReactLifeCycleMethods ctermfg=204 guifg=#D19A66
" }}}
" gitgutter {{{
nmap <Leader>ha <Plug>GitGutterStageHunk
nmap <Leader>hr <Plug>GitGutterUndoHunk
nmap ]h <Plug>GitGutterNextHunk
nmap [h <Plug>GitGutterPrevHunk
" }}}
" contabs {{{
let g:contabs#project#locations = [
\ { 'path': '~/Code', 'depth': 1 },
\]
nnoremap <silent> <Leader>p :call contabs#project#select()<CR>
" }}}
set guifont=FantasqueSansMono\ Nerd\ Font:h15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment