diff options
| author | 2026-10-13 17:03:34 -0400 | |
|---|---|---|
| committer | 2026-10-13 17:03:34 -0400 | |
| commit | 89387549e2670159a211de39a4ddf668addd9e9e (patch) | |
| tree | f372f7847a048b0325cc478c272bc7d9da9936f7 /files/vim | |
| parent | 33567739337783e67167a43557c434accb6fe3a0 (diff) | |
| download | dotfiles-master.tar.gz dotfiles-master.tar.bz2 dotfiles-master.zip | |
Diffstat (limited to 'files/vim')
| -rw-r--r-- | files/vim/plugin/qname.1.2.vim | 2 | ||||
| -rw-r--r-- | files/vim/vimrc | 58 | ||||
| -rw-r--r-- | files/vim/vimrc_root | 4 |
3 files changed, 40 insertions, 24 deletions
diff --git a/files/vim/plugin/qname.1.2.vim b/files/vim/plugin/qname.1.2.vim index 4e81318..ea31154 100644 --- a/files/vim/plugin/qname.1.2.vim +++ b/files/vim/plugin/qname.1.2.vim @@ -29,7 +29,7 @@ " Treat <S-BS> the same as <BS> " 2025-11-04: " Open selected buffer in the current window, even if the same buffer is -" already open in another window. +" already open in another window " " 1.2 2013-01-03 " ADD: <Tab> and <S-Tab> moves selection like <Up> and <Down> diff --git a/files/vim/vimrc b/files/vim/vimrc index 90d3646..61280c9 100644 --- a/files/vim/vimrc +++ b/files/vim/vimrc @@ -1,13 +1,16 @@ " @TODO: " - CullSubprojects from sessions command. -" - vim82 compat. +" - :checktime on open same file instead of nothing? +" - https://codeberg.org/dnkl/foot/wiki#vim +" - Are sessions bloat? +" - Actually make Hello. " Basic settings. set nocompatible set number " showmode too often puts the cursor on the bottom line, this can make " kitty's cursor_trail way too jumpy. -set noshowmode +"set noshowmode "set signcolumn=yes set updatetime=250 set scrolloff=5 @@ -24,7 +27,7 @@ set shortmess-=S set splitright set splitbelow " Stop buffers from jumping when opening buffer selection. -set splitkeep=screen +"set splitkeep=screen colo lil_pablo @@ -51,12 +54,16 @@ set expandtab set autoindent " C syntax preference. -let g:c_syntax_for_h=1 -let g:c_no_curly_error=1 -let g:c_function_pointers=1 +let g:c_syntax_for_h = 1 +let g:c_no_curly_error = 1 +let g:c_function_pointers = 1 set cinoptions=:0,=4,l1,g2,h2,(4,u4,+4,m1,j1,J1 set cindent +" C# syntax tuning (for performance). +let g:cs_raw_string_quote_count = 7 +let g:cs_raw_string_interpolation_brace_count = 6 + " Set different format for mail and text files. set nowrap nolinebreak nolist formatoptions=l textwidth=0 au FileType mail,text setlocal wrap formatoptions=l textwidth=0 @@ -67,7 +74,7 @@ set wildmenu " Set titlebar. set title -au BufEnter * let &titlestring=expand("%:t") +au BufEnter * let &titlestring = expand("%:t") " https://github.com/csdvrx/CuteVim/blob/main/.vimrc " Allow distinguishing <C-i> from <Tab> in bindings. @@ -84,7 +91,7 @@ au BufEnter * let &titlestring=expand("%:t") set clipboard=unnamedplus " Session options. -set ssop=curdir,skiprtp,blank,buffers,folds,winsize,terminal +"set ssop=curdir,skiprtp,blank,buffers,folds,winsize,terminal set vop-=curdir " Move ~/.viminfo. @@ -108,14 +115,14 @@ if isdirectory(expand("~/c")) if !isdirectory(swap_dir) call mkdir(swap_dir, "p", 0755) endif - let &directory=swap_dir + let &directory = swap_dir if has("persistent_undo") let undo_dir = expand("~/c/sessions/undo//") if !isdirectory(undo_dir) call mkdir(undo_dir, "p", 0755) endif - let &undodir=undo_dir + let &undodir = undo_dir set undofile endif @@ -127,28 +134,28 @@ if isdirectory(expand("~/c")) call mkdir(backup_dir, "p", 0755) endif endif - let &backupdir=backup_dir + let &backupdir = backup_dir set backup endif -set autocomplete -set complete=.^4,w^2,b^2 -set completeopt+=menu,menuone,popup,noinsert,noselect +"set autocomplete +"set complete=.^4,w^2,b^2 +"set completeopt+=menu,menuone,popup,noinsert,noselect " Plugins. let g:fugitive_no_maps = 1 set diffopt+=vertical packadd vim-fugitive packadd vim-gitbranch -packadd vim-asciidoc-folding +"packadd vim-asciidoc-folding packadd Colorizer "if !empty($NIX_SHELL) " packadd lsp " call LspAddServer([#{ -" \ name: 'clangd', -" \ filetype: ['c', 'cpp'], -" \ path: 'clangd', -" \ args: ['--background-index'] +" \ name: "clangd", +" \ filetype: ["c", "cpp"], +" \ path: "clangd", +" \ args: ["--background-index"] " \}]) "endif @@ -162,7 +169,7 @@ function! Statusline() abort let focused = g:statusline_winid == win_getid(winnr()) let status = focused ? "%#StatusLine#" : "%#StatusLineNC#" let status .= "%{StatuslineGit()}" - let status .= " %{expand('%:~:.')}" " Explicitly expand to relative file, %f was flaky. + let status .= " %{expand(\"%:~:.\")}" " Explicitly expand to relative file, %f was flaky. let status .= " vim@%{hostname()}" let status .= "%=" let status .= " %y" @@ -198,6 +205,9 @@ nnoremap <silent> <C-l> :wincmd l<CR> " Make ctrl + "." and "," map to previous buffer. nmap <C-,> <C-^> nmap <C-.> <C-^> +" Delete buffer but don't close split. +" https://stackoverflow.com/a/19619038 +nmap <C-S-,> :b#<bar>bd#<CR> " Personally intuitive pop-up menu binds. inoremap <expr> <CR> pumvisible() ? "<C-y><CR>" : "<CR>" inoremap <expr> <Up> pumvisible() ? "<C-p>" : "<Up>" @@ -220,7 +230,9 @@ function OpenBasedOnRelativeArgument(A, CMD) if arg != "" let arg = (arg[0] == "/" ? arg : resolve(fnamemodify(expand("%:h")."/".arg, ":p"))) endif - if a:CMD == "EDIT" + if arg == resolve(expand("%")) + " On an attempt to open the same file as the current buffer, do nothing. + elseif a:CMD == "EDIT" exe "edit" arg elseif a:CMD == "VERTICAL_SPLIT" exe "vsplit" arg @@ -276,14 +288,14 @@ command Hex :%!xxd command Unhex :%!xxd -r " https://stackoverflow.com/a/27721306 -command -nargs=+ Ggr exe "silent Ggrep!" <q-args> | botright cwindow | redraw! +command -nargs=+ Ggr let s:grep_dir=expand("%:p:h") | exe "silent Ggrep!" <q-args> | botright cwindow | exe "lcd " . s:grep_dir | redraw! " I had this mapped to <C-i> for the longest time. Sadly with OG vim " (not neovim) the fix for mapping <Tab> and <C-i> seperately doesn't work. " Changing this bind as the only concession to be compatible with vim " seems well worth it. nnoremap <C-o> :Ggr -command GrepWhitespace :Ggr '[[:blank:]]$' +command GrepWhitespace :Ggr "[[:blank:]]$" " https://vi.stackexchange.com/a/456 function! TrimWhitespace() diff --git a/files/vim/vimrc_root b/files/vim/vimrc_root new file mode 100644 index 0000000..3d5918c --- /dev/null +++ b/files/vim/vimrc_root @@ -0,0 +1,4 @@ +set notermguicolors +" https://vi.stackexchange.com/a/45012 +autocmd! ColorScheme default set t_Co=16 +colo default |