summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vimrc306
1 files changed, 199 insertions, 107 deletions
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! <C-BS> <C-w>
-noremap! <C-h> <C-w>
-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 <F8> :<C-u>call gitblame#echo()<CR>
+" }}} -------------------------<
+
+" {{{ ------------------------->
+" Ctrl bindings
+
+" Ctrl-Backspace deletes the previous word in insert mode.
+noremap! <C-BS> <C-w>
+noremap! <C-h> <C-w>
-" 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 <C-c> "+yi<Esc>
vmap <C-x> "+c<Esc>
@@ -73,10 +125,11 @@ vmap <C-v> c<ESC>"+p<Esc>
imap <C-v> <ESC>"+pa
map <C-a> ggVG
imap <C-z> <ESC>ui
-nmap <C-z> u
imap <C-r> <ESC><C-r>i
"imap <C-S-z> <C-r> An impossible dream
imap <C-s> <ESC>:w<CR>a
+nmap <C-S> <ESC>:w<CR>
+map <C-f> :set nomore<Bar>:ls<Bar>:set more<CR>:b<Space>
" Use Ctrl + hjkl for navigation in insert mode
" inoremap <C-h> <Left>
@@ -84,6 +137,15 @@ imap <C-s> <ESC>:w<CR>a
" inoremap <C-k> <Up>
" inoremap <C-l> <Right>
+" Go between tabs with Ctrl+l (tab to the right) and Ctrl+h (tab to the left)
+" nnoremap <C-l> :tabn<CR>
+" nnoremap <C-h> :tabp<CR>
+
+" }}} -------------------------<
+
+" {{{ ------------------------->
+" Comand abbreviations
+
" Cyrilic (Bulgarian yawerty layout) support
ca в w
ca ва wa
@@ -98,28 +160,44 @@ ca xa wa <bar> 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 <C-l> :tabn<CR>
-" nnoremap <C-h> :tabp<CR>
+" }}} -------------------------<
-set number " Show line numbers to the left
+" {{{ ------------------------->
+" Custom app open bindings
+nnoremap <F8> :<C-u>call gitblame#echo()<CR>
nnoremap = :tab ter ++close lazygit<CR>
+" }}} -------------------------<
+
+" {{{ ------------------------->
+" Other bindings
+
" Don't get into insert mode after adding a line with o/O
nnoremap o o<Esc>
nnoremap O O<Esc>
+" Move a line up and down with Alt+k and Alt-j
+execute "set <M-j>=\ej"
+nnoremap <M-j> <ESC>:m+1<CR>
+execute "set <M-k>=\ek"
+nnoremap <M-k> <ESC>:m-2<CR>
+
+" }}} -------------------------<
+
+" {{{ ------------------------->
+" 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 <C-Space> <C-X><C-O>
-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 <silent> <ScrollWheelUp> <c-w>:call EnterNormalMode()<CR>
-"""""""""""""""""""""""""""""""
-" 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 <Tab> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.swp$', '\~$'] " Ignore file, ending with .swp and ~
-"""""""""""""""""""""""""""""""
-" Undotree settings
-"""""""""""""""""""""""""""""""
+" }}} =============================<
+
+" {{{ =============================>
+" Undotree
" Toggle undotree with F5
nmap <F5> :UndotreeToggle<CR>
@@ -212,16 +287,18 @@ if !exists('g:undotree_DiffCommand')
let g:undotree_DiffCommand = "diff"
endif
-"""""""""""""""""""""""""""""""
+" }}} =============================<
+
+" {{{ =============================>
" Tabman
-"""""""""""""""""""""""""""""""
let g:tabman_toggle = '<S-Tab>'
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 <silent> <buffer> gd : OmniSharpGotoDefinition<CR>
autocmd Filetype cs nmap <silent> <buffer> gy : OmniSharpTypeLookup<CR>
@@ -365,9 +440,24 @@ autocmd FileType cs nmap <silent> <buffer> <F2> : OmniSharpRename<CR>
autocmd FileType cs nmap <silent> <buffer> ff : OmniSharpCodeFormat<CR>
autocmd FileType cs nmap <silent> <buffer> fu : OmniSharpFixUsings<CR>
-"""""""""""""""""""""""""""""""
+" }}} =============================<
+
+" {{{ =============================>
+" 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 <Plug>(coc-classobj-a)
" Use CTRL-S for selections ranges.
" Requires 'textDocument/selectionRange' support of language server.
-nmap <silent> <C-s> <Plug>(coc-range-select)
-xmap <silent> <C-s> <Plug>(coc-range-select)
+" nmap <silent> <C-s> <Plug>(coc-range-select)
+" xmap <silent> <C-s> <Plug>(coc-range-select)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
@@ -525,3 +615,5 @@ nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list.
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
+
+" }}} =============================<