From 6f4aee8a813f2a416ca56d1cb81a90ddaf655bc4 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 22 Jan 2021 09:54:12 +0200 Subject: Updated comments, updated identation setup, added tabman plugin, improved lightline (has enable collection and tab names have limited size) --- .vimrc | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index eea39bc..1e3daf9 100644 --- a/.vimrc +++ b/.vimrc @@ -16,7 +16,7 @@ Plug 'tomtom/tcomment_vim' " Toggle comments (gc, gcc) Plug 'godlygeek/tabular' " Line up text by a given character (:Tabularize /CHAR) Plug 'vim-syntastic/syntastic' " Syntax error checker Plug 'neoclide/coc.nvim', {'branch': 'release'} " IntelliSense practically -Plug 'itchyny/lightline.vim' " Statusline for Vim +Plug 'itchyny/lightline.vim' " Statusline and tabline for Vim Plug 'tpope/vim-fugitive' " git integration Plug 'mbbill/undotree' " Easily interact with undo history Plug 'OmniSharp/omnisharp-vim' " C# tools (autocompletion, ...) @@ -28,7 +28,8 @@ Plug 'pseewald/vim-anyfold' " Better folding Plug 'editorconfig/editorconfig-vim' " Support for EditorConfig Plug 'tpope/vim-eunuch' " Easy UNIX shell commands Plug 'mg979/vim-visual-multi' " Multiple line cursor (and other stuff) -Plug 'zivyangll/git-blame.vim' +Plug 'zivyangll/git-blame.vim' " Show who last edited a line +Plug 'kien/tabman.vim' " Show open buffers """""""""""""""""""""""""""""""" @@ -68,7 +69,7 @@ nmap u imap i "imap An impossible dream imap :wa - + " Use Ctrl + hjkl for navigation in insert mode inoremap inoremap @@ -81,7 +82,7 @@ ca ва wa ca ь x ca ьа xa -" The following work the same as usual (as :x and :xa), but can also close running jobs (e.g. terminal windows) +" The following works almost the same as normal :x and :xa, but can also close running jobs (e.g. terminal windows) ca x w q! ca xa wa qa! @@ -108,10 +109,9 @@ set mouse=a " Mouse support set tabstop=4 " Show tabs as 4 wide set shiftwidth=4 " Indent with 4 spaces -" set expandtab " Convert tabs to 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 tabs as 2 spaces +autocmd FileType css,ts setlocal ts=2 sw=2 sts=0 expandtab " Show CSS and TS tabs as 2 spaces " When you press F6 it will toggle a "spell check mode", " spell is activated and the colorscheme is changed @@ -147,7 +147,6 @@ endfunction tmap :call EnterNormalMode() - """"""""""""""""""""""""""""""" " Color scheme settings """"""""""""""""""""""""""""""" @@ -197,6 +196,13 @@ if !exists('g:undotree_DiffCommand') let g:undotree_DiffCommand = "diff" endif +""""""""""""""""""""""""""""""" +" Tabman +""""""""""""""""""""""""""""""" + +let g:tabman_toggle = '' +let g:tabman_side = 'right' + """"""""""""""""""""""""""""""" " Syntastic settings """"""""""""""""""""""""""""""" @@ -219,7 +225,6 @@ syntax on autocmd Filetype * AnyFoldActivate " activate for all filetypes set foldlevel=99 " Open all folds by default - """"""""""""""""""""""""""""""" " Lighline settings """"""""""""""""""""""""""""""" @@ -231,6 +236,10 @@ if !has('gui_running') endif let g:lightline = { + \ 'enable': { + \ 'statusline': 1, + \ 'tabline': 1 + \ }, \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], @@ -257,8 +266,7 @@ let g:lightline = { \ 'tab_component_function': { \ 'iconFilename': 'LightlineTabFilename', \ 'iconReadonly': 'LightlineTabReadonly', - \ 'iconModified': 'LightlineTabModified', - \ 'iconClose': 'LightlineTabIconClose' + \ 'iconModified': 'LightlineTabModified' \ }, \ 'separator': { 'left': '', 'right': '' }, \ 'subseparator': { 'left': '', 'right': '' }, @@ -290,12 +298,16 @@ function! LightlineFileType() return strlen(&filetype) ? WebDevIconsGetFileTypeSymbol() . ' ' . &filetype : '' endfunction -" Adds the filetype icon in tabs +" Adds the filetype 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') - return WebDevIconsGetFileTypeSymbol(_) . ' ' . ( _ !=# '' ? _ : '[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) + + return WebDevIconsGetFileTypeSymbol(_) . ' ' . _[0:tabNameLengthMax] endfunction function! LightlineTabReadonly(n) abort @@ -313,7 +325,6 @@ endfunction """"""""""""""""""""""""""""""" " Omni completion supports C, HTML, CSS, JavaScript, PHP, Python, Ruby, SQL, XML - filetype plugin on set omnifunc=syntaxcomplete#Complete " Completion for all supported languages @@ -498,4 +509,3 @@ nnoremap j :CocNext nnoremap k :CocPrev " Resume latest coc list. nnoremap p :CocListResume - -- cgit v1.2.3