From e27cc4e13812f96c0851de67015030a823cc0fbd Mon Sep 17 00:00:00 2001 From: Reinder van Bochove <42994209+iamreinder@users.noreply.github.com> Date: Tue, 20 Feb 2024 05:00:49 +0100 Subject: [PATCH] feat: add border config for SSH and keymaps help window (#299) * feat: add config for ssh window border * chore: add documentation for ssh window border * feat: add config for keymaps help window border * chore: add documentatoin for keymaps help window border --- README.md | 8 ++++++++ doc/oil.txt | 8 ++++++++ lua/oil/adapters/ssh/connection.lua | 3 ++- lua/oil/config.lua | 8 ++++++++ lua/oil/keymap_util.lua | 3 ++- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c023fd..52c643d 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,10 @@ require("oil").setup({ ["g."] = "actions.toggle_hidden", ["g\\"] = "actions.toggle_trash", }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "rounded", + }, -- Set to false to disable all of the above keymaps use_default_keymaps = true, view_options = { @@ -268,6 +272,10 @@ require("oil").setup({ winblend = 0, }, }, + -- Configuration for the floating SSH window + ssh = { + border = "rounded", + }, }) ``` diff --git a/doc/oil.txt b/doc/oil.txt index 7b04940..114298d 100644 --- a/doc/oil.txt +++ b/doc/oil.txt @@ -84,6 +84,10 @@ CONFIG *oil-confi ["g."] = "actions.toggle_hidden", ["g\\"] = "actions.toggle_trash", }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "rounded", + }, -- Set to false to disable all of the above keymaps use_default_keymaps = true, view_options = { @@ -159,6 +163,10 @@ CONFIG *oil-confi winblend = 0, }, }, + -- Configuration for the floating SSH window + ssh = { + border = "rounded", + }, }) < diff --git a/lua/oil/adapters/ssh/connection.lua b/lua/oil/adapters/ssh/connection.lua index 67754ac..a6bca02 100644 --- a/lua/oil/adapters/ssh/connection.lua +++ b/lua/oil/adapters/ssh/connection.lua @@ -1,3 +1,4 @@ +local config = require("oil.config") local layout = require("oil.layout") local util = require("oil.util") @@ -277,7 +278,7 @@ function SSHConnection:open_terminal() row = row, col = col, style = "minimal", - border = "rounded", + border = config.ssh.border, }) vim.cmd.startinsert() end diff --git a/lua/oil/config.lua b/lua/oil/config.lua index e8fc62b..3413f59 100644 --- a/lua/oil/config.lua +++ b/lua/oil/config.lua @@ -67,6 +67,10 @@ local default_config = { ["g."] = "actions.toggle_hidden", ["g\\"] = "actions.toggle_trash", }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "rounded", + }, -- Set to false to disable all of the above keymaps use_default_keymaps = true, view_options = { @@ -142,6 +146,10 @@ local default_config = { winblend = 0, }, }, + -- Configuration for the floating SSH window + ssh = { + border = "rounded", + }, } -- The adapter API hasn't really stabilized yet. We're not ready to advertise or encourage people to diff --git a/lua/oil/keymap_util.lua b/lua/oil/keymap_util.lua index 5f8f321..095d971 100644 --- a/lua/oil/keymap_util.lua +++ b/lua/oil/keymap_util.lua @@ -1,4 +1,5 @@ local actions = require("oil.actions") +local config = require("oil.config") local layout = require("oil.layout") local util = require("oil.util") local M = {} @@ -111,7 +112,7 @@ M.show_help = function(keymaps) height = math.min(editor_height, #lines), zindex = 150, style = "minimal", - border = "rounded", + border = config.keymaps_help.border, }) local function close() if vim.api.nvim_win_is_valid(winid) then