Skip to content

Commit 831cd28

Browse files
committed
update to latest
1 parent e3a11a0 commit 831cd28

File tree

10 files changed

+235
-43
lines changed

10 files changed

+235
-43
lines changed

init.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,40 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
132132
end ---@diagnostic disable-next-line: undefined-field
133133
vim.opt.rtp:prepend(lazypath)
134134

135+
local floating_win = nil
136+
137+
function FloatingTerm()
138+
if floating_win and vim.api.nvim_win_is_valid(floating_win) then
139+
vim.api.nvim_win_close(floating_win, true)
140+
floating_win = nil
141+
return
142+
end
143+
144+
local buf = vim.api.nvim_create_buf(false, true)
145+
local width = math.floor(vim.o.columns * 0.8)
146+
local height = math.floor(vim.o.lines * 0.8)
147+
local row = math.floor((vim.o.lines - height) / 2)
148+
local col = math.floor((vim.o.columns - width) / 2)
149+
150+
floating_win = vim.api.nvim_open_win(buf, true, {
151+
relative = 'editor',
152+
width = width,
153+
height = height,
154+
row = row,
155+
col = col,
156+
style = 'minimal',
157+
border = 'rounded',
158+
})
159+
160+
vim.fn.termopen(vim.o.shell)
161+
vim.cmd 'startinsert'
162+
163+
-- Map <Esc> to close the floating terminal when inside it
164+
vim.api.nvim_buf_set_keymap(buf, 't', '<Esc>', '<C-\\><C-n>:lua FloatingTerm()<CR>', { noremap = true, silent = true })
165+
end
166+
167+
vim.api.nvim_set_keymap('n', '<leader>t', ':lua FloatingTerm()<CR>', { noremap = true, silent = true })
168+
135169
require('lazy').setup({ { import = 'custom.plugins' } }, {
136170
ui = {
137171
-- If you are using a Nerd Font: set icons to an empty table which will use the

lua/custom/plugins/conform.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ return { -- Autoformat
3131
}
3232
end,
3333
formatters_by_ft = {
34+
java = { 'google-java-format' },
35+
terraform = { 'terraform_fmt' },
36+
xml = { 'xmlformatter', 'prettier' },
3437
lua = { 'stylua' },
35-
-- Conform can also run multiple formatters sequentially
3638
python = { 'isort', 'black' },
37-
--
38-
-- You can use 'stop_after_first' to run the first available formatter from the list
3939
javascript = { 'prettierd', 'prettier', stop_after_first = true },
4040
},
4141
},

lua/custom/plugins/copilot.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
return {
2+
'github/copilot.vim',
3+
config = function()
4+
vim.keymap.set('i', '<M-Tab>', 'copilot#Accept("\\<CR>")', { expr = true, replace_keycodes = false })
5+
vim.g.copilot_no_tab_map = true
6+
end,
7+
}

lua/custom/plugins/glow.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
return {
2+
'ellisonleao/glow.nvim',
3+
config = function()
4+
require('glow').setup()
5+
end,
6+
}

lua/custom/plugins/illuminate.lua

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
return {
2-
'RRethy/vim-illuminate',
3-
event = 'VeryLazy',
4-
config = function()
5-
require('illuminate').configure {
6-
providers = {
7-
'lsp',
8-
'treesitter',
9-
'regex',
10-
},
11-
delay = 100,
12-
filetype_overrides = {},
13-
filetypes_denylist = {
14-
'dirbuf',
15-
'dirvish',
16-
'fugitive',
17-
},
18-
filetypes_allowlist = {},
19-
modes_denylist = {},
20-
modes_allowlist = {},
21-
providers_regex_syntax_denylist = {},
22-
providers_regex_syntax_allowlist = {},
23-
under_cursor = true,
24-
large_file_cutoff = nil,
25-
large_file_overrides = nil,
26-
min_count_to_highlight = 1,
27-
should_enable = function(_)
28-
return true
29-
end,
30-
case_insensitive_regex = false,
31-
}
32-
end,
2+
-- 'RRethy/vim-illuminate',
3+
-- event = 'VeryLazy',
4+
-- config = function()
5+
-- require('illuminate').configure {
6+
-- providers = {
7+
-- 'lsp',
8+
-- 'treesitter',
9+
-- 'regex',
10+
-- },
11+
-- delay = 100,
12+
-- filetype_overrides = {},
13+
-- filetypes_denylist = {
14+
-- 'dirbuf',
15+
-- 'dirvish',
16+
-- 'fugitive',
17+
-- },
18+
-- filetypes_allowlist = {},
19+
-- modes_denylist = {},
20+
-- modes_allowlist = {},
21+
-- providers_regex_syntax_denylist = {},
22+
-- providers_regex_syntax_allowlist = {},
23+
-- under_cursor = true,
24+
-- large_file_cutoff = nil,
25+
-- large_file_overrides = nil,
26+
-- min_count_to_highlight = 1,
27+
-- should_enable = function(_)
28+
-- return true
29+
-- end,
30+
-- case_insensitive_regex = false,
31+
-- }
32+
-- end,
3333
}

lua/custom/plugins/lint.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ return {
44
config = function()
55
local lint = require 'lint'
66
lint.linters_by_ft = {
7-
markdown = { 'markdownlint' },
7+
markdown = { 'vale' },
88
}
99

1010
-- To allow other plugins to add linters to require('lint').linters_by_ft,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
return {
2+
'iamcco/markdown-preview.nvim',
3+
build = 'cd app && npm install',
4+
config = function()
5+
vim.g.mkdp_auto_start = 1
6+
end,
7+
}

lua/custom/plugins/mini.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ return { -- Collection of various small independent plugins/modules
55
require('mini.move').setup()
66
require('mini.notify').setup()
77
require('mini.starter').setup()
8+
require('mini.tabline').setup()
89
require('mini.statusline').setup {
910
use_icons = vim.g.have_nerd_font,
1011
}

lua/custom/plugins/neo-tree.lua

Lines changed: 137 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,151 @@ return {
33
version = '*',
44
dependencies = {
55
'nvim-lua/plenary.nvim',
6-
'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
6+
'nvim-tree/nvim-web-devicons',
77
'MunifTanjim/nui.nvim',
8+
'saifulapm/neotree-file-nesting-config',
89
},
910
cmd = 'Neotree',
11+
opts = {
12+
-- recommended config for better UI
13+
hide_root_node = true,
14+
retain_hidden_root_indent = true,
15+
filesystem = {
16+
filtered_items = {
17+
show_hidden_count = false,
18+
never_show = {
19+
'.DS_Store',
20+
},
21+
},
22+
},
23+
default_component_configs = {
24+
indent = {
25+
with_expanders = true,
26+
expander_collapsed = '',
27+
expander_expanded = '',
28+
},
29+
},
30+
},
1031
keys = {
1132
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
33+
{
34+
'<leader>b',
35+
function()
36+
require('neo-tree.command').execute { toggle = true, source = 'buffers', position = 'left' }
37+
end,
38+
desc = 'Buffers (root dir)',
39+
},
40+
{
41+
'<leader>e',
42+
function()
43+
require('neo-tree.command').execute { toggle = true, source = 'filesystem', position = 'left' }
44+
end,
45+
desc = 'Filesystem (root dir)',
46+
},
47+
{
48+
'<leader>g',
49+
function()
50+
require('neo-tree.command').execute { toggle = true, source = 'git_status', position = 'left' }
51+
end,
52+
desc = 'Filesystem (root dir)',
53+
},
1254
},
13-
opts = {
14-
filesystem = {
55+
config = function(_, opts)
56+
opts.nesting_rules = require('neotree-file-nesting-config').nesting_rules
57+
require('neo-tree').setup(opts)
58+
59+
local inputs = require 'neo-tree.ui.inputs'
60+
-- Trash the target
61+
local function trash(state)
62+
local node = state.tree:get_node()
63+
if node.type == 'message' then
64+
return
65+
end
66+
local _, name = require('neo-tree.utils').split_path(node.path)
67+
local msg = string.format("Are you sure you want to trash '%s'?", name)
68+
inputs.confirm(msg, function(confirmed)
69+
if not confirmed then
70+
return
71+
end
72+
vim.api.nvim_command('silent !trash -F ' .. node.path)
73+
require('neo-tree.sources.manager').refresh(state)
74+
end)
75+
end
76+
77+
-- Trash the selections (visual mode)
78+
local function trash_visual(state, selected_nodes)
79+
local paths_to_trash = {}
80+
for _, node in ipairs(selected_nodes) do
81+
if node.type ~= 'message' then
82+
table.insert(paths_to_trash, node.path)
83+
end
84+
end
85+
local msg = 'Are you sure you want to trash ' .. #paths_to_trash .. ' items?'
86+
inputs.confirm(msg, function(confirmed)
87+
if not confirmed then
88+
return
89+
end
90+
for _, path in ipairs(paths_to_trash) do
91+
vim.api.nvim_command('silent !trash -F ' .. path)
92+
end
93+
require('neo-tree.sources.manager').refresh(state)
94+
end)
95+
end
96+
97+
require('neo-tree').setup {
98+
event_handlers = {
99+
{
100+
event = 'neo_tree_buffer_enter',
101+
handler = function()
102+
vim.cmd 'highlight! Cursor blend=100'
103+
end,
104+
},
105+
{
106+
event = 'neo_tree_buffer_leave',
107+
handler = function()
108+
vim.cmd 'highlight! Cursor guibg=#5f87af blend=0'
109+
end,
110+
},
111+
},
15112
window = {
16113
mappings = {
17-
['\\'] = 'close_window',
18-
['<space>'] = { 'toggle_node', nowait = true },
19-
['P'] = { 'toggle_preview', config = { use_float = false } },
114+
['T'] = 'trash',
115+
['h'] = function(state)
116+
local node = state.tree:get_node()
117+
if node.type == 'directory' and node:is_expanded() then
118+
require('neo-tree.sources.filesystem').toggle_directory(state, node)
119+
else
120+
require('neo-tree.ui.renderer').focus_node(state, node:get_parent_id())
121+
end
122+
end,
123+
['l'] = function(state)
124+
local node = state.tree:get_node()
125+
if node.type == 'directory' then
126+
if not node:is_expanded() then
127+
require('neo-tree.sources.filesystem').toggle_directory(state, node)
128+
elseif node:has_children() then
129+
require('neo-tree.ui.renderer').focus_node(state, node:get_child_ids()[1])
130+
end
131+
else
132+
state.commands['open'](state)
133+
vim.cmd 'Neotree reveal'
134+
end
135+
end,
136+
['<tab>'] = function(state)
137+
local node = state.tree:get_node()
138+
if require('neo-tree.utils').is_expandable(node) then
139+
state.commands['toggle_node'](state)
140+
else
141+
state.commands['open'](state)
142+
vim.cmd 'Neotree reveal'
143+
end
144+
end,
20145
},
21146
},
22-
},
23-
},
147+
commands = {
148+
trash = trash,
149+
trash_visual = trash_visual,
150+
},
151+
}
152+
end,
24153
}

lua/custom/plugins/treesitter.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ return { -- Highlight, edit, and navigate code
2121
'query',
2222
'vim',
2323
'vimdoc',
24+
'java',
25+
'json',
26+
'markdown',
27+
'nginx',
28+
'sql',
29+
'tmux',
30+
'typescript',
31+
'yaml',
2432
},
2533
-- Autoinstall languages that are not installed
2634
auto_install = true,

0 commit comments

Comments
 (0)