Skip to content

Instantly share code, notes, and snippets.

@eliblaney
Last active December 18, 2019 19:20
Show Gist options
  • Save eliblaney/bb3808233b087e4214f20dcb53ac19f3 to your computer and use it in GitHub Desktop.
Save eliblaney/bb3808233b087e4214f20dcb53ac19f3 to your computer and use it in GitHub Desktop.
My .vimrc configuration for vim
set nocompatible
filetype plugin on
set tags=tags;/
let g:easytags_dyanmic_files = 1
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=~/.vim/plugin
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'vim-scripts/SQLComplete.vim'
Plugin 'vim-scripts/surround.vim'
" auto check syntax on save (:CheckSyntax)
Plugin 'vim-scripts/checksyntax-B'
" Source tree (:NERDTree)
Plugin 'scrooloose/nerdtree'
" Tags (:TlistToggle)
Plugin 'vim-scripts/taglist.vim'
Plugin 'vim-scripts/vim-misc'
Plugin 'vim-scripts/easytags.vim'
" Shell (:shell)
Plugin 'Shougo/deol.nvim'
call vundle#end()
filetype plugin indent on
let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py"
" disable help menu
map <F1> <Nop>
" linex of history
set history=700
" enable line numbers
set number
" auto update when edited from outside source
set autoread
" searching
set ignorecase
set smartcase
set hlsearch
set incsearch
" performance boost
set lazyredraw
" regex
set magic
" matching brackets
set showmatch
" how many tenths of a second to blink when matching brackets
set mat=2
" disable error noises
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" syntax highlighting
syntax enable
colorscheme desert
set background=dark
" gui options
if has("gui_running")
set guioptions-=T
set guioptions+=e
set t_Co=256
set guitablabel=%M\ %t
endif
set encoding=utf8
" unix as the standard file type
set ffs=unix,dos,mac
set ai " auto indent
set si " smart indent
" treat long lines as break lines
map j gj
map k gk
" always show the status line
set laststatus=2
" format status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ Line:\ %l
" remap VIM 0 to first non-blank character
map 0 ^
" moving lines around using ALT+[jk] (or Command+[jk] on mac)
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'.+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("mac") || has("macunix")
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif
" delete trailing whitespace on save for Python/CoffeeScript
func! DeleteTrailingsWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.coffee :call DeleteTrailingWS()
" Pressing ,ss will toggle spell checking
map <leader>ss :setlocal spell!<cr>
" shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" show current position
set ruler
" command bar
set cmdheight=2
" match brackets
set showmatch
set matchtime=3
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
" soft wrap text
set wrap linebreak nolist
" do not indicate line breaks with a special character
set showbreak=
" tabs
set tabstop=4
set shiftwidth=4
set smarttab
set smartindent
set autoindent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment