From 0d76dba001ff6a088e2d49832171e814c918a46a Mon Sep 17 00:00:00 2001 From: srdusr Date: Mon, 25 Mar 2024 05:21:26 +0200 Subject: Don't use plugins anymore --- .vim/vimrc | 534 ++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 296 insertions(+), 238 deletions(-) diff --git a/.vim/vimrc b/.vim/vimrc index 1a46d3d..eef6ac8 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -1,28 +1,43 @@ - "=============================================================================== " Mappings/Keybindings/Commands "=============================================================================== let mapleader = ";" " map leader to Semi colon -" Use to escape -inoremap jk + +inoremap jk " Use to escape + " Easier split navigations, just ctrl-j instead of ctrl-w then j nnoremap nnoremap nnoremap nnoremap + +" Recent files (MRU) +nnoremap m :browse old +" Search files by name +nnoremap p :find **/** +" browse files from same dir as current file +nnoremap e :e %:p:h + " Combine buffers list with buffer name -nnoremap b :buffers:buffer +"nnoremap b :buffers:buffer + +" Jump to a buffer +nnoremap b :ls t:b + " Map buffer next, prev and delete to map n :bn map p :bp map d :bd -" Set alt + j/k to switch lines of texts or simply move them -:nnoremap :let save_a=@a"add"ap:let @a=save_a -:nnoremap :let save_a=@a"add"ap:let @a=save_a + +"" Set alt + j/k to switch lines of texts or simply move them +":nnoremap :let save_a=@a"add"ap:let @a=save_a +":nnoremap :let save_a=@a"add"ap:let @a=save_a + " Swap two pieces of text, use x to cut in visual mode, then use Ctrl-x in " visual mode to select text to swap with :vnoremap `.``gvP``P + " To resize in different steps, you can create maps that will adjust the window " size differently. For example to increase the window size by a factor of 1.5 " and decrease the window size by 0.67, you can map this: @@ -32,43 +47,47 @@ nnoremap + :resize +5 nnoremap - :resize -5 nnoremap > :vertical resize +5 nnoremap < :vertical resize -5 + " Toggle set number -nnoremap $ :NumbersToggle +"nnoremap $ :NumbersToggle "nnoremap % :NumbersOnOff + " Copy and Paste with and "vmap y:call system("xclip -i -selection clipboard", getreg("\"")):call system("xclip -i", getreg("\"")) "nmap :call setreg("\"",system("xclip -o -selection clipboard"))p nnoremap p (v:register == '"' && &clipboard =~ 'unnamed' ? '"*p' : '"' . v:register . 'p') + " Use command :Vb for Visual Block or since is used for Copy command! Vb normal! + " Map to save/edit a root permission/read-only file, only works in " traditional vim and not neovim cmap w!! %!sudo tee > /dev/null + nnoremap x :silent !chmod +x % + "nnoremap <[-p> m`op`` -"nnoremap <]-p> m`Op`` " Paste on next line +"nnoremap <]-p> m`Op`` + "inoremap " -set keywordprg=:help -runtime ftplugin/man.vim +"set keywordprg=:help +"runtime ftplugin/man.vim "=============================================================================== " Settings "=============================================================================== -"let g:nvim_system_wide = 1 " let whole system use nvim config -set shell=zsh +" enable syntax, plugins (for netrw) and indentation +syntax enable + +"set shell=zsh set termguicolors set guicursor= let &t_SI = "\e[6 q" let &t_EI = "\e[2 q" -" reset the cursor on start (for older versions of vim, usually not required) -augroup myCmds -au! -autocmd VimEnter * silent !echo -ne "\e[2 q" -augroup END " Neovim requires xclip, check if normal vim has +clipboard by " <:echo has('clipboard')> from within Vim (if the output is 1, good to " go otherwise 0 then need a build that has it @@ -130,6 +149,21 @@ set autoread " if a file is changed outside of vim, automatically reload it with set diffopt=vertical " diffs are shown side-by-side not above/below set signcolumn=no " always show the sign column set textwidth=80 + +" FILE BROWSING: +let g:netrw_banner=0 " disable annoying banner +let g:netrw_browse_split=4 " open in prior window +let g:netrw_altv=1 " open splits to the right +let g:netrw_liststyle=3 " tree view +let g:netrw_fastbrowse = 0 +autocmd FileType netrw setl bufhidden=wipe + +" Faster vimgrep/grep via ripgrep +if executable("rg") + set grepprg=rg\ --vimgrep\ --no-heading + set grepformat=%f:%l:%c:%m,%f:%l:%m +endif + "------------------------------------------------------------------------------- @@ -138,52 +172,52 @@ set textwidth=80 "=============================================================================== " Auto-Install 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 - "autocmd VimEnter * PlugInstall | source $MYVIMRC -endif - -" :so % :PlugInstall -call plug#begin('~/.vim/autoload/plugged') -"Plug 'glepnir/dashboard-nvim' -Plug 'christoomey/vim-tmux-navigator' -Plug 'preservim/vimux' -Plug 'myusuf3/numbers.vim' -Plug 'romainl/vim-cool' -"Plug 'ervandew/supertab' -"Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'sheerun/vim-polyglot' -Plug 'vim-airline/vim-airline' -Plug 'ryanoasis/vim-devicons' -Plug 'rbgrouleff/bclose.vim' -"Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'} -Plug 'lambdalisue/fern.vim' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' -Plug 'airblade/vim-rooter' -"Plug 'SirVer/ultisnips' -"Plug 'honza/vim-snippets' -Plug 'airblade/vim-gitgutter' -Plug 'tpope/vim-eunuch' -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-surround' -Plug 'tpope/vim-obsession' -Plug 'tpope/vim-unimpaired' -Plug 'scrooloose/syntastic' -Plug 'w0rp/ale' -Plug 'davidhalter/jedi-vim' -"Plug 'valloric/youcompleteme' " vim needs to be compiled with python/ compiled with install.py in plugin directory -Plug 'Lenovsky/nuake' -Plug 'voldikss/vim-floaterm' -Plug 'gruvbox-community/gruvbox' -Plug 'srcery-colors/srcery-vim' -Plug 'tomasr/molokai' -Plug 'ayu-theme/ayu-vim' -Plug 'sjl/badwolf' -Plug 'joshdick/onedark.vim' -call plug#end() +"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 +" "autocmd VimEnter * PlugInstall | source $MYVIMRC +"endif +" +"" :so % :PlugInstall +"call plug#begin('~/.vim/autoload/plugged') +""Plug 'glepnir/dashboard-nvim' +"Plug 'christoomey/vim-tmux-navigator' +"Plug 'preservim/vimux' +"Plug 'myusuf3/numbers.vim' +"Plug 'romainl/vim-cool' +""Plug 'ervandew/supertab' +""Plug 'neoclide/coc.nvim', {'branch': 'release'} +"Plug 'sheerun/vim-polyglot' +"Plug 'vim-airline/vim-airline' +"Plug 'ryanoasis/vim-devicons' +"Plug 'rbgrouleff/bclose.vim' +""Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'} +"Plug 'lambdalisue/fern.vim' +"Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +"Plug 'junegunn/fzf.vim' +"Plug 'airblade/vim-rooter' +""Plug 'SirVer/ultisnips' +""Plug 'honza/vim-snippets' +"Plug 'airblade/vim-gitgutter' +"Plug 'tpope/vim-eunuch' +"Plug 'tpope/vim-fugitive' +"Plug 'tpope/vim-surround' +"Plug 'tpope/vim-obsession' +"Plug 'tpope/vim-unimpaired' +"Plug 'scrooloose/syntastic' +"Plug 'w0rp/ale' +"Plug 'davidhalter/jedi-vim' +""Plug 'valloric/youcompleteme' " vim needs to be compiled with python/ compiled with install.py in plugin directory +"Plug 'Lenovsky/nuake' +"Plug 'voldikss/vim-floaterm' +"Plug 'gruvbox-community/gruvbox' +"Plug 'srcery-colors/srcery-vim' +"Plug 'tomasr/molokai' +"Plug 'ayu-theme/ayu-vim' +"Plug 'sjl/badwolf' +"Plug 'joshdick/onedark.vim' +"call plug#end() "source $HOME/.vim/plug-config/coc.vim @@ -194,161 +228,170 @@ call plug#end() " Plugin Settings "=============================================================================== -" Fugitive statusline -"--------------------------------------- -"set statusline=%{fugitive#statusline()}%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%] -"------------------------------------------------------------------------------- -"" Show the buffer number in the status line. -"set statusline=%02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P -"set statusline=%{fugitive#statusline()}02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P -"------------------------------------------------------------------------------- - -" Airline -"--------------------------------------- -let g:airline#extensions#tabline#enabled = 1 -let g:airline#extensions#tabline#show_buffers = 1 -let g:airline_powerline_fonts = 1 -let g:airline#extensions#tabline#buffer_nr_show = 1 -let g:airline_theme='onedark' -"------------------------------------------------------------------------------- - -" Float Term -"--------------------------------------- -" Configuration example -let g:floaterm_keymap_new = 't' -let g:floaterm_keymap_prev = 'tn' -let g:floaterm_keymap_next = 'tp' -let g:floaterm_keymap_toggle = 'tt' -"------------------------------------------------------------------------------- - -" Nuake -"--------------------------------------- -" Toggle Nuake terminal panel -nnoremap :Nuake -inoremap :Nuake -tnoremap :Nuake -let g:nuake_per_tab = 1 " Enable the Nuake instance per tab page. (default 1) -let g:close_if_last_standing = 1 " Close the editor if the Nuake window is the last one. (default 1) -let g:nuake_position = 'right' -"let g:nuake_size = 0.2 -"------------------------------------------------------------------------------- - -" Vimux -"--------------------------------------- -" Prompt for a command to run -map vp :VimuxPromptCommand -" Run last command executed by VimuxRunCommand -map vl :VimuxRunLastCommand -" Inspect runner pane -map vi :VimuxInspectRunner -" Zoom the tmux runner pane -mapvz :VimuxZoomRunner -"------------------------------------------------------------------------------- - -" Snippets -"--------------------------------------- -" Snippets — code snippets allow you to quickly write some boilerplate code -" that is often repetitive. To add code snippets support, you will have to add -" UltiSnips. -let g:UltiSnipsExpandTrigger = "" -"let g:UltiSnipsJumpForwardTrigger = "" -"let g:UltiSnipsJumpBackwardTrigger = "" -"------------------------------------------------------------------------------- - -" Youcompleteme -"--------------------------------------- -"let g:ycm_global_ycm_extra_conf = '~/.config/nvim/autoload/plugged/youcompleteme/.ycm_extra_conf.py' -" ---> compatibility with another plugin (ultisnips) <--- -"let g:ycm_key_list_select_completion = [ '', '' ] -"let g:ycm_key_list_previous_completion = [ '', '' ] -"let g:SuperTabDefaultCompletionType = '' -" ---> disable preview window <--- -"set completeopt-=preview -" ---> navigating to the definition of a a symbol <--- -"map g :YcmCompleter GoToDefinitionElseDeclaration -"------------------------------------------------------------------------------- - - -"=============================================================================== -" File Manager & FZF -"=============================================================================== - -" CHADTree Filemanager/project drawer (NerdTree killer) -"--------------------------------------- -"" to toggle CHADTree run command :CHADopen or use hotkey v : -"nnoremap f CHADopen -""nnoremap v CHADopen " Default Behaviour -"nnoremap CHADopen -"" :CHADhelp to view documentation -"" Add a hotkey to clear quickfix list: -""nnoremap qk call setqflist([]) -"let g:chadtree_settings = { 'view.width': 25 } -"------------------------------------------------------------------------------- - -" FZF fuzzy finder -"--------------------------------------- -" Enable per-command history. -" CTRL-N and CTRL-P will be automatically bound to next-history and -" previous-history instead of down and up. If you don't like the change, -" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. -let g:fzf_history_dir = '~/.local/share/fzf-history' -map z :FZF -map a :Files -map l :Lines -map L :BLines -map B :Buffers -map h :History: -nnoremap g :Rg -"nnoremap t :Tags -nnoremap m :Marks -" This is the default extra key bindings -let g:fzf_action = { - \ 'ctrl-t': 'tab split', - \ 'ctrl-x': 'split', - \ 'ctrl-y': 'vsplit' } -let g:fzf_tags_command = 'ctags -R' -" Border color -let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } } -let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' -let $FZF_DEFAULT_COMMAND="rg --files --hidden" -" Customize fzf colors to match your color scheme -let g:fzf_colors = - \ { 'fg': ['fg', 'Normal'], - \ 'bg': ['bg', 'Normal'], - \ 'hl': ['fg', 'Comment'], - \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], - \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], - \ 'hl+': ['fg', 'Statement'], - \ 'info': ['fg', 'PreProc'], - \ 'border': ['fg', 'Ignore'], - \ 'prompt': ['fg', 'Conditional'], - \ 'pointer': ['fg', 'Exception'], - \ 'marker': ['fg', 'Keyword'], - \ 'spinner': ['fg', 'Label'], - \ 'header': ['fg', 'Comment'] } -" Get Files -command! -bang -nargs=? -complete=dir Files - \ call fzf#vim#files(, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), 0) -" Get text in files with Rg -command! -bang -nargs=* Rg - \ call fzf#vim#grep( - \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(), 1, - \ fzf#vim#with_preview(), 0) -" Ripgrep advanced -function! RipgrepFzf(query, fullscreen) - let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' - let initial_command = printf(command_fmt, shellescape(a:query)) - let reload_command = printf(command_fmt, '{q}') - let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} - call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) -endfunction -command! -nargs=* -bang RG call RipgrepFzf(, 0) -" Git grep -command! -bang -nargs=* GGrep - \ call fzf#vim#grep( - \ 'git grep --line-number '.shellescape(), 0, - \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) -command! -bang FM call fzf#run(fzf#wrap({'source': 'cat ~/.fzf-marks | sed "s/.*: \(.*\)$/\1/" | sed "s#~#${HOME}#"', 'sink': 'lcd'}, 0)) +"" Fugitive statusline +""--------------------------------------- +""set statusline=%{fugitive#statusline()}%F%m%r%h%w\ (%{&ff}){%Y}\ [%l,%v][%p%%] +""------------------------------------------------------------------------------- +""" Show the buffer number in the status line. +""set statusline=%02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +""set statusline=%{fugitive#statusline()}02n:%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P + +""------------------------------------------------------------------------------- +" +"" Airline +""--------------------------------------- +"let g:airline#extensions#tabline#enabled = 1 +"let g:airline#extensions#tabline#show_buffers = 1 +"let g:airline_powerline_fonts = 1 +"let g:airline#extensions#tabline#buffer_nr_show = 1 +"let g:airline_theme='onedark' +" +""------------------------------------------------------------------------------- +" +"" Float Term +""--------------------------------------- +"" Configuration example +"let g:floaterm_keymap_new = 't' +"let g:floaterm_keymap_prev = 'tn' +"let g:floaterm_keymap_next = 'tp' +"let g:floaterm_keymap_toggle = 'tt' +" +""------------------------------------------------------------------------------- +" +"" Nuake +""--------------------------------------- +"" Toggle Nuake terminal panel +"nnoremap :Nuake +"inoremap :Nuake +"tnoremap :Nuake +"let g:nuake_per_tab = 1 " Enable the Nuake instance per tab page. (default 1) +"let g:close_if_last_standing = 1 " Close the editor if the Nuake window is the last one. (default 1) +"let g:nuake_position = 'right' +""let g:nuake_size = 0.2 + +""------------------------------------------------------------------------------- +" +"" Vimux +""--------------------------------------- +"" Prompt for a command to run +"map vp :VimuxPromptCommand +"" Run last command executed by VimuxRunCommand +"map vl :VimuxRunLastCommand +"" Inspect runner pane +"map vi :VimuxInspectRunner +"" Zoom the tmux runner pane +"mapvz :VimuxZoomRunner + +""------------------------------------------------------------------------------- +" +"" Snippets +""--------------------------------------- +"" Snippets — code snippets allow you to quickly write some boilerplate code +"" that is often repetitive. To add code snippets support, you will have to add +"" UltiSnips. +"let g:UltiSnipsExpandTrigger = "" +""let g:UltiSnipsJumpForwardTrigger = "" +""let g:UltiSnipsJumpBackwardTrigger = "" + +""------------------------------------------------------------------------------- +" +"" Youcompleteme +""--------------------------------------- +""let g:ycm_global_ycm_extra_conf = '~/.config/nvim/autoload/plugged/youcompleteme/.ycm_extra_conf.py' +"" ---> compatibility with another plugin (ultisnips) <--- +""let g:ycm_key_list_select_completion = [ '', '' ] +""let g:ycm_key_list_previous_completion = [ '', '' ] +""let g:SuperTabDefaultCompletionType = '' +"" ---> disable preview window <--- +""set completeopt-=preview +"" ---> navigating to the definition of a a symbol <--- +""map g :YcmCompleter GoToDefinitionElseDeclaration + +""------------------------------------------------------------------------------- +" +" +""=============================================================================== +"" File Manager & FZF +""=============================================================================== +" +"" CHADTree Filemanager/project drawer (NerdTree killer) +""--------------------------------------- +""" to toggle CHADTree run command :CHADopen or use hotkey v : +""nnoremap f CHADopen +"""nnoremap v CHADopen " Default Behaviour +""nnoremap CHADopen +""" :CHADhelp to view documentation +""" Add a hotkey to clear quickfix list: +"""nnoremap qk call setqflist([]) +""let g:chadtree_settings = { 'view.width': 25 } + +""------------------------------------------------------------------------------- +" +"" FZF fuzzy finder +""--------------------------------------- +"" Enable per-command history. +"" CTRL-N and CTRL-P will be automatically bound to next-history and +"" previous-history instead of down and up. If you don't like the change, +"" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. +"let g:fzf_history_dir = '~/.local/share/fzf-history' +"map z :FZF +"map a :Files +"map l :Lines +"map L :BLines +"map B :Buffers +"map h :History: +"nnoremap g :Rg +""nnoremap t :Tags +"nnoremap m :Marks +"" This is the default extra key bindings +"let g:fzf_action = { +" \ 'ctrl-t': 'tab split', +" \ 'ctrl-x': 'split', +" \ 'ctrl-y': 'vsplit' } +"let g:fzf_tags_command = 'ctags -R' +"" Border color +"let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } } +"let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' +"let $FZF_DEFAULT_COMMAND="rg --files --hidden" +"" Customize fzf colors to match your color scheme +"let g:fzf_colors = +" \ { 'fg': ['fg', 'Normal'], +" \ 'bg': ['bg', 'Normal'], +" \ 'hl': ['fg', 'Comment'], +" \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], +" \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], +" \ 'hl+': ['fg', 'Statement'], +" \ 'info': ['fg', 'PreProc'], +" \ 'border': ['fg', 'Ignore'], +" \ 'prompt': ['fg', 'Conditional'], +" \ 'pointer': ['fg', 'Exception'], +" \ 'marker': ['fg', 'Keyword'], +" \ 'spinner': ['fg', 'Label'], +" \ 'header': ['fg', 'Comment'] } +"" Get Files +"command! -bang -nargs=? -complete=dir Files +" \ call fzf#vim#files(, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), 0) +"" Get text in files with Rg +"command! -bang -nargs=* Rg +" \ call fzf#vim#grep( +" \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(), 1, +" \ fzf#vim#with_preview(), 0) +"" Ripgrep advanced +"function! RipgrepFzf(query, fullscreen) +" let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true' +" let initial_command = printf(command_fmt, shellescape(a:query)) +" let reload_command = printf(command_fmt, '{q}') +" let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]} +" call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) +"endfunction +"command! -nargs=* -bang RG call RipgrepFzf(, 0) +"" Git grep +"command! -bang -nargs=* GGrep +" \ call fzf#vim#grep( +" \ 'git grep --line-number '.shellescape(), 0, +" \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), 0) +"command! -bang FM call fzf#run(fzf#wrap({'source': 'cat ~/.fzf-marks | sed "s/.*: \(.*\)$/\1/" | sed "s#~#${HOME}#"', 'sink': 'lcd'}, 0)) +" "------------------------------------------------------------------------------- @@ -369,14 +412,10 @@ command! -bang FM call fzf#run(fzf#wrap({'source': 'cat ~/.fzf-marks | sed "s/.* " Try to use a colorscheme plugin " but fallback to a default one -try - colorscheme gruvbox -catch /^Vim\%((\a\+)\)\=:E185/ - " no plugins available - colorscheme elflord -endtry +colorscheme desert highlight Normal guibg=NONE "set background=dark +" "------------------------------------------------------------------------------- @@ -400,6 +439,7 @@ function! ClearTerminal() sleep 100m let &scrollback=s:scroll_value endfunction + "------------------------------------------------------------------------------- " :Rename {newname} @@ -414,6 +454,7 @@ function! RenameFile() endif endfunction map r :call RenameFile() + "------------------------------------------------------------------------------- " Return to the same line when we reopen a file @@ -425,33 +466,34 @@ map r :call RenameFile() \ execute 'normal! g`"zvzz' | \ endif augroup END + "------------------------------------------------------------------------------- -" Update Tmux Status Vi-mode -"--------------------------------------- function! UpdateTmuxStatus() + if &filetype == "man" + return + endif + let mode = mode() - " Determine the mode name based on the mode value let mode_name = '' if mode ==# 'n' - let mode_name = '-- NORMAL --' + let mode_name = "-- NORMAL --" elseif mode ==# 'i' || mode ==# 'ic' - let mode_name = '-- INSERT --' + let mode_name = "-- INSERT --" else - let mode_name = '-- NORMAL --' " -- COMMAND --" + let mode_name = "-- NORMAL --" endif - " Write the mode name to the file - let file = $HOME . '/.vi-mode' + let file = $HOME . "/.vi-mode" call writefile([mode_name], file) - if exists('g:nvim_running') - " Neovim is running, update the mode file and refresh tmux - let VI_MODE = '' " Clear VI_MODE to show Neovim mode - silent !tmux refresh-client -S + if exists('*nvim_running') + let VI_MODE = "" " Clear VI_MODE to show vim mode + silent execute "!tmux refresh-client -S" endif + " Force tmux to update the status - silent !tmux refresh-client -S + silent execute "!tmux refresh-client -S" endfunction augroup TmuxStatus @@ -462,4 +504,20 @@ augroup TmuxStatus autocmd ModeChanged * call UpdateTmuxStatus() autocmd WinEnter,WinLeave * call UpdateTmuxStatus() augroup END + "------------------------------------------------------------------------------- + + +"=============================================================================== +" Statusline Configuration +"=============================================================================== + +" Load statusline script +if filereadable(expand("~/.vim/autoload/statusline.vim")) + source ~/.vim/autoload/statusline.vim +endif + +" Call the statusline activation function +call autoload#statusline#ActivateStatusline() + + -- cgit v1.2.3