Sunday, March 30, 2025

debuggable vimfiles

hello,

On Sun, Mar 30, 2025 at 10:41:59AM -0400, D. Ben Knoble wrote:
> > Aside: that's why my ~/.vimrc looks like this so I can
> > easily spot the problematic parts:
>
> I also frequently point folks towards [How to debug my
> vimrc](https://vi.stackexchange.com/q/2003/10604) and [How to debug a
> mapping](https://vi.stackexchange.com/q/7722/10604).

thanks for this pointer. so sad those questions arise in stack* as we have a
user mailing list.

> > vim9script
> > run r/defaults.vim
> > run r/colors.vim
> >
> > run r/sublime.vim
> > nnoremap <c-p> :SublimeCtrlP<cr>
> > run ftplugin/man.vim
> > nnoremap <expr> K
> > \ &kp == "man" ? ":Man \<cword>\<cr>"
> > \ : &kp == ":help" ? "K"
> > \ : ":KP\<cr>"
> > run r/iab.vim
> > run r/ezfold.vim
> > run r/math.vim
> > run r/buffer_navigation.vim
> > run r/setvts.vim
> > run r/parentheses.vim
> > run r/cmd_makeprg.vim
> > set aw ar
> > nnoremap <c-s> :make!<cr>
> > imap <c-s> <c-o><c-s>
> > run r/mail-to.vim | noremap <space>t :To<cr>
> > run r/was_fzy.vim
> > run r/dwm.vim
>
> What an interesting structure. Have you considered using
> `~/.vim/plugin` to have these load automatically?

this was the way I started back in the 90's because it was the
idiomatic way. also when packs came around, I had a most of the stuff
in ~/.vim/pack/*/start.

Nowadays, the only things I kepts in ~/.vim/pack/*/start are the
ftplugins and every addition comes as late as possible.

as example

┌─ /home/mc/.vim/after/ftplugin/python.vim ───
│ vim9script
│ set noet
│ packadd indent-object
│ run indent/python.vim
│ packadd lsp
│ call LspAddServer([{
│ name: 'python',
│ filetype: ['python'],
│ path: 'pylsp',
│ args: [],
│ syncInit: true,
│ }])

│ inoremap <buffer> (fn def :<cr>……<cr>return ……<esc>2k$i
│ inoremap <buffer> (wh while :<cr>……<esc>k$i
│ inoremap <buffer> (wi with :<cr>……<esc>k$i
│ inoremap <buffer> (aw async with :<cr>……<esc>k$i
│ inoremap <buffer> (if if :<cr>……<esc>k$i
│ inoremap <buffer> (ie if :<cr>……<cr>else:<cr>……<esc>3k$i
│ inoremap <buffer> (fo for X in …… :<cr>……<esc>k^fXs
│ inoremap <buffer> (af async for X in …… :<cr>……<esc>k^fXs


when I start to chase a bug, comment all the ~/.vimrc lines
and decomment it line by line.

in the process, I have

inoremap <c-s>:w\|!tmux split vim /tmp/test<cr>

so I can easily see what changed.

regards

--
Marc Chantreux

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/Z-mhAKeSOEEv9NQI%40prometheus.

No comments: