Paste #PAj -- näytä pelkkänä tekstinä -- uusi tämän pohjalta
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | " Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Set vim to store all the swap files in the same location
set directory=~/.vim/swap,.
" Set 256 colors
set t_Co=256
" allow backspacing over everything in insert mode
" set backspace=indent,eol,start
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
" set hlsearch
endif
" Suffixes for vim to ignore (binary files):
set suffixes=.com,.class,.dll,.exe,.o,.so,.d,.sym,.map,.lss,.hex,.elf,.eep,~
" Start pathogen plugin for autoload of plugins from ~/.vim/bundle
call pathogen#infect()
call pathogen#helptags()
syntax on
filetype plugin indent on
" Stuff for Airline
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_theme = 'powerlineish'
let g:airline_enable_branch = 1
let g:airline_enable_syntastic = 1
" Stuff for NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Remap F2 to NERDtree
nnoremap <F2> :NERDTree<CR>
" Keep NERDTree on the left at all times
let g:NERDTreeWinPos = "left"
let g:NERDTreeSplitVertical = 1
" Add vim suffixes to NERDTree ignore list
let NERDTreeIgnore = []
for suffix in split(&suffixes, ',')
let NERDTreeIgnore += [ escape(suffix, '.~') . '$' ]
endfor
" Required for taglist
filetype on
let g:Tlist_Use_Horiz_Window = 0
" Ctags tags file location
set tags=./tags;/
" Keybind for updating ctags db for taglist and code complete
nnoremap <C-F12> :!ctags -R --c++-kinds=+p --c-kinds=+p --fields=+iaS --extra=+q .<CR>
" Set tab settings
set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent smartindent
" Mark 80 characters
set cc=80
" Set line numbers
set number
" Set background to dark
set bg=dark
" Disable line wrapping
set nowrap
" Key bindings for changing tabs with ctrl+left/right and move them with alt+left/right
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>
" Key binding ctrl-l to remove search highlighting
nnoremap <c-l> <c-l>:noh<cr>
" Use relative line numbers, toggle with <C-n>
function! NumberToggle()
if(&relativenumber == 1)
set norelativenumber
set number
else
set nonumber
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
" Don't use relative line numbers when vim doesn't have focus
:au FocusLost * :set number
:au FocusGained * :set relativenumber
" Don't use relative line numbers in insert mode
autocmd InsertEnter * :set number
autocmd InsertLeave * :set relativenumber
|