"Cancel vi compatibility set nocompatible let mapleader="," "Move .swp files to /tmp - SSD will like it! "set backupdir=/tmp "set directory=/tmp "set history=10000 "set undofile "set undodir=/tmp "set undolevels=1000 "maximum number of changes that can be undone "set undoreload=10000 "maximum number lines to save for undo on a buffer reload "indentation set tabstop=4 set softtabstop=4 set shiftwidth=4 set noexpandtab set smartindent "set encoding to utf8 set encoding=utf-8 "enable mouse set mouse=a "show at least 6 lines before and after cursor pos "set scrolloff=6 "highlight line with cursor set cursorline "highlight 80th column set colorcolumn=80 "show info on in which mode you're in set showmode "show partial command set showcmd "show cursor position set ruler "complete commands on tab set wildmenu set wildmode=list:longest "tell vim we have fast terminal - smoother set ttyfast "make vim behave nicely with backspace set backspace=indent,eol,start "always show status set laststatus=2 "show both absolute and relative line numbers "set relativenumber set number "ignore case on search set ignorecase "if all chars are lc, ignore case set smartcase "highlight pair char match set showmatch "match < > too set matchpairs=(:),[:],{:},<:> "show match during type set incsearch "search from start on eof set wrapscan "auto-save on buffer change set autowrite "operations like :q or :e will ask, not fail set confirm "enable line breaks set wrap "break lines only in words " WARNING: This setting is eliminated by :set list set linebreak "set nice chars for tabs and eols set list if has("multi_byte") set lcs=tab:▸\ ,eol:¬ endif "set spelling options set spelllang=cs set mousemodel=popup " ================= " syntax highliting " ================= syntax on colorscheme dorticek " ===================== " show redundant spaces " ===================== au BufEnter * match RedundantSpaces /\s\+$\| \+\ze\t/ highlight RedundantSpaces ctermbg=red guibg=red " =========== " key hacking " =========== set =O1;2R " Vim nezná všechny znaky, které může posílat terminál. Je nutné ho prvně naučit, " co po něm terminál vlastně chce. Toho se docílí tak jako na následujícím řádku. " To co je za = se vygeneruje tak, že stisknu v INSERT modu Ctrl+v a následně " požadovanou zkratku " =========== " key mapping " =========== map :w imap :wa "reformat text map {gq} imap {gq}a map mmgggqG'm imap mmgggqG'ma "buffer manipulation map :bp imap :bpa map :bn imap :bna map :bn map :bp "user-friendly home imap I "toggle button for text width map :set textwidth=80 map :set textwidth=0 "navigate up and down in long lines splitted by :set wrap map k gk map j gj "esc boost inoremap kj inoremap KJ inoremap Kj inoremap kJ "don't you hate when you accidentally hit F1? inoremap nnoremap vnoremap "...and when you're too speed? command WQ wq command Wq wq command W w command Q q "add empty line and stay in normal mode nmap o o nmap O O "windows changing nnoremap h nnoremap j nnoremap k nnoremap l "reselect just pasted text "the similar thing is gv in normal mode - reselect previously selected area nnoremap p `[V`] "edit operations imap f 2Ff/pFd 2Ff/pF "consider macro 'q' as 'default' "run default macro map . @q "show whois information of object under cursor nnoremap w :! whois nnoremap d :! dig -x nnoremap a :! ansible-doc nnoremap t :! sdcv -n " ==================== " function definitions " ==================== function! NumberToggle() if(&relativenumber == 1) set norelativenumber else set relativenumber endif endfunc nnoremap :call NumberToggle() " ================== " external functions " ================== source ~/.vim/hicursorwords.vim " ============================================================================ " Plugins ==================================================================== " ============================================================================ " ============ " specialities " ============ " must be before Vundle activation "let g:ale_completion_enabled = 1 " ================= " Plugin management " ================= " git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim " vim +PluginInstall +qall filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() "---------------------------- Plugin 'VundleVim/Vundle.vim' Plugin 'w0rp/ale' Plugin 'pearofducks/ansible-vim' Plugin 'Yggdroot/indentLine' Plugin 'itchyny/lightline.vim' Plugin 'scrooloose/nerdcommenter' Plugin 'scrooloose/nerdtree' Plugin 'Xuyuanp/nerdtree-git-plugin' Plugin 'airblade/vim-gitgutter' Plugin 'dhruvasagar/vim-table-mode' Plugin 'Valloric/YouCompleteMe' "---------------------------- call vundle#end() filetype plugin indent on " ============ " ALE settings " ============ let g:ale_lint_on_text_changed = 'never' " ====================== " vim-gitgutter settings " ====================== highlight GitGutterAdd guifg=#009900 ctermfg=2 highlight GitGutterChange guifg=#bbbb00 ctermfg=3 highlight GitGutterDelete guifg=#ff2222 ctermfg=1 " ==================== " ansible-vim settings " ==================== let g:ansible_attribute_highlight = "ab" let g:ansible_name_highlight = 'd' let g:ansible_extra_keywords_highlight = 1 " =================== " table-mode settings " =================== let g:table_mode_corner = "|" " ================= " NERDTree settings " ================= map n :NERDTreeToggle " ====================== " YouCompleteMe settings " ====================== let g:ycm_autoclose_preview_window_after_completion = 1