feat: update documentation and configuration files for Neovim setup
Signed-off-by: juliano.barbosa <julianomb@gmail.com>
This commit is contained in:
parent
76edf81b0a
commit
7128ca764c
47 changed files with 1956 additions and 1147 deletions
|
|
@ -1,67 +1,89 @@
|
|||
# MIT License
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
dependencies = { "MunifTanjim/nui.nvim" },
|
||||
cmd = "Neotree",
|
||||
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
dependencies = { 'MunifTanjim/nui.nvim' },
|
||||
cmd = 'Neotree',
|
||||
init = function()
|
||||
vim.g.neo_tree_remove_legacy_commands = true
|
||||
end,
|
||||
opts = function()
|
||||
return {
|
||||
auto_clean_after_session_restore = true,
|
||||
close_if_last_window = true,
|
||||
sources = { "filesystem", "buffers", "git_status" },
|
||||
sources = { 'filesystem', 'buffers', 'git_status' },
|
||||
source_selector = {
|
||||
sources = {
|
||||
{ source = "filesystem", display_name = " Files " },
|
||||
{ source = "git_status", display_name = " Git " },
|
||||
{ source = 'filesystem', display_name = ' Files ' },
|
||||
{ source = 'git_status', display_name = ' Git ' },
|
||||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
icon = {
|
||||
folder_empty = "!",
|
||||
folder_empty_open = "!O",
|
||||
folder_empty = '!',
|
||||
folder_empty_open = '!O',
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
renamed = "",
|
||||
unstaged = "💣",
|
||||
renamed = '',
|
||||
unstaged = '💣',
|
||||
},
|
||||
},
|
||||
},
|
||||
document_symbols = {
|
||||
kinds = {
|
||||
File = { icon = "", hl = "Tag" },
|
||||
Namespace = { icon = "", hl = "Include" },
|
||||
Package = { icon = "", hl = "Label" },
|
||||
Class = { icon = "", hl = "Include" },
|
||||
Property = { icon = "", hl = "@property" },
|
||||
Enum = { icon = "", hl = "@number" },
|
||||
Function = { icon = "", hl = "Function" },
|
||||
String = { icon = "", hl = "String" },
|
||||
Number = { icon = "", hl = "Number" },
|
||||
Array = { icon = "", hl = "Type" },
|
||||
Object = { icon = "", hl = "Type" },
|
||||
Key = { icon = "", hl = "" },
|
||||
Struct = { icon = "", hl = "Type" },
|
||||
Operator = { icon = "", hl = "Operator" },
|
||||
TypeParameter = { icon = "", hl = "Type" },
|
||||
File = { icon = '', hl = 'Tag' },
|
||||
Namespace = { icon = '', hl = 'Include' },
|
||||
Package = { icon = '', hl = 'Label' },
|
||||
Class = { icon = '', hl = 'Include' },
|
||||
Property = { icon = '', hl = '@property' },
|
||||
Enum = { icon = '', hl = '@number' },
|
||||
Function = { icon = '', hl = 'Function' },
|
||||
String = { icon = '', hl = 'String' },
|
||||
Number = { icon = '', hl = 'Number' },
|
||||
Array = { icon = '', hl = 'Type' },
|
||||
Object = { icon = '', hl = 'Type' },
|
||||
Key = { icon = '', hl = '' },
|
||||
Struct = { icon = '', hl = 'Type' },
|
||||
Operator = { icon = '', hl = 'Operator' },
|
||||
TypeParameter = { icon = '', hl = 'Type' },
|
||||
StaticMethod = { icon = ' ', hl = 'Function' },
|
||||
},
|
||||
},
|
||||
commands = {
|
||||
parent_or_close = function(state)
|
||||
local node = state.tree:get_node()
|
||||
if (node.type == "directory" or node:has_children()) and node:is_expanded() then
|
||||
if (node.type == 'directory' or node:has_children()) and node:is_expanded() then
|
||||
state.commands.toggle_node(state)
|
||||
else
|
||||
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
|
||||
require('neo-tree.ui.renderer').focus_node(state, node:get_parent_id())
|
||||
end
|
||||
end,
|
||||
child_or_open = function(state)
|
||||
local node = state.tree:get_node()
|
||||
if node.type == "directory" or node:has_children() then
|
||||
if node.type == 'directory' or node:has_children() then
|
||||
if not node:is_expanded() then -- if unexpanded, expand
|
||||
state.commands.toggle_node(state)
|
||||
else -- if expanded and has children, seleect the next child
|
||||
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
|
||||
else -- if expanded and has children, seleect the next child
|
||||
require('neo-tree.ui.renderer').focus_node(state, node:get_child_ids()[1])
|
||||
end
|
||||
else -- if not a directory just open it
|
||||
state.commands.open(state)
|
||||
|
|
@ -74,62 +96,64 @@ return {
|
|||
local modify = vim.fn.fnamemodify
|
||||
|
||||
local results = {
|
||||
e = { val = modify(filename, ":e"), msg = "Extension only" },
|
||||
f = { val = filename, msg = "Filename" },
|
||||
F = { val = modify(filename, ":r"), msg = "Filename w/o extension" },
|
||||
h = { val = modify(filepath, ":~"), msg = "Path relative to Home" },
|
||||
p = { val = modify(filepath, ":."), msg = "Path relative to CWD" },
|
||||
P = { val = filepath, msg = "Absolute path" },
|
||||
e = { val = modify(filename, ':e'), msg = 'Extension only' },
|
||||
f = { val = filename, msg = 'Filename' },
|
||||
F = { val = modify(filename, ':r'), msg = 'Filename w/o extension' },
|
||||
h = { val = modify(filepath, ':~'), msg = 'Path relative to Home' },
|
||||
p = { val = modify(filepath, ':.'), msg = 'Path relative to CWD' },
|
||||
P = { val = filepath, msg = 'Absolute path' },
|
||||
}
|
||||
|
||||
local messages = {
|
||||
{ "\nChoose to copy to clipboard:\n", "Normal" },
|
||||
{ '\nChoose to copy to clipboard:\n', 'Normal' },
|
||||
}
|
||||
for i, result in pairs(results) do
|
||||
if result.val and result.val ~= "" then
|
||||
if result.val and result.val ~= '' then
|
||||
vim.list_extend(messages, {
|
||||
{ ("%s."):format(i), "Identifier" },
|
||||
{ (" %s: "):format(result.msg) },
|
||||
{ result.val, "String" },
|
||||
{ "\n" },
|
||||
{ ('%s.'):format(i), 'Identifier' },
|
||||
{ (' %s: '):format(result.msg) },
|
||||
{ result.val, 'String' },
|
||||
{ '\n' },
|
||||
})
|
||||
end
|
||||
end
|
||||
vim.api.nvim_echo(messages, false, {})
|
||||
local result = results[vim.fn.getcharstr()]
|
||||
if result and result.val and result.val ~= "" then
|
||||
vim.fn.setreg("+", result.val)
|
||||
if result and result.val and result.val ~= '' then
|
||||
vim.fn.setreg('+', result.val)
|
||||
end
|
||||
end,
|
||||
find_in_dir = function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
require("telescope.builtin").find_files {
|
||||
cwd = node.type == "directory" and path or vim.fn.fnamemodify(path, ":h"),
|
||||
}
|
||||
require('telescope.builtin').find_files({
|
||||
cwd = node.type == 'directory' and path or vim.fn.fnamemodify(path, ':h'),
|
||||
})
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["<space>"] = false, -- disable space until we figure out which-key disabling
|
||||
["[b"] = "prev_source",
|
||||
["]b"] = "next_source",
|
||||
Y = "copy_selector",
|
||||
h = "parent_or_close",
|
||||
l = "child_or_open",
|
||||
o = "open",
|
||||
['<space>'] = false, -- disable space until we figure out which-key disabling
|
||||
['[b'] = 'prev_source',
|
||||
[']b'] = 'next_source',
|
||||
Y = 'copy_selector',
|
||||
h = 'parent_or_close',
|
||||
l = 'child_or_open',
|
||||
o = 'open',
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = true,
|
||||
hijack_netrw_behavior = "open_current",
|
||||
hijack_netrw_behavior = 'open_current',
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
event_handlers = {
|
||||
{
|
||||
event = "neo_tree_buffer_enter",
|
||||
handler = function(_) vim.opt_local.signcolumn = "auto" end,
|
||||
event = 'neo_tree_buffer_enter',
|
||||
handler = function(_)
|
||||
vim.opt_local.signcolumn = 'auto'
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue