使用pandoc

时间:2015-07-22 13:04:57

标签: vim pandoc

我使用带有pandoc的vim并且需要相当规律地使用非破坏空间,这是通过反斜杠 - 逃避常规空间(即" \")在pandoc中实现的。我更喜欢在vim中使用硬换行符,但是当我这样做并且在行的末尾出现不间断的空格时,空格字符被删除并且反斜杠保留在行的末尾 - 这个信号段落的末尾为pandoc。

有没有办法告诉vim治疗" \"作为打印字符,当它用硬换行符重新格式化段落时?

例如,如果我写下以下内容:

This line contains a non-breaking space\ because I don't want a break after space.

想要 vim要做的是:

This line contains a non-breaking
space\ because I don't want a break after
space.

做的是这样的:

This line contains a non-breaking space\
because I don't want a break after space.

我目前的解决方法是坚持使用柔和的换行符,并将h重新映射到gh等,以便更轻松地处理。我还试图弄清楚是否有另一种方法来为pandoc指定一个不间断的空间,这样就不会对vim造成混淆。

1 个答案:

答案 0 :(得分:5)

将正确的UTF-8字符用于非中断空格(U + 00A0)而不是Ctrl-v x a 0。在Vim中,您可以insert it使用~/.vimrc

set list set listchars=nbsp:. 文件中添加以下内容以突出显示不间断的空格:

library(ggplot2)
library(tidyr)
library(dplyr)


weedweights<-data%>%
  select(-ends_with("No"))%>%
     gather(key=species, value=speciesmass, DIGSAWt:UnknownmonocotWt)%>%
     mutate(realmass= (10*speciesmass) / samplearea.m.2.)%>%
     group_by(Rot.Herb, species)%>%
     summarize(avgrealmass=mean(realmass, na.rm=TRUE))%>%
     filter(avgrealmass != "NaN")%>%
     ungroup()

ww2 <- weedweights %>%
  group_by(Rot.Herb) %>%
  mutate(totalweedweight=sum(avgrealmass)) %>%
  ungroup()

ggplot(weedweights, aes(x=1, y=avgrealmass, fill=species, order=avgrealmass)) +
  geom_bar(position = "fill", stat="identity") +
  facet_wrap(~ Rot.Herb) + 
  coord_polar("y") +
  ggtitle("Weedbiomass by crop phase and herbicide regime")+
  theme(plot.title = element_text(size=20, face="bold", vjust=2))+
  theme(axis.text.x = element_blank(), axis.text.y = element_blank(), axis.ticks = element_blank())+
  xlab("Weed dry biomass (kg per ha)")+
  ylab("Crop phase and herbicide regime")