When using `/` to search in vim, can different searches be performed in each buffer without affecting each other?
漂亮男人
漂亮男人 2017-05-16 16:39:03
0
2
783

vim version: 7.4 huge version.

There will be multiple buffers in use, there will be multiple split windows in one tab, and there will be multiple tabs.

Can multiple buffers in a vim process be searched separately without affecting each other?

漂亮男人
漂亮男人

reply all(2)
左手右手慢动作

Vim’s tab is just a container for display
The only thing that really exists is buffer

@Evian gave you suggestions on how to use the BufEnter/BufLeave event
Then let me help you complete the code

augroup SearchKeyword
    autocmd!
    autocmd BufEnter * let @/ = exists('b:keyword') ? b:keyword : ''
    autocmd BufLeave * let b:keyword = @/
augroup END

  • nohlsearchautocmd Invalid, deleted
伊谢尔伦

You can write your own plug-in.
Logging @/ to a buffer-local variable (b:) on a BufLeave event and doing the opposite on a BufEnter event.

by @evian

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template