Skip to content

Instantly share code, notes, and snippets.

@sidd
Created December 12, 2017 20:16
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 sidd/0889411ca7d8950d91607fda3b87882a to your computer and use it in GitHub Desktop.
Save sidd/0889411ca7d8950d91607fda3b87882a to your computer and use it in GitHub Desktop.
call plug#begin()
" JavaScript
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'ternjs/tern_for_vim'
Plug 'Galooshi/vim-import-js'
" Lint
Plug 'w0rp/ale'
" Appearance
Plug 'vim-airline/vim-airline'
Plug 'morhetz/gruvbox'
" Navigation
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'sidd/fzf.vim' " jsctags compatible fork
" Completion
Plug 'Valloric/YouCompleteMe'
" Ctags
Plug 'ludovicchabant/vim-gutentags'
" Git
Plug 'tpope/vim-fugitive'
" Misc
Plug 'tpope/vim-surround'
call plug#end()
" Split opinions
set splitbelow " horizontal splits spawn on bottom
set splitright " vertical splits spawn on right
" Mapping opinions
let mapleader="\<Space>"
" Appearance
set number " line numbers (inverse is nonumber)
set cursorline " highlight all columns on current line
" Tab behavior
set expandtab " indent with spaces instead of <Tab>
set tabstop=2 " 1 <Tab> === 2 spaces
set shiftwidth=2 " >> and << command === 2 spaces
" Search behavior
set ic " case insensitive search
set background=dark
" Plumbing
set timeoutlen=1000 ttimeoutlen=0 " remove Esc delay
set t_Co=256 " reddit says this is not enough for 256 colors?
set backupcopy=yes " ???
colorscheme gruvbox
" vim-test bindings
" nmap <silent> <leader>t :TestNearest<CR>
" nmap <silent> <leader>T :TestFile<CR>
" nmap <silent> <leader>a :TestSuite<CR>
" nmap <silent> <leader>l :TestLast<CR>
" nmap <silent> <leader>g :TestVisit<CR>
" vim-test settings
" let test#strategy="vimux"
" Mappings
" fzf.vim mappings
noremap <C-p> :GFiles<cr>
" Omnicompletion mappings
inoremap <silent><expr><Tab> pumvisible() ? "\<C-n>" : "\<tab>"
" Alt file mappings.
" NOTE: namespace under <Leader>c
nnoremap <leader>ct :call OpenTest()<cr>
nnoremap <leader>cc :call OpenCss()<cr>
" Quickly visit this file
nnoremap <leader>v :vs ~/.config/nvim/init.vim<cr>
" set linespace=0 " ???
" vim-airline settings
let g:airline#extensions#tabline#enabled=2
let g:airline#extensions#tabline#fnamemod=':t'
let g:airline#extensions#tabline#left_sep=''
let g:airline#extensions#tabline#right_sep=''
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_theme= 'gruvbox'
" tern settings
let g:tern_show_signature_in_pum='0' " This do disable full signature type on autocomplete
let g:tern#command=["tern"]
let g:tern#arguments=["--persistent"]
let g:tern#filetypes=['jsx', 'javascript.jsx', 'vue']
" Close documentation window on autocompletion dismissal
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
" Only show cursorline in active buffer
augroup CursorLineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
" Open file's Jest test
function! OpenTest()
execute ":vsplit" expand('%:p:h') . '/__tests__/' . expand('%:t:r') . '.test.' . expand('%:e')
endfunction
" Open file's stylesheet
function! OpenCss()
execute ":vsplit" expand('%:p:h') . '/' . expand('%:t:r') . '.css'
endfunction
" vim-gutentags settings
let g:gutentags_ctags_exclude=['node_modules']
let g:gutentags_ctags_executable="/Users/sidd/jsctags.js"
let g:gutentags_define_advanced_commands=1
" Disable fzf generating ctags; gutentags handles this
let g:fzf_tags_command=''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment