From 19120d4f9761c67d99ed1ce3da6084b83f5a49c9 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 30 Aug 2025 19:22:59 +0200 Subject: Linux-specific dotfiles --- .vim/vimrc | 296 ------------------------------------------------------------- 1 file changed, 296 deletions(-) delete mode 100644 .vim/vimrc (limited to '.vim/vimrc') diff --git a/.vim/vimrc b/.vim/vimrc deleted file mode 100644 index ce034e9..0000000 --- a/.vim/vimrc +++ /dev/null @@ -1,296 +0,0 @@ -"=============================================================================== -" Mappings/Keybindings/Commands -"=============================================================================== - -let mapleader = ";" " map leader to Semi colon - -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 - -" 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 - -" tab navigation -noremap h :tabprevious -noremap l :tabnext -noremap k :tabfirst -noremap j :tablast -noremap n :tabnew -noremap e :tabedit -noremap c :tabclose -noremap m :tabm - -" 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: -"nnoremap + :exe "resize " . (winheight(0) * 3/2) -"nnoremap - :exe "resize " . (winheight(0) * 2/3) -nnoremap + :resize +5 -nnoremap - :resize -5 -nnoremap > :vertical resize +5 -nnoremap < :vertical resize -5 - -" Toggle set number -"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`` -" Paste on next line -"nnoremap <]-p> m`Op`` - -"inoremap " -"set keywordprg=:help -"runtime ftplugin/man.vim - - -"=============================================================================== -" Settings -"=============================================================================== - -" 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 -" Next two commands make vim use X11 clipboard -set clipboard+=unnamedplus -let g:clipbrdDefaultReg = '+' - -"let g:loaded_clipboard_provider = 1 -" <:e %:h/filename> will create a new file named filename in the same -" directory as the currently open file, and write it. -set autochdir " or use this to use <:e> to create a file in current directory -set splitright " make vsplit put the new buffer on the right of the current buffer -set splitbelow " make split put the new buffer below the current buffer -" :Bclose script (delete a buffer without closing the window) sourced as a -" plugin in ~/.config/nvim/plugin/bclose.vim | keymap: bd -"let bclose_multiple = 1 -"set syntax -" Compute syntax highlighting from beginning of file. (By default, vim only -" looks 200 lines back, which can make it highlight code incorrectly in some -" long files.) -autocmd BufEnter * :syntax sync fromstart -" Don't syntax highlight markdown because it's often wrong -autocmd! FileType mkd setlocal syn=off -set ttyfast -set lazyredraw -" Set lazyredraw to false -"let &lazyredraw = 0 -set timeout timeoutlen=1000 ttimeoutlen=100 " fix slow O inserts -set scrolloff=8 sidescrolloff=8 -set tabstop=4 softtabstop=4 shiftwidth=4 expandtab -set autoindent -set smartindent -" Also load indent files, to automatically do language-dependent indenting. -filetype plugin indent on -set exrc -set relativenumber -set hidden -set noerrorbells -set nowrap -set ignorecase -set smartcase -set noswapfile -set nobackup -set incsearch -"set cursorline -set showmatch -set showcmd -set incsearch -set hlsearch -set laststatus=2 -let g:python3_host_prog = '/usr/bin/python3' -"let g:loaded_python3_provider = 1 -let g:sh_noisk=1 -set modeline -set modelines=3 " modelines (comments that set vim options on a per-file basis) -set foldmethod=manual -set nofoldenable " turn folding off -" Insert only one space when joining lines that contain sentence-terminating -" punctuation like `.`. -set nojoinspaces -set autoread " if a file is changed outside of vim, automatically reload it without asking -set diffopt=vertical " diffs are shown side-by-side not above/below -set signcolumn=no " always show the sign column -set textwidth=80 -set mouse=a - -" 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 - - -"=============================================================================== -" Colorscheme -"=============================================================================== - -" 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" - -"colorscheme desert -"colorscheme city-lights -set background=dark -highlight Normal guibg=NONE ctermbg=NONE -highlight EndOfBuffer ctermfg=NONE ctermbg=NONE - - -"------------------------------------------------------------------------------- - - -"=============================================================================== -" Functions/Scripts -"=============================================================================== - -" Enable mouse scrollback -"--------------------------------------- -set mouse=a -tnoremap -tnoremap -function! ClearTerminal() - set scrollback=1 - let &g:scrollback=1 - echo &scrollback - call feedkeys("\i") - call feedkeys("clear\") - call feedkeys("\\") - call feedkeys("\i") - sleep 100m - let &scrollback=s:scroll_value -endfunction - -"------------------------------------------------------------------------------- - -" :Rename {newname} -"--------------------------------------- -function! RenameFile() - let old_name = expand('%') - let new_name = input('New file name: ', expand('%'), 'file') - if new_name != '' && new_name != old_name - exec ':saveas ' . new_name - exec ':silent !rm ' . old_name - redraw! - endif -endfunction -map r :call RenameFile() - -"------------------------------------------------------------------------------- - -" Return to the same line when we reopen a file -"--------------------------------------- - augroup line_return - au! - au BufReadPost * - \ if line("'\"") > 0 && line("'\"") <= line("$") | - \ execute 'normal! g`"zvzz' | - \ endif - augroup END - -"------------------------------------------------------------------------------- -" -" Function to update tmux status and .vi-mode file -"--------------------------------------- -function! UpdateTmuxStatus() abort - " Check if the current buffer has a man filetype - if &filetype ==# 'man' - return - endif - - " Determine the mode name based on the mode value - let mode = mode() - let mode_name = '' - if mode ==# 'n' - let mode_name = '-- NORMAL --' - elseif mode ==# 'i' || mode ==# 'ic' - let mode_name = '-- INSERT --' - else - let mode_name = '-- NORMAL --' - endif - - " Write the mode name to the file - call writefile([mode_name], expand('$HOME') . '/.vi-mode') - -endfunction - -" Function to refresh tmux status -function! s:UpdateTmux() abort - call system('tmux refresh-client -S') -endfunction - -" Set up autocommands for tmux status update -if !empty($TMUX) && system('command -v tmux >/dev/null 2>&1') == 0 -augroup TmuxStatus - autocmd! - autocmd ModeChanged * call UpdateTmuxStatus() | call s:UpdateTmux() -augroup END -endif - -"------------------------------------------------------------------------------- - - -"=============================================================================== -" Statusline Configuration -"=============================================================================== - -" Autoload statusline -"--------------------------------------- -" 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