───────┬────────────────────────────────────────────────────────────────────────
       File: /home/mitch/.vimrc
───────┼────────────────────────────────────────────────────────────────────────
   1    " Description: My setting file for vim
   2    " Author.....: Mitchell Johnston
   3    " Updated....: Thu 27 Feb 2025 11:20:08 AM CST
   4    " Updated....: Wed 26 Mar 2025 06:08:28 AM CDT
   5    " Reference
   6    " =========
   7    "
   8    " Macros
   9    " j gj      Allows scroll down in sentence by line
  10    " k gk      Allows scroll up in sentence by line
  11    " \b        Markdown __bold__ word
  12    " \i        Markdown _italic_ word
  13    " \e        Open tab with emoji
  14    " \l        Run dictionary lookup script (default to lookup word under cursor)
  15    " \N        Toggle line numbers
  16    " \n        Scratch Pad
  17    " \s        Search KJV
  18    " \S        Toggle spell check
  19    " \t        Term in split window
  20    " \T        Term in a Tab
  21    " \v        Open .vimrc in new tab, sources when saved
  22    " \pb       Paragraph style=blue
  23    " \py       Paragraph style=yellow
  24    " \pr       Paragraph style=red
  25    " \pg       Paragraph style=green
  26    " \wa       Bash Cookbook
  27    " \wb       Bash Quick ref
  28    
  29    " Control and Alt Key mappings
  30    " A-g Mark class=green
  31    " A-r Mark class=red
  32    " C-b Mark class=blue
  33    " C-t Toggle Terminal
  34    " C-y Mark class=yellow
  35    
  36    " F-Keys
  37    " F2 New tab Netrw
  38    " F3 Get URLS in current buffer (uses youtube-dl)
  39    " F4 - autocomplete, backward Insert mode
  40    " F5 - autocomplete, forward Insert mode
  41    " F6 Replace current line with kjv output
  42    " F7 Replace current line with formated output for file under /var/www (mp4 or
  43    " picture)
  44    " F8 Replace current line with link to file unde /var/www
  45    " F9 Run ./compiler in current directory
  46    " F12 Open file current buffer
  47    " S-F12 Open file new tab
  48    
  49    " :Commands
  50    
  51    " :Plug{tab}   Plugin manager
  52    " :term        Open a split window term
  53    " :TableModeToggle   VIM Table Mode toggle
  54    
  55    
  56    " Typing savers 
  57    " ==============
  58    
  59    " bash
  60    ab _var # Variables<CR>---------<CR><ESC>0D
  61    ab _func # Functions<CR>---------<CR><ESC>0D
  62    ab _main # Main<CR>----<CR><ESC>0D
  63    
  64    " urls
  65    ab _crn http://crn.hopto.org/ 
  66    ab _email mitch@crn.hopto.org
  67    ab _gop gopher://crn.hopto.org
  68    ab _Jesus [Jesus](/Jesus)
  69    ab _kjv [KJV](/#kjv)
  70    ab _KJV [KJV](/#kjv)
  71    ab _Bible [Bible](/bible)
  72    ab _bible [Bible](/bible)
  73    
  74    " dates
  75    ab _date <C-R>=strftime("%a %b %d %Y")<CR>
  76    ab _time <C-R>=strftime("%r %Z")<CR>
  77    ab _u Updated: <C-R>=strftime('%A %m/%d/%y')<CR>
  78    
  79    " admonitions
  80    ab _? :question: 
  81    ab _! :exclamation: __Important:__
  82    ab _ao 🎧 __Audio Only__
  83    ab _bl 🤬 __Warning bad language__
  84    ab _c :computer: __Code:__
  85    ab _ch :chart_with_upwards_trend: _Chart Of The Day:_
  86    ab _hc :sparkling_heart: __Health Clip__
  87    ab _d 🥵 __Warning Disturbing__
  88    ab _fun :laughing: __Some humor to lighten the day:__
  89    ab _geek 🧠 __Geek Related:__
  90    ab _k :key: 
  91    ab _l - [🔗 title](link){target="blank"}<ESC>04l
  92    ab _memo :memo: __Note:__
  93    ab _book 📖 __Worth Reading:__
  94    ab _mw 🤓 ___Must Watch___
  95    ab _rl :+1: __Rule of Thumb__
  96    ab _tip :bulb: __Tip:__
  97    ab _up 🔧 __Updates:__
  98    ab _warn :warning: __Warning:__
  99    ab _ar  🔗 _Off-site Artical_
 100    
 101    " misc 
 102    ab --0 [🔝](#)<CR><HR><CR><ESC>
 103    ab --1 <hr class="one">
 104    ab --2 <hr class="two">
 105    ab --3 <hr class="three">
 106    ab --p <hr class="packman">
 107    ab _A >🎧 Audio Included<CR>
 108    ab _V >🎥 Video Included<CR>
 109    ab _L ### [🔗 title](link){target="blank"} <C-R>=strftime("%r %Z")<CR><ESC>44h
 110    ab _mj Mitchell Johnston - UID 0
 111    ab _nl :newspaper: __News Links:__<CR>
 112    ab _see - [👓 See more](link)
 113    ab _sn - [📝 Show Notes](link){target="blank"}<ESC>21h
 114    ab _ts :mortar_board: [__Theological Seminary Of The Air__](/mp3/ruckman/theologic-seminary-of-the-air/)<CR>
 115    ab _tb {target="blank"}
 116    ab _div <div style="text-align: center;">
 117    ab _re <u>Related:</u>  
 118    ab _U </u>
 119    ab _u <u><ESC>i
 120    ab _vc <script src="https://av1611.com/verseclick/verseclick.js"></script>
 121    ab _iframe <iframe src="link" scrolling="no" width="100%" height="400" style="border:1px solid black;"></iframe>
 122    ab _Iframe <iframe src="link" scrolling="no" onload="resizeIframe(this) style="border:1px solid black;"></iframe>
 123    
 124    " Offsite
 125    ab _axe - [🔗 Dr Axe](https://draxe.com/){target="blank"} 
 126    ab _da - [🔗 Dr. Ardis](https://thedrardisshow.com/){target="blank"} 
 127    ab _dlm - [🔗 Dr. Lee Merritt](https://drleemerritt.com/){target="blank"} 
 128    ab _ere - [🔗 Eredin](https://www.patreon.com/eredin?utm_source=search){target="blank"} 
 129    ab _ep - [🔗 Eric Peters](https://www.ericpetersautos.com/){target="blank"} 
 130    ab _dk - [🔗 The David Knight Show](http://www.thedavidknightshow.com/){target="blank"}<CR>- [🔗 David Knight Gold](https://davidknight.gold/){target="blank"}   
 131    ab _jl - [🔗 Jon Levi](https://jonlevichannel.com/){target="blank"} 
 132    ab _kb - [🔗 Dr. Ken Berry](https://www.drberry.com/){target="blank"}  
 133    ab _mia - [🔗 Man in America](https://rumble.com/c/ManInAmerica){target="blank"}  
 134    ab _mi - [🔗 Mises](https://mises.org/){target="blank"}  
 135    ab _mlb - [🔗 MYLUNCHBREAK](https://rumble.com/c/MYLUNCHBREAK){target="blank"} 
 136    ab _norm - [🔗 Norml](https://norml.org/){target="blank"}  
 137    ab _rc - [🔗 Rain Country](https://rumble.com/c/RainCountryHomestead){target="blank"}  
 138    ab _pft - [🔗 Press for Truth](https://pressfortruth.ca/){target="blank"}  
 139    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"} 
 140    ab _sr - [🔗 Solari Report](https://home.solari.com/){target="blank"}  
 141    ab _stl - [🔗 Switched To Linux](https://switchedtolinux.com/){target="blank"}  
 142    ab _wf - [🔗 The Why Files](https://rumble.com/c/TheWhyFiles){target="blank"}  
 143    
 144    " On-site
 145    
 146    ab _911 - [🎬 More on 911](/media/911/)
 147    ab _addict - [🎬 More on Addiction](/media/health/addiction/)
 148    ab _arc - [🎬 For more content check the archives](/media/) 
 149    ab _ba - [💻 Bible Analyzer](/media/bible-analyzer)
 150    ab _berg - [🎬 More from Dr Berg](/media/health/dr-berg/)
 151    ab _bio - [🎬 More on Biography](/media/biography/)
 152    ab _chicks - [🎬 More on Chickens](/media/prep/chickens-rabbits/)
 153    ab _cooper - [🎬 More from Bill Cooper](/media/bill-cooper/)
 154    ab _control - [🎬 More on Control](/media/control/)
 155    ab _covid - [🎬 More on Covid](/media/health/covid/)
 156    ab _cr - [🎬 More from James Corbett](/media/corbett/)
 157    ab _cults - [🎬 More on Cults](/media/cults/) 
 158    ab _dental - [🎬 More on Dental](/media/health/dental/)
 159    ab _detox - [🎬 More on Detox](health/#detox)
 160    ab _diet - [🎬 More on Diet](/media/health/diet/)
 161    ab _dirt - [🎬 More on Diatomaceous Earth](/media/health/minerals/diatomaceous-earth/)
 162    ab _env - [🎬 More on Environment](/media/environment/)
 163    ab _em - [🎬 More Eustace Mullins](/media/eustace-mullins/)
 164    ab _flat - [🎬 More on Flat Earth](/media/flat/) 
 165    ab _gatto - [🎬 More from John Talor Gatto](/media/john-t-gatto/) 
 166    ab _gear - [🎬 More on Gear](/media/gear/) 
 167    ab _geg - [🎬 More from G.Edward Griffin](/media/g-edward-griffin/) 
 168    ab _gipp - [🎬 More from Sam Gipp](/media/gipp) 
 169    ab _gr - [🎬 More from Gail Riplinger](/media/riplinger/) 
 170    ab _jd - [🎬 More from Dr James Dinicolantonio](/media/health/dr-james-dinicolantonio/) 
 171    ab _garden - [🎬 More on Gardening](/media/prep/garden/) 
 172    ab _hemp - [🎬 More on Hemp](/media/health/remedies/hemp/) 
 173    ab _herbs - [🎬 More on Herbs](/media/health/remedies/herbs/) 
 174    ab _history - [🎬 More on history](/media/history/) 
 175    ab _jd - [🎬 More from Dr James Dinicolantonio](/media/health/dr-james-dinicolantonio/)
 176    ab _law - [🎬 More on Law](/media/law/)
 177    ab _km - [🎬 More on Kary Mullis](/media/health/kary-mullis/)
 178    ab _larkin - [🎬 More from Larkin Rose](/media/larkin/)
 179    ab _levy - [🎬 More from Dr Thomas Levy](/media/health/dr-thomas-levy/)
 180    ab _mica - [🎬 More from Mica Colston](/media/mica-colston/)
 181    ab _min [🎬 More on Minerals](/include/vids/health/minerals/)
 182    ab _money - [🎬 More on Money](/media/money/) 
 183    ab _mp3 - [🎧 MP3 Files](/mp3)
 184    ab _ortho - [🎬 More on Orthomolecular Medicine](/include/vids/health/orthomolecular/)
 185    ab _pets - [🎧 More on Pets](/media/prep/pets/)
 186    ab _pics - [🎨 More Pictures](/pics)
 187    ab _radio - [🎬 More on Radio](/media/gear/radio/)
 188    ab _rem - [🎬 More on Remedies](/include/vids/health/remedies/)
 189    ab _mms - [🎬 More on MMS](/include/vids/health/remedies/mms)
 190    ab _ruckman - [🎬 More from Peter Ruckman](/media/ruckman/)
 191    ab _sam - [🎬 More from Dr Sam Bailey](/media/health/dr-sam-bailey/)
 192    ab _sircus - [🎬 More from Dr Mark Sircus](/media/health/dr-mark-sircus/)
 193    ab _save - [🔗 Salvation (forgiveness)](/salvation)
 194    ab _selft - [🎬 More on Self Therapy](/media/health/self-therapy/)
 195    ab _spy - [🎬 More on Spying](/media/spying/) 
 196    ab _survive - [🎬 More on Survival](/media/survive/)
 197    ab _tea - [🎬 More on Tea](/include/vids/health/remedies/tea/)
 198    ab _turp - [🎬 More on Turpentine](/include/vids/health/remedies/essential-oils/turpentine)
 199    ab _vax - [🎬 More on Vaccines](/media/health/vaccines/)
 200    ab _vernon - [🎬 More from Dr Vernon Coleman](/media/health/vernon/)
 201    
 202    
 203    " Create task, check off, uncheck (see my .bashrc functions 'today' & 'task')
 204    ab ,c - [ ]
 205    map ,C :s/\[ \]/\[✔\]<CR> " Completed
 206    map ,X :s/\[❌\]/\[ \]<CR> " Unmark completed
 207    map ,i :s/\[ \]/\[🔨\]<CR> " In progress
 208    map ,I :s/\[🔨\]/\[ \]<CR> " Unmark In progress
 209    map ,o :s/\[ \]/\[⭕\]<CR> " Outsourced
 210    map ,O :s/\[⭕\]/\[ \]<CR> " Unmark Outsourced
 211    
 212    " Settings
 213    " ========
 214    
 215    set wildoptions=pum
 216    set cryptmethod=blowfish " use blowfish encryption for encrytped files
 217    set switchbuf=usetab     " when switching buffers, include tabs
 218    set splitright           " create vertical splits to the right
 219    set splitbelow           " create horizontal splits below
 220    set formatoptions=croq   " c=autowrap comments, r=continue comment on <enter>,
 221                             " o=continue comment on o or O, q=allow format comment with gqgq
 222    set backspace=2          " allow backspacing over everything in insert mode
 223    set encoding=UTF-8
 224    
 225    " Folds
 226    set foldenable               " Enable folding
 227    set foldmethod=indent        " Folding based on markers
 228    set foldlevelstart=10        " open most folds by default
 229    set foldnestmax=10           " 10 nested fold max
 230    
 231    " Tabs
 232    set hardtabs=4               " Tab setups
 233    set tabstop=4
 234    set shiftwidth=4
 235    set expandtab                " tab to spaces
 236    set softtabstop=4            " number of spaces in tab when editing
 237    set tabpagemax=15            " Max number of tabs displayed
 238    set showtabline=2            " always display tab line
 239    
 240    " Completion
 241    set dictionary+=~/etc/words-alpha.txt "Ctr-n, Ctr-p word complete
 242    set complete+=k
 243    set ignorecase               " On searches
 244    set infercase
 245    set autoindent               " Good for codding
 246    set smartindent              " Turn on file typed indenting
 247    set shiftround               " When shifting lines, round the indentation to the nearest multiple of “shiftwidth.”
 248    set history=50               " keep 50 lines of command line history
 249    set laststatus=2             " Make sure the status line is always displayed
 250    set nocompatible             " Better for Vim features
 251    set shell=/bin/bash          " Set default shell
 252    set scrolloff=0              " Start scrolling when I'm 3 lines from top/bottom
 253    set backspace=indent,eol,start "Allow backspacing over indention, line breaks and insertion start
 254    set lbr!                     " wrap on words
 255    set formatoptions+=j         " Delete comment characters when joining lines.
 256    set spell                    " Turn on spell check
 257    set belloff=all
 258    
 259    " Display
 260    set number relativenumber    "turn on normal and relitive line numbers
 261    set ruler                    " Display ruler
 262    set showcmd                  " Show commands
 263    set showmatch                " Show matching brackets
 264    set showmode                 " Display what mode you are in
 265    set cursorline               " highlight current line
 266    set wildmenu                 " visual autocomplete for command menu
 267    "set list                     " show hidden characters
 268    set listchars=eol:¬,tab:→→,trail:.,extends:>,precedes:<
 269    set autoread
 270    
 271    " Search
 272    set path+=**                 " :find {file} supports wilecard
 273    set wildmenu                 " tab completetion 
 274    set hlsearch                 " Highlight search matches
 275    set smartcase                " Turn off ignorcase if caps is used
 276    set incsearch                " search as characters are entered
 277    
 278    " netrw setting
 279    let g:netrw_liststyle = 3
 280    let ghregex='\(^\|\s\s\)\zs\.\S\+'
 281    let g:netrw_list_hide=ghregex
 282    
 283    " backup files
 284    silent !mkdir ~/.vim/backup > /dev/null 2>&1
 285    set viminfo='1000,f1,<500    " File information to Keep
 286    set backup                   "Turn on backups
 287    set backupdir=~/.vim/backup     "The place to remove files after I make big errors
 288    set backupskip=/tmp/*,~/.vim/backup/*
 289    set writebackup              "Make backup before overwriting the current buffer
 290    set backupcopy=yes           "Overwrite the original backup file
 291    au BufWritePre * let &bex = '@' . strftime("%F.%H:%M")
 292    
 293    " Keep undo history across sessions by storing it in a file
 294    if has('persistent_undo')
 295        call system('mkdir ~/.vim/undo')
 296        set undodir=~/.vim/undo/
 297        set undofile
 298        set undolevels=1000
 299        set undoreload=10000
 300    endif
 301    
 302    " Vim-plug
 303    if empty(glob('~/.vim/autoload/plug.vim'))
 304      silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
 305        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
 306      autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
 307    endif
 308    
 309    " Plugins will be downloaded under the specified directory.
 310    call plug#begin('~/.vim/plugged')
 311    " Declare the list of plugins.
 312    Plug 'ryanoasis/vim-devicons'
 313    Plug 'marcopaganini/termschool-vim-theme'
 314    Plug 'junegunn/fzf'
 315    Plug 'junegunn/fzf.vim'
 316    Plug 'katono/rogue.vim'
 317    Plug 'dhruvasagar/vim-table-mode'
 318    Plug 'hallison/vim-markdown'
 319    Plug 'ap/vim-css-color'
 320    Plug 'glensc/vim-syntax-lighttpd'
 321    Plug 'jclsn/glow.vim'
 322    
 323    "Vim Rogue options
 324    let g:rogue#name = 'Mitch'
 325    let g:rogue#directory = '/home/mitch/etc'
 326    let g:rogue#jump = '1'
 327    let g:rogue#tombstone = '1'
 328    let g:rogue#fruit = 'Grapes'
 329    
 330    " enable this plugin for filetypes, '*' for all files.
 331    let g:apc_enable_ft = {'text':1, 'markdown':1, 'php':1}
 332    
 333    " List ends here. Plugins become visible to Vim after this call.
 334    call plug#end()
 335    
 336    " File types 
 337    " ==========
 338    augroup configgroup
 339        autocmd!
 340        autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown 
 341        autocmd BufNewFile,BufFilePre,BufRead *.txt set filetype=txt
 342        autocmd FileType make setlocal noexpandtab
 343        autocmd BufEnter Makefile setlocal noexpandtab
 344        autocmd BufEnter *.sh setlocal tabstop=2
 345        autocmd BufEnter *.sh setlocal shiftwidth=2
 346        autocmd BufEnter *.sh setlocal softtabstop=2
 347        au BufNewFile,BufRead *conkyrc* set filetype=conkyrc
 348        autocmd bufwritepost .vimrc source $MYVIMRC
 349        autocmd bufwritepost sp.md <ESC>:!pandoc sp.md -o sp.html<CR>
 350    augroup END
 351    
 352    " Display setup 
 353    " ==============
 354    colorscheme termschool
 355    :set guioptions-=r  "remove right-hand scroll bar
 356    set background=dark " Modify for dark background
 357    "set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
 358    "au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta 
 359    "au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse 
 360    
 361    " using Source Code Pro
 362    set anti enc=utf-8
 363    set guifont=Source\ Code\ Pro\ 16
 364    filetype plugin on
 365    syntax on
 366    set conceallevel=2
 367    
 368    " Set style for spelling errors
 369    hi clear SpellBad
 370    hi SpellBad cterm=reverse 
 371    hi SpellBad gui=reverse
 372    
 373    " Macros 
 374    " ======
 375    map j gj
 376    map k gk
 377    map <leader>a <ESC>A [AW](#archaic) [NA](#names)<ESC>0n
 378    map <leader>l <ESC>:term ++close lu <c-r><c-w><CR>
 379    map <leader>N <ESC>:set nu! rnu!<CR>
 380    map <leader>pb 0i<p class="blue"><ESC>A</p><ESC>
 381    map <leader>pg 0i<p class="green"><ESC>A</p><ESC>
 382    map <leader>pr 0i<p class="red"><ESC>A</p><ESC>
 383    map <leader>py 0i<p class="yellow"><ESC>A</p><ESC>
 384    map <leader>qn :tabedit ~/Documents/jots/scratch.md<CR>
 385    " vim-powered terminal in split window
 386    map <Leader>t :term ++close<cr>
 387    tmap <Leader>t <c-w>:term ++close<cr>
 388    
 389    " vim-powered terminal in new tab
 390    map <Leader>T :tab term ++close<cr>
 391    tmap <Leader>T <c-w>:tab term ++close<cr>
 392    map <leader>v :tabedit $MYVIMRC<CR>
 393    map <leader>wb <ESC>:!epy ~/Documents/books/tech/dev-bash/bash-pocket-reference.epub<CR>
 394    map <leader>wh <ESC>:!epy ~/Documents/books/tech/dev-web/oreilly-html-and-css-the-good-parts-by-the-good-parts.epub<CR>
 395    noremap <space> za " space open/closes folds
 396    noremap H :set hlsearch!<CR>
 397    
 398    " HTML
 399    " ----
 400    " Highlite in blue (Ruckman) or yellow (mine) or green X-ref
 401    map <C-b> 0i<mark class="blue"><ESC>A</mark><ESC>03j
 402    map <C-y> 0i<mark class="yellow"><ESC>A</mark><ESC>03j
 403    map <A-g> 0i<mark class="green";<ESC>A</mark><ESC>0
 404    map <A-r> 0i<mark class="red";<ESC>A</mark><ESC>0
 405    
 406    " Function keys
 407    " -------------
 408    
 409    " noh - no highlight
 410    map <esc> :noh <CR>
 411    
 412    " <F2> Explorer in newtab
 413    map <F2> <ESC>:tabe .<CR>
 414    map! <F2> <ESC>:tabe .<CR>
 415    
 416    " This calls my download manager. I make a list in vim, hit F3 and it downloads them.
 417    map <F3> <ESC>:w ~/Downloads/get.txt<CR>:term ++close /home/mitch/bin/get -d<CR>>
 418    
 419    " F4 - autocomplete, backward Insert mode
 420    inoremap <F4> <C-P>
 421    
 422    " F5 - autocomplete, forward Insert mode
 423    inoremap <F5> <C-N>
 424    
 425    " This allows me to insert a Bible quote in to a document.
 426    map <F6> <ESC>0D<ESC>!!kjv 
 427    map! <F6> <ESC>0D<ESC>:!kjv 
 428    "map! <F6> <ESC>0D<ESC>:.!kjv 
 429    
 430    " pi take the name of a mp4 or picture file under /var/www and will return html with png
 431    " created for a markdown document.
 432    map <F7> <ESC>0D<ESC>:.!pi 
 433    map! <F7> <ESC>0D<ESC>:.!pi 
 434    
 435    " mkln is "make link" will return markdown formated link with emoji for major
 436    " file types, and will auto-local file under /var/www.
 437    map <F8> <ESC>0D<ESC>:.!mkln 
 438    map! <F8> <ESC>0D<ESC>:.!mkln 
 439    
 440    " Run external compiler (used for CRN’s AV Bible)
 441    map <F9> <ESC>:w!<ESC>:tab term ++close glow -p %<CR>
 442    
 443    " <F10> Place holder
 444    
 445    " Easy tab navigation
 446    nnoremap <Leader>1 1gt
 447    nnoremap <Leader>2 2gt
 448    nnoremap <Leader>3 3gt
 449    nnoremap <Leader>4 4gt
 450    nnoremap <Leader>5 5gt
 451    nnoremap <Leader>6 6gt
 452    nnoremap <Leader>7 7gt
 453    nnoremap <Leader>8 8gt
 454    nnoremap <Leader>9 9gt
 455    
 456    
 457    " ===== new status line ====
 458    
 459    "" 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.
 460    
 461    " Images - https://www.reddit.com/r/vim/comments/ld8h2j/i_made_a_status_line_from_scratch_no_plugins_used/
 462    " I have used Nerd icon fonts. Icons won't work without them. https://github.com/ryanoasis/nerd-fonts/
 463    
 464    " This statusline looks exactly like Vim Airline (even more customizable & powerful) & loads faster than Vim airline. Only take few ms to load.
 465    
 466    " STARTUP TIME - With Vim Airline - ~250ms. With this statusline - ~100ms. Without any statusline - ~98ms.
 467    
 468    " 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.
 469    " e.g. source "~/.config/vim/statusline.vim"
 470    
 471    
 472    
 473    " Color highlighting groups
 474    " Add this AFTER `colorscheme` option in your vimrc. Otherwise your colorscheme will clear this highlightings. OR use ColorScheme autocommand. VERY IMPORTANT.
 475    
 476    " Color pallet
 477    " Green  - #2BBB4F (BG) - #080808 (FG)
 478    " Blue   - #4799EB
 479    " Violet - #986FEC 
 480    " Yellow - #D7A542
 481    " Orange - #EB754D
 482    " Grey1  - #202020
 483    " Grey   - #303030
 484     
 485     
 486    " Define color variables
 487    let g:StslineColorGreen  = "#2BBB4F"
 488    let g:StslineColorBlue   = "#4799EB"
 489    let g:StslineColorViolet = "#986FEC"
 490    let g:StslineColorYellow = "#D7A542"
 491    let g:StslineColorOrange = "#EB754D"
 492     
 493    let g:StslineColorLight  = "#C0C0C0"
 494    let g:StslineColorDark   = "#080808"
 495    let g:StslineColorDark1  = "#181818"
 496    let g:StslineColorDark2  = "#202020"
 497    let g:StslineColorDark3  = "#303030"
 498     
 499     
 500    " Define colors
 501    let g:StslineBackColor   = g:StslineColorDark2
 502    let g:StslineOnBackColor = g:StslineColorLight
 503    "let g:StslinePriColor   = g:StslineColorGreen
 504    let g:StslineOnPriColor  = g:StslineColorDark
 505    let g:StslineSecColor    = g:StslineColorDark3
 506    let g:StslineOnSecColor  = g:StslineColorLight
 507     
 508     
 509    " Create highlight groups
 510    execute 'highlight StslineSecColorFG guifg=' . g:StslineSecColor   ' guibg=' . g:StslineBackColor
 511    execute 'highlight StslineSecColorBG guifg=' . g:StslineColorLight ' guibg=' . g:StslineSecColor
 512    execute 'highlight StslineBackColorBG guifg=' . g:StslineColorLight ' guibg=' . g:StslineBackColor
 513    execute 'highlight StslineBackColorFGSecColorBG guifg=' . g:StslineBackColor ' guibg=' . g:StslineSecColor
 514    execute 'highlight StslineSecColorFGBackColorBG guifg=' . g:StslineSecColor ' guibg=' . g:StslineBackColor
 515    execute 'highlight StslineModColorFG guifg=' . g:StslineColorYellow ' guibg=' . g:StslineBackColor
 516     
 517     
 518     
 519    " Statusline
 520    
 521    " Enable statusline
 522    set laststatus=2
 523    
 524    " Disable showmode - i.e. Don't show mode like --INSERT-- in current statusline.
 525    set noshowmode
 526    
 527    " 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.).
 528    set termguicolors
 529    
 530    
 531    
 532    " Understand statusline elements
 533    
 534    " %{StslineMode()}  = Output of a function
 535    " %#StslinePriColorBG# = Highlight group
 536    " %F, %c, etc. are variables which contain value like - current file path, current colums, etc.
 537    " %{&readonly?\"\ \":\"\"} = If file is readonly ? Then "Lock icon" Else : "Nothing"
 538    " %{get(b:,'coc_git_status',b:GitBranch)}    = If b:coc_git_status efists, then it's value, else value of b:GitBranch
 539    " &filetype, things starting with & are also like variables with info.
 540    " \  - Is for escaping a space. \" is for escaping a double quote.
 541    " %{&fenc!='utf-8'?\"\ \":''}   = If file encoding is NOT!= 'utf-8' ? THEN output a "Space" else : no character 
 542    
 543    
 544    
 545    " Define active statusline
 546    
 547    function! ActivateStatusline()
 548    call GetFileType()
 549    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\ 
 550    endfunction
 551    
 552    
 553    
 554    " Define Inactive statusline
 555    
 556    function! DeactivateStatusline()
 557    
 558    if !exists("b:GitBranch") || b:GitBranch == ''
 559    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\ 
 560    
 561    else
 562    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\ 
 563    endif
 564    
 565    endfunction
 566    
 567    
 568    
 569    " Get Statusline mode & also set primary color for that mode
 570    function! StslineMode()
 571    
 572        let l:CurrentMode=mode()
 573    
 574        if l:CurrentMode==#"n"
 575            let g:StslinePriColor     = g:StslineColorGreen
 576            let b:CurrentMode = "NORMAL "
 577    
 578        elseif l:CurrentMode==#"i"
 579            let g:StslinePriColor     = g:StslineColorViolet
 580            let b:CurrentMode = "INSERT "
 581    
 582        elseif l:CurrentMode==#"c"
 583            let g:StslinePriColor     = g:StslineColorYellow
 584    
 585            let b:CurrentMode = "COMMAND "
 586    
 587        elseif l:CurrentMode==#"v"
 588            let g:StslinePriColor     = g:StslineColorBlue
 589            let b:CurrentMode = "VISUAL "
 590    
 591        elseif l:CurrentMode==#"V"
 592            let g:StslinePriColor     = g:StslineColorBlue
 593            let b:CurrentMode = "V-LINE "
 594    
 595        elseif l:CurrentMode==#"\<C-v>"
 596            let g:StslinePriColor     = g:StslineColorBlue
 597            let b:CurrentMode = "V-BLOCK "
 598    
 599        elseif l:CurrentMode==#"R"
 600            let g:StslinePriColor     = g:StslineColorViolet
 601            let b:CurrentMode = "REPLACE "
 602    
 603        elseif l:CurrentMode==#"s"
 604            let g:StslinePriColor     = g:StslineColorBlue
 605            let b:CurrentMode = "SELECT "
 606    
 607        elseif l:CurrentMode==#"t"
 608            let g:StslinePriColor     =g:StslineColorYellow
 609            let b:CurrentMode = "TERM "
 610    
 611        elseif l:CurrentMode==#"!"
 612            let g:StslinePriColor     = g:StslineColorYellow
 613            let b:CurrentMode = "SHELL "
 614    
 615        endif
 616    
 617    
 618        call UpdateStslineColors()
 619        
 620        return b:CurrentMode
 621    
 622    endfunction
 623    
 624    
 625    
 626    " Update colors. Recreate highlight groups with new Primary color value.
 627    function! UpdateStslineColors()
 628    
 629    execute 'highlight StslinePriColorBG           guifg=' . g:StslineOnPriColor ' guibg=' . g:StslinePriColor
 630    execute 'highlight StslinePriColorBGBold       guifg=' . g:StslineOnPriColor ' guibg=' . g:StslinePriColor ' gui=bold'
 631    execute 'highlight StslinePriColorFG           guifg=' . g:StslinePriColor   ' guibg=' . g:StslineBackColor
 632    execute 'highlight StslinePriColorFGSecColorBG guifg=' . g:StslinePriColor   ' guibg=' . g:StslineSecColor
 633    execute 'highlight StslineSecColorFGPriColorBG guifg=' . g:StslineSecColor   ' guibg=' . g:StslinePriColor
 634    
 635    if !exists("b:GitBranch") || b:GitBranch == ''
 636    execute 'highlight StslineBackColorFGPriColorBG guifg=' . g:StslineBackColor ' guibg=' . g:StslinePriColor
 637    endif
 638    
 639    endfunction
 640    
 641    
 642    
 643    " Get git branch name
 644    
 645    function! GetGitBranch()
 646    let b:GitBranch=""
 647    try
 648        let l:dir=expand('%:p:h')
 649        let l:gitrevparse = system("git -C ".l:dir." rev-parse --abbrev-ref HEAD")
 650        if !v:shell_error
 651            let b:GitBranch="   ".substitute(l:gitrevparse, '\n', '', 'g')." "
 652            execute 'highlight StslineBackColorFGPriColorBG guifg=' . g:StslineBackColor ' guibg=' . g:StslineSecColor
 653        endif
 654    catch
 655    endtry
 656    endfunction
 657    
 658    
 659    
 660    " Get filetype & custom icon. Put your most used file types first for optimized performance.
 661    
 662    function! GetFileType()
 663    
 664    if &filetype == 'typescript'
 665    let b:FiletypeIcon = ' '
 666    
 667    elseif &filetype == 'html'
 668    let b:FiletypeIcon = ' '
 669    
 670    elseif &filetype == 'scss'
 671    let b:FiletypeIcon = ' '
 672    
 673    elseif &filetype == 'css'
 674    let b:FiletypeIcon = ' '
 675    
 676    elseif &filetype == 'javascript'
 677    let b:FiletypeIcon = ' '
 678    
 679    elseif &filetype == 'javascriptreact'
 680    let b:FiletypeIcon = ' '
 681    
 682    elseif &filetype == 'markdown'
 683    let b:FiletypeIcon = ' '
 684    
 685    elseif &filetype == 'sh' || &filetype == 'zsh'
 686    let b:FiletypeIcon = ' '
 687    
 688    elseif &filetype == 'vim'
 689    let b:FiletypeIcon = ' '
 690    
 691    elseif &filetype == ''
 692    let b:FiletypeIcon = ''
 693    
 694    elseif &filetype == 'rust'
 695    let b:FiletypeIcon = ' '
 696    
 697    elseif &filetype == 'ruby'
 698    let b:FiletypeIcon = ' '
 699    
 700    elseif &filetype == 'cpp'
 701    let b:FiletypeIcon = ' '
 702    
 703    elseif &filetype == 'c'
 704    let b:FiletypeIcon = ' '
 705    
 706    elseif &filetype == 'go'
 707    let b:FiletypeIcon = ' '
 708    
 709    elseif &filetype == 'lua'
 710    let b:FiletypeIcon = ' '
 711    
 712    elseif &filetype == 'haskel'
 713    let b:FiletypeIcon = ' '
 714    
 715    else
 716    let b:FiletypeIcon = '🖊 '
 717    
 718    endif
 719    endfunction
 720    
 721    
 722    
 723    " Get git branch name after entering a buffer
 724    augroup GetGitBranch
 725        autocmd!
 726        autocmd BufEnter * call GetGitBranch()
 727    augroup END
 728    
 729    
 730    " Set active / inactive statusline after entering, leaving buffer
 731    augroup SetStslineline
 732        autocmd!
 733        autocmd BufEnter,WinEnter * call ActivateStatusline()
 734        autocmd BufLeave,WinLeave * call DeactivateStatusline()
 735    augroup END
 736    
 737    " vim: nospell 
───────┴────────────────────────────────────────────────────────────────────────