Skip to content

Commit

Permalink
Merge pull request #430 from mrjones2014/mrj/smart-splits-extension
Browse files Browse the repository at this point in the history
feat(extension): Update smart-splits.nvim extension with new features
  • Loading branch information
mrjones2014 authored Mar 4, 2024
2 parents 6fd54ed + 2aae1c8 commit a27f704
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/EXTENSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ require('legendary').setup({
-- or, default settings shown below
smart_splits = {
directions = { 'h', 'j', 'k', 'l' },
-- key to use to jump to previous window
prev_win = '<C-\\>',
mods = {
-- for moving cursor between windows
move = '<C>',
Expand Down
11 changes: 10 additions & 1 deletion lua/legendary/extensions/smart_splits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

---@class LegendarySmartSplitsExtensionOpts
---@field directions string[] Directional keys to use, in order of left/down/up/right (defaults to h/j/k/l).
---@field prev_win string Key to use for "previous window"
---@field mods LegendarySmartSplitsMods modifiers to use, defaults to ctrl for move, alt for resize.
---@field mode string[] List of modes to map keys in, defaults to just normal mode

Expand All @@ -20,6 +21,7 @@ local direction_map = {
}

local default_opts = {
prev_win = '<C-\\>',
directions = { 'h', 'j', 'k', 'l' },
mods = {
move = '<C>',
Expand Down Expand Up @@ -64,7 +66,14 @@ return function(opts)
end

local t = require('legendary.toolbox')
local keymaps = {}
local keymaps = {
{
opts.prev_win,
t.lazy_required_fn('smart-splits', 'move_cursor_previous_win'),
description = 'smart-splits: Previous window',
},
}

for action, mod in pairs(opts.mods) do
if mod then
local mod_stripped
Expand Down

0 comments on commit a27f704

Please sign in to comment.