new steps

This commit is contained in:
2026-02-13 02:05:33 +02:00
parent 6b4008ca38
commit 6cc023ec35
11 changed files with 167 additions and 609 deletions

View File

@@ -5,6 +5,30 @@ local api = vim.api
local au = api.nvim_create_autocmd
local group = api.nvim_create_augroup('core.events', { clear = true })
vim.api.nvim_create_user_command('W', function()
vim.cmd('w')
end, { desc = 'Write current buffer' })
function _G.see(val)
local lines = vim.split(vim.inspect(val), '\n')
vim.cmd('new')
vim.api.nvim_buf_set_lines(0, 0, -1, false, lines)
vim.bo.buftype = 'nofile'
vim.bo.bufhidden = 'wipe'
end
vim.api.nvim_create_user_command('MessagesToBuffer', function()
local output = vim.api.nvim_exec2('silent messages', { output = true }).output or ''
local lines = vim.split(output, '\n', { plain = true, trimempty = false })
vim.cmd('new')
local bufnr = vim.api.nvim_get_current_buf()
vim.bo[bufnr].buftype = 'nofile'
vim.bo[bufnr].bufhidden = 'wipe'
vim.bo[bufnr].swapfile = false
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
end, { desc = 'Open :messages output in a scratch buffer' })
-- Automatically create a scratch buffer if Neovim starts with no files
au('VimEnter', {
group = group,

14
lua/core/filetypes.lua Normal file
View File

@@ -0,0 +1,14 @@
vim.filetype.add({
pattern = {
['.*/templates/.*%.ya?ml'] = 'helm',
['.*/manifests/.*%.ya?ml'] = 'helm',
['.*/crds/.*%.ya?ml'] = 'helm',
['.*/kubernetes/.*%.ya?ml'] = 'helm',
['.*/k8s/.*%.ya?ml'] = 'helm',
['.*/charts/.*%.ya?ml'] = 'helm',
},
extension = {
gotmpl = 'helm',
tftpl = 'yaml',
},
})

View File

@@ -46,6 +46,20 @@ local function my_on_attach(bufnr)
vim.keymap.set('n', 'U', api.tree.reload, opts)
end
local ignored_watcher_dirs = {
['.git'] = true,
['.DS_Store'] = true,
build = true,
dist = true,
public = true,
node_modules = true,
target = true,
}
local function ignore_watcher_dir(path)
return ignored_watcher_dirs[vim.fs.basename(path)] or false
end
require('nvim-tree').setup({
on_attach = my_on_attach,
view = { signcolumn = 'no' },
@@ -55,6 +69,7 @@ require('nvim-tree').setup({
special_files = {},
highlight_hidden = 'all',
highlight_modified = 'name',
highlight_clipboard = 'all',
indent_markers = {
@@ -70,7 +85,7 @@ require('nvim-tree').setup({
folder = false,
folder_arrow = false,
git = true,
modified = false,
modified = true,
hidden = false,
diagnostics = false,
bookmarks = true,
@@ -91,6 +106,7 @@ require('nvim-tree').setup({
hijack_cursor = true,
prefer_startup_root = true,
reload_on_bufenter = true,
update_focused_file = {
enable = true,
update_root = { enable = true, ignore_list = {} },
@@ -110,14 +126,6 @@ require('nvim-tree').setup({
filesystem_watchers = {
enable = true,
debounce_delay = 50,
ignore_dirs = {
'/.git',
'/.DS_Store',
'/build',
'/dist',
'/public',
'/node_modules',
'/target',
},
ignore_dirs = ignore_watcher_dir,
},
})

View File

@@ -1,9 +1,10 @@
local function clone_package_manager()
local lock_path = vim.fs.joinpath(vim.fn.stdpath('config'), 'paq-lock.json')
local function clone_paq()
local path = vim.fn.stdpath('data') .. '/site/pack/paqs/opt/paq-nvim'
if not vim.uv.fs_stat(path) then
local repo = 'https://github.com/savq/paq-nvim.git'
local cmd = { 'git', 'clone', '--depth=1', repo, path }
local result = vim.system(cmd):wait()
local result = vim.system({ 'git', 'clone', '--depth=1', repo, path }):wait()
if result.code == 0 then
print('Package manager installed correctly')
end
@@ -14,11 +15,13 @@ local function load_paq()
vim.cmd.packadd('paq-nvim')
local paq = require('paq')
local packages = require('setup.packages').get()
paq:setup({ lock = vim.fn.stdpath('config') .. '/paq-lock.json' })(packages)
paq:setup({ lock = lock_path })(packages)
return paq
end
local function install_packages()
clone_paq()
local done = false
vim.api.nvim_create_autocmd('User', {
pattern = 'PaqDoneInstall',
@@ -31,11 +34,6 @@ local function install_packages()
local paq = load_paq()
paq.install()
local to_install = paq.query('to_install')
if #to_install == 0 then
return
end
vim.wait(60000, function()
return done
end, 200)
@@ -57,30 +55,20 @@ local function install_languages()
lm.install()
end
vim.api.nvim_create_user_command('InstallAll', function()
print('> Starting clone package manager...')
clone_package_manager()
print('\n> Starting installing packages...')
install_packages()
print('\n> Starting installing languages: ts parsers, language servers, linters, formatters...')
install_languages()
print('\n=== Install Finished ===\n\n')
end, {})
vim.api.nvim_create_user_command('Sync', function()
local function sync_packages()
clone_paq()
local paq = load_paq()
paq:sync()
end, {})
end
vim.api.nvim_create_user_command('FetchLspConfigs', function()
-- local base_url = 'https://raw.githubusercontent.com/neovim/nvim-lspconfig/master/lsp/'
local function fetch_lsp_configs()
local base_url = 'https://raw.githubusercontent.com/neovim/nvim-lspconfig/refs/heads/master/lsp/'
local lm = require('plugins.language-manager')
lm.invalidate_cache()
local general = lm.load_specs()
local lsp_dir = vim.fs.joinpath(vim.fn.getcwd(), 'lsp')
local lsp_dir = vim.fs.joinpath(vim.fn.stdpath('config'), 'lsp')
vim.fn.mkdir(lsp_dir, 'p')
for _, name in ipairs(general.language_servers or {}) do
@@ -99,4 +87,31 @@ vim.api.nvim_create_user_command('FetchLspConfigs', function()
vim.notify('Skipped existing ' .. name .. '.lua', vim.log.levels.INFO)
end
end
end, { desc = 'Fetch default LSP configs into ./lsp in cwd' })
end
local function create_command(name, callback, desc)
vim.api.nvim_create_user_command(name, callback, { desc = desc })
end
create_command('Setup', function()
print('> Installing packages...')
install_packages()
print('\n> Installing languages: treesitter parsers, language servers, linters, formatters...')
install_languages()
print('\n=== Setup Finished ===\n')
end, 'Install packages and language tooling (first-time setup)')
create_command('InstallPackages', function()
print('> Installing packages...')
install_packages()
print('\n=== Package Install Finished ===\n')
end, 'Install packages via Paq')
create_command('InstallLanguages', function()
print('> Installing languages: treesitter parsers, language servers, linters, formatters...')
install_languages()
print('\n=== Language Install Finished ===\n')
end, 'Install treesitter, LSP, linter, and formatter tooling')
create_command('Sync', sync_packages, 'Sync packages with Paq')
create_command('FetchLspConfigs', fetch_lsp_configs, 'Fetch default LSP configs into lsp/')