Commit Graph
74 Commits
Author SHA1 Message Date
NicolasGB 5b20479cff feat(log): Allow creating new changes with multiple parents through
visual selection
2026-01-09 13:59:27 +01:00
NicolasGB b6d7ebddf6 feat(log): Allow abandoning multiple changes at once through visual
selection
2026-01-09 13:09:45 +01:00
NicolasGB 9d9e2379fd feat(log): Implement squash and quick squash from the log buffer.
- Squash: behaves like rebase, the user can select 1 or more
      revisions to squash and then a destination
    - Quick squash: `-r {rev} -u --ignore-immutable` flag from jj allowing
      for quick visuall squashes
2026-01-08 18:29:04 +01:00
NicolasGB a23997d3bc fix(parser): Fix some edge cases where false positives where getting
parsed as change-lines.

    - Added some tests to avoid these false positives
    - Forced the parser to ensure there is at least a symbol in the
      change line allowed_prefixes before finding out the change
2026-01-07 12:52:42 +01:00
NicolasGB ba48ed08b5 feat(log): add immutable-ignoring rebase keymaps
Changes add support for rebasing while ignoring immutability constraints with new keymaps (<S-CR>, <S-o>, <S-a>, <S-b>) and update documentation. Refactors rebase handler to accept optional ignore_immut parameter and includes minor comment improvements in buffer and command modules.
2026-01-06 13:20:19 +01:00
Marco S HymanandGitHub ca75a50858 feat: Terminal buffer keymap help (#64)
This sets up a base where the keymap g? shows a help buffer displaying the normal mode keymaps available.
2026-01-05 09:49:45 +01:00
Nicolas GBandGitHub 12e91e547d feat: Rebase on log buffer (#62)
Now it is possible to rebase interactively from the log buffer with visual feedback. You can rebase one or many visually selected changes.

Supported target modes are: `-o` / `-A` / `-B`.

Limitation:
	- As of now you cannot rebase a whole branch (-b) from the log view.

Bonus from this pr:
	- Now keymaps support different modes
2026-01-02 18:41:59 +01:00
Nicolas GBandGitHub 2c898c6be3 feat(diff): Restore cursor when exiting diff mode (#63) 2026-01-02 12:11:11 +01:00
NicolasGB 16eedac9b9 fix(editor): Use native jjdescription highlights groups and simply override them
Keep the Renamed logic since this one is not native to neovim.
2025-12-30 18:39:16 +01:00
NicolasGB c40dfed316 fix(log): handle bookmark now is a method of the module instead of local
like all the others
2025-12-30 12:25:56 +01:00
NicolasGB 746f78b60f fix(log): if a default prefix has been set take it into account when
creating a bookmark from the logfile
2025-12-30 12:22:47 +01:00
Marco S HymanandGitHub a7b9de68cb Fix: snacks picker history (#59) 2025-12-30 09:42:26 +01:00
Nicolas GBandGitHub 6eb41f631e Feat: Annotation by file and line (#55) 2025-12-29 11:46:35 -08:00
Marco S HymanandGitHub 176456b498 Add --no-pager to the log diff handler (#58) 2025-12-29 09:47:32 -08:00
Mathew HarmanandGitHub faf1a9f63c feat(describe): set the local filetype of the editor describe to jjdescription (#57) 2025-12-24 16:20:01 -08:00
NicolasGB 40cf2fea13 fix(bookmark): add -r when creating bookmarks to correctly handle revsets 2025-12-19 19:36:54 +10:00
NicolasGB 5dc6fbafa7 fix(runner): use sh -c wrapper for safe command execution 2025-12-19 16:57:38 +10:00
868c3ce2e1 fix(diff): revset must be shell-escaped (#53)
Co-authored-by: Julien Moutinho <julm+jj-nvim@sourcephile.fr>
2025-12-18 22:48:01 -08:00
NicolasGB 1fd8faed4b feat(bookmark): add prefix configuration for bookmark creation
- Add `prefix` option to `bookmark_create()` function for setting default bookmark names
- Add `bookmark.prefix` configuration option for global bookmark prefix defaults
- Update README with bookmark prefix usage examples
2025-12-18 19:43:36 +10:00
NicolasGB 43b5a81771 fix: prevent invalid buffer access in terminal on_exit callbacks
When closing a terminal buffer (floating or regular), a race condition
could occur where the BufWipeout/BufDelete autocmd clears the buffer
reference, but the job's on_exit handler later tries to operate on it
via vim.schedule. This caused 'Invalid buffer' errors.

Add validity checks in both floating and regular buffer on_exit
handlers to safely handle the case where the buffer has already been
cleaned up.
2025-12-11 17:01:46 +11:00
Nicolas GBandGitHub d63761e1bf feat(bookmark): add bookmark management from log buffer and bookmark_move API (#51) 2025-11-27 22:07:22 +01:00
NicolasGB b32ba1aa5e fix(utils): get_all_bookmarks returns only local and non deleted ones 2025-11-27 21:29:37 +01:00
NicolasGB 8350606dab feat(cmd): add platform-agnostic PR/MR opening functionality 2025-11-27 20:58:34 +01:00
NicolasGB e22bf5ec4e feat: Add fetch/push commands and log keybinds, make long-running operations non-blocking
Convert blocking jj commands to async using vim.fn.jobstart() to prevent UI
freezing during fetch, push, rebase, squash, and other heavy operations.

Changes:
- Implement execute_command_async() in runner with proper error handling
  - Captures stdout from job and passes to success callback
  - Supports stdin input for commands that require it
  - Includes silent flag to suppress error notifications
  - Replicates sync version's error handling behavior

- Convert blocking operations to async:
  - handle_log_fetch, handle_log_push_all, handle_log_new
  - handle_log_edit, handle_log_abandon, handle_log_describe
  - describe.execute_describe, all init.lua commands

- Add push/fetch as public commands with CLI support:
  - M.fetch() - fetch from remote
  - M.push(opts) - push all changes or specific bookmark
  - CLI: :J push, :J push <bookmark>, :J fetch

- Implement handle_log_push_bookmark() for revision under cursor:
  - Retrieves and strips modified bookmark indicator (*)
  - Pushes specific bookmark to remote
  - Keybind: Shift+p in log buffer

- Update README with new keybinds:
  - a: abandon revision under cursor
  - f: fetch from remote
  - p: push all changes
  - Shift+p: push revision's bookmark

- Add Lua API docs for push command options
2025-11-27 20:58:34 +01:00
NicolasGB 8f1a60342a feat: implement jj abandon as native 2025-11-27 20:58:34 +01:00
Nicolas GBandGitHub 10c611eaab feat: add close_on_edit config for log buffer (#48)
- Add close_on_edit option to close log buffer after editing a change (default: false)
- Rename handle_log_enter to handle_log_edit with close_on_exit parameter
- Update log keymaps to pass close_on_edit config to handlers
- Update config types and defaults in init.lua
2025-11-26 15:48:56 +01:00
Nicolas GBandGitHub 39de3c6bc9 fix: Improve the parser and add test to handle edge cases (#42) 2025-11-26 09:42:45 +01:00
NicolasGB 7329e89a85 feat(terminal): add configurable cursor render delay for terminal buffers
Add cursor position restoration with configurable timing to handle terminal
     buffer rendering asynchronously. This fixes cursor column being reset to 0
     when refreshing jj log commands.

     Changes:
     - Add `terminal.cursor_render_delay` configuration option (default: 10ms)
     - Add buffer.get_cursor() and buffer.set_cursor() helpers in core/buffer
       * buffer.set_cursor() uses defer_fn with configurable delay for terminal buffers
       * Automatic position validation with clamping to buffer bounds
       * Line number clamped to [1, line_count]
       * Column clamped to [0, line_length] based on actual line content
       * Validation happens inside deferred callback to check against final rendered content
     - Extract clamp_cursor_position() helper to eliminate code duplication
     - Refactor terminal module to use new buffer cursor helpers
     - Store and restore cursor position when cycling through log commands
     - Update README with terminal configuration section and example usage

     The delay is necessary because nvim_open_term() + nvim_chan_send() have
     asynchronous rendering in the terminal emulator layer. Setting the cursor
     before rendering completes results in the column being reset to 0. Users
     experiencing issues can increase the delay value if needed.
2025-11-25 09:10:12 +01:00
NicolasGB 0cd1f554a6 fix: Correctly parse complex subcommands and push a table to terminal.run() when it's possible instead of making a concat 2025-11-23 18:07:30 +01:00
NicolasGB c5a51a1beb refactor: Make the floating buffer configurable keymaps too 2025-11-23 16:34:42 +01:00
NicolasGB 050608c2cc refactor: remove hardcoded closing keymaps on the terminal buffer 2025-11-23 16:34:42 +01:00
NicolasGB a96a5c7849 refactor: split cmd.lua into multiple files when commands have enough business inside them 2025-11-23 16:34:42 +01:00
NicolasGB be925a9882 Update README with new config structure
- Document describe.editor configuration for type and keymaps
- Document keymaps configuration for log, status, and close keybindings
- Update examples to show the new nested config structure
- Add section on customizing describe editor keymaps
- Preserve multiline descriptions in describe editor buffer
2025-11-23 16:34:42 +01:00
NicolasGB b34e08d815 fix: describe command reopening log buffer without flicker
- Close terminal buffer before opening describe editor
  - Capture log state before closing to detect if we should reopen
  - Add on_unload callback to editor to handle log reopening
  - Suppress redraws during buffer transitions with lazyredraw
  - Remove duplicate hardcoded status keymaps from terminal.lua (were referencing undefined functions)
  - Fix resolve_keymaps_from_specs to validate handlers exist before creating keymaps
2025-11-23 16:34:42 +01:00
NicolasGB f06b23326e refactor: Restructure keymaps and event handlers into centralized config-driven system
- Add M.setup() to cmd module for configuration
    - Move describe editor config to M.config.describe.editor with nested structure
    - Add keymaps config with separate log, status, and close sections
    - Implement resolve_keymaps_from_specs() helper to build keymap lists from config
    - Extract editor.open_editor() keymaps parameter support
    - Move status/log event handlers from terminal.lua to cmd.lua
    - Convert log/status buffer keymaps to config-driven approach with handler specs
2025-11-23 16:34:42 +01:00
NicolasGB f0cfb459bd refactor: create a new buffer module to centralize buffer operation logic 2025-11-23 16:34:42 +01:00
NicolasGB e545d02ceb refactor: restructure the whole plugin following a better separation of concers 2025-11-23 16:34:42 +01:00
NicolasGB f6982a7716 fix: split with the same logic as the editor 2025-11-23 16:34:42 +01:00
Nicolas GBandGitHub d385501067 fix: Improve default command parsing logic and allow for toml array definition. (#37) 2025-11-20 13:21:15 +01:00
Sivansh GuptaandGitHub 3f6049b17c feat: D to describe a change in log buffer (#23) 2025-11-20 10:03:06 +01:00
SpiegieandGitHub 9446ad8f69 Feat: edit mutable changes in log buffer (#30) 2025-11-19 16:21:37 +01:00
NicolasGB 9d39e74ce5 fix: update clearing buffer, this makes the plugin work again on nightly 2025-11-18 17:21:29 +01:00
NicolasGB 84ba77a8fc fix(log): Add u/r keymaps for undoing and redoing operations on log buffer. 2025-11-18 14:33:16 +01:00
NicolasGB 10c9a07ad7 Refactor M.j() command dispatch to use handler table
- Replace nested if/elseif chains with dispatch table for cleaner pattern matching
- Store remaining_args_str to avoid repeated table.concat() calls
- Simplify whitespace trimming using vim.trim() instead of gsub patterns
- Add state.buf_cmd tracking to store subcommand on successful execution for conditional UI refreshes
- Clean up state on buffer close and execution failure
- Add conditional log refresh for squash(), undo(), and redo() when log buffer is active
- Fix type annotations for nil handling
2025-11-18 14:04:21 +01:00
NicolasGB e0370ad0ca feat: Make undo/redo native 2025-11-18 14:04:21 +01:00
NicolasGB af6dbbc3a7 fix(cmd): Improve default command parsing logic, to allow for builtin functionalities to be used 2025-11-18 14:00:34 +01:00
NicolasGB b41812e0f8 feat(cmd): enhance log new handling with after/ignore-immutable 2025-11-18 14:00:34 +01:00
NicolasGB c3aba8f35f feat(log): Add n keybinding to create commits after the revision under the cursor 2025-11-18 14:00:34 +01:00
NicolasGB 9ef710390b feat(log): add conflict symbol × (U+00D7) to revision parser 2025-11-12 14:10:21 +01:00
NicolasGB a33cbba40f refactor(diff): Improve api with lua types and more flexibility 2025-10-31 14:50:43 +01:00