Raxol.Navigation.Vim (Raxol v2.0.1)
View SourceVIM-style navigation for terminal buffers.
Provides familiar VIM keybindings for buffer navigation including:
- Basic movement (h, j, k, l)
- Jump commands (gg, G, 0, $)
- Word movement (w, b, e)
- Search (/, ?, n, N)
- Visual mode selection
Example
state = Vim.new(buffer)
{:ok, new_state} = Vim.handle_key("j", state) # Move down
{:ok, new_state} = Vim.handle_key("w", state) # Next word
{:ok, new_state} = Vim.handle_key("/", state) # Start searchConfiguration
config = %{
wrap_horizontal: true,
wrap_vertical: false,
word_separators: " .,;:!?",
search_incremental: true
}
state = Vim.new(buffer, config)
Summary
Functions
Get the current visual selection range.
Handle a key press and update navigation state.
Create a new VIM navigation state.
Types
@type mode() :: :normal | :search | :visual
@type position() :: {non_neg_integer(), non_neg_integer()}
@type search_direction() :: :forward | :backward
@type t() :: %Raxol.Navigation.Vim{ buffer: Raxol.Core.Buffer.t(), command_buffer: String.t(), config: map(), cursor: position(), mode: mode(), search_direction: search_direction() | nil, search_index: non_neg_integer(), search_matches: [position()], search_pattern: String.t() | nil, visual_start: position() | nil }
Functions
Get the current visual selection range.
Handle a key press and update navigation state.
@spec new(Raxol.Core.Buffer.t(), map()) :: t()
Create a new VIM navigation state.