如何在搜索模式下启动nvim?(我不想执行搜索,只是为了让nvim准备好接受搜索字符串)



我想打开一个文件,一旦打开文件,nvim就会自动进入搜索模式。

我需要找到要使用的正确命令,可能是nvim-cCommandfile.txt

为了澄清,我想启动nvim,并能够通过键入搜索字符串开始搜索,而无需先按"/"进入搜索模式。

运行nvim-c'/searchString'会立即执行搜索,这不是我想要的

我的用例是使用nvim作为kitty的滚动寻呼机。

# kitty passes text to nvim via stdinput which i write to a tmp file in /tmp/kitty_scrollback_buffer
# I then open this file with the nvim terminal by catting the file
# is there anyway to then automatically enter command search mode so that nvim is ready to search when i enter a search string (I do not want to type /, i want to be able to search immediately)
exec nvim 
-u NONE 
-c "silent! write! /tmp/kitty_scrollback_buffer | terminal cat /tmp/kitty_scrollback_buffer - " 
是的,你就在那里。如果要在file.txt中搜索foo,请运行以下命令:
nvim -c "/foo" file.txt

最新更新