-
-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text objects and motions for headings, subtrees and etc #48
Comments
I added support for motions. Check docs from here https://github.com/kristijanhusak/orgmode.nvim/blob/master/DOCS.md#org_next_visible_heading. I'll add text objects separately. I plan to add these (
Do you have some additional suggestions? |
Looks like a great start! I'm personally pretty happy with this objects but I think it nice to have full list implemented in vim-orgmode. |
Could you give me some detailed breakdown what's the difference between some of these? I installed vim-orgmode and some of these behaved completely same to me, like |
test file:
|
Thanks @petRUShka , this is really helpful! |
@kristijanhusak, please tell me, do you have plan on this issue? Actually it is the only issue that stopping me from migrating to this plugin. So for me it would be great to have this functionality implemented! P.S. I use it to bind hotkeys for selecting and moving |
@petRUShka I plan to implement this, but it's not on my high priority list. Are you using |
@kristijanhusak, right now I'm on jceb/vim-orgmode because it's the only org-mode plugin with text-object feature. So I'm looking forward to have this feature! |
@petRUShka I pushed a commit with support for these motions on |
I added documentation around them and made them configurable. |
@kristijanhusak, thanks a lot! It's a huge step! But It seems that
|
Example file: https://gist.github.com/petRUShka/cdf772db1fcbc1c2aa8318511609450b
|
@petRUShka could you show me what you get and what's the expectation? From what I understood (from the screenshots in your previous comment):
Can you give more detailed explanation how these should work? Also, did you test your first example #48 (comment) ? |
On test file from #48 (comment)
What do you think on changing from |
But in case of bigger file from comment One can see that when I run You can compar behavior with It selects text till line 35 which is the line of next header of level 1. |
I've tested it with same as in previous comment result also with set nocompatible
set runtimepath^=~/.vim runtimepath+=~/.vim/after
call plug#begin('~/.vim/plugged')
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'kristijanhusak/orgmode.nvim', { 'branch': 'tree-sitter' }
call plug#end()
filetype plugin indent on
syntax enable
lua << EOF
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.org = {
install_info = {
url = 'https://github.com/milisims/tree-sitter-org',
revision = 'main',
files = {'src/parser.c', 'src/scanner.cc'},
},
filetype = 'org',
}
require'nvim-treesitter.configs'.setup {
-- If TS highlights are not enabled at all, or disabled via `disable` prop, highlighting will fallback to default Vim syntax highlighting
highlight = {
enable = true,
disable = {'org'}, -- Remove this to use TS highlighter for some of the highlights (Experimental)
additional_vim_regex_highlighting = {'org'}, -- Required since TS highlighter doesn't support all syntax features (conceal)
},
ensure_installed = {'org'}, -- Or run :TSUpdate org
}
require('orgmode').setup({
org_agenda_files = {'~/Dropbox/org/*'},
org_default_notes_file = '~/Dropbox/org/test.org',
})
EOF |
Folds were the issue. I didn't account for those. Pull latest tree-sitter branch and give it a test. I tried vim-orgmode for some of these, and in certain situations it behaves differently, like when cursor is on an empty line, |
It works much better, thanks! But sometimes I've added several copies of line 32 and did These behavior isn't repeated. I've seen it several times on several files (including real one and test one), but suddenly it stops behave like this. |
I think this issue is the same issue as this one. Treesitter tree is not properly refreshed when some changes are done to the document, which causes all content to be treated as child of the first entry. I'm looking at that issue now. |
It somehow triggered by Steps to reproduce:
|
Can you try doing this and see if it still happens? |
@petRUShka I just pushed a fix for the parsing issue. Try using latest tree-sitter branch. No need to do what I said in last comment. |
It looks like you've fixed this issue. Thanks a lot! |
Awesome, thanks for your help! Can we close this? |
So what do you think on changing
|
Please look at #48 (comment) for details. |
Oooh, that's |
I updated it to be |
Great! Thanks a lot |
There is one annoying difference between vim-orgmode vim-orgmode selects text including newline, whereas Suppose we have:
where and in orgmode.nvim it would be:
Which isn't what you naturally expect. |
To me <div>First div</div>
<div>Second| div</div> and doing |
Another core-vim example is deleting line:
Line deletes completely as there is was line at all, so no new line left, cursor goes to beginning of a first line which seems kind of natural for me. If you want to delete heading do you want to have extra line after deletion? I believe you don't in most of the cases. |
The issue happens only on the last subtree, and I figured out what's exactly the issue. I pushed a change, should be working as expected now. |
It's working well right now, thanks! |
@petRUShka can you pull latest changes and test everything all over again? I fixed this issue, but I changed how things are generally calculated, so I want to be sure I didn't break anything. |
@petRUShka any updates on this? |
Now it seems to work fine. I'll put my eye on it! |
This may be slightly off-topic, but is there a reason why the character for "subtree" is |
@Maltimore |
I think this issue could be closed then? Everything seems to be addressed. |
Yeah I think we are ok with closing this. |
Does this feature exist in Emacs orgmode?
N/A
If answer to first question is "No", elaborate on how this feature is valuable and what problem does it solve.
One cool feature of jceb/vim-orgmode is text objects for orgmode. It allows to combine power of orgmode and Vim ideas. Quotation:
I thinks it is a very good idea to use powerful Vim features to interact with Org content.
Additional context
P.S. Having motions should be also very useful.
The text was updated successfully, but these errors were encountered: