Last active
November 2, 2017 06:00
-
-
Save dphov/9cc472fddb78f60cdbcb6414c5165aed to your computer and use it in GitHub Desktop.
My vimrc for vim8
This file contains hidden or 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 | |
syntax enable | |
set encoding=utf-8 | |
set showcmd | |
filetype plugin indent on | |
""Whitespace | |
set nowrap "don't wrap lines | |
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4) | |
set expandtab "usespaces,nottabs(optional) | |
set backspace=indent,eol,start "backspace through everything in insertmode | |
""Searching | |
set hlsearch "highlightmatches | |
set incsearch "incrementalsearching | |
set ignorecase "searchesarecaseinsensitive... | |
set smartcase " ...unless they contain at least one capital letter | |
set rnu | |
set expandtab | |
set autoindent | |
set autowrite | |
ab #d #define | |
ab #i #include | |
ab #b /******************************************************** | |
ab #e ********************************************************/ | |
ab #l /*------------------------------------------------------*/ | |
set sw=4 | |
set notextmode | |
set notextauto | |
set textwidth=79 | |
set guifont=SFMono-Regular:h12 | |
"easier navigation between split windows | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
" Set up colourscheme | |
" colorscheme base16-default | |
colorscheme solarized8_dark | |
" Disable Arrow keys | |
inoremap <Up> <NOP> | |
inoremap <Down> <NOP> | |
inoremap <Left> <NOP> | |
inoremap <Right> <NOP> | |
noremap <Up> <NOP> | |
noremap <Down> <NOP> | |
noremap <Left> <NOP> | |
noremap <Right> <NOP> | |
filetype plugin on | |
" Statusbar style | |
" | |
set laststatus=2 " Always show statusbar | |
function! GitBranch() | |
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") | |
endfunction | |
function! StatuslineGit() | |
let l:branchname = GitBranch() | |
return strlen(l:branchname) > 0?' '.l:branchname.' ':'' | |
endfunction | |
set statusline= | |
set statusline+=%#PmenuSel# | |
set statusline+=%{StatuslineGit()} | |
set statusline+=%#LineNr# | |
set statusline+=\ %f | |
set statusline+=%m\ | |
set statusline+=%= | |
set statusline+=%#CursorColumn# | |
set statusline+=\ %y | |
set statusline+=\ %{&fileencoding?&fileencoding:&encoding} | |
set statusline+=\[%{&fileformat}\] | |
set statusline+=\ %p%% | |
set statusline+=\ %l:%c | |
set statusline+=\ | |
fun! Solarized8Contrast(delta) | |
let l:schemes = map(["_low", "_flat", "", "_high"], '"solarized8_".(&background).v:val') | |
exe "colors" l:schemes[((a:delta+index(l:schemes, g:colors_name)) % 4 + 4) % 4] | |
endf | |
nmap <leader>- :<c-u>call Solarized8Contrast(-v:count1)<cr> | |
nmap <leader>+ :<c-u>call Solarized8Contrast(+v:count1)<cr> | |
" PEP8 indentation | |
au BufNewFile,BufRead *.py | |
\ set tabstop=4 | |
\ set softtabstop=4 | |
\ set shiftwidth=4 | |
\ set textwidth=79 | |
\ set expandtab | |
\ set autoindent | |
\ set fileformat=unix | |
" HTML JS CSS | |
au BufNewFile,BufRead *.js, *.html, *.css | |
\ set tabstop=2 | |
\ set softtabstop=2 | |
\ set shiftwidth=2 | |
" Flagging Unnecessary Whitespace | |
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment