Skip to content

Instantly share code, notes, and snippets.

@basicxman
Created May 23, 2011 16:53
Show Gist options
  • Select an option

  • Save basicxman/987039 to your computer and use it in GitHub Desktop.

Select an option

Save basicxman/987039 to your computer and use it in GitHub Desktop.
" Vim configuration - Andrew Horsman [basicxman]
" Operating system dependent options
if has("win32") || has("unix")
source $VIMRUNTIME/mswin.vim
behave mswin
endif
if has("win32")
:cd C:\Users\Andrew
set guifont=Consolas
endif
" autocmd options
if has("autocmd")
" Automagically reload vimrc after edit.
autocmd bufwritepost .vimrc source $MYVIMRC
autocmd bufwritepost _vimrc source $MYVIMRC " Windows :|
" Load indent files for language-dependent indenting.
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
filetype on
filetype indent on
filetype plugin on
endif
" gvim options
if has("gui_running")
set guioptions-=T
endif
" <injekt> In many terminal emulators the mouse works just fine, thus enable
" it.
if has('mouse')
set mouse=a
endif
" Regular options
" ---------------
set nocompatible " Who the hell uses vi?
set title " Set window title
set number " Line numbering
set showmatch " Match opening/closing punctuation together
set nobackup " Git is my backup.
set nowritebackup " Git is my backup.
set foldenable " Folding <3 (take that injekt!)
set noswapfile " wurt.
set ruler " Cursor position!
set noerrorbells " Annoying as !@#$
set visualbell " Flashes screen for 20mS instead of error bell.
set cursorline " Highlight line of cursor (awesome sauce)
set nowrap " Also annoying.
set splitbelow " Splitting buffers goes below instead of above
set showmatch " Matching brackets/braces etc
set nohlsearch " Highlighting searches are so annoying.
set incsearch " Incremental searching.
set whichwrap+=<,>,h,l,b,[,] " Backspace and cursor keys wrap back to previous line!
set history=2000 " Command history
" Set map leader for misc normal mode commands.
let mapleader = ","
" Indentation
set autoindent
set smartindent
set shiftwidth=2
set tabstop=2
set smarttab
set expandtab
" Tab completion
set wildmode=list:longest,list:full
" Themeing
" FYI, Solarized plugin is a massive amount of #winning
syntax enable
set background=dark
colorscheme solarized
" Keyboard shortcuts
nmap <C-t> :tabnew<CR>
imap <C-t> <Esc>:tabnew<CR>
nmap <C-b> :tabclose<CR>
imap <C-b> <Esc>:tabclose<CR>
nmap <C-Tab> :tabn<CR>
imap <C-Tab> <Esc>:tabn<CR>
nmap <C-S-Tab> :tabp<CR>
imap <C-S-Tab> <Esc>:tabp<CR>
nmap <C-d> dd
imap <C-d> <Esc>dd
nmap <C-S> :update<CR>
imap <C-S> <Esc>:update<CR>
vmap <C-S> <Esc>:update<CR>
nmap <Leader>vrc :tabedit $MYVIMRC<CR>
nmap <Leader>nt :NERDTreeToggle<CR>
nmap <Leader>h :split<CR>
nmap <Leader>v :vs<CR>
" Escape alternative
imap <C-space> <Esc>
" Go to end/state of line.
inoremap <S-Right> <Esc>$i
inoremap <S-Left> <Esc>^i
" Sorry, no mercy.
nnoremap <Left> :echoe "Use h!"<CR>
nnoremap <Right> :echoe "Use l!"<CR>
nnoremap <Up> :echoe "Use k!"<CR>
nnoremap <Down> :echoe "Use j"<CR>
@leejarvis
Copy link

Andrew, with your ,foo commands, you should set your mapleader to ',', then you just have to specify <Leader> -- see here. You might also be interested in Pathogen. I use it for grouping everything into the ~/.vim/bundle directory like this. All of those projects are their own git repos, so I can simple issue pulls when I like, and they're all self contained. Then you just have to call pathogen#runtime_append_all_bundles() at the top of your .vimrc

@basicxman
Copy link
Author

Sweet, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment