nvim: add psoxizsh.plugins.editor

This commit is contained in:
Paul Stemmet 2024-08-08 12:02:21 +00:00
parent 388b6daa3a
commit 0a15980464
Signed by: Paul Stemmet
GPG Key ID: EDEA539F594E7E75
8 changed files with 140 additions and 224 deletions

View File

@ -1,157 +0,0 @@
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,
enable_git_status = true,
default_component_configs = {
container = {
enable_character_fade = true
},
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "",
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon"
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
-- Change type
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
modified = "~", -- or "", but this is redundant info if you use git_status_colors on the name
deleted = "",-- this can only be used in the git_status source
renamed = "",-- this can only be used in the git_status source
-- Status type
untracked = "",
ignored = "",
unstaged = "",
staged = "",
conflict = "",
},
},
},
window = {
position = "left",
width = 40,
mapping_options = {
noremap = true,
nowait = true,
},
mappings = {
["?"] = "show_help",
["q"] = "close_window",
[Super.key] = "close_window",
["R"] = "refresh",
["<space>"] = { "toggle_node", nowait = false },
["<cr>"] = "open",
["S"] = "open_split",
["s"] = "open_vsplit",
["C"] = "close_node",
["z"] = "close_all_nodes",
["Z"] = "expand_all_nodes",
["X"] = "delete",
["r"] = "rename",
["a"] = { "add", config = { show_path = "relative" } },
["A"] = { "add_directory", config = { show_path = "relative" } },
["c"] = { "copy", config = { show_path = "relative" } },
["m"] = { "move", config = { show_path = "relative" } },
["y"] = "copy_to_clipboard",
["p"] = "paste_from_clipboard",
},
},
filesystem = {
filtered_items = {
visible = false, -- when true, they will just be displayed differently than normal items
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = { --[[ Example: 'node_modules' ]] },
hide_by_pattern = { --[[ Example '*.meta' ]] },
never_show = { --[[ remains hidden even if visible is toggled to true ]] },
},
follow_current_file = true, -- This will find and focus the file in the active buffer every
-- time the current file is changed while the tree is open.
group_empty_dirs = false, -- when true, empty folders will be grouped together
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
-- in whatever position is specified in window.position
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
window = {
mappings = {
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "clear_filter",
["[g"] = "prev_git_modified",
["]g"] = "next_git_modified",
},
},
},
buffers = {
follow_current_file = true, -- This will find and focus the file in the active buffer every
-- time the current file is changed while the tree is open.
group_empty_dirs = true, -- when true, empty folders will be grouped together
show_unloaded = true,
window = {
mappings = {
["X"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
},
},
},
git_status = {
window = {
position = "float",
mappings = {
["A"] = "git_add_all",
["gu"] = "git_unstage_file",
["ga"] = "git_add_file",
["gr"] = "git_revert_file",
["gc"] = "git_commit",
["gp"] = "git_push",
["gg"] = "git_commit_and_push",
},
},
},
}
g['neo_tree_remove_legacy_commands'] = 1
neotree.setup(util.mconfig('config.neotree', defaults))
end

View File

@ -1,9 +0,0 @@
return function()
local g = vim.g
-- Balance pairs when on open, close and delete
g.pear_tree_smart_openers = 1
g.pear_tree_smart_closers = 1
g.pear_tree_smart_backspace = 1
g.pear_tree_ft_disabled = { 'TelescopePrompt' }
end

View File

@ -1,17 +0,0 @@
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 = {
mappings = { i = {
[FuzzySearch.key] = 'close',
}}
}
ts.setup(util.mconfig('config.telescope', { defaults = defaults }))
-- Requires telescope-fzf-native.nvim
-- Speeds up search times by 5-10x
ts.load_extension('fzf')
end

View File

@ -1,17 +0,0 @@
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 = Terminal.key,
start_in_insert = true,
insert_mappings = false,
terminal_mappings = true,
direction = 'float',
float_opts = { border = 'curved' },
}
tt.setup(util.mconfig('config.toggleterm', defaults))
end

View File

@ -1,7 +0,0 @@
return function()
local trouble, util = require 'trouble', require 'psoxizsh.util'
local defaults = {}
trouble.setup(util.mconfig('config.trouble', defaults))
end

View File

@ -1,11 +0,0 @@
return function()
local g = vim.g
-- Don't force qf/loc windows to bottom
g.qf_window_bottom = 0
g.qf_loclist_window_bottom = 0
-- Let Neomake control window size
g.qf_auto_resize = 0
end

View File

@ -1,6 +0,0 @@
return function()
local g = vim.g
g['tmux_navigator_no_mappings'] = 1
g['tmux_navigator_disable_when_zoomed'] = 1
end

View File

@ -0,0 +1,140 @@
return {
-- Disables search highlights when not searching
{ 'romainl/vim-cool', version = false, lazy = false },
-- Extends the '%' operator
{ 'andymass/vim-matchup', version = false, lazy = false },
-- Allows for per-window searches
{ 'mox-mox/vim-localsearch', version = false, lazy = false },
-- Comment helpers
{ 'scrooloose/nerdcommenter', version = false, lazy = false },
-- Text alignment
{ 'junegunn/vim-easy-align', version = false, lazy = false },
-- Pair () {} [], etc matching
{ 'tmsvg/pear-tree',
version = false,
lazy = false,
init = function(_)
-- Balance pairs when on open, close and delete
vim.g['pear_tree_smart_openers'] = 1
vim.g['pear_tree_smart_closers'] = 1
vim.g['pear_tree_smart_backspace'] = 1
-- Ignore Telescope windows
vim.g['pear_tree_ft_disabled'] = { 'TelescopePrompt' }
end,
},
{ 'echasnovski/mini.pairs', enabled = false }, -- We use pear-tree, disable LazyVim default
-- File browser
{ 'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
dependencies = {
'nvim-lua/plenary.nvim',
'kyazdani42/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
opts = {
close_if_last_window = true,
enable_git_status = true,
filesystem = {
follow_current_file = { enabled = true },
}
},
keys = {
{ '<C-Left>' , '<cmd>Neotree toggle reveal position=left<CR>' , desc = 'Open FileExplorer' },
{ '<leader><Tab>' , '<cmd>Neotree toggle reveal float source=buffers<CR>' , desc = 'Open Buffers' },
{ '<leader>gs' , '<cmd>Neotree float git_status<CR>' , desc = 'GitStatus Float' },
},
},
-- Fuzzy search helpers
{ 'nvim-telescope/telescope.nvim',
branch = '0.1.x',
opts = {
mappings = { i = {
['<C-Right>'] = 'close',
}}
},
keys = {
{ '<C-Right>' , '<cmd>Telescope builtin<CR>' , desc = 'Open FuzzyFinder' },
{ '<leader>,' , false },
}
},
-- Maker / diagnostics listing
{ 'folke/trouble.nvim',
dependencies = { 'kyazdani42/nvim-web-devicons' },
keys = {
{ '<C-Down>' , '<cmd>Trouble diagnostics toggle<CR>' , desc = 'Open Diagnostics' },
},
},
-- Terminal
{ 'akinsho/toggleterm.nvim',
version = '^2.0',
opts = {
open_mapping = '<C-Up>',
start_in_insert = true,
insert_mappings = false,
terminal_mappings = true,
direction = 'float',
float_opts = { border = 'curved' },
},
},
-- Tmux integration for pane movement
{ 'christoomey/vim-tmux-navigator',
cmd = { 'TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp', 'TmuxNavigateRight', 'TmuxNavigatePrevious' },
init = function(_)
vim.g['tmux_navigator_no_mappings'] = 1
vim.g['tmux_navigator_disable_when_zoomed'] = 1
end,
keys = {
{ '<C-k>' , '<cmd>TmuxNavigateUp<CR>' , desc = 'Navigate up one window' },
{ '<C-h>' , '<cmd>TmuxNavigateLeft<CR>' , desc = 'Navigate left one window' },
{ '<C-l>' , '<cmd>TmuxNavigateRight<CR>' , desc = 'Navigate right one window' },
{ '<C-j>' , '<cmd>TmuxNavigateDown<CR>' , desc = 'Navigate down one window' },
},
},
-- Buffer management
{ 'qpkorr/vim-bufkill',
version = false,
lazy = false,
init = function(_)
-- We create these ourselves, with descriptions for which-key.nvim
vim.g['BufKillCreateMappings'] = 0
-- If the buffer you want to kill is in many windows,
-- the following option governs what to do.
--
-- default: 'confirm'
-- options: 'confirm' / 'kill' / 'cancel'
vim.g['BufKillActionWhenBufferDisplayedInAnotherWindow'] = 'confirm'
end,
keys = {
{ '<leader>bun' , '<Plug>BufKillBun' , desc = 'Unload Buffer' },
{ '<leader>!bun' , '<Plug>BufKillBangBun' , desc = 'Unload Buffer, force' },
{ '<leader>bd' , '<Plug>BufKillBd' , desc = 'Kill Buffer' },
{ '<leader>!bd' , '<Plug>BufKillBangBd' , desc = 'Kill Buffer, force' },
{ '<leader>bw' , '<Plug>BufKillBw' , desc = 'Wipeout Buffer' },
{ '<leader>!bw' , '<Plug>BufKillBangBw' , desc = 'Wipeout Buffer, force' },
{ '<leader>bundo' , '<Plug>BufKillUndo' , desc = 'Undo last Buffer action' },
},
},
-- Git integration
{ 'tpope/vim-fugitive', version = false, lazy = false },
-- Per project configuration
{ import = 'lazyvim.plugins.extras.lsp.neoconf' },
{ 'folke/neoconf.nvim',
version = '^1.0',
},
}