Skip to content

Instantly share code, notes, and snippets.

@Meshiest
Last active March 4, 2018 20:33
Show Gist options
  • Save Meshiest/e9db012126d414c587e1ca6421742dcc to your computer and use it in GitHub Desktop.
Save Meshiest/e9db012126d414c587e1ca6421742dcc to your computer and use it in GitHub Desktop.
My VimPlug .vimrc
call plug#begin('~/.vim/plugged')
" Git magic
Plug 'airblade/vim-gitgutter'
" Rust Stuff
Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer'
" File tree
Plug 'scrooloose/nerdtree'
" Syntax higlighting
Plug 'scrooloose/syntastic'
" Completion plugin
Plug 'valloric/youcompleteme'
" Sublime multi selection
Plug 'terryma/vim-multiple-cursors'
" Theme Plugin
Plug 'tomasr/molokai'
" Statusline Theming
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
" Line Swapping
function! s:swap_lines(n1, n2)
let line1 = getline(a:n1)
let line2 = getline(a:n2)
call setline(a:n1, line2)
call setline(a:n2, line1)
endfunction
function! s:swap_up()
let n = line('.')
if n == 1
return
endif
call s:swap_lines(n, n - 1)
exec n - 1
endfunction
function! s:swap_down()
let n = line('.')
if n == line('$')
return
endif
call s:swap_lines(n, n + 1)
exec n + 1
endfunction
noremap <silent> <c-s-up> :call <SID>swap_up()<CR>
noremap <silent> <c-s-down> :call <SID>swap_down()<CR>
set wildmenu
" Set the colorscheme
colorscheme molokai
let g:rehash256 = 1
" Statusline Theme
let g:airline_powerline_fonts = 1
" Always show statusline
set laststatus=2
" Statusline Extensions
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#vcm#enabled = 1
" Enable syntax highlighting
syntax on
" Enable line numbers
set number
" Highlight current line
se cursorline
" Enable mouse
set mouse=a
set rtp+=$GOPATH/src/github.com/golang/lint/misc/vim
" Ctrl-N to open file tree
map <C-n> :NERDTreeToggle<CR>
" Open file tree on start when no file is selected
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Open file tree on start when a directory is provided
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" Nerdtree theming
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
" Two space tabs, tabs look like 4 spaces
set tabstop=4 softtabstop=2 expandtab shiftwidth=2 smarttab
" YouCompleteMe config file
let g:ycm_global_ycm_extra_conf = '~/.vim/plugged/youcompleteme/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
" Gvim font even though I don't use gvim
set guifont=Roboto\ Mono\ Thin\ for\ Powerline
set hidden
let g:racer_cmd = '~/.cargo/bin/racer'
let $RUST_SRC_PATH='~/Github/rust-lang/rust/src'
let g:racer_experimental_completer = 1
" Bind ctrl-D to multi-select
let g:multi_cursor_start_key='<C-d>'
let g:multi_cursor_next_key='<C-d>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment