Skip to content

Instantly share code, notes, and snippets.

Last active Sep 29, 2020
What would you like to do?
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
" Plugins here
call plug#begin('~/.vim/plugged')
Plug 'w0rp/ale'
Plug 'keith/swift.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Plug 'morhetz/gruvbox'
Plug 'tpope/vim-fugitive'
Plug 'kien/ctrlp.vim'
Plug 'terryma/vim-multiple-cursors'
" Plug 'Rip-Rip/clang_complete'
Plug 'rakr/vim-one'
Plug 'eagletmt/ghcmod-vim'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'morhetz/gruvbox'
" formatting
Plug 'jelera/vim-javascript-syntax'
" Plug 'pangloss/vim-javascript' " messes up jsx indenting
Plug 'maxmellon/vim-jsx-pretty' " indents correctly
" Plug 'mxw/vim-jsx' " messes up jsx inndenting
Plug 'flowtype/vim-flow'
call plug#end()
" Objective C
" Disable auto completion, always <c-x> <c-o> to complete
" let g:clang_complete_auto = 0
" let g:clang_use_library = 1
" let g:clang_periodic_quickfix = 0
" let g:clang_close_preview = 1
" For Objective-C, this needs to be active, otherwise multi-parameter methods won't be completed correctly
" let g:clang_snippets = 1
" This might change depending on your installation
let g:clang_exec = '/Applications/'
let g:clang_library_path = '/Library/Developer/CommandLineTools/usr/lib'
" Linting
let g:javascript_plugin_flow = 1
let g:jsx_ext_required = 0
" let g:syntastic_swift_checkers = ['swiftpm', 'swiftlint']
" Asynchronous Linting Engine
let g:ale_javascript_eslint_use_global = 0
let g:ale_lint_on_text_changed = 'always'
let g:ale_sign_column_always = 1
let g:ale_sign_error = ''
let g:ale_sign_warning = ''
let g:ale_statusline_format = ['✗ %d', '⚠ %d', '✓ ok']
highlight ALEErrorSign ctermbg=NONE ctermfg=52
highlight ALEWarningSign ctermfg=yellow
let g:ale_linters = {'js': ['eslint', 'flow'], 'jsx': ['eslint', 'flow'], 'svelte': ['eslint', 'flow']}
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_pattern_options_enabled = 1
" eslint
let g:eslint_configs = ['.eslintrc']
" flow
let g:flow#enable = 1
let g:flow_configs= ['.flowconfig']
let g:flow#showquickfix = 0
let g:flow#autoclose = 1
" ctrlp
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|android'
" enable to start search in current directory:
let g:ctrlp_working_path_mode = 0
" fzf fuzzy-finder in vim
set rtp+=/usr/local/opt/fzf
set runtimepath^=~/.vim/fzf.vim
" ctags
set autochdir
set tags=tags;/
" make things pretty
syntax enable
syntax on
set number
" set relativenumber
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoindent
set textwidth=80
set smartindent
set mouse=a
set ttymouse=sgr " make clicking work properly
set scrolloff=999
set splitbelow
set splitright
set textwidth=180
filetype indent on
filetype plugin indent on
" colors
" colorscheme gruvbox
" set background:light
" if (has("termguicolors"))
" set termguicolors
" endif
" if (has("nvim"))
" endif
" if (has("termguicolors"))
" set termguicolors
" endif
" vim-airline statusbar
" let g:airline_theme='gruvbox'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
set t_Co=256
set laststatus=2
set ttimeoutlen=50
"highlight current cursorline number
" set cursorline
"highlight current cursorline
" hi CursorLine cterm=NONE ctermbg=grey ctermfg=grey guibg=grey guifg=grey
" hi clear CursorLine
"hi CursorLine gui=underline cterm=underline
augroup CursorLine
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline
augroup END
"change cursor shape for different modes
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" make sure indenting works properly with keywords like elsif/end
" set runtimepath^=~/.vim/bundle/vim-endwise/plugin/endwise.vim
" set runtimepath^=~/.vim/bundle/undotree/plugin/undotree.vim
" Use Mac OS X's clipboard for copy/pasting
set clipboard=unnamed
" backspace from anywhere
set backspace=2
" make lowercase searches case insensitive, but keep searches with capitals case sensitive
set smartcase
" Press <leader> Enter to remove search highlights
noremap <silent> <leader><cr> :noh<cr>
" make gitgutter update faster
set updatetime=250
" Run checktime in buffers, but avoiding the Command Line (q:) window
au CursorHold * if getcmdwintype() == '' | checktime | endif
" swap files (.swp) in a common location
" // means use the file's full path
set swapfile
set dir=~/_swap
" backup files (~) in a common location if possible
set backup
set backupdir=$HOME/.vim/_backup/,~/tmp,.
" turn on undo files, put them in a common location
set undofile
set undodir=$HOME/.vim/_undo/
" autoclosing
let delimitMate_expand_cr = 2
let delimitMate_expand_space = 1
" navigate between splits more easily (ctrl+HJKL)
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
nnoremap <silent> <Leader>= :exe "vertical resize +5"<CR>
nnoremap <silent> <Leader>- :exe "vertical resize -5"<CR>
" disable arrow navigation
" set noesckeys
" inoremap <buffer> <up> <nop>
" inoremap <buffer> <down> <nop>
" inoremap <buffer> <left> <nop>
" inoremap <buffer> <right> <nop>
" nnoremap <buffer> <up> <nop>
" nnoremap <buffer> <down> <nop>
" nnoremap <buffer> <left> <nop>
" nnoremap <buffer> <right> <nop>
" quit current split
" nnoremap <C-Q> <C-W><C-Q>
" FZF shortcuts
" Open files in current window
nnoremap <silent> <Leader><Leader> :call fzf#run({'sink': 'e'})<CR>
" Open files in new horizontal split
nnoremap <silent> <Leader>s :call fzf#run({
\ 'down': '40%',
\ 'sink': 'split' })<CR>
" Open files in new vertical horizontal split
nnoremap <silent> <Leader>v :call fzf#run({
\ 'right': winwidth('.') / 2,
\ 'sink': 'vertical split' })<CR>
" automatically remove trailing whitespace on save
" autocmd BufWritePre * %s/\s\+$//e
" source .vimrc
command! SO source ~/.vimrc
" shortcut for Undotree
command! UN UndotreeToggle
let g:easytags_syntax_keyword = 'always'
let g:indent_guides_guide_size=1
set nrformats=octal,hex,alpha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment