Skip to content

Instantly share code, notes, and snippets.

@netsmertia
Created August 17, 2014 19:14
Show Gist options
  • Save netsmertia/52aef973e8cd3814273d to your computer and use it in GitHub Desktop.
Save netsmertia/52aef973e8cd3814273d to your computer and use it in GitHub Desktop.
General purpose vimrc
"GENERAL
"==============================================
set background=dark " Assume a dark background
syntax on " Syntax highlighting
filetype plugin indent on " Automatically detect file types.
if !has('gui')
set term=$TERM " Make arrow and other keys work
endif
set hidden " Allow buffer switching without saving
set history=1000 " Store a ton of history (default is 20)
set virtualedit=onemore " Allow for cursor beyond last character
set mousehide " Hide the mouse cursor while typing
set shortmess+=filmnrxoOtT " Abbrev. of messages (avoids 'hit enter')
"VIM UI
"==============================================
set guioptions-=T "disable toolbar in gvim
set guioptions-=rL "disable scrollbar in gvim
set tabpagemax=15 " Only show 15 tabs
set showmode " Display the current mode
set cursorline " Highlight current line
set ruler " Show the ruler
set showcmd " Show partial commands in status line and
" Selected characters/lines in visual mode
set ttyfast
if has('statusline')
set laststatus=2
" Broken down into easily includeable segments
set statusline=%<%f\ " Filename
set statusline+=%w%h%m%r " Options
"set statusline+=%{fugitive#statusline()} " Git Hotness
set statusline+=\ [%{&ff}/%Y] " Filetype
set statusline+=\ [%{getcwd()}] " Current dir
set statusline+=%=%-14.(%l,%c%V%)\ %p%% " Right aligned file nav info
endif
set number " Line numbers on
set incsearch " Find as you type search
set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
set wildmode=list:longest,full " Command <Tab> completion, list matches, " then longest common part, then all.
set scrolloff=3 " Minimum lines to keep above and below cursor
set pumheight=9 "set popup menu height
set list
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
"FORMATTING
"==============================================
set nowrap " Wrap long lines
set autoindent " Indent at the same level of the previous line
set shiftwidth=4 " Use indents of 4 spaces
set shiftround
set noexpandtab " Tabs are spaces, not tabs
set tabstop=4 " An indentation every four columns
set softtabstop=4 " Let backspace delete indent
set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J)
set smarttab
set matchpairs+=<:> " Match, to be used with %
"KEY REMAPPING
"==============================================
" Set leader key to ',' for easy access
let mapleader = ","
" Wrapped lines goes down/up to next row, rather than next line in file.
noremap j gj
noremap k gk
" Fast tab switching
map <S-H> gT
map <S-L> gt
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" Toggle search highlighting rather than clear the current
nmap <silent> <leader>/ :set invhlsearch<CR>
" Visual shifting (does not exit Visual mode)
vnoremap < <gv
vnoremap > >gv
" Allow using the repeat operator with a visual selection (!)
vnoremap . :normal .<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment