From cc56c4ee72717bc02a26e9f4a5d151d41faab53d Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 13 May 2021 10:57:24 +0300 Subject: Major update of vimrc: updated structure of contents, added some settings --- .vimrc | 306 ++++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 199 insertions(+), 107 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 74262ea..278de82 100644 --- a/.vimrc +++ b/.vimrc @@ -1,10 +1,10 @@ -""""""""""""""""""""""""""""""" +" {{{ =============================> " Plugin Manager -""""""""""""""""""""""""""""""" + call plug#begin('~/.vim/plugged') -"""""""""""""""""""""""""""""" +" {{{ -------------------------> " Plugins Plug 'morhetz/gruvbox', {'rtp': 'vim'} " Color theme @@ -31,25 +31,70 @@ Plug 'mg979/vim-visual-multi' " Multiple line cursor (and other stuff) Plug 'zivyangll/git-blame.vim' " Show who last edited a line Plug 'kien/tabman.vim' " Show open buffers Plug 'alvan/vim-closetag' " Automatically add HTML closing tags +Plug 'OrangeT/vim-csharp' +Plug 'neovimhaskell/haskell-vim' -"""""""""""""""""""""""""""""""" +" }}} -------------------------< call plug#end() -""""""""""""""""""""""""""""""" -" Vim settings -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> +" Vim-anyfold + folding + +filetype plugin indent on +syntax on +autocmd Filetype * AnyFoldActivate " activate for all filetypes +autocmd FileType,BufRead vim,text,sh setlocal foldmethod=marker +set foldlevel=99 " Open all folds by default +autocmd FileType,BufRead vim,sh setlocal foldlevel=0 + +" }}} =============================< + +" {{{ =============================> +" General + +" {{{ -------------------------> +" Color scheme + +colorscheme gruvbox +set background=dark " Setting dark mode +let g:gruvbox_contrast_dark='medium' + +" }}} -------------------------< + +" {{{ -------------------------> +" Identation + +set tabstop=4 " Show tabs as 4 wide +set shiftwidth=4 " Indent with 4 spaces + +autocmd BufRead,BufNewFile *.component.css set filetype=css +autocmd FileType css,ts setlocal ts=2 sw=2 sts=0 expandtab " Tranform tabs in CSS and TS into 2 spaces + +" }}} -------------------------< + +" {{{ -------------------------> +" Character visuals -set list +set list " Enabled customization of whitespace characters, so spaces, tabs, EOL, etc. (:h 'list') + +" Show tabs as a | with three spaces " DO NOT remove the trailing space in the next line! set listchars=tab:│\ +" }}} -------------------------< + +" {{{ -------------------------> +" Backspace and cursor + autocmd InsertEnter,InsertLeave * set cul! " Highlight current line, when in insert mode -set backspace=indent,eol,start " Better backspace functionality -" Map Ctrl-Backspace to delete the previous word in insert mode. -noremap! -noremap! -set scrolloff=0 " Don't keep any screen lines above or below the cursor +set backspace=indent,eol,start " Better backspace functionality + +set scrolloff=0 " Don't keep any screen lines above or below the cursor +set number " Show line numbers to the left +set mouse=a " Mouse support " Thin cursor in insert mode in Gnome-Terminal (version >=3.16 ; also works with Terminator) if has("autocmd") @@ -63,9 +108,16 @@ if has("autocmd") au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw! endif -nnoremap :call gitblame#echo() +" }}} -------------------------< + +" {{{ -------------------------> +" Ctrl bindings + +" Ctrl-Backspace deletes the previous word in insert mode. +noremap! +noremap! -" Ctrl+c, Ctrl+v, Ctrl+z, Ctrl+a and Ctrl+s bindings +" The usual Ctrl+s, Ctrl+v type of bindings " Partly taken from: https://gist.github.com/jshih/3423345 vmap "+yi vmap "+c @@ -73,10 +125,11 @@ vmap c"+p imap "+pa map ggVG imap ui -nmap u imap i "imap An impossible dream imap :wa +nmap :w +map :set nomore:ls:set more:b " Use Ctrl + hjkl for navigation in insert mode " inoremap @@ -84,6 +137,15 @@ imap :wa " inoremap " inoremap +" Go between tabs with Ctrl+l (tab to the right) and Ctrl+h (tab to the left) +" nnoremap :tabn +" nnoremap :tabp + +" }}} -------------------------< + +" {{{ -------------------------> +" Comand abbreviations + " Cyrilic (Bulgarian yawerty layout) support ca в w ca ва wa @@ -98,28 +160,44 @@ ca xa wa qa! ca tt tab ter ca te tabe -" Go between tabs with Ctrl+l (tab to the right) and Ctrl+h (tab to the left) -" nnoremap :tabn -" nnoremap :tabp +" }}} -------------------------< -set number " Show line numbers to the left +" {{{ -------------------------> +" Custom app open bindings +nnoremap :call gitblame#echo() nnoremap = :tab ter ++close lazygit +" }}} -------------------------< + +" {{{ -------------------------> +" Other bindings + " Don't get into insert mode after adding a line with o/O nnoremap o o nnoremap O O +" Move a line up and down with Alt+k and Alt-j +execute "set =\ej" +nnoremap :m+1 +execute "set =\ek" +nnoremap :m-2 + +" }}} -------------------------< + +" {{{ -------------------------> +" Omni complition + +" Omni completion supports C, HTML, CSS, JavaScript, PHP, Python, Ruby, SQL, XML +set omnifunc=syntaxcomplete#Complete " Completion for all supported languages + " Do omni completion from Ctrl+Space nnoremap -set mouse=a " Mouse support +" }}} -------------------------< -set tabstop=4 " Show tabs as 4 wide -set shiftwidth=4 " Indent with 4 spaces -filetype plugin indent on -autocmd BufRead,BufNewFile *.component.css set filetype=css -autocmd FileType css,ts setlocal ts=2 sw=2 sts=0 expandtab " Show CSS and TS tabs as 2 spaces +" {{{ -------------------------> +" Spell check mode " When you press F6 it will toggle a "spell check mode", " spell is activated and the colorscheme is changed @@ -155,25 +233,21 @@ endfunction tmap :call EnterNormalMode() -""""""""""""""""""""""""""""""" -" Color scheme settings -""""""""""""""""""""""""""""""" +" }}} -------------------------< -colorscheme gruvbox -set background=dark " Setting dark mode -let g:gruvbox_contrast_dark='medium' +" }}} =============================< -""""""""""""""""""""""""""""""" +" {{{ =============================> " DelimitMate -""""""""""""""""""""""""""""""" let delimitMate_expand_cr = 1 " Don't autocomplete diamond brackets in HTML (compatibility with closetag plugin) autocmd FileType html let b:delimitMate_matchpairs='(:),[:],{:}' -""""""""""""""""""""""""""""""" -" NERDTree settings -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> +" NERDTree let NERDTreeCustomOpenArgs={'file':{'where':'t'}} " Open file in new tab, doesn't work only for double-click let NERDTreeShowHidden=1 @@ -181,9 +255,10 @@ let NERDTreeShowHidden=1 nmap :NERDTreeToggle let NERDTreeIgnore=['\.swp$', '\~$'] " Ignore file, ending with .swp and ~ -""""""""""""""""""""""""""""""" -" Undotree settings -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> +" Undotree " Toggle undotree with F5 nmap :UndotreeToggle @@ -212,16 +287,18 @@ if !exists('g:undotree_DiffCommand') let g:undotree_DiffCommand = "diff" endif -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> " Tabman -""""""""""""""""""""""""""""""" let g:tabman_toggle = '' let g:tabman_side = 'right' -""""""""""""""""""""""""""""""" -" Syntastic settings -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> +" Syntastic set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} @@ -232,18 +309,13 @@ let g:syntastic_auto_loc_list=1 let g:syntastic_check_on_open=1 let g:syntastic_check_on_wq=0 -""""""""""""""""""""""""""""""" -" Vim-anyfold settings -""""""""""""""""""""""""""""""" +" }}} =============================< -filetype plugin indent on -syntax on -autocmd Filetype * AnyFoldActivate " activate for all filetypes -set foldlevel=99 " Open all folds by default +" {{{ =============================> +" Lighline -""""""""""""""""""""""""""""""" -" Lighline settings -""""""""""""""""""""""""""""""" +" {{{ -------------------------> +" Settings set laststatus=2 @@ -252,43 +324,48 @@ if !has('gui_running') endif let g:lightline = { - \ 'enable': { - \ 'statusline': 1, - \ 'tabline': 1 - \ }, - \ 'colorscheme': 'wombat', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], - \ [ 'gitbranch', 'filename', 'charvaluehex', 'readonly', 'modified' ] ], - \ 'right': [ [ 'lineinfo' ], - \ [ 'fileencoding', 'filetype'] ] - \ }, - \ 'component': { - \ 'charvaluehex': '0x%B', - \ }, - \ 'component_function': { - \ 'gitbranch': 'LightlineFugitive', - \ 'readonly': 'LightlineReadonly', - \ 'modified': 'LightlineModified', - \ 'filetype': 'LightlineFileType' - \ }, - \ 'tabline': { - \ 'right': [[]] - \ }, - \ 'tab': { - \ 'active': [ 'iconFilename','iconReadonly', 'iconModified' ], - \ 'inactive': [ 'iconFilename', 'iconReadonly', 'iconModified' ] - \ }, - \ 'tab_component_function': { - \ 'iconFilename': 'LightlineTabFilename', - \ 'iconReadonly': 'LightlineTabReadonly', - \ 'iconModified': 'LightlineTabModified' - \ }, - \ 'separator': { 'left': '', 'right': '' }, - \ 'subseparator': { 'left': '', 'right': '' }, - \ 'tabline_separator': { 'left': '▒', 'right': '' }, - \ 'tabline_subseparator': { 'left': '░' } - \ } + \ 'enable': { + \ 'statusline': 1, + \ 'tabline': 1 + \ }, + \ 'colorscheme': 'wombat', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], + \ [ 'gitbranch', 'filename', 'charvaluehex', 'readonly', 'modified' ] ], + \ 'right': [ [ 'lineinfo' ], + \ [ 'fileencoding', 'filetype'] ] + \ }, + \ 'component': { + \ 'charvaluehex': '0x%B', + \ }, + \ 'component_function': { + \ 'gitbranch': 'LightlineFugitive', + \ 'readonly': 'LightlineReadonly', + \ 'modified': 'LightlineModified', + \ 'filetype': 'LightlineFileType' + \ }, + \ 'tabline': { + \ 'right': [[]] + \ }, + \ 'tab': { + \ 'active': [ 'iconFilename','iconReadonly', 'iconModified' ], + \ 'inactive': [ 'iconFilename', 'iconReadonly', 'iconModified' ] + \ }, + \ 'tab_component_function': { + \ 'iconFilename': 'LightlineTabFilename', + \ 'iconReadonly': 'LightlineTabReadonly', + \ 'iconModified': 'LightlineTabModified' + \ }, + \ 'separator': { 'left': '', 'right': '' }, + \ 'subseparator': { 'left': '', 'right': '' }, + \ 'tabline_separator': { 'left': '▒', 'right': '' }, + \ 'tabline_subseparator': { 'left': '░' } +\ } + +" }}} -------------------------< + +" {{{ -------------------------> +" Function modification " Most of the following functions are just modification of source: " Examples from doc file - https://github.com/itchyny/lightline.vim/blob/53176a0b75d6389d775d7bce0d494e58fc654f38/doc/lightline.txt#L583 @@ -318,7 +395,7 @@ endfunction function! LightlineTabFilename(n) abort let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) - let _ = (expand('#'.buflist[winnr - 1].':t') !=# '' ? expand('#'.buflist[winnr - 1].':t') : '[No Name]') + let _ = (expand('#'.buflist[winnr - 1].':t') !=# '' ? expand('#'.buflist[winnr - 1].':t') : '[No Name]') " Limit the width of tabs, so they don't go out of the screen let tabNameLengthMax = &columns/((tabpagenr('$') > 0 ? tabpagenr('$') : 0) + 5) @@ -336,26 +413,24 @@ function! LightlineTabModified(n) abort return gettabwinvar(a:n, winnr, '&modified') ? '' : gettabwinvar(a:n, winnr, '&modifiable') ? '' : '' endfunction -""""""""""""""""""""""""""""""" -" Enable Omni completion -""""""""""""""""""""""""""""""" +" }}} -------------------------< -" Omni completion supports C, HTML, CSS, JavaScript, PHP, Python, Ruby, SQL, XML -filetype plugin on -set omnifunc=syntaxcomplete#Complete " Completion for all supported languages +" }}} =============================< -""""""""""""""""""""""""""""""" +" {{{ =============================> " Ale settings -""""""""""""""""""""""""""""""" let g:ale_linters = { \ 'cs': ['OmniSharp'], \} let b:ale_linters = ['cs'] -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> " OmniSharp settings -""""""""""""""""""""""""""""""" + +let g:syntastic_cs_checkers = ['code_checker'] autocmd Filetype cs nmap gd : OmniSharpGotoDefinition autocmd Filetype cs nmap gy : OmniSharpTypeLookup @@ -365,9 +440,24 @@ autocmd FileType cs nmap : OmniSharpRename autocmd FileType cs nmap ff : OmniSharpCodeFormat autocmd FileType cs nmap fu : OmniSharpFixUsings -""""""""""""""""""""""""""""""" +" }}} =============================< + +" {{{ =============================> +" haskell-vim settings + +let g:haskell_classic_highlighting = 1 +let g:haskell_enable_quantification = 1 " to enable highlighting of `forall` +let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec` +let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc` +let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern` +let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles +let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static` +let g:haskell_backpack = 1 " to enable highlighting of backpack keywords + +" }}} =============================< + +" {{{ =============================> " COC settings -""""""""""""""""""""""""""""""" " All of the following is the example configuration with some values modified " https://github.com/neoclide/coc.nvim#example-vim-configuration @@ -491,8 +581,8 @@ omap ac (coc-classobj-a) " Use CTRL-S for selections ranges. " Requires 'textDocument/selectionRange' support of language server. -nmap (coc-range-select) -xmap (coc-range-select) +" nmap (coc-range-select) +" xmap (coc-range-select) " Add `:Format` command to format current buffer. command! -nargs=0 Format :call CocAction('format') @@ -525,3 +615,5 @@ nnoremap j :CocNext nnoremap k :CocPrev " Resume latest coc list. nnoremap p :CocListResume + +" }}} =============================< -- cgit v1.2.3