From f3ea7c8003c7a65de29c2f4e0e1bf0d592dd0ad8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 28 Jan 2024 16:05:38 +0200 Subject: [.vimrc] Reworked entire vimrc --- .vim/.vimrc | 57 -------------- .vim/autocommands.vim | 45 +++++++++++ .vim/main.vim | 111 ++++++++++++++++++++++++++ .vim/mappings.vim | 143 +++++++++++++--------------------- .vim/miniplugins/code_terminal.vim | 85 -------------------- .vim/miniplugins/spell_check_mode.vim | 33 -------- .vim/miniplugins/statusline.vim | 111 -------------------------- .vim/miniplugins/tabline.vim | 91 ---------------------- .vim/plugins_conf.vim | 83 ++++++++++++++++++++ .vim/plugins_list.vim | 49 ++++++++++++ .vim/pluginsettings.vim | 66 ---------------- .vim/settings.vim | 86 -------------------- .vimrc | 2 +- 13 files changed, 342 insertions(+), 620 deletions(-) delete mode 100644 .vim/.vimrc create mode 100644 .vim/autocommands.vim create mode 100644 .vim/main.vim delete mode 100644 .vim/miniplugins/code_terminal.vim delete mode 100644 .vim/miniplugins/spell_check_mode.vim delete mode 100644 .vim/miniplugins/statusline.vim delete mode 100644 .vim/miniplugins/tabline.vim create mode 100644 .vim/plugins_conf.vim create mode 100644 .vim/plugins_list.vim delete mode 100644 .vim/pluginsettings.vim delete mode 100644 .vim/settings.vim diff --git a/.vim/.vimrc b/.vim/.vimrc deleted file mode 100644 index e6cbf99..0000000 --- a/.vim/.vimrc +++ /dev/null @@ -1,57 +0,0 @@ -runtime settings.vim -runtime mappings.vim - -call plug#begin('~/.vim/plugged') - -""" Visuals -Plug 'morhetz/gruvbox', {'rtp': 'vim'} " Color theme -Plug 'ryanoasis/vim-devicons' " Icons on stuff like NERDTree -" Plug 'AndrewRadev/popup_scrollbar.vim' " Scrollbar - -""" Quality of life -Plug 'tomtom/tcomment_vim' " Toggle comments (gc, gcc) -" Plug 'Raimondi/delimitMate' " Autocomplete brackets and quotes -Plug 'preservim/nerdtree' " Browse directories (:NERDTree) -Plug 'mbbill/undotree' " Easily interact with undo history -Plug 'godlygeek/tabular' " Line up text by a given character (:Tabularize /CHAR) -Plug 'tpope/vim-eunuch' " Easy UNIX shell commands -Plug 'alvan/vim-closetag' " Automatically add HTML closing tags -Plug 'kien/tabman.vim' " Show open buffers -Plug 'ervandew/supertab' " Makes be nicer to use with Omnicompletion -Plug 'tpope/vim-surround' " Add and change surrounding quotes and braces - -""" Software development -Plug 'dense-analysis/ale' " Linting with LSP -Plug 'editorconfig/editorconfig-vim' " Support for EditorConfig -Plug 'zivyangll/git-blame.vim' " Show who last edited a line -Plug 'wakatime/vim-wakatime' " Time tracking via wakatime.com - -""" Language integration -Plug 'dNitro/vim-pug-complete', { 'for': ['jade', 'pug'] } " Pug: Omnicompletion integration -Plug 'digitaltoad/vim-pug', { 'for': ['jade', 'pug'] } " Pug: Filetype detection, identation, syntax highlighting -Plug 'bfrg/vim-cpp-modern', { 'for': ['c', 'cpp'] } " C/C++: Better syntax highlighting -Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' } " haskell: Adds identation -Plug 'vim-scripts/syntaxhaskell.vim', { 'for': 'haskell' } " haskell: Better syntax highlighting -Plug 'AndrewRadev/id3.vim' " mp3: Proper metadata editing - -Plug 'https://gitlab.com/Syndamia/texty-office.vim' - -call plug#end() - -""" -""" Package plugins -""" - -packadd! matchit - -""" -""" Manual plugins -""" - -runtime miniplugins/code_terminal.vim -runtime miniplugins/statusline.vim -runtime miniplugins/tabline.vim -runtime miniplugins/spell_check_mode.vim - -runtime pluginsettings.vim - diff --git a/.vim/autocommands.vim b/.vim/autocommands.vim new file mode 100644 index 0000000..9100420 --- /dev/null +++ b/.vim/autocommands.vim @@ -0,0 +1,45 @@ +""" +""" Settings +""" + +autocmd FileType * set foldmethod=syntax + +autocmd BufRead,BufNewFile * set foldtext=MyFoldText() +function! MyFoldText() + " Gets the first fold line and replace tabs with spaces (as many as shiftwidth is set to) + let line = substitute(getline(v:foldstart), "\t", repeat(" ", shiftwidth(0)), "") + + " Calculates amount of folded lines + let linecount = v:foldend - v:foldstart + + " Shows our line, then a lot of spaces, and at the very end we have line number and arrows + return line . repeat(" ", winwidth('%') - strlen(line) - 10 - strlen(linecount)) + \ . "  " . linecount . "  " +endfunction + +" autocmd BufEnter * call ResizeOnEnter() +function! ResizeOnEnter() + vert res &columns/2 + hor res &lines*2/3 + + for bufN in range(1, bufnr('$')) + if bufname(bufN) =~ "NERD_tree" + call setbufvar(bufN, "&winwidth", 31) + endif + endfor +endfunction + +""" +""" Config file formatting +""" + +autocmd FileType vim,sh,zsh,xdefaults setlocal foldlevel=0 + +""" +""" Programming language formatting +""" + +autocmd FileType css,ts setlocal ts=2 sw=2 sts=0 expandtab " Transform tabs in CSS and TS into 2 spaces + +autocmd FileType lisp,scheme,haskell setlocal ts=2 sw=2 sts=0 expandtab +autocmd BufRead,BufNewFile *.component.css set filetype=css diff --git a/.vim/main.vim b/.vim/main.vim new file mode 100644 index 0000000..a60795d --- /dev/null +++ b/.vim/main.vim @@ -0,0 +1,111 @@ +""" +""" Runtimes +""" + +runtime plugins_list.vim +runtime plugins_conf.vim + +runtime mappings.vim +runtime autocommands.vim + +runtime feat/code_terminal.vim +runtime feat/spell_check_mode.vim +runtime feat/statusline.vim +runtime feat/tabline.vim +runtime feat/term_scroll.vim + +""" +""" Settings +""" + +"" +"" Colors +"" + +colorscheme gruvbox +set background=dark + +syntax on +filetype plugin indent on +set nohlsearch + +"" +"" Cursor +"" + +set scrolloff=5 " Lines above and below cursor +set showmatch " Jump to opening brace + +let &t_SI = "\e[5 q" " thin cursor on insert mode +let &t_SR = "\e[4 q" " underline on replace mode +let &t_EI = "\e[1 q" " block on normal mode + +" Highlight current line but not in insert mode +set cul +autocmd InsertEnter,InsertLeave * set cul! + +"" +"" Characters and keys +"" + +set list " Customize white-space characters +set listchars=tab:│\ ,extends:>,precedes:< +set tabstop=4 " Show tabs as 4 spaces +set shiftwidth=4 " Indent with 4 spaces + +set backspace=indent,eol,start +set mouse=a + +"" +"" Folding +"" + +set foldlevel=99 +hi Folded ctermfg=NONE + +"" +"" Splitting +"" + +set splitbelow splitright + +"" +"" History +"" + +set history=1000 +set undofile +set undodir=~/.vim/vimundo + +"" +"" Menus +"" + +set number +set signcolumn=number +set wildmenu +set wildmode=list:longest,full +set shortmess=acTOI + +"" +"" Spelling +"" + +set langmap=АA,аa,БB,бb,ВW,вw,ГG,гg,ДD,дd,ЕE,еe,ЖV,жv,ЗZ,зz,ИI,иi,ЙJ,йj,КK,кk,ЛL,лl,МM,мm,НN,нn,ОO,оo,ПP,пp,РR,рr,СS,сs,ТT,тt,УU,уu,ФF,фf,ХH,хh,ЦC,цc,Ч~,ч`,Ш{,ш[,Щ},щ],ЪY,ъy,ЬX,ьx,Ю\|,ю\\,ЯQ,яq +set spelllang=en,bg_BG " Adds Bulgarian to spelling languages + +"" +"" ToHTML +"" + +let g:html_line_ids = 1 +let g:html_dynamic_folds = 1 + +"" +"" Other +"" + +autocmd BufRead,BufNewFile * set tw=0 " Sets textwidth to 0 for all files (set with autocmd since just doing "set tw=0" can be overridden) + +set showcmd +set incsearch diff --git a/.vim/mappings.vim b/.vim/mappings.vim index 406c112..c620b69 100644 --- a/.vim/mappings.vim +++ b/.vim/mappings.vim @@ -1,123 +1,86 @@ -" Ctrl-C, Ctrl-V, ... {{{ - " Partly taken from: https://gist.github.com/jshih/3423345 - inoremap :w - inoremap + - inoremap ggVG - inoremap - inoremap u - - nnoremap :w - nnoremap ggVG - - xnoremap c+ - xnoremap ggVG - xnoremap "+y - xnoremap "+d -" }}} - -" Move lines with Alt-J, Alt-K {{{ - execute "set =\ej" - nnoremap :m+1 - execute "set =\ek" - nnoremap :m-2 - - xnoremap :m '>+1gv=gv - xnoremap :m '<-2gv=gv -" }}} - -" Omni completion (really needs a rework) {{{ - " 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 - inoremap - - " Thanks to: https://vim.fandom.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE - " set completeopt=longest,menuone - " [ The following are disabled, because they conflict with delimitMate's autobracket feature ] - " inoremap pumvisible() ? "\" : "\u\" - " inoremap pumvisible() ? '' : '=pumvisible() ? "\Down>" : ""' - - " "Disables" arrow navigation in completion menu - inoremap pumvisible() ? '' : '' - inoremap pumvisible() ? '' : '' - - " Pressing tab goes from top to bottom - let g:SuperTabContextDefaultCompletionType = "" -" }}} - -" When line is wrapped, going up or down will also go into the wrapped part -" move in wrapped lines when no count prefix +""" +""" Single key +""" + +nnoremap :mksession! .vim-session + noremap :ALERename +nnoremap :UndotreeToggle +nnoremap :call gitblame#echo() + +nnoremap :NERDTreeToggle + nnoremap k (v:count == 0 ? 'gk' : 'k') -xnoremap k (v:count == 0 ? 'gk' : 'k') nnoremap j (v:count == 0 ? 'gj' : 'j') +xnoremap k (v:count == 0 ? 'gk' : 'k') xnoremap j (v:count == 0 ? 'gj' : 'j') -" Don't move cursor one character back on esc key press -" inoremap :stopinsert +nnoremap \| :tab ter ++close lazygit + +""" +""" Shift + key +""" -" Don't get into insert mode after adding a line with o/O -" nnoremap o o -" nnoremap O O +let g:tabman_toggle = '' -" Thanks https://github.com/drzel/vim-split-line -nnoremap K :keep s/\s*\%#\s*/\r/e noh +""" +""" Control + key +""" + +inoremap :w +inoremap "+p +inoremap ggVG +inoremap +inoremap u + +nnoremap :w +nnoremap ggVG + +xnoremap "+p +xnoremap "+y +xnoremap "+d -" Better resizing when navigating splits nnoremap l= nnoremap h= nnoremap j= nnoremap k= + tnoremap l= tnoremap h= tnoremap j= tnoremap k= -" Ctrl-Backspace deletes the previous word in insert mode. inoremap cnoremap inoremap cnoremap -" Make session file -nnoremap :mksession! .vim-session +""" +""" Alt + key +""" -" Show who edited the current line from git history -nnoremap :call gitblame#echo() +" Move lines up/down with Alt-J/K +execute "set =\ej" +nnoremap :m+1 +execute "set =\ek" +nnoremap :m-2 -" Open lazygit in a new tab with = -nnoremap \| :tab ter ++close lazygit +xnoremap :m '>+1gv=gv +xnoremap :m '<-2gv=gv -" Tab navigtion execute "set =\eo" nnoremap gT inoremap gT tnoremap gT + execute "set =\ep" nnoremap gt inoremap gt tnoremap gt -" Arrows = bad -inoremap -inoremap -inoremap -inoremap -nnoremap -nnoremap -nnoremap -nnoremap - -" Cyrillic (Bulgarian yawerty layout) support -ca в w -ca ва wa -ca ь x -ca ьа xa - -" Make x and xa just save and quit without saving. This allows for closing all tabs and terminals. -ca x w q! -ca xa wa qa! - -" Open a terminal vim tab with tt and open a blank tab with te -ca tt tab ter -ca te tabe +""" +""" Two keys +""" + +nnoremap gd (ale_go_to_definition) +nnoremap gi (ale_go_to_implementation) +nnoremap ff (ale_hover) diff --git a/.vim/miniplugins/code_terminal.vim b/.vim/miniplugins/code_terminal.vim deleted file mode 100644 index 4ddc1ae..0000000 --- a/.vim/miniplugins/code_terminal.vim +++ /dev/null @@ -1,85 +0,0 @@ -" Program in which build actions are executed. If no value, build commands are executes as bash commands. -" This is only really useful in languages with interpreters -let g:codeenvs = { -\ 'scheme' : 'racket', -\ 'lisp' : 'rlwrap sbcl --noinform', -\ } - -" The following two dictionaries support certain substitutions: -" %F - location of current file (relative path) -" %D - directory of current file (full path) - -" Building the current file only -let g:codebuildsingle = { -\ 'scheme' : '(enter! "%F")', -\ 'cpp' : "g++ -g -pedantic '%F' && ./a.out", -\ 'yacc' : 'bison -t -d %F', -\ 'lex' : 'flex %F', -\ 'haskell' : 'runhaskell "%F"', -\ 'lisp' : '(load "%F")', -\ } -" Building all files in the directory (and subdirectories) of the current file -let g:codebuildproject = { -\ 'cpp' : "g++ -g -pedantic '%D/'**/*.cpp && ./a.out" -\ } - -noremap :call CodeTerminal(g:codebuildsingle) -noremap :call CodeTerminal(g:codebuildproject) -inoremap :call CodeTerminal(g:codebuildsingle) -inoremap :call CodeTerminal(g:codebuildproject) -" We assume that the last accessed window is the one with the source code, otherwise it gets complicated -tnoremap :call CodeTerminal(g:codebuildsingle) -tnoremap :call CodeTerminal(g:codebuildproject) - -au TabNew * call CTCreateTabVars() - -function! CTCreateTabVars() - let t:codetermbufnr = -1 - let t:codetermft = "" - let t:codetermhadenv = 0 -endfunction -call CTCreateTabVars() - -function! OpenCodeTerminal() - if !bufexists(t:codetermbufnr) - term - " Latest buffer is the terminal buffer we just opened - let t:codetermbufnr = bufnr("$") - " We go back to the file from which this was called - wincmd p - let t:codetermft = "" - let t:codetermhadenv = 0 - endif - - if &filetype != t:codetermft - if t:codetermhadenv - " This is kinda bad, since certain environments might not close with this only - call term_sendkeys(t:codetermbufnr, "\") - " The sleep is kinda bad, but it fixes the next term_sendkeys not working properly - sleep 500m - endif - - let t:codetermft = &filetype - if has_key(g:codeenvs, &filetype) - call term_sendkeys(t:codetermbufnr, g:codeenvs[&filetype] . "\") - let t:codetermhadenv = 1 - else - let t:codetermhadenv = 0 - endif - endif -endfunction - -function! CodeTerminal(builddict) - call OpenCodeTerminal() - - if has_key(a:builddict, &filetype) - let buildcomm = a:builddict[&filetype] . "\" - let buildcomm = substitute(buildcomm, "%F", @%, "") - let buildcomm = substitute(buildcomm, "%D", expand('%:p:h'), "") - call term_sendkeys(t:codetermbufnr, buildcomm) - echo "[CodeTerminal] Sent build command!" - else - call term_sendkeys(t:codetermbufnr, "\\") - echo "[CodeTerminal] No value in build dictionary!" - endif -endfunction diff --git a/.vim/miniplugins/spell_check_mode.vim b/.vim/miniplugins/spell_check_mode.vim deleted file mode 100644 index cfdd46a..0000000 --- a/.vim/miniplugins/spell_check_mode.vim +++ /dev/null @@ -1,33 +0,0 @@ -" When you press F6 it will toggle a "spell check mode", -" spell is activated and the colour scheme is changed -nmap :call SpellCheckModeToggle() - -function! SpellCheckModeToggle() - if g:colors_name == 'gruvbox' - set spell - colorscheme darkblue - else - set nospell - colorscheme gruvbox - endif -endfunction - -" Scrolling (shows history) in terminal (except in lazygit) -" Scroll up to activate it, and press a to deactivate it -" Slightly modified version of: https://github.com/vim/vim/issues/2490#issuecomment-393973253 -tmap :call EnterNormalMode() - -function! ExitNormalMode() - unmap - call feedkeys("a") -endfunction - -function! EnterNormalMode() - if @% == '!lazygit' - tunmap - elseif &buftype == 'terminal' && mode('') == 't' - call feedkeys("\N") - call feedkeys("\") - map :call ExitNormalMode() - endif -endfunction diff --git a/.vim/miniplugins/statusline.vim b/.vim/miniplugins/statusline.vim deleted file mode 100644 index 78a771d..0000000 --- a/.vim/miniplugins/statusline.vim +++ /dev/null @@ -1,111 +0,0 @@ -" Needed settings -set laststatus=2 -set timeoutlen=1000 ttimeoutlen=50 -set noshowmode - -" Logic - -let leftcap = '' -let rightcap = '' -let leftmcap = '' -let rightmcap = '' - -let g:activesl = '' -let g:inactivesl = '' - -" Colors {{{ - autocmd ColorScheme * call SLCreateHighlightGroups() - - function! SLCreateHighlightGroups() - hi SLMode ctermfg=1 ctermbg=0 - hi SLModeC ctermfg=1 ctermbg=0 - - hi SLRowCol ctermfg=238 ctermbg=244 - hi SLRowColC ctermfg=244 ctermbg=239 - endfunction - call SLCreateHighlightGroups() -" }}} - -" Mode {{{ - " Values are, in order, for: normal (default), insert, replace, visual modes - " [ctermfg, ctermbg] - let s:modecolors = [ - \ ['236', '117'], - \ ['236', '119'], - \ ['236', '203'], - \ ['236', '216'], - \] - - let g:modestring = '' - - function! SLModeSetter() - let cm = mode() - let ind = 0 - - if cm == 'i' - let ind = 1 - elseif cm == 'R' - let ind = 2 - let cm = 'r' - elseif cm == 'v' - let ind = 3 - endif - - call hlset([#{name: 'SLMode', ctermfg: s:modecolors[l:ind][0], ctermbg: s:modecolors[l:ind][1]}]) - call hlset([#{name: 'SLModeC', ctermfg: s:modecolors[l:ind][1], ctermbg: '239'}]) - let g:modestring = l:cm - - return '' - endfunction - - let g:activesl ..= '%#StatusLine#%{SLModeSetter()}%#SLModeC#%{leftcap}%#SLMode#%{modestring}%#SLModeC#%{rightcap}%<' - " \______leftcap______/\________mode_______/\______rightcap_____/ - let g:inactivesl ..= '%#StatusLineNC# %<' -" }}} - -" Filename {{{ - let g:_filename = ' %f %{rightmcap}' - let g:activesl ..= '%#StatusLine#'..g:_filename - let g:inactivesl ..= '%#StatusLineNC#'..g:_filename -" }}} - -" File stat {{{ - function! SLReadonly() - return (&ft !~? 'vimfiler' && &readonly) ? ' ' : '' - endfunction - - function! SLModified() - return (&ft =~ 'vimfiler') ? '' : (&modified ? '' : (&modifiable ? '' : '')) - endfunction - - let g:_filestat = ' %{SLReadonly()}%{SLModified()} ' - let g:activesl ..= g:_filestat - let g:inactivesl ..= g:_filestat -" }}} - -" Middle separator {{{ - let g:activesl ..= '%=' - let g:inactivesl ..= '%=' -" }}} - -" Filetype {{{ - let g:_filetype = '%{leftmcap} %{WebDevIconsGetFileTypeSymbol()} %{&ft} ' - let g:activesl ..= g:_filetype - let g:inactivesl ..= g:_filetype -" }}} - -" Line and column count {{{ - let g:_linecol = '%#SLRowColC#%{leftcap}%#SLRowCol#%l:%c%#SLRowColC#%{rightcap}' - let g:activesl ..= g:_linecol - let g:inactivesl ..= g:_linecol -" }}} - -" Statusline setting {{{ - set statusline= - - augroup SLModeAU - au! - au WinEnter,BufEnter * setlocal statusline=%!g:activesl - au WinLeave,BufLeave * setlocal statusline=%!g:inactivesl - augroup end -" }}} diff --git a/.vim/miniplugins/tabline.vim b/.vim/miniplugins/tabline.vim deleted file mode 100644 index bb6fe57..0000000 --- a/.vim/miniplugins/tabline.vim +++ /dev/null @@ -1,91 +0,0 @@ -let tabcap = '' -let tabmiddlecap = '' - -set tabline=%!TablineGenerator() - -" Tab data/helper functions {{{ - function! TabFilename(n) - let buflist = tabpagebuflist(a:n) - let winnr = tabpagewinnr(a:n) - 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) - - return WebDevIconsGetFileTypeSymbol(_) .. ' ' .. _[0:tabNameLengthMax] - endfunction - - function! TabReadonly(n) - let winnr = tabpagewinnr(a:n) - return gettabwinvar(a:n, winnr, '&readonly') ? ' ' : '' - endfunction - - function! TabModified(n) - let winnr = tabpagewinnr(a:n) - return gettabwinvar(a:n, winnr, '&modified') ? ' ' : (gettabwinvar(a:n, winnr, '&modifiable') ? '' : ' ') - endfunction -" }}} - -" Colors {{{ - autocmd ColorScheme * call TLCreateHighlightGroups() - - " Colorscheme clears highlights https://vi.stackexchange.com/a/3356 - function! TLCreateHighlightGroups() - hi TLTab ctermfg=252 ctermbg=242 - hi TLTabSel ctermfg=252 ctermbg=235 - hi TLRest ctermfg=248 ctermbg=238 - - let s:hi_tltab = hlget('TLTab')[0] - let s:hi_tltabsel = hlget('TLTabSel')[0] - let s:hi_tlrest = hlget('TLRest')[0] - call hlset([#{name: 'TLTabSelLC', ctermfg: s:hi_tltab['ctermbg'], ctermbg: s:hi_tltabsel['ctermbg'] }, - \ #{name: 'TLTabSelRC', ctermfg: s:hi_tltabsel['ctermbg'], ctermbg: s:hi_tltab['ctermbg'] }, - \ #{name: 'TLTabSelRCF', ctermfg: s:hi_tltabsel['ctermbg'], ctermbg: s:hi_tlrest['ctermbg'] }, - \ #{name: 'TLTabRCF', ctermfg: s:hi_tltab['ctermbg'], ctermbg: s:hi_tlrest['ctermbg'] }]) - endfunction - call TLCreateHighlightGroups() -" }}} - -function! TablineGenerator() - let s = '' - - " For each tab i - for i in range(1, tabpagenr('$')) - " Sets the tab page number, so that mouse clicks work - let s ..= '%' .. i .. 'T' - - let innerText = '%{TabFilename(' .. i .. ')}%{TabReadonly(' .. i .. ')}%{TabModified(' .. i .. ')} ' - - " If tab is the selected one - if i == tabpagenr() - " If tab isn't the left most - if i > 1 - let s ..= '%#TLTabSelLC#%{tabcap}' - endif - - let s ..= '%#TLTabSel# ' .. l:innerText - - " If tab is the last one, right cap bg color has to be different - let s ..= (i == tabpagenr('$') ? '%#TLTabSelRCF#' : '%#TLTabSelRC#') .. '%{tabcap}' - - else - let s ..= '%#TLTab#' - " If tab isn't to the right of selected and isn't the left most - if (i-1 != tabpagenr()) && (i > 1) - let s ..= '%{tabmiddlecap}' - endif - - let s ..= ' ' .. l:innerText - - " Last tab has to have a tabcap - if i == tabpagenr('$') - let s ..= '%#TLTabRCF#%{tabcap}' - endif - endif - endfor - - " After last tab, fill with TLRest - let s ..= '%#TLRest#%T' - - return s -endfunction diff --git a/.vim/plugins_conf.vim b/.vim/plugins_conf.vim new file mode 100644 index 0000000..32f95b8 --- /dev/null +++ b/.vim/plugins_conf.vim @@ -0,0 +1,83 @@ +" This file must NOT have any mappings! + +""" +""" ALE +""" + +set omnifunc=ale#completion#OmniFunc +let g:ale_completion_enabled = 1 + +let g:ale_cursor_detail = 1 +let g:ale_set_balloons = 1 +let g:ale_hover_to_floating_preview = 1 + +" set ttymouse=xterm +let g:ale_floating_preview = 1 " Use floating window +let g:ale_floating_window_border = [] + +let g:ale_typescript_tsserver_use_global = 1 " Use global tsserver package + +""" +""" DelimitMate +""" + +let delimitMate_expand_cr = 1 +" Don't autocomplete diamond brackets in HTML (compatibility with closetag plugin) +autocmd FileType html let b:delimitMate_matchpairs='(:),[:],{:}' + +""" +""" gruvbox +""" + +let g:gruvbox_contrast_dark = 'hard' + +""" +""" NERDTree +""" + +let NERDTreeShowHidden = 1 +let NERDTreeWinPos = "right" +let NERDTreeIgnore = ['\.swp$', '\~$'] " Ignore file, ending with .swp and ~ + +" Do not save blank screens, solves https://github.com/preservim/nerdtree/issues/745 +set sessionoptions-=blank + +""" +""" popup_scrollbar +""" + +let g:popup_scrollbar_auto = 1 +let g:popup_scrollbar_shape = { + \ 'head': '', + \ 'body': '│', + \ 'tail': '', } +let g:popup_scrollbar_highlight = 'Comment' + +""" +""" SuperTab +""" + +let g:SuperTabDefaultCompletionType = "context" + +""" +""" Tabman +""" + +let g:tabman_side = 'right' + +""" +""" texty-office +""" + +let g:texty_office_executable_directory='/home/kamen/Programming/GitLab-repos/texty-office' +" let g:texty_office_pretty_mode=1 + +""" +""" Undotree +""" + +let g:undotree_WindowLayout = 2 +let g:undotree_ShortIndicators = 1 " e.g. using 'd' instead of 'days' to save some space. +let g:undotree_SetFocusWhenToggle = 1 " if set, let undotree window get focus after being opened, otherwise focus will stay in current window. +let g:undotree_TreeNodeShape = '*' +let g:undotree_DiffCommand = "diff" diff --git a/.vim/plugins_list.vim b/.vim/plugins_list.vim new file mode 100644 index 0000000..0d2dc62 --- /dev/null +++ b/.vim/plugins_list.vim @@ -0,0 +1,49 @@ +""" +""" vim-plug plugins +""" + +call plug#begin('~/.vim/plugged') + +""" Visuals +Plug 'morhetz/gruvbox', {'rtp': 'vim'} " Color theme +Plug 'ryanoasis/vim-devicons' " Icons on stuff like NERDTree +" Plug 'AndrewRadev/popup_scrollbar.vim' " Scrollbar + +""" Quality of life +Plug 'tomtom/tcomment_vim' " Toggle comments (gc, gcc) +" Plug 'Raimondi/delimitMate' " Autocomplete brackets and quotes +Plug 'preservim/nerdtree' " Browse directories (:NERDTree) +Plug 'mbbill/undotree' " Easily interact with undo history +Plug 'godlygeek/tabular' " Line up text by a given character (:Tabularize /CHAR) +Plug 'tpope/vim-eunuch' " Easy UNIX shell commands +Plug 'alvan/vim-closetag' " Automatically add HTML closing tags +Plug 'kien/tabman.vim' " Show open buffers +Plug 'ervandew/supertab' " Makes be nicer to use with Omnicompletion +Plug 'tpope/vim-surround' " Add and change surrounding quotes and braces +Plug 'ntpeters/vim-better-whitespace' " Highlight trailing whitespaces + +""" Software development +Plug 'dense-analysis/ale' " Linting with LSP +Plug 'editorconfig/editorconfig-vim' " Support for EditorConfig +Plug 'zivyangll/git-blame.vim' " Show who last edited a line +Plug 'wakatime/vim-wakatime' " Time tracking via wakatime.com + +""" Language integration +Plug 'dNitro/vim-pug-complete', { 'for': ['jade', 'pug'] } " Pug: Omnicompletion integration +Plug 'digitaltoad/vim-pug', { 'for': ['jade', 'pug'] } " Pug: Filetype detection, identation, syntax highlighting +Plug 'bfrg/vim-cpp-modern', { 'for': ['c', 'cpp'] } " C/C++: Better syntax highlighting +Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' } " haskell: Adds identation +Plug 'vim-scripts/syntaxhaskell.vim', { 'for': 'haskell' } " haskell: Better syntax highlighting +Plug 'AndrewRadev/id3.vim' " mp3: Proper metadata editing +Plug 'vim-scripts/XML-Folding' " xml: Proper syntax folding + +Plug 'https://gitlab.com/Syndamia/texty-office.vim' +Plug 'tpope/vim-afterimage' + +call plug#end() + +""" +""" Package plugins +""" + +packadd! matchit diff --git a/.vim/pluginsettings.vim b/.vim/pluginsettings.vim deleted file mode 100644 index b1d3a17..0000000 --- a/.vim/pluginsettings.vim +++ /dev/null @@ -1,66 +0,0 @@ -" 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 {{{ - " Toggle NERDTree with Tab - nmap :NERDTreeToggle - - let NERDTreeShowHidden = 1 - let NERDTreeWinPos = "right" - let NERDTreeIgnore = ['\.swp$', '\~$'] " Ignore file, ending with .swp and ~ - - " Do not save blank screens, solves https://github.com/preservim/nerdtree/issues/745 - set sessionoptions-=blank -" }}} - -" Undotree {{{ - " Toggle undotree with F5 - nmap :UndotreeToggle - - let g:undotree_WindowLayout = 2 - let g:undotree_ShortIndicators = 1 " e.g. using 'd' instead of 'days' to save some space. - let g:undotree_SetFocusWhenToggle = 1 " if set, let undotree window get focus after being opened, otherwise focus will stay in current window. - let g:undotree_TreeNodeShape = '*' - let g:undotree_DiffCommand = "diff" -" }}} - -" Tabman {{{ - let g:tabman_toggle = '' - let g:tabman_side = 'right' -" }}} - -" SuperTab {{{ - let g:SuperTabDefaultCompletionType = "context" -" }}} - -" ALE {{{ - map :ALERename - map gd :ALEGoToDefinition - map gi :ALEHover - map ge :ALEDetail - - set omnifunc=ale#completion#OmniFunc - let g:ale_completion_enabled = 1 - - let g:ale_floating_preview = 1 " Use floating window - let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰'] " Nicer borders - - let g:ale_typescript_tsserver_use_global = 1 " Use global tsserver package -" }}} - -" texty-office {{{ - let g:texty_office_executable_directory='/home/kamen/Programming/GitLab-repos/texty-office' - " let g:texty_office_pretty_mode=1 -" }}} - -" popup_scrollbar {{{ - let g:popup_scrollbar_auto = 1 - let g:popup_scrollbar_shape = { - \ 'head': '', - \ 'body': '│', - \ 'tail': '', } - let g:popup_scrollbar_highlight = 'Comment' -" }}} diff --git a/.vim/settings.vim b/.vim/settings.vim deleted file mode 100644 index dd83663..0000000 --- a/.vim/settings.vim +++ /dev/null @@ -1,86 +0,0 @@ -" Color scheme {{{ - colorscheme gruvbox - let g:gruvbox_contrast_dark = 'hard' - set background=dark " Setting dark mode -" }}} - -" Cursor {{{ - set scrolloff=5 " Screen lines above and below the cursor - set showmatch " Cursor jumps to matching opening bracket automatically - - let &t_SI = "\e[5 q" " thin cursor on insert mode - let &t_SR = "\e[4 q" " underline on replace mode - let &t_EI = "\e[1 q" " block on normal mode - - set cul " Highlight current cursor line - autocmd InsertEnter,InsertLeave * set cul! " Don't highlight current line, when in insert mode -" }}} - -" Indentation {{{ - set tabstop=4 " Show tabs as 4 wide - set shiftwidth=4 " Indent with 4 spaces - - autocmd FileType css,ts setlocal ts=2 sw=2 sts=0 expandtab " Transform tabs in CSS and TS into 2 spaces - autocmd FileType lisp,scheme,haskell setlocal ts=2 sw=2 sts=0 expandtab -" }}} - -" Folding {{{ - autocmd FileType * set foldmethod=syntax " Syntax folding for all - autocmd FileType vim,text,sh,zsh,xdefaults setlocal foldmethod=marker " Overrides folding to marker for types - - set foldlevel=99 " Open all folds by default - autocmd FileType vim,sh,zsh,xdefaults setlocal foldlevel=0 " Close all folds by defualt on filetypes - - set foldtext=MyFoldText() " Custom text for a fold - function MyFoldText() - let line = substitute(getline(v:foldstart), "\t", repeat(" ", shiftwidth(0)), "") " Gets the first fold line and replace tabs with spaces (as many as shiftwidth is set to) - let linecount = v:foldend - v:foldstart " Calculates amount of folded lines - return line . repeat(" ", winwidth('%') - strlen(line) - 10 - strlen(linecount)) - \ . "  " . linecount . "  " " Shows our line, then a lot of spaces, and at the very end we have line number and arrows - endfunction -" }}} - -" Splits {{{ - autocmd VimEnter,VimResized * let &winwidth=&columns/2 | let &winheight=&lines*2/3 -" }}} - -set list " Enabled customization of white space characters, so spaces, tabs, EOL, etc. (:h 'list') - -" Show tabs as a | with three spaces -" When line extends beyond the screen, use > (and <) characters -set listchars=tab:│\ ,extends:>,precedes:< - -autocmd BufReadPre,FileReadPre * call NoWrapIfHasLongLine() -function! NoWrapIfHasLongLine() - let longestline = system("wc -L " . bufname("%") . " | awk '{print $1}'") - if longestline > 840 - set nowrap - endif -endfunction - -set backspace=indent,eol,start " Better backspace functionality - -filetype plugin indent on -syntax on " Syntax highlighting -set number " Show line numbers to the left -set signcolumn=number " Show signs and numbers on the same column -set mouse=a " Mouse support -set showcmd -set wildmenu -set wildmode=list:longest,full -set history=1000 -set incsearch -set shortmess=acTOI -set undodir=~/.vim/vimundo -set undofile - -" For TOhtml -let g:html_line_ids = 1 -let g:html_dynamic_folds = 1 - -autocmd BufRead,BufNewFile * set tw=0 " Sets textwidth to 0 for all files (set with autocmd since just doing "set tw=0" can be overridden) -autocmd BufRead,BufNewFile *.component.css set filetype=css - -" Language mapping for (bulgarian) cyrillic characters to english -set langmap=АA,аa,БB,бb,ВW,вw,ГG,гg,ДD,дd,ЕE,еe,ЖV,жv,ЗZ,зz,ИI,иi,ЙJ,йj,КK,кk,ЛL,лl,МM,мm,НN,нn,ОO,оo,ПP,пp,РR,рr,СS,сs,ТT,тt,УU,уu,ФF,фf,ХH,хh,ЦC,цc,Ч~,ч`,Ш{,ш[,Щ},щ],ЪY,ъy,ЬX,ьx,Ю\|,ю\\,ЯQ,яq -set spelllang=en,bg_BG " Adds Bulgarian to spelling languages diff --git a/.vimrc b/.vimrc index 73e1a2a..f651526 120000 --- a/.vimrc +++ b/.vimrc @@ -1 +1 @@ -.vim/.vimrc \ No newline at end of file +./.vim/main.vim \ No newline at end of file -- cgit v1.2.3