From 6c715d2cbe290e1868f96bba4b3b184ecee558ee Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 7 Nov 2022 12:41:28 +0200 Subject: [vimrc] Moved spell check mode and code terminal into their own section, put all plugin configs into their own section --- .vimrc | 302 +++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 153 insertions(+), 149 deletions(-) diff --git a/.vimrc b/.vimrc index 2f17c23..0746302 100644 --- a/.vimrc +++ b/.vimrc @@ -39,7 +39,7 @@ let g:gruvbox_contrast_dark = 'hard' set background=dark " Setting dark mode " }}} - + " Character visuals {{{ set list " Enabled customization of white space characters, so spaces, tabs, EOL, etc. (:h 'list') @@ -47,7 +47,7 @@ " DO NOT remove the trailing space in the next line! set listchars=tab:│\ " }}} - + " Backspace and cursor {{{ set cul " Highlight current cursor line autocmd InsertEnter,InsertLeave * set cul! " Don't highlight current line, when in insert mode @@ -71,7 +71,7 @@ au VimLeave * silent execute '!echo -ne "\e[ q"' | redraw! endif " }}} - + " Indentation {{{ set tabstop=4 " Show tabs as 4 wide set shiftwidth=4 " Indent with 4 spaces @@ -80,16 +80,16 @@ 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 setlocal expandtab " }}} - + " Folding {{{ filetype plugin indent on syntax on " Syntax highlighting 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) @@ -98,7 +98,7 @@ \ . "  " . linecount . "  " " Shows our line, then a lot of spaces, and at the very end we have line number and arrows endfunction " }}} - + " Mappings {{{ " 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 @@ -142,7 +142,7 @@ " Open lazygit in a new tab with = nnoremap = :tab ter ++close lazygit " }}} - + " Command abbreviations {{{ " Cyrillic (Bulgarian yawerty layout) support ca в w @@ -158,7 +158,7 @@ ca tt tab ter ca te tabe " }}} - + " Omni completion {{{ " Omni completion supports C, HTML, CSS, JavaScript, PHP, Python, Ruby, SQL, XML set omnifunc=syntaxcomplete#Complete " Completion for all supported languages @@ -179,7 +179,14 @@ " Pressing tab goes from top to bottom let g:SuperTabContextDefaultCompletionType = "" " }}} - + + " 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 signcolumn=number " Show signs and numbers on the same column + " }}} +" }}} + +" Custom functionality {{{ " Spell check mode {{{ " When you press F6 it will toggle a "spell check mode", " spell is activated and the colour scheme is changed @@ -270,157 +277,154 @@ endif endfunction " }}} +" }}} - " 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 signcolumn=number " Show signs and numbers on the same column +" Plugins {{{ + " DelimitMate {{{ + let delimitMate_expand_cr = 1 + " Don't autocomplete diamond brackets in HTML (compatibility with closetag plugin) + autocmd FileType html let b:delimitMate_matchpairs='(:),[:],{:}' " }}} -" }}} -" 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 -" NERDTree {{{ - " Toggle NERDTree with Tab - nmap :NERDTreeToggle + let NERDTreeCustomOpenArgs = {'file':{'where':'t'}} " Open file in new tab, doesn't work only for double-click + let NERDTreeShowHidden = 1 + let NERDTreeWinPos = "right" + let NERDTreeIgnore = ['\.swp$', '\~$'] " Ignore file, ending with .swp and ~ + " }}} - let NERDTreeCustomOpenArgs = {'file':{'where':'t'}} " Open file in new tab, doesn't work only for double-click - let NERDTreeShowHidden = 1 - let NERDTreeWinPos = "right" - let NERDTreeIgnore = ['\.swp$', '\~$'] " Ignore file, ending with .swp and ~ -" }}} + " 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" + " }}} -" 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' + " }}} -" Tabman {{{ - let g:tabman_toggle = '' - let g:tabman_side = 'right' -" }}} + " SuperTab {{{ + let g:SuperTabDefaultCompletionType = "context" + " }}} -" SuperTab {{{ - let g:SuperTabDefaultCompletionType = "context" -" }}} + " Lightline {{{ + " Settings {{{ + set laststatus=2 -" Lightline {{{ - " Settings {{{ - set laststatus=2 - - if !has('gui_running') - set t_Co=256 - 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': '' } - \ } - " }}} - - " Function overrides {{{ - " 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 - " Tab source code - https://github.com/itchyny/lightline.vim/blob/master/autoload/lightline/tab.vim - - function! LightlineFugitive() - if exists('*FugitiveHead') - let branch = FugitiveHead() - return branch !=# '' ? ' '.branch : '' + if !has('gui_running') + set t_Co=256 endif - return '' - endfunction - - function! LightlineReadonly() - return &ft !~? 'help\|vimfiler' && &readonly ? '' : '' - endfunction - - function! LightlineModified() - return &ft =~ 'help\|vimfiler' ? '' : &modified ? '' : &modifiable ? '' : '' - endfunction - - function! LightlineFileType() - return strlen(&filetype) ? WebDevIconsGetFileTypeSymbol() . ' ' . &filetype : '' - endfunction - - " Adds the file type icon in tabs and limit their width - 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]') - - " 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! LightlineTabReadonly(n) abort - let winnr = tabpagewinnr(a:n) - return gettabwinvar(a:n, winnr, '&readonly') ? '' : '' - endfunction - - function! LightlineTabModified(n) abort - let winnr = tabpagewinnr(a:n) - return gettabwinvar(a:n, winnr, '&modified') ? '' : gettabwinvar(a:n, winnr, '&modifiable') ? '' : '' - endfunction + + 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': '' } + \ } + " }}} + + " Function overrides {{{ + " 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 + " Tab source code - https://github.com/itchyny/lightline.vim/blob/master/autoload/lightline/tab.vim + + function! LightlineFugitive() + if exists('*FugitiveHead') + let branch = FugitiveHead() + return branch !=# '' ? ' '.branch : '' + endif + return '' + endfunction + + function! LightlineReadonly() + return &ft !~? 'help\|vimfiler' && &readonly ? '' : '' + endfunction + + function! LightlineModified() + return &ft =~ 'help\|vimfiler' ? '' : &modified ? '' : &modifiable ? '' : '' + endfunction + + function! LightlineFileType() + return strlen(&filetype) ? WebDevIconsGetFileTypeSymbol() . ' ' . &filetype : '' + endfunction + + " Adds the file type icon in tabs and limit their width + 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]') + + " 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! LightlineTabReadonly(n) abort + let winnr = tabpagewinnr(a:n) + return gettabwinvar(a:n, winnr, '&readonly') ? '' : '' + endfunction + + function! LightlineTabModified(n) abort + let winnr = tabpagewinnr(a:n) + return gettabwinvar(a:n, winnr, '&modified') ? '' : gettabwinvar(a:n, winnr, '&modifiable') ? '' : '' + endfunction + " }}} " }}} -" }}} -" ALE {{{ - map :ALERename - map gd :ALEGoToDefinition - map gi :ALEHover - map ge :ALEDetail + " ALE {{{ + map :ALERename + map gd :ALEGoToDefinition + map gi :ALEHover + map ge :ALEDetail - set omnifunc=ale#completion#OmniFunc - let g:ale_completion_enabled = 1 + 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 + 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 + " }}} " }}} -- cgit v1.2.3