dotfiles

My opinionated dotfiles
git clone git://git.erethon.com/dotfiles
Log | Files | Refs

.vimrc (3872B)


      1 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
      2 "For updates please check https://erethon.com and https://github.com/erethon
      3 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
      4 
      5 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
      6 "Plugins and Vundle
      7 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
      8 set nocompatible
      9 filetype off
     10 set rtp+=~/.vim/bundle/Vundle.vim
     11 "call vundle#begin()
     12 
     13 "Plugin 'kien/ctrlp.vim'
     14 "Plugin 'scrooloose/nerdcommenter'
     15 "Plugin 'tpope/vim-surround'
     16 "Plugin 'derekwyatt/vim-scala'
     17 "Plugin 'lepture/vim-jinja
     18 
     19 "call vundle#end()
     20 filetype plugin indent on
     21 
     22 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
     23 "Visual stuff
     24 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
     25 "Turn syntax highlighting on
     26 syntax on
     27 
     28 "Insert 8 spaces when tab is pressed (if not softtabstop is set)
     29 set tabstop=8
     30 "Insert space characters when tab is pressed
     31 set expandtab
     32 "Insert 4 spaces when tab is pressed (overrides tabstop if expandtab is set)
     33 set softtabstop=4
     34 "Controls how many spaces are indented when > and < is used
     35 set shiftwidth=4
     36 
     37 "Remove trailing whitespace for .py/.yml/.init/.rst/.spec files
     38 autocmd BufWritePre *.py :%s/\s\+$//e
     39 autocmd BufWritePre *.yml :%s/\s\+$//e
     40 autocmd BufWritePre *.init :%s/\s\+$//e
     41 autocmd BufWritePre *.rst %s/\s\+$//e
     42 autocmd BufWritePre *.spec %s/\s\+$//e
     43 autocmd BufWritePre *.conf %s/\s\+$//e
     44 
     45 "Show line numbers
     46 set number
     47 "Show ruler on bottom of vim
     48 set ruler
     49 
     50 "Ignore case when searching
     51 set ignorecase
     52 "Set smartcace on (aka step will find stepbrother and Steps, but Step wont
     53 "find stepbrother)
     54 set smartcase
     55 "Highlight search results
     56 set hlsearch
     57 
     58 set showmatch
     59 set mat=2
     60 
     61 "Set colorscheme
     62 colorscheme pychimp
     63 
     64 "Show a blue vertical line on the 80th character (pep8 compliant)
     65 if exists('+colorcolumn')
     66   highlight ColorColumn ctermbg=23
     67   call matchadd('ColorColumn', '\%80v', 100)
     68 else
     69   au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
     70 endif
     71 
     72 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
     73 " Mapping stuff
     74 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
     75 "Map <leader> to ";"
     76 let mapleader = ";"
     77 
     78 "Mapping 0 to go to first non-blank character of line
     79 map 0 ^
     80 
     81 "Use Ctrl + t for opening a new tab
     82 nnoremap <c-t> :tabnew
     83 "Use Ctrl + h/l for previous/next tab
     84 nnoremap <c-h> gT
     85 nnoremap <c-l> gt
     86 
     87 "Use <Space> to go half-page down
     88 nnoremap <Space> <c-d>
     89 
     90 "Faster Normal Mode
     91 imap ii <Esc>
     92 
     93 "Pep8 checking
     94 map <F5> :!pep8 % <Enter>
     95 
     96 "Git blame
     97 map <F6> :!git blame % <Enter>
     98 
     99 "Check number of characters in file
    100 map <F4> :!wc -m %<CR>
    101 
    102 "Easy set paste and set nopaste
    103 set pastetoggle=<F2>
    104 "Spell checking
    105 map <F7> :set spell<CR>
    106 
    107 " Set options to comply with the linux kernel coding style
    108 function Kernel()
    109     set noexpandtab
    110     set tabstop=8
    111     set softtabstop=8
    112     set shiftwidth=8
    113     set cinoptions=:0,l1,t0,g0,(0
    114 endfunction
    115 
    116 " Set options JS and PHP coding style
    117 function JSphp()
    118     set expandtab
    119     set tabstop=4
    120     set softtabstop=4
    121     set shiftwidth=4
    122 endfunction
    123 
    124 "Go in kernel mode coding style
    125 map <F8> :call Kernel() <Enter>
    126 
    127 "Go in js/php mode coding style
    128 map <F9> :call JSphp() <Enter>
    129 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    130 " Settings
    131 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    132 set nomodeline
    133 set cursorline
    134 
    135 " Greek mapping for normal mode
    136 set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR
    137 set langmap+=ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj
    138 set langmap+=κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
    139 
    140 "Enable mouse in vim
    141 set mouse=a
    142 
    143 "Set spell checking languages
    144 set spelllang=en,el