在vim中使用ctag时如何显示相对路径
我有一个由Linux内核生成的带有“maketagsccope”的tags/cscope文件 现在,当我这样做的时候:在vim中使用ctag时如何显示相对路径,vim,ctags,Vim,Ctags,我有一个由Linux内核生成的带有“maketagsccope”的tags/cscope文件 现在,当我这样做的时候: vim -t tcp_ack 它表明: Cscope tag: tcp_ack # line filename / context / line 1 678 /home/christoph/workspace/linux/mptcp/drivers/net/ethernet/neterion/s2io.h <<tcp_ack>>
vim -t tcp_ack
它表明:
Cscope tag: tcp_ack
# line filename / context / line
1 678 /home/christoph/workspace/linux/mptcp/drivers/net/ethernet/neterion/s2io.h <<tcp_ack>>
__be32 tcp_ack;
2 56 /home/christoph/workspace/linux/mptcp/include/linux/inet_lro.h <<tcp_ack>>
__be32 tcp_ack;
3 3292 /home/christoph/workspace/linux/mptcp/net/ipv4/tcp_input.c <<tcp_ack>>
static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
Type number and <Enter> (empty cancels):
Cscope标记:tcp\u确认
#行文件名/上下文/行
1678/home/christoph/workspace/linux/mptcp/drivers/net/ethernet/neterion/s2io.h
__be32-tcp_-ack;
2 56/home/christoph/workspace/linux/mptcp/include/linux/inet_lro.h
__be32-tcp_-ack;
33292/home/christoph/workspace/linux/mptcp/net/ipv4/tcp_input.c
静态int-tcp_-ack(结构sock*sk,结构sk_-buff*skb,int标志)
类型编号和(空则取消):
如您所见,它显示文件的整个路径。但是,我希望它只显示文件的相对路径。比如:
Cscope tag: tcp_ack
# line filename / context / line
1 678 drivers/net/ethernet/neterion/s2io.h <<tcp_ack>>
__be32 tcp_ack;
2 56 include/linux/inet_lro.h <<tcp_ack>>
__be32 tcp_ack;
3 3292 net/ipv4/tcp_input.c <<tcp_ack>>
static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
Type number and <Enter> (empty cancels):
Cscope标记:tcp\u确认
#行文件名/上下文/行
1678个驱动程序/net/ethernet/neterion/s2io.h
__be32-tcp_-ack;
2 56 include/linux/inet_lro.h
__be32-tcp_-ack;
33292 net/ipv4/tcp_input.c
静态int-tcp_-ack(结构sock*sk,结构sk_-buff*skb,int标志)
类型编号和(空则取消):
我怎样才能做到这一点
谢谢你的帮助 这实际上不是一个显示问题,因为Vim在索引器记录路径时显示路径 如果您希望在
标记
文件中使用相对文件名(从而在Vim的列表中),则必须通过传递--tag relative=yes
选项明确地告诉CTAG这样做
据我所知,cscope默认使用相对路径。Ok,问题是我使用:make O=../build_dir标记生成标记文件,这样它将包含绝对路径而不是相对路径。因此,当生成带有“maketags”的标记文件时,它使用相对文件名。