Skip to content

Add Logseq-like structural editing: task cycling, block movement, and wiki link wrapping#3

Merged
benjaminoakes merged 5 commits intomainfrom
copilot/add-logseq-functionality
Jan 23, 2026
Merged

Add Logseq-like structural editing: task cycling, block movement, and wiki link wrapping#3
benjaminoakes merged 5 commits intomainfrom
copilot/add-logseq-functionality

Conversation

Copy link

Copilot AI commented Jan 13, 2026

Implements three structural editing features from Logseq Desktop to enable keyboard-driven task management and navigation.

Changes

  • Task Status Cycling - logseq#CycleTaskStatus() cycles bullet points through (none) → TODO → DOING → DONE → (none) while preserving indentation

    • Keybinding: <Leader>t
    • Plug: <Plug>(logseq-cycle-task)
  • Block Movement - logseq#MoveBlockUp() / logseq#MoveBlockDown() swap lines or visual selections with adjacent lines

    • Keybindings: <Alt-k> / <Alt-j>
    • Plugs: <Plug>(logseq-move-up) / <Plug>(logseq-move-down)
    • Supports both normal and visual mode
  • Wiki Link Creation - logseq#CreateLink() wraps visual selection with [[]]

    • No default keybinding (avoids conflicts with <CR>)
    • Plug: <Plug>(logseq-make-link)

All features use <Plug> mappings for customization and apply only to logseq filetype buffers. Default keybindings use hasmapto() to avoid conflicts.

Example Usage

" On a bullet line:
- Research vim plugins

" Press <Leader>t repeatedly to cycle:
- TODO Research vim plugins
- DOING Research vim plugins  
- DONE Research vim plugins
- Research vim plugins  " back to start

" Visually select "vim plugins" and map to create link:
autocmd FileType logseq vmap <buffer> <Leader>l <Plug>(logseq-make-link)
" Result: - Research [[vim plugins]]

Testing

Added 13 unit tests covering all features, edge cases, and indentation preservation. All 29 tests pass.

Original prompt

Add more Logseq-like functionality

I am developing the vim-logseq plugin (written in Vimscript).
Current State: The plugin currently handles file detection, syntax highlighting, and basic searching (autoload/logseq.vim).
Goal: I want to implement "Logseq-like" structural editing features directly into the plugin.
Please write the Vimscript to implement the following three features. Provide the code for autoload/logseq.vim and the mappings for plugin/logseq.vim.

1. Task Status Cycling

Create a function logseq#CycleTaskStatus() that operates on the current line.

  • If the line starts with - , check for task keywords.
  • Cycle Order: (no task) -> TODO -> DOING -> DONE -> (no task).
  • Constraint: Preserve existing indentation and bullet points.

2. Block Movement (Bubbling)

Create functions logseq#MoveBlockUp() and logseq#MoveBlockDown().

  • These should move the current line (or visual selection) up or down by one line.
  • Similar to Alt+Up/Down in Logseq Desktop.

3. Wiki Link Wrapping

Create a function logseq#CreateLink() for Visual Mode.

  • It should wrap the selected text in double brackets: [[selected text]].

4. Mappings

In plugin/logseq.vim, expose these via <Plug> mappings so users can remap them, but provide these defaults if no conflict exists:

  • Task Cycle: <Leader>t (or Ctrl+Enter if valid)
  • Move Up/Down: <Alt-k> / <Alt-j>
  • Make Link: <Enter> (Only in Visual Mode)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 13, 2026 20:36
…d wiki link creation

Co-authored-by: benjaminoakes <5323+benjaminoakes@users.noreply.github.com>
Co-authored-by: benjaminoakes <5323+benjaminoakes@users.noreply.github.com>
… standard Vim behavior

Co-authored-by: benjaminoakes <5323+benjaminoakes@users.noreply.github.com>
…umn 1

Co-authored-by: benjaminoakes <5323+benjaminoakes@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Logseq-like functionality to vim-logseq plugin Add Logseq-like structural editing: task cycling, block movement, and wiki link wrapping Jan 13, 2026
Copilot AI requested a review from benjaminoakes January 13, 2026 20:46
@benjaminoakes benjaminoakes marked this pull request as ready for review January 23, 2026 22:55
@benjaminoakes benjaminoakes merged commit 907c93d into main Jan 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants