Closed jbarik closed 3 years ago
what's your conceallevel (:echo &conceallevel
) while you're in the org buffer?
:echo &conceallevel produces the answer 0
try doing :setlocal conceallevel=2
while in org buffer and see if it works then.
:setlocal conceallevel=2 worked
Ok, and what about the output of echo &concealcursor
?
echo &concealcursor is empty
Ok. You need to add set conceallevel=2
to your vimrc. If you want to have concealing only for org, add it to autocmd:
autocmd FileType org setlocal conceallevel=2
Thanks a lot. with conceallevel=2 the issue is solved, but I am seeing one more behaviour. the moment my cursor is on the line containing the link it gets exapnded. I would like it to be expanded when I am in insert mode - I am switching from vim-orgmode, where that was the behaviour. Can I change some setting to get my desired behaviour.
Yes, add also setlocal concealcursor=nc
to the autocmd.
Sorry to bother again. I see that even with conceallevel=2, the brackets are not hidden when it is inside a heading
Links in headline are not supported because of similar issue like this. You should use tree-sitter
branch with experimental highlighting enabled if you want this.
Good to know that tree-sitter branch will fix this. For now, I replaced the line
"syntax match org_hyperlink "[{2}[^][](][[^][])\?]{2}" contains=org_hyperlinkBracketsLeft,org_hyperlinkURL,org_hyperlinkBracketsRight"
in org.vim file to
"syntax match org_hyperlink "[{2}[^][](][[^][])\?]{2}" contains=org_hyperlinkBracketsLeft,org_hyperlinkURL,org_hyperlinkBracketsRight containedin=OrgHeadlineLevel1,OrgHeadlineLevel2,OrgHeadlineLevel3,OrgHeadlineLevel4,OrgHeadlineLevel5"
With this I think it'll work for 5 levels of heading and I can live with that till tree-sitter branch becomes the main.
Thanks for your effort.
There seems to be an issue with line wrapping if the link URL is very long
This is with disable = {'org'}
in Treesitter as I saw the notice that concealing in TS is unsupported. Should I open a separate issue?
Though it's possible to do setlocal nowrap
to avoid this, but this can sometimes make :tags: :help orgmode-org_set_tags_command
show off-screen in a small split
EDIT: Thought I'd post the lua version of the augroup that includes all of the 3 fixes posted in above posts: In your init.lua (if you use init.vim just copy the stuff between [[ ]] (exclusive))
vim.api.nvim_exec(
[[
function! SetOrgSets()
setlocal conceallevel=2
setlocal concealcursor=nc
setlocal nowrap
endfunction
autocmd FileType org call SetOrgSets()
]],
true)
@sethidden I don't think this can be fixed. It's just how concealing works in Vim. Try doing set conceallevel=0
and see how it really looks in the background. There is no way to control this behavior. As you said, nowrap
should do the trick.
For organization's sake - concealed text wrongly contributing to wrapping is reported upstream in neovim under https://github.com/neovim/neovim/issues/14409
Are you using "tree-sitter" branch?
No
Describe the bug
As shown in the above message, for links the brackets are not hidden. Am I missing some setting. My minimal init.vim to reproduce the issue
init.vim
function! PackagerInit() abort
packadd vim-packager
call packager#init()
call packager#add('kristijanhusak/orgmode.nvim')
endfunction
command! PackagerInstall call PackagerInit() | call packager#install()' })
command! -bang PackagerUpdate call PackagerInit() | call packager#update({ 'force_hooks': '
command! PackagerClean call PackagerInit() | call packager#clean()
command! PackagerStatus call PackagerInit() | call packager#status()
lua << EOF
require('orgmode').setup({
org_hide_leading_stars = true
})
EOF
Steps to reproduce
My org file contnts: [[test]] [[test][link to test]]
Expected behavior
The brackets should be hidden
Emacs functionality
No response
Screenshots and recordings
OS / Distro
Ubuntu 20.04.3 LTS
Neovim version/commit
NVIM v0.5.0-dev+1372-g056c464e8
Additional context
No response