Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save curtiswilkinson/99a156218cbd95fabca71fca7314c59e to your computer and use it in GitHub Desktop.
Save curtiswilkinson/99a156218cbd95fabca71fca7314c59e to your computer and use it in GitHub Desktop.
lol
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" ------------------------------------
" Theme
" ------------------------------------
set termguicolors
" My Bundles
Plugin 'editorconfig/editorconfig-vim'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/syntastic'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-vinegar.git'
Plugin 'sheerun/vim-polyglot'
Plugin 'tpope/vim-commentary' " A simple comment toggle plugin
Plugin 'rking/ag.vim'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'tpope/vim-obsession'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'vim-airline/vim-airline'
Plugin 'takac/vim-hardtime'
" Elm
Plugin 'elmcast/elm-vim'
let g:ycm_semantic_triggers = {
\ 'elm' : ['.'],
\}
let g:polyglot_disabled = ['elm']
let g:elm_detailed_complete = 1
let g:elm_format_autosave = 1
let g:elm_syntastic_show_warnings = 1
" Typescript
Plugin 'Shougo/vimproc.vim' " Needed by Quramy/tsuquyomi and other plugins
Plugin 'Quramy/tsuquyomi'
Plugin 'ianks/vim-tsx'
"Themes
Plugin 'arcticicestudio/nord-vim'
" Required by Vundle
call vundle#end()
colorscheme nord
let g:bufferline_echo = 0
" ------------------------------------
" Vim Defaults - https://github.com/vim/vim/blob/master/runtime/defaults.vim
" ------------------------------------
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Allow backspacing over everything in insert mode.
set backspace=indent,eol,start
set history=200 " keep 200 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set wildmenu " display completion matches in a status line
set ttimeout " time out for key codes
set ttimeoutlen=100 " wait up to 100ms after Esc for special key
" Show @@@ in the last line if it is truncated.
" set display=truncate
" Show a few lines of context around the cursor. Note that this makes the
" text scroll if you mouse-click near the start or end of the window.
set scrolloff=5
" Do incremental searching when it's possible to timeout.
if has('reltime')
set incsearch
endif
" Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
" confusing.
set nrformats-=octal
" Don't use Ex mode, use Q for formatting.
" Revert with ":unmap Q".
map Q gq
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
" so that you can undo CTRL-U after inserting a line break.
" Revert with ":iunmap <C-U>".
inoremap <C-U> <C-G>u<C-U>
" In many terminal emulators the mouse works just fine. By enabling it you
" can position the cursor, Visually select and scroll with the mouse.
" if has('mouse')
" set mouse=a
" endif
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
" Revert with: ":delcommand DiffOrig".
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | wincmd p | diffthis
endif
" ------------------------------------
" Sensible Vim Settings
" ------------------------------------
set complete-=i " Limit the files searched for auto-completes.
set lazyredraw " Don’t update screen during macro and script execution.
set hlsearch
set clipboard=unnamed
set encoding=utf-8
" ------------------------------------
" Indention Options
" ------------------------------------
set autoindent
filetype plugin indent on " Enable indentation rules that are file-type specific.
filetype plugin on
" ------------------------------------
" User Interface Options
" ------------------------------------
set cursorline
set title " Set the window’s title, reflecting the file currently being edited
set laststatus=2 " Always display the status bar.
set number
set norelativenumber
" autocmd InsertEnter * :set norelativenumber
" autocmd InsertLeave * :set relativenumber
" ------------------------------------
" Code Folding Options
" ------------------------------------
" zc (close), zo (open), za (toggle) fold under cursor for one level
" zC (close), zO (open), zA (toggle) fold under cursor for all levels
" zr (opens), zm (closes) globally one level of folds
" zR (opens), zM (closes) globally all folds
" zv (opens) line under cursor
" zMzO Hide all folds except for fold under cursor
set foldmethod=syntax " Fold based on syntax config.
set foldlevelstart=20
" ------------------------------------
" Text Rendering Options
" ------------------------------------
set tabstop=2
set nowrap
set sidescrolloff=5 " The number of screen columns to keep to the left and right of the cursor.
" ------------------------------------
" Custom Settings
" ------------------------------------
let mapleader = "\<Space>"
set path=$PWD/**
set autoread
" ------------------------------------
" Key Bindings
" ------------------------------------
imap jj <esc>
imap jk <esc>
imap kj <esc>
" Clear search by pressing esc
nnoremap <silent> <esc> :nohl<cr><esc>
" Easier navigation
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>
" ------------------------------------
" Netrw
" ------------------------------------
" F1 help
" D delete
" R rename
" s sort
" x special
" vinegar.vim
" - Go up a directory or open Netrw
" I to toggle header
" gh toggle dot files
" . prepopulate : command
" cg or cl :cd or :lcd to the current director
" ~ Go home
if executable('trash')
let g:netrw_localrmdir='trash'
endif
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+' " Hide dot files by default
" ------------------------------------
" Syntastic
" ------------------------------------
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_loc_list_height = 3
let g:syntastic_json_checkers = ['jsonlint']
let g:syntastic_typescript_checkers = ['tslint', 'tsuquyomi']
let g:syntastic_javascript_checkers = []
let g:syntastic_html_tidy_exec = 'tidy5'
let g:elm_format_autosave = 1
let g:elm_syntastic_show_warnings = 1
" ------------------------------------
" Tsuquyomi
" ------------------------------------
autocmd FileType typescript setlocal completeopt+=menu,preview
autocmd FileType typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>
let g:tsuquyomi_disable_quickfix = 1
" ------------------------------------
" UltiSnips
" ------------------------------------
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" ------------------------------------
" Ag searching
" ------------------------------------
" Ag is a faster alternative to grep
" We can use it to speed up ctrlp and searching
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
" Grep for the work under the cursor
nnoremap <leader>\\ :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" bind \ (backward slash) to grep shortcut
command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag!<SPACE>
endif
" ------------------------------------
" Hardtime
" ------------------------------------
let g:hardtime_default_on = 0
" ------------------------------------
" Easy Motion
" ------------------------------------
map <Leader> <Plug>(easymotion-prefix)
nmap <Leader>w <Plug>(easymotion-overwin-w)
syntax on
" ------------------------------------
" You Complete Me
" ------------------------------------
if !exists("g:ycm_semantic_triggers")
let g:ycm_semantic_triggers = {}
endif
let g:ycm_semantic_triggers['typescript'] = ['.']
let g:ycm_key_list_select_completion = ['<TAB>']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment