Comments (10)
I'm sorry, but I don't quite follow. Could you please explain what you want to achieve?
from wiki.vim.
I never enable folds in this plugin, I just set the foldmethod. If you don't want folds, you can either disable them globally with set nofoldenable
in your vimrc, or for wiki files with autocmd Filetype wiki set nofoldenable
.
from wiki.vim.
I tried it with a minimal init.vim
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.vim/bundle')
Plug 'lervag/wiki.vim'
call plug#end()
syntax on
filetype plugin indent on " required
let g:wiki_root = '~/Cloud/wiki/'
set nofoldenable
autocmd Filetype wiki set nofoldenable
And the wiki is still folded. I thought it was the plugin, because the filetype stuff gets sourced after the init.vim
from wiki.vim.
Sorry, this was actually a bug. In the code that opens a wiki link, I do normal! zMzvzz
to focus the link target, but zM
enables folds. I was not aware. I've fixed this now.
from wiki.vim.
Hi @lervag, is it possible that you overwrite the foldlevel user option? Using the index command (and this Focusing part), foldlevel=0 is forced.
Maybe something like this would be better:
" Focus
if &foldenable
if l:same_file || &foldlevel > 0
normal! zv
else
normal! zMzv
endif
endif
However, I'm not sure why you close all folds by default in the first place. Isn't it done automatically?
from wiki.vim.
Good questions.
However, I'm not sure why you close all folds by default in the first place. Isn't it done automatically?
No, not necessarily. That is, people could use different foldlevel
settings. But I do agree that the current version overrides this!
Perhaps it is better to fully avoid the zM
. People could use the autocmd event to customize if they want a different behaviour, after all.
I'd like more opinions on this. @jabirali for instance, what do you think?
Note: I've accepted your suggested change as a bugfix.
from wiki.vim.
Sorry about the late reply... I've been a lot sick lately, so haven't kept up with my notifications :).
I'd like more opinions on this. @jabirali for instance, what do you think?
Personally, I think I like the same behaviour as you: I like that folding allows me to only see the relevant parts of the file, and I believe the zMzv
solution fits well with that workflow.
If you do keep this behaviour, perhaps the snippet of @rattletat can be generalized to all fold levels? Quickly checking the docs, it seems like replacing zMzv
by zx
is the most correct solution, and seems to be supported on both Vim and Neovim?
If you decide to remove the zM
part, I think it could be nice to mention briefly how to set it up again in the documentation :).
from wiki.vim.
replacing
zMzv
byzx
is the most correct solution
The docs for zx
:
*zx*
zx Update folds: Undo manually opened and closed folds: re-apply
'foldlevel', then do "zv": View cursor line.
Also forces recomputing folds. This is useful when using
'foldexpr' and the buffer is changed in a way that results in
folds not to be updated properly.
I'm not so sure if this is right, though. In the l:same_file || &foldlevel > 0
case, we don't want to disturb the manually changed folds, only to ensure that the current line is visible (i.e. zv
). In the other case, we know that &foldlevel = 0
, which means zx
should behave the same as zMzv
, right? Thus, this proposed change does not really change anything? Or did I miss something?
Or did you mean to change the entire snippet and do zx
in all cases? I don't like that, because e.g. navigation inside the same file should not close other open folds.
Perhaps, though, that this is better (and what you meant)?
if l:same_file
normal! zv
else
normal! zx
endif
Opinions, @rattletat and @jabirali?
If you decide to remove the zM part, I think it could be nice to mention briefly how to set it up again in the documentation :).
Agreed, will do that if I make the change.
from wiki.vim.
Indeed, that's what I meant :).
Having a different behavior for l:same_file
is not the issue. I was mainly thinking that I like the current zMzv
behaviour, but think it would be ideal if wiki.vim
behaved roughly the same way for foldlevel=0
and foldlevel>0
.
My understanding of the documentation is that replacing zMzv
with zx
allows you to handle all fold levels with the same code (as in the code snippet you posted), and provide a consistent behavior.
from wiki.vim.
Agreed, thanks. I'll update accordingly.
from wiki.vim.
Related Issues (20)
- citekey: link to BibDesk (in wiki.vim too) [feature request] HOT 27
- Feature Request: Auto-Copy Text for WikiLinkFollow HOT 10
- Default keybinds not loading when attempting to use `adoc` HOT 3
- How can I avoid affecting certain default templates of wiki.vim HOT 3
- Possible to use one prefix to delimit a line of tags? HOT 3
- WikITocGenerate for more filetypes HOT 3
- WikiJournalNext / WikiJournalPrev navigate out of journal folder HOT 7
- Backlinks don't update immediately HOT 16
- WikiExport: cmd should use double quote under windows HOT 18
- How can g:wiki_export be configured to support HTML, docx, and PDF? HOT 4
- Using custom resolver breaks WikiJournalNext/WikiJournalPrev HOT 10
- Disabling default mappings might be broken HOT 2
- Provide dictionaries containing default mappings HOT 6
- Enhancement request for WikiJournalIndex: reverse order and update HOT 3
- Is it possible for wiki-link-types to support jumping to Vim help? HOT 7
- WikiTags can't work under gvim 9.1 or neovim 0.10 + win 10 pro HOT 19
- Infinite loop on template rendering if function starts at index 0 in template file HOT 1
- HTML text objects are overwritten by text objects for link texts HOT 3
- WikiLinkAdd in visual mode HOT 3
- Add completion source for `:WikiOpen`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wiki.vim.