Create a gist now

Instantly share code, notes, and snippets.

@mooreniemi /.vimrc
Last active Feb 22, 2017

Embed
What would you like to do?
" http://superuser.com/questions/693528/vim-is-there-a-downside-to-using-space-as-your-leader-key
map <space> <leader>
map <space><space> <leader><leader>
set pastetoggle=<leader>p
imap ;; <Esc>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" movement mappings
" ----------------------------------------------------------------------------------
map <leader>t :tabNext<CR>
" simulates the Sublime text single line vertical movement
nnoremap <leader>. :m .+1<CR>==
nnoremap <leader>, :m .-2<CR>==
inoremap <leader>. <Esc>:m .+1<CR>==gi
inoremap <leader>, <Esc>:m .-2<CR>==gi
vnoremap <leader>. :m '>+1<CR>gv=gv
vnoremap <leader>, :m '<-2<CR>gv=gv
" https://robots.thoughtbot.com/vim-splits-move-faster-and-more-naturally
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>
" idk wtf????
" http://stackoverflow.com/questions/25158461/ignore-errors-and-warnings-for-a-vim-plugin
autocmd VimEnter * silent! exec "unmap <C-e>"
" emacs style beginning and end of line in insert mode
imap <C-e> <Esc>A
imap <C-a> <Esc>I
" for easily cycling through syntastic errors (or whatever) in location list
map <leader>ll :ll<CR>
map <leader>ccl :ccl<CR>
" " Close the current buffer and move to the previous one
" " This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>
" settings
" ----------------------------------------------------------------------------------
filetype plugin on
set omnifunc=syntaxcomplete#Complete
" let git handle this
set noswapfile
set so=4
set backupdir=./.backup,.,/tmp
set directory=.,./.backup,/tmp
set wildmenu
set wildmode=longest:full,full
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor,*/public/system/,*/tmp/*,*.so,*.swp,*.zip
set ruler
set number
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
" https://amix.dk/vim/vimrc.html
" Ignore case when searching
set ignorecase
" " When searching try to be smart about cases
set smartcase
" " Highlight search results
set hlsearch
" " Makes search act like search in modern browsers
set incsearch
set splitbelow
set splitright
" This allows buffers to be hidden if you've modified a buffer.
" " This is almost a must if you wish to use buffers in this way.
set hidden
" plugins via vim-plug https://github.com/junegunn/vim-plug
" ----------------------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" core helpful
Plug 'kien/ctrlp.vim'
Plug 'scrooloose/nerdtree'
" <leader><leader>= to see a sort of outline of the code
Plug 'majutsushi/tagbar'
Plug 'romainl/vim-qf'
" <Ctrl+N> on the cursor position, repeat to add next instance
Plug 'kristijanhusak/vim-multiple-cursors'
" :VimProcBang <shell command>
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
" unload all buffers but the current one
Plug 'vim-scripts/BufOnly.vim'
" ie. to exchange 2 lines, do cxx on first, then cxx on 2nd
Plug 'tommcdo/vim-exchange'
" useful for toggling low cardinality values
Plug 'AndrewRadev/switch.vim'
Plug 'regedarek/ZoomWin'
Plug 'easymotion/vim-easymotion'
" tim pope
" some settings defaults
Plug 'tpope/vim-sensible'
" great for switching quotes, deleting surrounding brackets, ie:
" ysiw] with cursor on hello will surround it with brackets to [hello]
Plug 'tpope/vim-surround'
" makes . work with plugins
Plug 'tpope/vim-repeat'
" mostly for ex commands. but [<Space> and ]<Space> add newlines above
" or below, and [e and ]e will exchange above and below lines
Plug 'tpope/vim-unimpaired'
" search
Plug 'rking/ag.vim'
Plug 'mileszs/ack.vim'
" git / version mgmt
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" ruby
Plug 'ck3g/vim-change-hash-syntax', { 'for': 'ruby' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'tonekk/vim-binding-pry', { 'for': 'ruby' }
Plug 'jgdavey/vim-blockle', { 'for': 'ruby' }
Plug 'slim-template/vim-slim', { 'for': 'slim' }
Plug 'tpope/vim-rails', { 'for': 'ruby' }
Plug 'thoughtbot/vim-rspec', { 'for': 'ruby' }
" formatting
Plug 'junegunn/vim-easy-align'
Plug 'Raimondi/delimitMate'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'ntpeters/vim-better-whitespace'
Plug 'Chiel92/vim-autoformat'
Plug 'KurtPreston/vim-autoformat-rails'
Plug 'vim-utils/vim-troll-stopper'
" syntax
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdcommenter'
Plug 'Chiel92/vim-autoformat'
" completion
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Plug 'ervandew/supertab'
Plug 'Valloric/YouCompleteMe'
" Plug 'Shougo/neocomplete.vim'
" look
Plug 'Sclarki/neonwave.vim'
Plug 'mhinz/vim-startify'
Plug 'bling/vim-airline'
Plug 'kien/rainbow_parentheses.vim'
"" misc
" runs compiling async http://tilvim.com/2014/03/13/dispatch.html
Plug 'tpope/vim-dispatch'
" javascript / web
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'claco/jasmine.vim', { 'for': 'javascript' }
Plug 'moll/vim-node', { 'for': 'javascript' }
Plug 'othree/javascript-libraries-syntax.vim', { 'for': 'javascript' }
Plug 'othree/html5.vim', { 'for': 'html' }
Plug 'othree/html5-syntax.vim', { 'for': 'html' }
Plug 'skammer/vim-css-color', { 'for': 'css' }
Plug 'hail2u/vim-css3-syntax', { 'for': 'css' }
" go
Plug 'fatih/vim-go', { 'for': 'go' }
" esolangs
Plug 'brandonbloom/vim-factor', { 'for': 'factor' }
Plug 'vim-scripts/forth.vim', { 'for': 'forth' }
Plug 'jakwings/vim-pony', { 'for': 'pony' }
" c
Plug 'justinmk/vim-syntax-extra', { 'for': 'c' }
Plug 'vim-scripts/c.vim', { 'for': 'c' }
" haskell
Plug 'eagletmt/ghcmod-vim', { 'for': 'haskell' }
Plug 'bitc/vim-hdevtools', { 'for': 'haskell' }
Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' }
" writing
Plug 'beloglazov/vim-online-thesaurus', { 'for': 'markdown' }
Plug 'reedes/vim-lexical', { 'for': 'markdown' }
Plug 'reedes/vim-pencil', { 'for': 'markdown' }
Plug 'reedes/vim-wordy', { 'for': 'markdown' }
Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
Plug 'junegunn/limelight.vim', { 'for': 'markdown' }
" f#
Plug 'fsharp/vim-fsharp', {
\ 'for': 'fsharp',
\ 'do': 'make fsautocomplete',
\}
" scala
Plug 'derekwyatt/vim-scala', { 'for': 'scala' }
" Unmanaged plugin (manually installed and updated)
Plug '~/.janus/misc-funcs'
call plug#end()
" dependent on plugins
" ----------------------------------------------------------------------------------
let g:ycm_key_list_select_completion=['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion=['<C-p>', '<Up>']
let g:UltiSnipsExpandTrigger="<Tab>"
let g:UltiSnipsJumpForwardTrigger="<Tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
" Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe.
"let g:UltiSnipsJumpBackwardTrigger="<c-z>"
"let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsSnippetDirectories = ["UltiSnips", "my_snips"]
let g:neocomplete#enable_at_startup = 1
let g:ycm_seed_identifiers_with_syntax = 1
let g:fsharp_completion_helptext = 1
" example of how to give neocomplete control from ycm
" let g:ycm_filetype_blacklist = { 'fsharp': 1 }
" autocmd FileType fsharp NeoCompleteUnlock
let g:switch_mapping = "-"
nnoremap <leader>_ :RelatedSpecVOpen<CR>
nnoremap <leader><leader>f :Autoformat %<CR>
let g:SuperTabDefaultCompletionType = 'context'
" Add the pry debug line with \bp (or <Space>bp, if you did: map <Space> <Leader> )
map <Leader>bp orequire'pry';binding.pry<esc>:w<cr>
" Alias for one-handed operation:
map <Leader><Leader>p <Leader>bp
map <leader>n :NERDTreeToggle<CR>
let NERDTreeShowHidden = 1
" for really big repos like zipcar-main need the following
let g:ctrlp_max_files = 0
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_clear_cache_on_exit = 0
" Sane Ignore For ctrlp
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|data\|log\|tmp$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
" CtrlP auto cache clearing.
" ----------------------------------------------------------------------------
function! SetupCtrlP()
if exists("g:loaded_ctrlp") && g:loaded_ctrlp
augroup CtrlPExtension
autocmd!
autocmd FocusGained * CtrlPClearCache
autocmd BufWritePost * CtrlPClearCache
augroup END
endif
endfunction
if has("autocmd")
autocmd VimEnter * :call SetupCtrlP()
endif
" Show all open buffers and their status
nmap <C-u> :CtrlPBuffer<CR>
" Start interactive EasyAlign in visual mode (e.g. vipga)
" ie vipga= to center around an = sign for inner paragraph
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)" super helpful for navigating big ass files
nmap <leader>r :Dispatch! rspec %<CR>
nmap <leader><leader>= :TagbarToggle<CR>
let g:tagbar_autofocus = 1
let g:tagbar_type_ruby = {
\ 'kinds' : [
\ 'm:modules',
\ 'c:classes',
\ 'd:describes',
\ 'C:contexts',
\ 'f:methods',
\ 'F:singleton methods'
\ ]
\ }
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 = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_loc_list_height = 5
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_go_checkers = ['goimports', 'golint', 'govet', 'errcheck']
let g:syntastic_ruby_checkers = ['rubocop', 'mri', 'reek']
" look n feel (〜 ̄▽ ̄)〜
" ----------------------------------------------------------------------------------
" https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" " Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#syntastic#enabled = 1
let g:airline_powerline_fonts = 1
if has("gui_running")
let s:uname = system("uname")
if s:uname == "Darwin\n"
"set guifont=Source\ Code\ Pro\ for\ Powerline "make sure to escape the spaces in the name properly
set guifont=Inconsolata\ for\ Powerline:h15
endif
endif
let g:startify_custom_header = map(split(system('figlet -f isometric1 vim'), '\n'), '" ". v:val') + ['','']
" https://github.com/ntpeters/vim-better-whitespace/issues/25
au VimEnter * ToggleStripWhitespaceOnSave
" https://github.com/kien/rainbow_parentheses.vim
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
autocmd QuickFixCmdPost *grep* cwindow
if has("autocmd")
let rubocop_pipeline = "rubocop -R -a"
let rubocop_pipeline .= " | rubocop -R -a"
autocmd FileType ruby let &formatprg=rubocop_pipeline
endif
autocmd FileType yaml execute ':silent! %s#^\t\+#\=repeat(" ", len(submatch(0))*' . &ts . ')'
augroup pencil
autocmd!
autocmd FileType markdown,mkd,md call pencil#init()
\ | call lexical#init()
augroup END
colorscheme neonwave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment