Created
June 5, 2022 14:07
Revisions
-
George-B created this gist
Jun 5, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ Let's say you want to make use of `ignorecase` as that's what you'd like when searching with `/` and `?`. However you then realise how oddly pervasive this setting is in that is applies to things like `:s`. Rather than inserting "\C" into every pattern you think you'll use use an autocmd and so some up with something like the following config. ```vim set ignorecase autocmd CmdLineEnter : set noignorecase autocmd CmdLineLeave : set ignorecase ``` Only to find it doesn't work, `ignorecase` still seems to be in effect when using `:s`. This is because `CmdLineLeave` fires not only before you truly leave the command-line but also before the command has executed. Here's a snippet to overcome this in a generic fashion by using a timer. ```vim let [s:ignorecase, s:smartcase] = [&ignorecase, &smartcase] function! s:RestoreCase(ID) let [&ignorecase, &smartcase] = [s:ignorecase, s:smartcase] endfunction augroup SaneCase autocmd! autocmd CmdlineEnter : set noignorecase nosmartcase autocmd CmdlineLeave : call timer_start(100, '<SID>RestoreCase') augroup END ``` The far reaching effecting of `ignorecase` annoys me enough as it is but `CmdLineLeave` firing before executing the command really takes the biscuit here.