aboutsummaryrefslogtreecommitdiffstats
path: root/vim
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2026-07-16 13:03:59 +0200
committerGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2026-07-16 13:03:59 +0200
commit6685f8228d4ff99fa27eaa76ce36244fe551e501 (patch)
tree24b3de9bc9c10e316f1aae9324e5a60fb04da3d1 /vim
parent4ca56df0e4020ebcfb791c75a51e4dc1ad17448b (diff)
downloaddotfiles-6685f8228d4ff99fa27eaa76ce36244fe551e501.tar.gz
dotfiles-6685f8228d4ff99fa27eaa76ce36244fe551e501.tar.bz2
dotfiles-6685f8228d4ff99fa27eaa76ce36244fe551e501.zip
Fixed vim
Diffstat (limited to 'vim')
-rw-r--r--vim/.vim/ftplugin/python.vim8
-rwxr-xr-xvim/.vim/vimrc80
2 files changed, 66 insertions, 22 deletions
diff --git a/vim/.vim/ftplugin/python.vim b/vim/.vim/ftplugin/python.vim
index 183ef4b..e847d12 100644
--- a/vim/.vim/ftplugin/python.vim
+++ b/vim/.vim/ftplugin/python.vim
@@ -1,4 +1,4 @@
1set tabstop=8 1setlocal tabstop=8
2set expandtab 2setlocal expandtab
3set shiftwidth=4 3setlocal shiftwidth=4
4set softtabstop=4 4setlocal softtabstop=4
diff --git a/vim/.vim/vimrc b/vim/.vim/vimrc
index 5fd4e01..aa97947 100755
--- a/vim/.vim/vimrc
+++ b/vim/.vim/vimrc
@@ -6,9 +6,9 @@ Plug 'edkolev/tmuxline.vim'
6" Plug 'ervandew/supertab' 6" Plug 'ervandew/supertab'
7Plug 'mhinz/vim-janah' 7Plug 'mhinz/vim-janah'
8Plug 'mhinz/vim-signify' 8Plug 'mhinz/vim-signify'
9Plug 'scrooloose/nerdcommenter' 9Plug 'preservim/nerdcommenter'
10Plug 'scrooloose/nerdtree' 10Plug 'preservim/nerdtree'
11Plug 'scrooloose/syntastic' 11Plug 'dense-analysis/ale'
12Plug 'tpope/vim-fugitive' 12Plug 'tpope/vim-fugitive'
13Plug 'unblevable/quick-scope' 13Plug 'unblevable/quick-scope'
14Plug 'vim-airline/vim-airline-themes' 14Plug 'vim-airline/vim-airline-themes'
@@ -23,24 +23,26 @@ endif
23 23
24if executable('python') || executable('python3') 24if executable('python') || executable('python3')
25 Plug 'davidhalter/jedi-vim' 25 Plug 'davidhalter/jedi-vim'
26 " YCM handles completion (async); keep jedi-vim for goto/rename only
27 let g:jedi#completions_enabled = 0
26endif 28endif
27 29
28if has('python') || has('python3') 30if has('python') || has('python3')
29 let g:ycm_install_command = './install.py --clang-completer' 31 let g:ycm_install_command = './install.py --clang-completer'
30 32
31 if executable('node') && executable('npm') 33 if executable('node') && executable('npm')
32 let g:ycm_install_command .= ' --tern-completer' 34 let g:ycm_install_command .= ' --ts-completer'
33 endif 35 endif
34 36
35 if executable('go') 37 if executable('go')
36 let g:ycm_install_command .= ' --gocode-completer' 38 let g:ycm_install_command .= ' --go-completer'
37 endif 39 endif
38 40
39 if executable('rustc') 41 if executable('rustc')
40 let g:ycm_install_command .= ' --rust-completer' 42 let g:ycm_install_command .= ' --rust-completer'
41 endif 43 endif
42 44
43 Plug 'Valloric/YouCompleteMe', {'do': g:ycm_install_command} 45 Plug 'ycm-core/YouCompleteMe', {'do': g:ycm_install_command}
44endif 46endif
45 47
46if has('nvim') 48if has('nvim')
@@ -63,7 +65,8 @@ let mapleader=" "
63syntax on 65syntax on
64filetype plugin indent on 66filetype plugin indent on
65 67
66cnoreabbrev git Git 68" Expand :git to fugitive's :Git, but only as a whole command
69cnoreabbrev <expr> git (getcmdtype() ==# ':' && getcmdline() ==# 'git') ? 'Git' : 'git'
67 70
68" Some vim settings 71" Some vim settings
69set number 72set number
@@ -76,6 +79,19 @@ set listchars=trail:·,tab:▸\ ,eol:¬
76set scrolloff=1 79set scrolloff=1
77set backspace=indent,eol,start 80set backspace=indent,eol,start
78set cursorline 81set cursorline
82set hidden
83set wildmenu
84
85" Faster gutter updates (signify) and snappier <Esc> in terminal vim
86set updatetime=100
87set ttimeoutlen=10
88
89" Persistent undo across sessions
90if !isdirectory(expand('~/.local/share/vim/undo'))
91 call mkdir(expand('~/.local/share/vim/undo'), 'p', 0700)
92endif
93set undofile
94set undodir=~/.local/share/vim/undo
79 95
80" Set colorscheme when the terminal has 256 color support 96" Set colorscheme when the terminal has 256 color support
81try 97try
@@ -98,13 +114,28 @@ set smartcase " capital letters = case sensitive
98" Disable ex mode 114" Disable ex mode
99nnoremap Q <Nop> 115nnoremap Q <Nop>
100 116
101" Save as sudo 117" Save as sudo (abbreviation, so a plain :w never stalls on timeoutlen)
102cnoremap w!! w !sudo tee > /dev/null % 118" Note: doesn't work in neovim (sudo can't prompt for a password there);
119" use a suda.vim-style plugin if needed.
120cnoreabbrev <expr> w!! (getcmdtype() ==# ':' && getcmdline() ==# 'w!!')
121 \ ? 'w !sudo tee > /dev/null %' : 'w!!'
122
123" Remove trailing spaces on save, preserving cursor and search pattern
124function! StripTrailingWhitespace()
125 if index(['markdown', 'diff'], &filetype) >= 0
126 return
127 endif
128 let l:view = winsaveview()
129 keeppatterns %s/\s\+$//e
130 call winrestview(l:view)
131endfunction
103 132
104" Remove training spaces on save 133augroup strip_whitespace
105autocmd BufWritePre * :%s/\s\+$//e 134 autocmd!
135 autocmd BufWritePre * call StripTrailingWhitespace()
136augroup END
106 137
107" Switch windows with <C-W>[direction] 138" Switch windows with <C-[direction]>
108nnoremap <C-J> <C-W>j 139nnoremap <C-J> <C-W>j
109nnoremap <C-K> <C-W>k 140nnoremap <C-K> <C-W>k
110nnoremap <C-H> <C-W>h 141nnoremap <C-H> <C-W>h
@@ -131,9 +162,12 @@ nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
131 162
132" NeoVIM specifics 163" NeoVIM specifics
133if has('nvim') 164if has('nvim')
134 nmap <BS> <C-W>h 165 nnoremap <BS> <C-W>h
135 " tnoremap <Esc> <C-\><C-n> 166 " tnoremap <Esc> <C-\><C-n>
136 autocmd TermOpen * setlocal nolist 167 augroup nvim_term
168 autocmd!
169 autocmd TermOpen * setlocal nolist
170 augroup END
137 lua require('claude-code').setup({ window = { position = 'vertical botright' } }) 171 lua require('claude-code').setup({ window = { position = 'vertical botright' } })
138endif 172endif
139 173
@@ -141,10 +175,20 @@ endif
141if exists("g:plug_home") 175if exists("g:plug_home")
142 176
143 " NERDTree: 177 " NERDTree:
144 " Open NERDTree when no file is specified 178 " Open NERDTree when no file is specified; quit when it's the last window
145 autocmd StdinReadPre * let s:std_in=1 179 augroup nerdtree_auto
146 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif 180 autocmd!
147 autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 181 autocmd StdinReadPre * let s:std_in=1
182 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
183 autocmd BufEnter * if winnr('$') == 1 && &filetype ==# 'nerdtree' | quit | endif
184 augroup END
185
186 " CtrlP:
187 " Use ripgrep for listing files (fast, respects .gitignore)
188 if executable('rg')
189 let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
190 let g:ctrlp_use_caching = 0
191 endif
148 192
149 " NERDCommenter: 193 " NERDCommenter:
150 " Pretty comments 194 " Pretty comments