Last active
August 29, 2015 14:16
-
-
Save ohjann/7f13c0deedefc7898007 to your computer and use it in GitHub Desktop.
vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'gmarik/Vundle.vim' | |
" plugins | |
Plugin 'kien/ctrlp.vim' | |
Plugin 'sjl/gundo.vim.git' | |
Plugin 'scrooloose/nerdtree.git' | |
Plugin 'bling/vim-airline' | |
Plugin 'jeetsukumaran/vim-buffergator.git' | |
Plugin 'Lokaltog/vim-easymotion' | |
Plugin 'tpope/vim-fugitive.git' | |
Plugin 'aperezdc/vim-template.git' | |
Plugin 'evidens/vim-twig.git' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
"return the syntax highlight group under the cursor '' | |
function! StatuslineCurrentHighlight() | |
let name = synIDattr(synID(line('.'),col('.'),1),'name') | |
if name == '' | |
return '' | |
else | |
return '[' . name . ']' | |
endif | |
endfunction | |
syntax on | |
set backspace=2 | |
set background=dark | |
set hidden " Make certain buffers hidden | |
set pastetoggle=<F2> " Bind pastetoggle to F2 | |
set showmode " Show what mode you're in | |
set nocompatible | |
set ai " Set autoindent | |
set smartindent " Use intelligent indentation | |
set tabstop=4 " Tab width is 4 spaces | |
set shiftwidth=4 " Indent also with 4 spaces | |
set expandtab " Expand tabs to spaces | |
set textwidth=0 " Sets width of text per line, 0 for line wrapping | |
set wrap " Set wrapping | |
set linebreak " For some reason, wiki says this should be set when trying to disasble linebreak | |
set nolist " List disables linebreak | |
set wrapmargin=0 " Stop inserting line break on wrap | |
set formatoptions+=1 " Stop wrapping | |
set number " Show line number | |
set showmatch " Hilights matching searched | |
set ignorecase " Searches are case insensitive... | |
set smartcase " ... unless they contain at least one capital letter | |
set t_Co=256 " 256 colours | |
set tags=./tags;/ " Search the source tree for tags | |
set laststatus=2 " Always show the statusline | |
set encoding=utf-8 " Necessary to show Unicode glyphs | |
set nomodeline " Disable reading the first and last few lines of each file for ex commands, for security reasons | |
set noswapfile " no swap files | |
set statusline=%f\ "tail of the filename | |
set statusline+=\ \ %c, "cursor column | |
set statusline+=%l/%L "cursor line/total lines | |
set statusline+=\ %P "percent through file | |
set laststatus=2 | |
nmap <silent> <A-Up> :wincmd k<CR> | |
nmap <silent> <A-Down> :wincmd j<CR> | |
nmap <silent> <A-Left> :wincmd h<CR> | |
nmap <silent> <A-Right> :wincmd l<CR> | |
" jk instead of Esc | |
imap jk <Esc> | |
filetype plugin on | |
filetype plugin indent on | |
filetype indent on " Makes indentation different per file, good with html | |
filetype on | |
" automatically add "}" after typing "{" | |
inoremap { {}<Left> | |
inoremap {<CR> {<CR>}<Esc>O | |
inoremap {{ { | |
inoremap {} {} | |
" w!! will write as sudo | |
cmap w!! w !sudo tee % >/dev/null<CR>:e!<CR><CR> | |
" Bind f2 to pastetoggle | |
nnoremap <F2> :set invpaste paste?<CR> | |
" Rebinding supertab to <F3> | |
let g:SuperTabMappingForward = '<F3>' | |
" swaps between header and source | |
map <F4> :A<CR> | |
" opens a definition in a new tab | |
map <F5> :tab split<CR>:exec("tag ".expand("<cword>"))<CR> | |
" opens a definition in a vspilt | |
map <F6> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>) | |
" set tagbartoggle | |
nmap <F7> :TagbarToggle<CR> | |
" go to definition | |
map <F8> <C-]> | |
" maps NERDTree to F10 | |
map <silent> <F10> :NERDTreeToggle<CR> | |
" paste with correct indents | |
nnoremap p p=`] | |
" Tab remapping | |
nnoremap tn :tabnext<CR> | |
nnoremap tp :tabprev<CR> | |
nnoremap tc :tabnew<CR> | |
" Resizing split | |
nnoremap <silent> <Leader>+ :exe "resize " . (winheight(0) * 6/2)<CR> | |
nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/6)<CR> | |
" Settings for screen | |
if match($TERM, "screen")!=-1 | |
set term=xterm | |
syntax on | |
endif | |
" colors for tmux | |
set term=screen-256color | |
" Start NERDTree on vimenter | |
" autocmd vimenter * NERDTree | |
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
" autocmd VimEnter * wincmd p | |
" tell it to use an undo file | |
set undofile | |
" set a directory to store the undo history | |
set undodir=~/.vim/undo/ | |
" for templates | |
let g:email = 'eoghan@thejournal.ie' | |
let g:username = 'Eoghan Hynes' | |
let g:license = 'Internal use only' | |
let mapleader=" " | |
" highlights text with blue when it goes over 80 characters | |
highlight OverLength ctermbg=Blue ctermfg=white guibg=#592929 | |
match OverLength /\%81v.\+/ | |
" vim-markdown | |
let g:vim_markdown_folding_disabled=1 | |
" Ctrl+P | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:30' | |
let g:ctrlp_switch_buffer = 'Et' | |
" no bells | |
set noerrorbells visualbell t_vb= | |
" buffergator | |
" Use the right side of the screen | |
let g:buffergator_viewport_split_policy = 'R' | |
" I want my own keymappings... | |
let g:buffergator_suppress_keymaps = 1 | |
" Looper buffers | |
"let g:buffergator_mru_cycle_loop = 1 | |
" Go to the previous buffer open | |
nmap <leader>jj :BuffergatorMruCyclePrev<cr> | |
" Go to the next buffer open | |
nmap <leader>kk :BuffergatorMruCycleNext<cr> | |
" View the entire list of buffers open | |
nmap <leader>bl :BuffergatorOpen<cr> | |
" Shared bindings from Solution #1 from earlier | |
nmap <leader>T :enew<cr> | |
nmap <leader>bq :bp <BAR> bd #<cr> | |
" Vim Airline | |
let g:airline_powerline_fonts = 1 | |
" Enable the list of buffers | |
let g:airline#extensions#tabline#enabled = 1 | |
" Show just the filename | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
" theme | |
let g:airline_theme = 'bubblegum' | |
" highlight print statements | |
:highlight preprint ctermbg=blue | |
:highlight preprint ctermfg=white | |
:match preprint /pre_print_r(.*);/ | |
" gundo | |
nnoremap <F6> :GundoToggle<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment