Vim 作为笔记平台:在垂直分割的窗口中跳转到标签 [英] Vim as a note taking platform: Jump to tag in vertically split windows

查看:16
本文介绍了Vim 作为笔记平台:在垂直分割的窗口中跳转到标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去,我使用 Vim 作为笔记平台,通过使用 Vim 帮助文件格式创建带有标签列表的 index.txt 文件,然后创建一堆具有普通 * 的文本文件Help_Tag* 链接语法,以便在 index.txt 文件中的标记上使用 CTRL-] 将跳转到任意注释文本文件中的相应标记.您需要执行 :helptags dir 来生成目录的标签(其中 dir 是 notes 目录的路径).

In the past, I have used Vim as a note taking platform by creating an index.txt file with a list of tags using the Vim help file format and then creating a bunch of text files that have the normal *Help_Tag* link syntax so that using CTRL-] on a tag in the index.txt file will jump to the respective tag in an arbitrary notes text file. You need to do :helptags dir to generate the tags for the directory (where dir is the path to the notes directory).

我正在寻找的是一种简单的方法,可以在左侧拆分窗口中并在右侧拆分窗口中打开光标下的标签.CTRL-W v 之类的东西,但用于标签跳转和使用已经打开的垂直拆分窗口.

What I am looking for is a simple way to be on the left split window and open the tag under the cursor in the right split window. Something like CTRL-W v but for tag jumping and using the already open vertical split window.

问题是如果你这样做 CTRL-] 它将在左窗格中打开标签,如果你这样做 CTRL-W CTRL-] 它会创建一个水平分割左窗格中的窗口.

The problem is if you do CTRL-] it will open the tag in the left pane and if you do CTRL-W CTRL-] it creates a horizontally split window in the left pane.

一定有一种方法可以做到这一点,我忽略了.

There must be a way to do this that I'm overlooking.

推荐答案

很可能 easiset 是一个自动命令本地映射

Probably the easiset would be an autocommand local mapping

au FileType index.txt nnoremap <buffer> <cr> 
     :vert belowright split 
     |tag <c-r><c-w>
     |vert resize 130<cr>

注意我使用 return

这篇关于Vim 作为笔记平台:在垂直分割的窗口中跳转到标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆