Closed pengyun04 closed 8 years ago
For those of us not knowing what :Unite -no-split outline
does, could you quickly describe it?
@nasenatmer It opens the window "fullscreen", instead of in a split window.
I'll consider this when I get the time.
@nasenatmer That's unite plugin and unite-outline plugin.
Unite plugin is a good plugin, you can try it.
https://github.com/Shougo/unite.vim https://github.com/h1mesuke/unite-outline
@pengyun04 Yes, I'm aware of that but I haven't got the time to just play around with any plugin that is suggested here. But thanks for the hint though.
@nasenatmer But I recommend you to try it, it's really a good plugin :)
@pengyun04 I've been thinking: I think the standard TOC feature (and Table of labels) is OK the way it is in vimtex. That is, I don't want to change the current code.
However, I think it makes sense to add a unite source for the table of contents. Most of the code is already there, so I should be able to implement this quite quickly.
Ok, so I have started this. I have an initial unite source that currently does nothing:
let s:save_cpo = &cpo
set cpo&vim
let s:source = {
\ 'name' : 'vimtex_toc',
\ 'sorters' : 'sorter_nothing',
\}
function! s:source.gather_candidates(args, context)
let entries = vimtex#toc#get_entries()
return map(entries, '{
\ "word" : v:val.title,
\ }')
endfunction
function! unite#sources#vimtex_toc#define()
return s:source
endfunction
let &cpo = s:save_cpo
unlet s:save_cpo
I want to add:
I have not written many unite sources before, so I need to investigate how to do this properly. Perhaps @Shougo have time to help me, or to give a link to a relevant source that opens a particular line in a file and that has syntax?
@lervag Great, I agree with you, no need to change vimtex. It will be cool use unite.
Haha, I wish I could help you, but I know little about vim script debug.
I've just pushed an update that adds syntax highlighting to the unite source. I was not able to make it work nicely with the highlighting of the matching pattern, though. Let me know what you think.
Btw: I also added source for table of labels.
@lervag Could you tell me how to use it? Should I use Unite-outline or something?
@pengyun04 You simply do :Unite vimtex_toc
(and Unite vimtex_labels
for the list of labels).
@lervag It's great, I can use it. It would be more convenient if there is indent for TOC, such as indent for subsection, like a real TOC. But it's a plus, it's now easy to use unite.vim for search, I am satisfied currently. Thanks very much for your help!
I've updated the TOC source, I think it looks better now. Thanks for the indent suggestion.
@lervag It's great, thank you very much!
No problem. Thanks for the suggestion! :)
Btw: I'm updating the docs with some info on the unite sources. I'll tag the commit with this issue, and I'd be happy if you could review the documentation when I push the commit.
@lervag I have seen the docs, it's great. You're really hard working :)
I wonder it may be better if the number is placed before the section, like this:
Preamble
Table of contents
1 Basics
1.1 Section types
1.1.1 Example subsection
1.2 Basic page settings
As I use Chinese, it looks a little messy:
Btw, I use plugin 'junegunn/goyo.vim' to help me concentrate on writing. It centers the screen and provide soft wrap, very useful for writing latex, like this: But when I write Chinese and open TOC under goyo, there are two lines merged with the background, resulting in that I cannot distinguish them from the background, I don't know why:
While in English this does not happen under goyo. And in Chinese without goyo this does not happen neither.
I have another advice, but it needs more consideration.... do you use conceal function in latex. I find it's very useful for writing math. I think the conceal could be more better, such as I can set \cite{aaaaa} can display or not, convenient for reading.
Haha, this is the first time I paste pictures, I have use so many. Thanks very much for your help, as your may see, I'm now using vimtex writing my Ph.D thesis. Have a good day!
I think I've fixed the problem with messy TOC in chinese, please test. If it is OK, I'd rather keep the current version where the numbers are on the right. I think it looks good, even though I am aware that it is more common to have the numbers on the left.
I'm hoping that the Goyo issue might also be resolved with the latest update. If not, please open a new issue where you explain how to reproduce.
Regarding the conceal question: I don't really use it myself, as I prefer to see the actual tex code. In any case, I'd appreciate if you could open a new issue for this. Since I did not quite understand the advice, I would be happy if you could elaborate/explain more what you suggest.
The Chinese messy problem has fixed, it's OK now.
But the goyo issue is still there. I don't know why. I just use conceal in normal mode. But at present I don't have a clear idea myself what it eventually I like, it might take some time. I've just studied VIM about one month, I need more time to absorb it and think about it. If I have figured out the reason and have clear ideas, I'll tell you. Thank you very much!
No problem! Happy vimming! :)
I don't want
:VimtexTocToggle<cr>
to open a split window. I would like it works like:Unite -no-split outline
.But I only find
g:vimtex_index_split_pos
setting, it is not I want. Is there any way for no split?By the way, it would be good if TOC unite with unite.vim.
Vimtex is a great plugin, thank you a lot!