Last active
February 20, 2018 15:28
-
-
Save alekswn/c09ec72d962b0d47e6ab to your computer and use it in GitHub Desktop.
My .vimrc
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 UTF-8 encoding | |
set enc=utf-8 | |
set fenc=utf-8 | |
set termencoding=utf-8 | |
" disable vi compatibility (emulation of old bugs) | |
set nocompatible | |
" use indentation of previous line | |
set autoindent | |
" use intelligent indentation for C | |
set smartindent | |
" configure tabwidth and insert spaces instead of tabs | |
set tabstop=4 " tab width is 4 spaces | |
set shiftwidth=4 " indent also with 4 spaces | |
set expandtab " expand tabs to spaces | |
" wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays. | |
set textwidth=120 | |
" turn syntax highlighting on | |
set t_Co=256 | |
syntax on | |
" colorscheme wombat256 | |
" turn line numbers on | |
set number | |
" highlight matching braces | |
set showmatch | |
" intelligent comments | |
set comments=sl:/*,mb:\ *,elx:\ */ | |
" Enhanced keyboard mappings | |
" | |
" in normal mode F2 will save the file | |
nmap <F2> :w<CR> | |
" in insert mode F2 will exit insert, save, enters insert again | |
imap <F2> <ESC>:w<CR>i | |
" switch between header/source with F4 | |
map <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR> | |
" make with F7 | |
map <F7> :make<CR> | |
" build using makeprg with <S-F7> | |
map <S-F7> :make clean all<CR> | |
" spell settings | |
:setlocal spell spelllang=en | |
" set the spellfile - folders must exist | |
set spellfile=~/.vim/spellfile.add | |
map <M-Down> ]s | |
map <M-Up> [s | |
" remove trailing spaces | |
autocmd FileType c,cpp,java,php autocmd BufWritePre <buffer> %s/\s\+$//e | |
" smart numbering | |
:set number relativenumber | |
:augroup numbertoggle | |
: autocmd! | |
: autocmd BufEnter,FocusGained,InsertLeave * set relativenumber | |
: autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber | |
:augroup END | |
" current line highlight | |
set cursorline | |
" pane navigation | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" natural pane spliting | |
set splitbelow | |
set splitright |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment