nvim/key: add Super keys

super keys are super powered binds accessible via <C-Arrow_Key>, for
example, <C-Left> opens the current file tree.

These binds are expected to be used often and provide 4 fundamental
features:

1. Terminal               | <C-Up>
2. Fuzzy Search           | <C-Right>
3. Workspace diagnostics  | <C-Down>
4. File tree              | <C-Left>

Each is powerful, but can be thought of as a different 'mode' that
should be intentionally invoked by the user.

Fuzzy search has perhaps the most potential of the supers, allowing for
everything from fuzzy file searches to direct integration with the
active LSP, allowing for fuzzy searching of actual symbols; functions,
classes, etc.

A builtin terminal is useful for running background jobs (compiles,
tests), and is generally useful for all the things a shell is when you
don't have a multiplexer of some kind (tmux, good terminal, etc)

A file tree is useful for IDE like movement between files and getting a
general view of the current workspace's git +-~ status. Not mention for
deletion and/or movement of files.

Last but not least, diagnostics are great for understanding the active
codebase's health, and for providing an aggregate overview of
outstanding issues in the code.
This commit is contained in:
Paul Stemmet 2022-10-02 18:07:41 +00:00
parent 15e77291d9
commit 8d00216396
Signed by: Paul Stemmet
GPG Key ID: EDEA539F594E7E75
4 changed files with 26 additions and 2 deletions

View File

@ -30,6 +30,19 @@ M.Global.N {
},
-- ############
-- ## Supers ##
-- ############
--
Super = G {
FileBrowser = B { 'Toggle File Browser' , key = '<C-Left>' , action = '<cmd>Neotree toggle reveal position=left<CR>' , } ,
FuzzySearch = B { 'Activate Telescope fuzzy finder' , key = '<C-Right>' , action = '<cmd>Telescope builtin<CR>' , } ,
Terminal = B { 'Open terminal in a float' , key = '<C-Up>' , action = '<cmd>ToggleTerm<CR>' , } ,
Diagnostics = B { 'Open workspace diagnostics' , key = '<C-Down>' , action = '<cmd>TroubleToggle<CR>' , } ,
},
-- ################
-- ## Navigation ##
-- ################

View File

@ -1,6 +1,8 @@
return function()
local g = vim.g
local neotree, util = require 'neo-tree', require 'psoxizsh.util'
local keys = require 'psoxizsh.key.map'
local Super = keys.Global.N.Super.FileBrowser
local defaults = {
close_if_last_window = true,
@ -67,6 +69,7 @@ return function()
mappings = {
["?"] = "show_help",
["q"] = "close_window",
[Super.key] = "close_window",
["R"] = "refresh",
["<space>"] = { "toggle_node", nowait = false },
["<cr>"] = "open",

View File

@ -1,7 +1,13 @@
return function()
local ts, util = require 'telescope', require 'psoxizsh.util'
local keys = require 'psoxizsh.key.map'
local FuzzySearch = keys.Global.N.Super.FuzzySearch
local defaults = {}
local defaults = {
mappings = { i = {
[FuzzySearch.key] = 'close',
}}
}
ts.setup(util.mconfig('config.telescope', { defaults = defaults }))

View File

@ -1,8 +1,10 @@
return function()
local tt, util = require 'toggleterm', require 'psoxizsh.util'
local keys = require 'psoxizsh.key.map'
local Terminal = keys.Global.N.Super.Terminal
local defaults = {
open_mapping = '<C-Up>',
open_mapping = Terminal.key,
start_in_insert = true,
insert_mappings = false,
terminal_mappings = true,