Skip to content

Instantly share code, notes, and snippets.

@alanf
Created June 17, 2015 18:00
Show Gist options
  • Save alanf/35b6402ab4ac2a215cca to your computer and use it in GitHub Desktop.
Save alanf/35b6402ab4ac2a215cca to your computer and use it in GitHub Desktop.
vimrc
set nocompatible
filetype off
" filetype indent plugin on
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'surround.vim'
Plugin 'fatih/vim-go'
Plugin 'go.vim'
Plugin 'ctrlp.vim'
call vundle#end()
filetype plugin indent on
syntax on
:set tabstop=8 expandtab shiftwidth=4 softtabstop=4
:set number
:set hlsearch
set history=800
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Leader
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader = ","
"Fast saving
nmap <leader>w :w!<cr>
"" Autoreload vimrc, from:
"" http://www.oreillynet.com/onlamp/blog/2006/08/make_your_vimrc_trivial_to_upd_1.html
",v brings up my .vimrc
"",V reloads it -- making all changes active (have to save first)
map <leader>v :sp $MYVIMRC<CR><C-W>_
map <silent> <leader>V :source $MYVIMRC<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Search
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set incsearch " Find as you type
set hlsearch
set isk+=- " Match - as part of whole word seach using * and #
set confirm " Ask to save files
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files and backups
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " Turn backup off, since most stuff is in SVN, git anyway...
set nobackup
set nowb
set noswapfile
" " One of the most important options to activate. Allows you to switch from
" an
" " unsaved buffer without saving it first. Also allows you to keep an undo
" " history for multiple files. Vim will complain if you try to quit without
" " saving, if your computer crashes you're SOL so save often!
set hidden
"
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " => Moving around, tabs and buffers
" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" " Smart way to move btw. windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Close the current buffer
map <leader>bd :Bclose<cr>
"
" " Close all the buffers
map <leader>ba :1,300 bd!<cr>
"
" " Use the arrows to something usefull
map <right> :bn<cr>
map <left> :bp<cr>
"
" " Tab configuration
map <leader>tn :tabnew %<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <C-I> :tabprevious<cr>
map <C-O> :tabnext<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment