From c6c097057c0f7a47706d4965aca6b5ea4cc5f3f9 Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 1 Nov 2024 17:48:29 -0700 Subject: [PATCH 1/2] change smart split keys --- lua/plugins/smart-splits.lua | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/lua/plugins/smart-splits.lua b/lua/plugins/smart-splits.lua index e552197..cf4a09a 100644 --- a/lua/plugins/smart-splits.lua +++ b/lua/plugins/smart-splits.lua @@ -1,27 +1,22 @@ return { { "mrjones2014/smart-splits.nvim" }, lazy = false, - config = function() - local smart_splits = require("smart-splits") - local keymap = vim.keymap - -- recommended mappings + keys = { -- resizing splits - -- these keymaps will also accept a range, - -- for example `10` will `resize_left` by `(10 * config.default_amount)` - keymap.set("n", "", smart_splits.resize_left) - keymap.set("n", "", smart_splits.resize_down) - keymap.set("n", "", smart_splits.resize_up) - keymap.set("n", "", smart_splits.resize_right) + { "n", "", ":lua require('smart-splits').resize_left()" }, + { "n", "", ":lua require('smart-splits').resize_down()" }, + { "n", "", ":lua require('smart-splits').resize_up()" }, + { "n", "", ":lua require('smart-splits').resize_right()" }, -- moving between splits - keymap.set("n", "", smart_splits.move_cursor_left) - keymap.set("n", "", smart_splits.move_cursor_down) - keymap.set("n", "", smart_splits.move_cursor_up) - keymap.set("n", "", smart_splits.move_cursor_right) - keymap.set("n", "", smart_splits.move_cursor_previous) + { "n", "", ":lua require('smart-splits').move_cursor_left()" }, + { "n", "", ":lua require('smart-splits').move_cursor_down()" }, + { "n", "", ":lua require('smart-splits').move_cursor_up()" }, + { "n", "", ":lua require('smart-splits').move_cursor_right()" }, + { "n", "", ":lua require('smart-splits').move_cursor_previous()" }, -- swapping buffers between windows - keymap.set("n", "h", smart_splits.swap_buf_left) - keymap.set("n", "j", smart_splits.swap_buf_down) - keymap.set("n", "k", smart_splits.swap_buf_up) - keymap.set("n", "l", smart_splits.swap_buf_right) - end, + { "n", "a", ":lua require('smart-splits').swap_buf_left()" }, + { "n", "o", ":lua require('smart-splits').swap_buf_down()" }, + { "n", "e", ":lua require('smart-splits').swap_buf_up()" }, + { "n", "u", ":lua require('smart-splits').swap_buf_right()" }, + }, } From 9bae641b35498ef3c356fc244dfdeeb1d2c25a6e Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 1 Nov 2024 17:56:44 -0700 Subject: [PATCH 2/2] correct syntax --- lua/plugins/smart-splits.lua | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/lua/plugins/smart-splits.lua b/lua/plugins/smart-splits.lua index cf4a09a..7a872c4 100644 --- a/lua/plugins/smart-splits.lua +++ b/lua/plugins/smart-splits.lua @@ -3,20 +3,24 @@ return { lazy = false, keys = { -- resizing splits - { "n", "", ":lua require('smart-splits').resize_left()" }, - { "n", "", ":lua require('smart-splits').resize_down()" }, - { "n", "", ":lua require('smart-splits').resize_up()" }, - { "n", "", ":lua require('smart-splits').resize_right()" }, + { "", ":lua require('smart-splits').resize_left()", desc = "smart split: resize left" }, + { "", ":lua require('smart-splits').resize_down()", desc = "smart split: resize down" }, + { "", ":lua require('smart-splits').resize_up()", desc = "smart split: resize up" }, + { "", ":lua require('smart-splits').resize_right()", desc = "smart split: resize right" }, -- moving between splits - { "n", "", ":lua require('smart-splits').move_cursor_left()" }, - { "n", "", ":lua require('smart-splits').move_cursor_down()" }, - { "n", "", ":lua require('smart-splits').move_cursor_up()" }, - { "n", "", ":lua require('smart-splits').move_cursor_right()" }, - { "n", "", ":lua require('smart-splits').move_cursor_previous()" }, + { "", ":lua require('smart-splits').move_cursor_left()", desc = "smart split: move cursor left" }, + { "", ":lua require('smart-splits').move_cursor_down()", desc = "smart split: move cursor up" }, + { "", ":lua require('smart-splits').move_cursor_up()", desc = "smart split: move cursor up" }, + { "", ":lua require('smart-splits').move_cursor_right()", desc = "smart split: move cursor right" }, + { + "", + ":lua require('smart-splits').move_cursor_previous()", + desc = "smart split: move cursor to previous", + }, -- swapping buffers between windows - { "n", "a", ":lua require('smart-splits').swap_buf_left()" }, - { "n", "o", ":lua require('smart-splits').swap_buf_down()" }, - { "n", "e", ":lua require('smart-splits').swap_buf_up()" }, - { "n", "u", ":lua require('smart-splits').swap_buf_right()" }, + { "a", ":lua require('smart-splits').swap_buf_left()", desc = "smart split: swap left" }, + { "o", ":lua require('smart-splits').swap_buf_down()", desc = "smart split: swap down" }, + { "e", ":lua require('smart-splits').swap_buf_up()", desc = "smart split: swap up" }, + { "u", ":lua require('smart-splits').swap_buf_right()", desc = "smart split: swap right" }, }, }