" Title......: .vimrc " Description: My setting file for vim " Author.....: Mitchell Johnston " Updated....: Sun 17 Nov 2024 08:13:43 AM CST " " Reference " ========= " " Macros " j gj Allows scroll down in sentence by line " k gk Allows scroll up in sentence by line " \b Markdown __bold__ word " \i Markdown _italic_ word " \e Open tab with emoji " \l Run dictionary lookup script (default to lookup word under cursor) " \N Toggle line numbers " \n Scratch Pad " \s Search KJV " \S Toggle spell check " \t Term in split window " \T Term in a Tab " \v Open .vimrc in new tab, sources when saved " \pb Paragraph style=blue " \py Paragraph style=yellow " \pr Paragraph style=red " \pg Paragraph style=green " \wa Bash Cookbook " \wb Bash Quick ref " Control and Alt Key mappings " A-g Mark class=green " A-r Mark class=red " C-b Mark class=blue " C-t Toggle Terminal " C-y Mark class=yellow " F-Keys " F2 New tab Netrw " F3 Get URLS in current buffer (uses youtube-dl) " F4 - autocomplete, backward Insert mode " F5 - autocomplete, forward Insert mode " F6 Replace current line with kjv output " F7 Replace current line with formated output for file under /var/www (mp4 or " picture) " F8 Replace current line with link to file unde /var/www " F9 Run ./compiler in current directory " F12 Open file current buffer " S-F12 Open file new tab " :Commands " :Plug{tab} Plugin manager " :term Open a split window term " :TableModeToggle VIM Table Mode toggle " Typing savers " ============== " bash ab _var # Variables<CR>---------<CR><ESC>0D ab _func # Functions<CR>---------<CR><ESC>0D ab _main # Main<CR>----<CR><ESC>0D " urls ab _Bible [Bible](/bible/) ab _crn http://crn.hopto.org/ ab _email mitch@crn.hopto.org ab _gop gopher://crn.hopto.org ab _Jesus [Jesus](/Jesus) ab kjv [KJV](/#kjv) ab KJV [KJV](/#kjv) ab Bible [Bible](/#kjv) ab bible [Bible](/#kjv) ab _mykjv [MyKJV](https://mykjv.com/) " dates ab _date <C-R>=strftime("%a %b %d %Y")<CR> ab _time <C-R>=strftime("%T")<CR> ab _u Updated: <C-R>=strftime('%A %m/%d/%y')<CR> " admonitions ab _? :question: ab _! :exclamation: __Important:__ ab _ao π§ __Audio Only__ ab _bl π€¬ __Warning bad language__ ab _c :computer: __Code:__ ab _ch :chart_with_upwards_trend: _Chart Of The Day:_ ab _hc :sparkling_heart: __Health Clip__ ab _d π₯΅ __Warning Disturbing__ ab _fun :laughing: __Some humor to lighten the day:__ ab _geek π§ __Geek Related:__ ab _k :key: ab _l π __Links:__ ab _memo :memo: __Note:__ ab _mw π€ ___Must Watch___ ab _rl :+1: __Rule of Thumb__ ab _tip :bulb: __Tip:__ ab _up π§ __Updates:__ ab _warn :warning: __Warning:__ ab _ar π _Off-site Artical_ " misc ab --- [π](#)<CR><HR><CR><ESC> ab --1 <hr class="one"> ab --2 <hr class="two"> ab --3 <hr class="three"> ab --p <hr class="packman"> ab _A >π§ Audio Included<CR> ab _L ### [π title](link){target="blank"} ab _mj Mitchell Johnston - UID 0 ab _nl :newspaper: __News Links:__<CR> ab _see - [π See more](link) ab _sn - [π Show Notes](link){target="blank"} ab _ts :mortar_board: [__Theological Seminary Of The Air__](/mp3/ruckman/theologic-seminary-of-the-air/)<CR> ab _tb {target="blank"} ab _div <div style="text-align: center;"> ab _re <u>Related:</u> ab _U </u> ab _u <u><ESC>i ab _vc <script src="https://av1611.com/verseclick/verseclick.js"></script> ab _iframe <iframe src="link" scrolling="no" width="100%" height="400" style="border:1px solid black;"></iframe> ab _Iframe <iframe src="link" scrolling="no" onload="resizeIframe(this) style="border:1px solid black;"></iframe> " Offsite ab _axe - [π Dr Axe](https://draxe.com/){target="blank"} ab _dk - [π The David Knight Show](http://www.thedavidknightshow.com/){target="blank"}<CR>- [π David Knight Gold](https://davidknight.gold/){target="blank"} ab _jl - [π Jon Levi](https://jonlevichannel.com/){target="blank"} ab _kb - [π Dr. Ken Berry](https://www.drberry.com/){target="blank"} ab _mi - [π Mises](https://mises.org/){target="blank"} ab _norm - [π Norml](https://norml.org/){target="blank"} ab _rc - [π Rain Country](https://rumble.com/c/RainCountryHomestead){target="blank"} ab _rg - [π ReallyGraceful](https://rumble.com/user/reallygraceful){target="blank"}<CR>- [π The Deep State Encyclopedia: Exposing the Cabal's Playbook](https://www.amazon.com/Deep-State-Encyclopedia-Exposing-Playbook/dp/B0BW2K4GRT/ref=sr_1_1?crid=L3E7PRK32XAF&dib=eyJ2IjoiMSJ9.abdCs2CjZJUaoZb39XP1UU8PqU7hXwaPfdKvrBkA9eCv7-LBc27eAel8xNDCA9zbfMUzTLgmqVOaHUFVH93Cd75NVYt7BO7hi5OldPhjRiz70HMSGAcxacy0gIN3us4p.OuuQzd1UMe1hFSXk6R4NUlJB66CS144pPKpvG3mP8MA&dib_tag=se&keywords=deep+state+encyclopedia+really+graceful&qid=1726739581&sprefix=really+gra%2Caps%2C158&sr=8-1){target="blank"} " On-site ab _911 - [π¬ More on 911](/media/911/) ab _addict - [π¬ More on Addiction](/media/health/addiction/) ab _arc - [π¬ For more content check the archives](/media/) ab _ba - [π» Bible Analyzer](/media/bible-analyzer) ab _berg - [π¬ More from Dr Berg](/media/health/dr-berg/) ab _bio - [π¬ More Biography](/media/biography/) ab _chicks - [π¬ More on Chickens](/media/prep/chickens-rabbits/) ab _cooper - [π¬ More from Bill Cooper](/media/bill-cooper/) ab _control - [π¬ More on Control](/media/control/) ab _covid - [π¬ More on Covid](/media/health/covid/) ab _cr - [π¬ More from James Corbett](/media/corbett/) ab _cults - [π¬ More Cults](/media/cults/) ab _dental - [π¬ More on Dental](/media/health/dental/) ab _detox - [π¬ More on Detox](health/#detox) ab _diet - [π¬ More on Diet](/media/health/diet/) ab _env - [π¬ More Environment](/media/environment/) ab _flat - [π¬ More Flat Earth](/media/flat/) ab _gatto - [π¬ More from John Talor Gatto](/media/john-t-gatto/) ab _gear - [π¬ More Gear](/media/gear/) ab _geg - [π¬ More from G.Edward Griffin](/media/g-edward-griffin/) ab _gr - [π¬ More from Gail Riplinger](/media/riplinger/) ab _garden - [π¬ More Gardening](/media/prep/garden/) ab _hemp - [π¬ More from Hemp](/media/health/remedies/hemp/) ab _herbs - [π¬ More from Herbs](/media/health/remedies/herbs/) ab _history - [π¬ More history](/media/history/) ab _jd - [π¬ More from Dr James Dinicolantonio](/media/health/dr-james-dinicolantonio/) ab _law - [π¬ More Law](/media/law/) ab _larkin - [π¬ More from Larkin Rose](/media/larkin/) ab _levy - [π¬ More from Dr Thomas Levy](/media/health/dr-thomas-levy/) ab _mica - [π¬ More from Mica Colston](/media/mica-colston/) ab _min [π¬ More Minerals](/include/vids/health/minerals/) ab _money - [π¬ More money](/media/money/) ab _mp3 - [π§ MP3 Files](/mp3) ab _ortho - [π¬ More Orthomolecular Medicine](/include/vids/health/orthomolecular/) ab _pics - [π¨ More Pictures](/pics) ab _radio - [π¬ More on Radio](/media/gear/radio/) ab _rem - [π¬ More Remedies](/include/vids/health/remedies/) ab _mms - [π¬ More MMS](/include/vids/health/remedies/mms) ab _ruckman - [π¬ More from Peter Ruckman](/media/ruckman/) ab _sam - [π¬ More from Dr Sam Bailey](/media/health/dr-sam-bailey/) ab _sircus - [π¬ More from Dr Mark Sircus](/media/health/dr-mark-sircus/) ab _save - [π Salvation (forgiveness)](/salvation) ab _selft - [π¬ More on Self Therapy](/media/health/self-therapy/) ab _spy - [π¬ More Spying](/media/spying/) ab _survive - [π¬ More on Survival](/media/survive/) ab _tea - [π¬ More on Tea](/include/vids/health/remedies/tea/) ab _turp - [π¬ More Turpentine](/include/vids/health/remedies/essential-oils/turpentine) ab _vernon - [π¬ More from Dr Vernon Coleman](/media/health/vernon/) " Create task, check off, uncheck (see my .bashrc functions 'today' & 'task') ab ,c - [ ] map ,C :s/\[ \]/\[β\]<CR> " Completed map ,X :s/\[β\]/\[ \]<CR> " Unmark completed map ,i :s/\[ \]/\[π¨\]<CR> " In progress map ,I :s/\[π¨\]/\[ \]<CR> " Unmark In progress map ,o :s/\[ \]/\[β\]<CR> " Outsourced map ,O :s/\[β\]/\[ \]<CR> " Unmark Outsourced " Settings " ======== set cryptmethod=blowfish " use blowfish encryption for encrytped files set switchbuf=usetab " when switching buffers, include tabs set splitright " create vertical splits to the right set splitbelow " create horizontal splits below set formatoptions=croq " c=autowrap comments, r=continue comment on <enter>, " o=continue comment on o or O, q=allow format comment with gqgq set backspace=2 " allow backspacing over everything in insert mode set encoding=UTF-8 " Folds set foldenable " Enable folding set foldmethod=indent " Folding based on markers set foldlevelstart=10 " open most folds by default set foldnestmax=10 " 10 nested fold max " Tabs set hardtabs=4 " Tab setups set tabstop=4 set shiftwidth=4 set expandtab " tab to spaces set softtabstop=4 " number of spaces in tab when editing set tabpagemax=15 " Max number of tabs displayed set showtabline=2 " always display tab line " Completion set dictionary+=~/etc/words-alpha.txt "Ctr-n, Ctr-p word complete set complete+=k set ignorecase " On searches set infercase set autoindent " Good for codding set smartindent " Turn on file typed indenting set shiftround " When shifting lines, round the indentation to the nearest multiple of βshiftwidth.β set history=50 " keep 50 lines of command line history set laststatus=2 " Make sure the status line is always displayed set nocompatible " Better for Vim features set shell=/bin/bash " Set default shell set scrolloff=0 " Start scrolling when I'm 3 lines from top/bottom set backspace=indent,eol,start "Allow backspacing over indention, line breaks and insertion start set lbr! " wrap on words set formatoptions+=j " Delete comment characters when joining lines. set spell " Turn on spell check set belloff=all " Display "set nu " turn on line numbers set ruler " Display ruler set showcmd " Show commands set showmatch " Show matching brackets set showmode " Display what mode you are in set cursorline " highlight current line set wildmenu " visual autocomplete for command menu "set list " show hidden characters set listchars=eol:Β¬,tab:ββ,trail:.,extends:>,precedes:< set autoread " Search set path+=** " :find {file} supports wilecard set wildmenu " tab completetion set hlsearch " Highlight search matches set smartcase " Turn off ignorcase if caps is used set incsearch " search as characters are entered " netrw setting let g:netrw_liststyle = 3 let ghregex='\(^\|\s\s\)\zs\.\S\+' let g:netrw_list_hide=ghregex " backup files set viminfo='1000,f1,<500 " File information to Keep set backup "Turn on backups set backupdir=~/.vim/backup/ "The place to remove files after I make big errors, not that I ever do that set backupskip=/tmp/*,~/.vim/backup/* set writebackup "Make backup before overwriting the current buffer set backupcopy=yes "Overwrite the original backup file au BufWritePre * let &bex = '@' . strftime("%F.%H:%M") " Keep undo history across sessions by storing it in a file if has('persistent_undo') call system('mkdir ~/.vim/undo') set undodir=~/.vim/undo/ set undofile set undolevels=1000 set undoreload=10000 endif " Vim-plug if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif " Plugins will be downloaded under the specified directory. call plug#begin('~/.vim/plugged') " Declare the list of plugins. Plug 'ryanoasis/vim-devicons' Plug 'marcopaganini/termschool-vim-theme' Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' Plug 'katono/rogue.vim' Plug 'dhruvasagar/vim-table-mode' Plug 'hallison/vim-markdown' Plug 'ap/vim-css-color' Plug 'qadzek/link.vim' "Vim Rogue options let g:rogue#name = 'Mitch' let g:rogue#directory = '/home/mitch/etc' let g:rogue#jump = '1' let g:rogue#tombstone = '1' let g:rogue#fruit = 'Grapes' " enable this plugin for filetypes, '*' for all files. let g:apc_enable_ft = {'text':1, 'markdown':1, 'php':1} " List ends here. Plugins become visible to Vim after this call. call plug#end() " File types " ========== augroup configgroup autocmd! autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown autocmd BufNewFile,BufFilePre,BufRead *.txt set filetype=txt autocmd FileType make setlocal noexpandtab autocmd BufEnter Makefile setlocal noexpandtab autocmd BufEnter *.sh setlocal tabstop=2 autocmd BufEnter *.sh setlocal shiftwidth=2 autocmd BufEnter *.sh setlocal softtabstop=2 au BufNewFile,BufRead *conkyrc* set filetype=conkyrc autocmd bufwritepost .vimrc source $MYVIMRC autocmd bufwritepost sp.md <ESC>:!pandoc sp.md -o sp.html<CR> augroup END " Display setup " ============== colorscheme termschool :set guioptions-=r "remove right-hand scroll bar set background=dark " Modify for dark background "set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] "au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta "au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse " using Source Code Pro set anti enc=utf-8 set guifont=Source\ Code\ Pro\ 16 filetype plugin on syntax on set conceallevel=2 " Set style for spelling errors hi clear SpellBad hi SpellBad cterm=reverse hi SpellBad gui=reverse " Macros " ====== map j gj map k gk map <leader>a <ESC>A [AW](#archaic) [NA](#names)<ESC>0n map <leader>l <ESC>:term ++close lu <c-r><c-w><CR> map <leader>N <ESC>:set nu! rnu!<CR> map <leader>pb 0i<p class="blue"><ESC>A</p><ESC> map <leader>pg 0i<p class="green"><ESC>A</p><ESC> map <leader>pr 0i<p class="red"><ESC>A</p><ESC> map <leader>py 0i<p class="yellow"><ESC>A</p><ESC> map <leader>qn :tabedit ~/Documents/jots/scratch.md<CR> " vim-powered terminal in split window map <Leader>t :term ++close<cr> tmap <Leader>t <c-w>:term ++close<cr> " vim-powered terminal in new tab map <Leader>T :tab term ++close<cr> tmap <Leader>T <c-w>:tab term ++close<cr> map <leader>v :tabedit $MYVIMRC<CR> map <leader>wb <ESC>:!epy ~/Documents/books/tech/dev-bash/bash-pocket-reference.epub<CR> map <leader>wh <ESC>:!epy ~/Documents/books/tech/dev-web/oreilly-html-and-css-the-good-parts-by-the-good-parts.epub<CR> noremap <space> za " space open/closes folds noremap H :set hlsearch!<CR> " HTML " ---- " Highlite in blue (Ruckman) or yellow (mine) or green X-ref map <C-b> 0i<mark class="blue"><ESC>A</mark><ESC>03j map <C-y> 0i<mark class="yellow"><ESC>A</mark><ESC>03j map <A-g> 0i<mark class="green";<ESC>A</mark><ESC>0 map <A-r> 0i<mark class="red";<ESC>A</mark><ESC>0 " Function keys " ------------- " <F2> Explorer in newtab map <F2> <ESC>:tabe .<CR> map! <F2> <ESC>:tabe .<CR> " This calls my download manager. I make a list in vim, hit F3 and it downloads them. map <F3> <ESC>:w ~/Downloads/get.txt<CR>:term ++close /home/mitch/bin/get -d<CR>> " F4 - autocomplete, backward Insert mode inoremap <F4> <C-P> " F5 - autocomplete, forward Insert mode inoremap <F5> <C-N> " This allows me to insert a Bible quote in to a document. map <F6> <ESC>0D<ESC>:.!kjv map! <F6> <ESC>0D<ESC>:.!kjv " pi take the name of a mp4 or picture file under /var/www and will return html with png " created for a markdown document. map <F7> <ESC>0D<ESC>:.!pi map! <F7> <ESC>0D<ESC>:.!pi " mkln is "make link" will return markdown formated link with emoji for major " file types, and will auto-local file under /var/www. map <F8> <ESC>0D<ESC>:.!mkln map! <F8> <ESC>0D<ESC>:.!mkln " Run external compiler (used for CRNβs AV Bible) map <F9> <ESC>:w!<ESC>:tab term ++close glow -p %<CR> " <F10> Place holder " Open file in current buffer or a new tab via netrw map <F12> j<ESC>:r !./ab<CR> map! <F12> <ESC>:Files ~<CR> " Easy tab navigation nnoremap <Leader>1 1gt nnoremap <Leader>2 2gt nnoremap <Leader>3 3gt nnoremap <Leader>4 4gt nnoremap <Leader>5 5gt nnoremap <Leader>6 6gt nnoremap <Leader>7 7gt nnoremap <Leader>8 8gt nnoremap <Leader>9 9gt " ===== new status line ==== "" This was made by Reddit user u/SamLovesNotion. Also with the help of - https://tdaly.co.uk/projects/vim-statusline-generator/ for learning the syntax. Sorry for English & grammar, this post was made in hurry. " Images - https://www.reddit.com/r/vim/comments/ld8h2j/i_made_a_status_line_from_scratch_no_plugins_used/ " I have used Nerd icon fonts. Icons won't work without them. https://github.com/ryanoasis/nerd-fonts/ " This statusline looks exactly like Vim Airline (even more customizable & powerful) & loads faster than Vim airline. Only take few ms to load. " STARTUP TIME - With Vim Airline - ~250ms. With this statusline - ~100ms. Without any statusline - ~98ms. " Add all of this at the end of your vimrc OR Create separate file like 'statusline.vim' & 'colorsgroup.vim' & source those files in your main vimrc. " e.g. source "~/.config/vim/statusline.vim" " Color highlighting groups " Add this AFTER `colorscheme` option in your vimrc. Otherwise your colorscheme will clear this highlightings. OR use ColorScheme autocommand. VERY IMPORTANT. " Color pallet " Green - #2BBB4F (BG) - #080808 (FG) " Blue - #4799EB " Violet - #986FEC " Yellow - #D7A542 " Orange - #EB754D " Grey1 - #202020 " Grey - #303030 " Define color variables let g:StslineColorGreen = "#2BBB4F" let g:StslineColorBlue = "#4799EB" let g:StslineColorViolet = "#986FEC" let g:StslineColorYellow = "#D7A542" let g:StslineColorOrange = "#EB754D" let g:StslineColorLight = "#C0C0C0" let g:StslineColorDark = "#080808" let g:StslineColorDark1 = "#181818" let g:StslineColorDark2 = "#202020" let g:StslineColorDark3 = "#303030" " Define colors let g:StslineBackColor = g:StslineColorDark2 let g:StslineOnBackColor = g:StslineColorLight "let g:StslinePriColor = g:StslineColorGreen let g:StslineOnPriColor = g:StslineColorDark let g:StslineSecColor = g:StslineColorDark3 let g:StslineOnSecColor = g:StslineColorLight " Create highlight groups execute 'highlight StslineSecColorFG guifg=' . g:StslineSecColor ' guibg=' . g:StslineBackColor execute 'highlight StslineSecColorBG guifg=' . g:StslineColorLight ' guibg=' . g:StslineSecColor execute 'highlight StslineBackColorBG guifg=' . g:StslineColorLight ' guibg=' . g:StslineBackColor execute 'highlight StslineBackColorFGSecColorBG guifg=' . g:StslineBackColor ' guibg=' . g:StslineSecColor execute 'highlight StslineSecColorFGBackColorBG guifg=' . g:StslineSecColor ' guibg=' . g:StslineBackColor execute 'highlight StslineModColorFG guifg=' . g:StslineColorYellow ' guibg=' . g:StslineBackColor " Statusline " Enable statusline set laststatus=2 " Disable showmode - i.e. Don't show mode like --INSERT-- in current statusline. set noshowmode " Enable GUI colors for terminals (Some terminals may not support this, so you'll have to *manually* set color pallet for tui colors. Lie tuibg=255, tuifg=120, etc.). set termguicolors " Understand statusline elements " %{StslineMode()} = Output of a function " %#StslinePriColorBG# = Highlight group " %F, %c, etc. are variables which contain value like - current file path, current colums, etc. " %{&readonly?\"ο£\ \":\"\"} = If file is readonly ? Then "Lock icon" Else : "Nothing" " %{get(b:,'coc_git_status',b:GitBranch)} = If b:coc_git_status efists, then it's value, else value of b:GitBranch " &filetype, things starting with & are also like variables with info. " \ - Is for escaping a space. \" is for escaping a double quote. " %{&fenc!='utf-8'?\"\ \":''} = If file encoding is NOT!= 'utf-8' ? THEN output a "Space" else : no character " Define active statusline function! ActivateStatusline() call GetFileType() setlocal statusline=%#StslinePriColorBG#\ %{StslineMode()}%#StslineSecColorBG#%{get(b:,'coc_git_status',b:GitBranch)}%{get(b:,'coc_git_blame','')}%#StslineBackColorFGPriColorBG#ξΊ%#StslinePriColorFG#\ %{&readonly?\"ο£\ \":\"\"}%F\ %#StslineModColorFG#%{&modified?\"ο\ \":\"\"}%=%#StslinePriColorFG#\ %{b:FiletypeIcon}%{&filetype}\ %#StslineSecColorFG#ξ²%#StslineSecColorBG#%{&fenc!='utf-8'?\"\ \":''}%{&fenc!='utf-8'?&fenc:''}%{&fenc!='utf-8'?\"\ \":''}%#StslinePriColorFGSecColorBG#ξ²%#StslinePriColorBG#\ %p\%%\ %#StslinePriColorBGBold#%l%#StslinePriColorBG#/%L\ :%c\ endfunction " Define Inactive statusline function! DeactivateStatusline() if !exists("b:GitBranch") || b:GitBranch == '' setlocal statusline=%#StslineSecColorBG#\ INACTIVE\ %#StslineSecColorBG#%{get(b:,'coc_git_statusline',b:GitBranch)}%{get(b:,'coc_git_blame','')}%#StslineBackColorFGSecColorBG#ξΊ%#StslineBackColorBG#\ %{&readonly?\"ο£\ \":\"\"}%F\ %#StslineModColorFG#%{&modified?\"ο\ \":\"\"}%=%#StslineBackColorBG#\ %{b:FiletypeIcon}%{&filetype}\ %#StslineSecColorFGBackColorBG#ξ²%#StslineSecColorBG#\ %p\%%\ %l/%L\ :%c\ else setlocal statusline=%#StslineSecColorBG#%{get(b:,'coc_git_statusline',b:GitBranch)}%{get(b:,'coc_git_blame','')}%#StslineBackColorFGSecColorBG#ξΊ%#StslineBackColorBG#\ %{&readonly?\"ο£\ \":\"\"}%F\ %#StslineModColorFG#%{&modified?\"ο\ \":\"\"}%=%#StslineBackColorBG#\ %{b:FiletypeIcon}%{&filetype}\ %#StslineSecColorFGBackColorBG#ξ²%#StslineSecColorBG#\ %p\%%\ %l/%L\ :%c\ endif endfunction " Get Statusline mode & also set primary color for that mode function! StslineMode() let l:CurrentMode=mode() if l:CurrentMode==#"n" let g:StslinePriColor = g:StslineColorGreen let b:CurrentMode = "NORMAL " elseif l:CurrentMode==#"i" let g:StslinePriColor = g:StslineColorViolet let b:CurrentMode = "INSERT " elseif l:CurrentMode==#"c" let g:StslinePriColor = g:StslineColorYellow let b:CurrentMode = "COMMAND " elseif l:CurrentMode==#"v" let g:StslinePriColor = g:StslineColorBlue let b:CurrentMode = "VISUAL " elseif l:CurrentMode==#"V" let g:StslinePriColor = g:StslineColorBlue let b:CurrentMode = "V-LINE " elseif l:CurrentMode==#"\<C-v>" let g:StslinePriColor = g:StslineColorBlue let b:CurrentMode = "V-BLOCK " elseif l:CurrentMode==#"R" let g:StslinePriColor = g:StslineColorViolet let b:CurrentMode = "REPLACE " elseif l:CurrentMode==#"s" let g:StslinePriColor = g:StslineColorBlue let b:CurrentMode = "SELECT " elseif l:CurrentMode==#"t" let g:StslinePriColor =g:StslineColorYellow let b:CurrentMode = "TERM " elseif l:CurrentMode==#"!" let g:StslinePriColor = g:StslineColorYellow let b:CurrentMode = "SHELL " endif call UpdateStslineColors() return b:CurrentMode endfunction " Update colors. Recreate highlight groups with new Primary color value. function! UpdateStslineColors() execute 'highlight StslinePriColorBG guifg=' . g:StslineOnPriColor ' guibg=' . g:StslinePriColor execute 'highlight StslinePriColorBGBold guifg=' . g:StslineOnPriColor ' guibg=' . g:StslinePriColor ' gui=bold' execute 'highlight StslinePriColorFG guifg=' . g:StslinePriColor ' guibg=' . g:StslineBackColor execute 'highlight StslinePriColorFGSecColorBG guifg=' . g:StslinePriColor ' guibg=' . g:StslineSecColor execute 'highlight StslineSecColorFGPriColorBG guifg=' . g:StslineSecColor ' guibg=' . g:StslinePriColor if !exists("b:GitBranch") || b:GitBranch == '' execute 'highlight StslineBackColorFGPriColorBG guifg=' . g:StslineBackColor ' guibg=' . g:StslinePriColor endif endfunction " Get git branch name function! GetGitBranch() let b:GitBranch="" try let l:dir=expand('%:p:h') let l:gitrevparse = system("git -C ".l:dir." rev-parse --abbrev-ref HEAD") if !v:shell_error let b:GitBranch=" ο¦ ".substitute(l:gitrevparse, '\n', '', 'g')." " execute 'highlight StslineBackColorFGPriColorBG guifg=' . g:StslineBackColor ' guibg=' . g:StslineSecColor endif catch endtry endfunction " Get filetype & custom icon. Put your most used file types first for optimized performance. function! GetFileType() if &filetype == 'typescript' let b:FiletypeIcon = 'ξ¨ ' elseif &filetype == 'html' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'scss' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'css' let b:FiletypeIcon = 'οΌ ' elseif &filetype == 'javascript' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'javascriptreact' let b:FiletypeIcon = 'ξΊ ' elseif &filetype == 'markdown' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'sh' || &filetype == 'zsh' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'vim' let b:FiletypeIcon = 'ξ ' elseif &filetype == '' let b:FiletypeIcon = '' elseif &filetype == 'rust' let b:FiletypeIcon = 'ξ¨ ' elseif &filetype == 'ruby' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'cpp' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'c' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'go' let b:FiletypeIcon = 'ξ§ ' elseif &filetype == 'lua' let b:FiletypeIcon = 'ξ ' elseif &filetype == 'haskel' let b:FiletypeIcon = 'ξ ' else let b:FiletypeIcon = 'π ' endif endfunction " Get git branch name after entering a buffer augroup GetGitBranch autocmd! autocmd BufEnter * call GetGitBranch() augroup END " Set active / inactive statusline after entering, leaving buffer augroup SetStslineline autocmd! autocmd BufEnter,WinEnter * call ActivateStatusline() autocmd BufLeave,WinLeave * call DeactivateStatusline() augroup END " vim: nospell