搜索或跳转后vim自动跳转到列

时间:2011-06-08 14:24:08

标签: vim

感谢这些stack overflow帖子,我知道如何在搜索后创建一个以为中心的nmap。这很好,但我正在使用管道分隔值,其中一行可能是1000列长,我想将行放在中心并将匹配的放在左侧。屏幕。谁知道怎么做?

示例:

/University of California<CR>n

应该放

University of California, San Francisco, Calif. (...)  

在此行的屏幕左侧:

CASE, Ed|N00025882|http://bioguide.congress.gov/scripts/biodisplay.pl?index=C001055|a Representative from Hawaii; born in Hilo, Territory of Hawaii, September 27, 1952; graduated from Hawaii Preparatory High School, Kamuela, Hawaii, 1970; B.A., Williams College, Williamstown, Mass., 1975; J.D., University of California, San Francisco, Calif., 1981; lawyer, private practice; staff member for United States Representative Spark Matsunaga, 1975-1977; staff member for United States Senator Spark Matsunaga, 1977-1978; member of the Hawaii state house of representatives, 1994-2002; unsuccessful candidate for nomination for Governor of Hawaii in 2002; elected as a Democrat to the One Hundred and Seventh Congress, by special election, to fill the vacancy caused by the death of United States Representative Patsy Mink, (November 30, 2002-January 3, 2003); elected as a Democrat to the One Hundred Eighth Congress, by special election, to fill the vacancy caused by the death of United States Representative Patsy Mink, and reelected to the succeeding Congress (January 4, 2003-January 3, 2007); not a candidate for reelection, but was an unsuccessful candidate to the United States Senate in 2006; unsuccessful candidate for United States House of Representatives in 2010.

1 个答案:

答案 0 :(得分:2)

nnoremap n nzzzsnnoremap N Nzzzs可能会完成您的要求。如果vim隐藏了搜索短语的第一个字母,您可能希望在其中zh向左滚动一列。

  • zz将光标垂直放在屏幕中央
  • zs将光标放在屏幕的最左侧

有关详细信息,请参阅:help scroll-horizontal