update to latest
This commit is contained in:
parent
e3a11a0ba5
commit
831cd284aa
34
init.lua
34
init.lua
|
@ -132,6 +132,40 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
end ---@diagnostic disable-next-line: undefined-field
|
end ---@diagnostic disable-next-line: undefined-field
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
local floating_win = nil
|
||||||
|
|
||||||
|
function FloatingTerm()
|
||||||
|
if floating_win and vim.api.nvim_win_is_valid(floating_win) then
|
||||||
|
vim.api.nvim_win_close(floating_win, true)
|
||||||
|
floating_win = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local buf = vim.api.nvim_create_buf(false, true)
|
||||||
|
local width = math.floor(vim.o.columns * 0.8)
|
||||||
|
local height = math.floor(vim.o.lines * 0.8)
|
||||||
|
local row = math.floor((vim.o.lines - height) / 2)
|
||||||
|
local col = math.floor((vim.o.columns - width) / 2)
|
||||||
|
|
||||||
|
floating_win = vim.api.nvim_open_win(buf, true, {
|
||||||
|
relative = 'editor',
|
||||||
|
width = width,
|
||||||
|
height = height,
|
||||||
|
row = row,
|
||||||
|
col = col,
|
||||||
|
style = 'minimal',
|
||||||
|
border = 'rounded',
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.fn.termopen(vim.o.shell)
|
||||||
|
vim.cmd 'startinsert'
|
||||||
|
|
||||||
|
-- Map <Esc> to close the floating terminal when inside it
|
||||||
|
vim.api.nvim_buf_set_keymap(buf, 't', '<Esc>', '<C-\\><C-n>:lua FloatingTerm()<CR>', { noremap = true, silent = true })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>t', ':lua FloatingTerm()<CR>', { noremap = true, silent = true })
|
||||||
|
|
||||||
require('lazy').setup({ { import = 'custom.plugins' } }, {
|
require('lazy').setup({ { import = 'custom.plugins' } }, {
|
||||||
ui = {
|
ui = {
|
||||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||||
|
|
|
@ -31,11 +31,11 @@ return { -- Autoformat
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
|
java = { 'google-java-format' },
|
||||||
|
terraform = { 'terraform_fmt' },
|
||||||
|
xml = { 'xmlformatter', 'prettier' },
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
|
||||||
python = { 'isort', 'black' },
|
python = { 'isort', 'black' },
|
||||||
--
|
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
|
||||||
javascript = { 'prettierd', 'prettier', stop_after_first = true },
|
javascript = { 'prettierd', 'prettier', stop_after_first = true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
'github/copilot.vim',
|
||||||
|
config = function()
|
||||||
|
vim.keymap.set('i', '<M-Tab>', 'copilot#Accept("\\<CR>")', { expr = true, replace_keycodes = false })
|
||||||
|
vim.g.copilot_no_tab_map = true
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
'ellisonleao/glow.nvim',
|
||||||
|
config = function()
|
||||||
|
require('glow').setup()
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,33 +1,33 @@
|
||||||
return {
|
return {
|
||||||
'RRethy/vim-illuminate',
|
-- 'RRethy/vim-illuminate',
|
||||||
event = 'VeryLazy',
|
-- event = 'VeryLazy',
|
||||||
config = function()
|
-- config = function()
|
||||||
require('illuminate').configure {
|
-- require('illuminate').configure {
|
||||||
providers = {
|
-- providers = {
|
||||||
'lsp',
|
-- 'lsp',
|
||||||
'treesitter',
|
-- 'treesitter',
|
||||||
'regex',
|
-- 'regex',
|
||||||
},
|
-- },
|
||||||
delay = 100,
|
-- delay = 100,
|
||||||
filetype_overrides = {},
|
-- filetype_overrides = {},
|
||||||
filetypes_denylist = {
|
-- filetypes_denylist = {
|
||||||
'dirbuf',
|
-- 'dirbuf',
|
||||||
'dirvish',
|
-- 'dirvish',
|
||||||
'fugitive',
|
-- 'fugitive',
|
||||||
},
|
-- },
|
||||||
filetypes_allowlist = {},
|
-- filetypes_allowlist = {},
|
||||||
modes_denylist = {},
|
-- modes_denylist = {},
|
||||||
modes_allowlist = {},
|
-- modes_allowlist = {},
|
||||||
providers_regex_syntax_denylist = {},
|
-- providers_regex_syntax_denylist = {},
|
||||||
providers_regex_syntax_allowlist = {},
|
-- providers_regex_syntax_allowlist = {},
|
||||||
under_cursor = true,
|
-- under_cursor = true,
|
||||||
large_file_cutoff = nil,
|
-- large_file_cutoff = nil,
|
||||||
large_file_overrides = nil,
|
-- large_file_overrides = nil,
|
||||||
min_count_to_highlight = 1,
|
-- min_count_to_highlight = 1,
|
||||||
should_enable = function(_)
|
-- should_enable = function(_)
|
||||||
return true
|
-- return true
|
||||||
end,
|
-- end,
|
||||||
case_insensitive_regex = false,
|
-- case_insensitive_regex = false,
|
||||||
}
|
-- }
|
||||||
end,
|
-- end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ return {
|
||||||
config = function()
|
config = function()
|
||||||
local lint = require 'lint'
|
local lint = require 'lint'
|
||||||
lint.linters_by_ft = {
|
lint.linters_by_ft = {
|
||||||
markdown = { 'markdownlint' },
|
markdown = { 'vale' },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
'iamcco/markdown-preview.nvim',
|
||||||
|
build = 'cd app && npm install',
|
||||||
|
config = function()
|
||||||
|
vim.g.mkdp_auto_start = 1
|
||||||
|
end,
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ return { -- Collection of various small independent plugins/modules
|
||||||
require('mini.move').setup()
|
require('mini.move').setup()
|
||||||
require('mini.notify').setup()
|
require('mini.notify').setup()
|
||||||
require('mini.starter').setup()
|
require('mini.starter').setup()
|
||||||
|
require('mini.tabline').setup()
|
||||||
require('mini.statusline').setup {
|
require('mini.statusline').setup {
|
||||||
use_icons = vim.g.have_nerd_font,
|
use_icons = vim.g.have_nerd_font,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,22 +3,151 @@ return {
|
||||||
version = '*',
|
version = '*',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
|
'nvim-tree/nvim-web-devicons',
|
||||||
'MunifTanjim/nui.nvim',
|
'MunifTanjim/nui.nvim',
|
||||||
|
'saifulapm/neotree-file-nesting-config',
|
||||||
},
|
},
|
||||||
cmd = 'Neotree',
|
cmd = 'Neotree',
|
||||||
|
opts = {
|
||||||
|
-- recommended config for better UI
|
||||||
|
hide_root_node = true,
|
||||||
|
retain_hidden_root_indent = true,
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
show_hidden_count = false,
|
||||||
|
never_show = {
|
||||||
|
'.DS_Store',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default_component_configs = {
|
||||||
|
indent = {
|
||||||
|
with_expanders = true,
|
||||||
|
expander_collapsed = '',
|
||||||
|
expander_expanded = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||||
|
{
|
||||||
|
'<leader>b',
|
||||||
|
function()
|
||||||
|
require('neo-tree.command').execute { toggle = true, source = 'buffers', position = 'left' }
|
||||||
|
end,
|
||||||
|
desc = 'Buffers (root dir)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>e',
|
||||||
|
function()
|
||||||
|
require('neo-tree.command').execute { toggle = true, source = 'filesystem', position = 'left' }
|
||||||
|
end,
|
||||||
|
desc = 'Filesystem (root dir)',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>g',
|
||||||
|
function()
|
||||||
|
require('neo-tree.command').execute { toggle = true, source = 'git_status', position = 'left' }
|
||||||
|
end,
|
||||||
|
desc = 'Filesystem (root dir)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
opts.nesting_rules = require('neotree-file-nesting-config').nesting_rules
|
||||||
|
require('neo-tree').setup(opts)
|
||||||
|
|
||||||
|
local inputs = require 'neo-tree.ui.inputs'
|
||||||
|
-- Trash the target
|
||||||
|
local function trash(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if node.type == 'message' then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local _, name = require('neo-tree.utils').split_path(node.path)
|
||||||
|
local msg = string.format("Are you sure you want to trash '%s'?", name)
|
||||||
|
inputs.confirm(msg, function(confirmed)
|
||||||
|
if not confirmed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
vim.api.nvim_command('silent !trash -F ' .. node.path)
|
||||||
|
require('neo-tree.sources.manager').refresh(state)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Trash the selections (visual mode)
|
||||||
|
local function trash_visual(state, selected_nodes)
|
||||||
|
local paths_to_trash = {}
|
||||||
|
for _, node in ipairs(selected_nodes) do
|
||||||
|
if node.type ~= 'message' then
|
||||||
|
table.insert(paths_to_trash, node.path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local msg = 'Are you sure you want to trash ' .. #paths_to_trash .. ' items?'
|
||||||
|
inputs.confirm(msg, function(confirmed)
|
||||||
|
if not confirmed then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, path in ipairs(paths_to_trash) do
|
||||||
|
vim.api.nvim_command('silent !trash -F ' .. path)
|
||||||
|
end
|
||||||
|
require('neo-tree.sources.manager').refresh(state)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
require('neo-tree').setup {
|
||||||
|
event_handlers = {
|
||||||
|
{
|
||||||
|
event = 'neo_tree_buffer_enter',
|
||||||
|
handler = function()
|
||||||
|
vim.cmd 'highlight! Cursor blend=100'
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = 'neo_tree_buffer_leave',
|
||||||
|
handler = function()
|
||||||
|
vim.cmd 'highlight! Cursor guibg=#5f87af blend=0'
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
opts = {
|
|
||||||
filesystem = {
|
|
||||||
window = {
|
window = {
|
||||||
mappings = {
|
mappings = {
|
||||||
['\\'] = 'close_window',
|
['T'] = 'trash',
|
||||||
['<space>'] = { 'toggle_node', nowait = true },
|
['h'] = function(state)
|
||||||
['P'] = { 'toggle_preview', config = { use_float = false } },
|
local node = state.tree:get_node()
|
||||||
},
|
if node.type == 'directory' and node:is_expanded() then
|
||||||
|
require('neo-tree.sources.filesystem').toggle_directory(state, node)
|
||||||
|
else
|
||||||
|
require('neo-tree.ui.renderer').focus_node(state, node:get_parent_id())
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
['l'] = function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if node.type == 'directory' then
|
||||||
|
if not node:is_expanded() then
|
||||||
|
require('neo-tree.sources.filesystem').toggle_directory(state, node)
|
||||||
|
elseif node:has_children() then
|
||||||
|
require('neo-tree.ui.renderer').focus_node(state, node:get_child_ids()[1])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
state.commands['open'](state)
|
||||||
|
vim.cmd 'Neotree reveal'
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
['<tab>'] = function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if require('neo-tree.utils').is_expandable(node) then
|
||||||
|
state.commands['toggle_node'](state)
|
||||||
|
else
|
||||||
|
state.commands['open'](state)
|
||||||
|
vim.cmd 'Neotree reveal'
|
||||||
|
end
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
commands = {
|
||||||
|
trash = trash,
|
||||||
|
trash_visual = trash_visual,
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,14 @@ return { -- Highlight, edit, and navigate code
|
||||||
'query',
|
'query',
|
||||||
'vim',
|
'vim',
|
||||||
'vimdoc',
|
'vimdoc',
|
||||||
|
'java',
|
||||||
|
'json',
|
||||||
|
'markdown',
|
||||||
|
'nginx',
|
||||||
|
'sql',
|
||||||
|
'tmux',
|
||||||
|
'typescript',
|
||||||
|
'yaml',
|
||||||
},
|
},
|
||||||
-- Autoinstall languages that are not installed
|
-- Autoinstall languages that are not installed
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
|
|
Loading…
Reference in New Issue