From b5dee7e0f2ac08656a0bf428e860635727a20824 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 7 Dec 2025 20:50:11 +1100 Subject: [PATCH] multiple updates - update swayrc with 4k monitor - update popterm - update nvim lsp config - add helm-ls - remove yaml/ansible lsps --- .config/nvim/init.lua | 204 +++++++++++++++++++++--------- .config/nvim/lua/func/popterm.lua | 87 +++++++++++-- .config/nvim/lua/plug.lua | 1 + .config/password-store | 2 +- .config/sway/config | 11 +- .config/zsh/zshrc | 4 + 6 files changed, 229 insertions(+), 80 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index ab9c8a1..b17b230 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -90,76 +90,156 @@ cmp.setup({ }, }) -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) +-- LSP configuration using Neovim 0.11+ vim.lsp.config() API +-- Note: Default keybindings and capabilities are automatically set --- mason +-- mason (for LSP server management) require("mason").setup() -require("mason-lspconfig").setup() +require("mason-lspconfig").setup({ + automatic_installation = true, +}) --- lspconfig --- require('lspconfig')['gofumpt'].setup{} --- require('lspconfig')['golines'].setup{} --- require('lspconfig')['goimports'].setup{} -require('lspconfig')['gopls'].setup{ - on_attach = on_attach, - capabilities = capabilities, - cmd = {"gopls"}, - filetypes = {"go", "gomod", "gowork", "dotmpl"}, - settings = { - gopls = { - gofumpt = true, - completeUnimported = true, - usePlaceholders = true, - analyses = { - unusedparams = true, - }, +-- Go language server configuration +vim.lsp.config('gopls', { + cmd = {"gopls"}, + filetypes = {"go", "gomod", "gowork", "gotmpl"}, + settings = { + gopls = { + gofumpt = true, + completeUnimported = true, + usePlaceholders = true, + analyses = { + unusedparams = true, + shadow = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, }, }, -} -require('lspconfig')['pyright'].setup { - on_attach = on_attach, - capabilities = capabilities, - flags = lsp_flags, -} -require('lspconfig')['powershell_es'].setup{} -require('lspconfig')['clangd'].setup{} -require('lspconfig')['rust_analyzer'].setup{} -require('lspconfig')['ansiblels'].setup{ - on_attach = on_attach, - capabilities = capabilities, -} -require('lspconfig')['bashls'].setup{ - on_attach = on_attach, - capabilities = capabilities, -} -require('lspconfig')['lua_ls'].setup{ - on_attach = on_attach, - capabilities = capabilities, + }, +}) + +-- Python language server +vim.lsp.config('pyright', { + settings = { + python = { + analysis = { + typeCheckingMode = "basic", + }, + }, + }, +}) + +-- PowerShell language server +vim.lsp.config('powershell_es', {}) + +-- C/C++ language server +vim.lsp.config('clangd', {}) + +-- Rust language server +vim.lsp.config('rust_analyzer', { + settings = { + ["rust-analyzer"] = { + checkOnSave = { + command = "clippy", + }, + inlayHints = { + enable = true, + }, + }, + }, +}) + +-- -- Ansible language server +-- vim.lsp.config('ansiblels', {}) + +-- Bash language server +vim.lsp.config('bashls', {}) + +-- Lua language server +vim.lsp.config('lua_ls', { settings = { Lua = { + runtime = { + version = 'LuaJIT', + }, diagnostics = { - globals = { 'vim', 'on_attach', 'lsp_flags'} - } - } - } -} -require('lspconfig')['yamlls'].setup{ - on_attach = on_attach, - capabilities = capabilities, - settings = { - yaml = { - customTags = { '!vault'} - } - } -} -require('lspconfig')['intelephense'].setup{} -require('lspconfig')['grammarly'].setup{} -require('lspconfig')['puppet'].setup{} -require('lspconfig')['terraformls'].setup{ - on_attach = on_attach, - capabilities = capabilities, -} + globals = { 'vim' }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + checkThirdParty = false, + }, + telemetry = { + enable = false, + }, + hint = { + enable = true, + }, + }, + }, +}) + +-- vim.lsp.config('helm_ls', { +-- settings = { +-- ['helm-ls'] = { +-- yamlls = { +-- path = "yaml-language-server", +-- } +-- } +-- } +-- }) + +-- -- YAML language server +-- vim.lsp.config('yamlls', { +-- settings = { +-- yaml = { +-- customTags = { '!vault' }, +-- schemas = { +-- kubernetes = "*.yaml", +-- ["http://json.schemastore.org/github-workflow"] = ".github/workflows/*", +-- ["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}", +-- ["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}", +-- ["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}", +-- ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "*docker-compose*.{yml,yaml}", +-- }, +-- }, +-- }, +-- }) + +-- PHP language server +vim.lsp.config('intelephense', {}) + +-- Grammar checking +vim.lsp.config('grammarly', {}) + +-- Puppet language server +vim.lsp.config('puppet', {}) + +-- Terraform language server +vim.lsp.config('terraformls', {}) + +-- Enable all configured language servers +vim.lsp.enable('gopls') +vim.lsp.enable('pyright') +vim.lsp.enable('powershell_es') +vim.lsp.enable('clangd') +vim.lsp.enable('rust_analyzer') +-- vim.lsp.enable('ansiblels') +vim.lsp.enable('bashls') +vim.lsp.enable('lua_ls') +-- vim.lsp.enable('yamlls') +-- vim.lsp.enable('helm_ls') +vim.lsp.enable('intelephense') +vim.lsp.enable('grammarly') +vim.lsp.enable('puppet') +vim.lsp.enable('terraformls') vim.api.nvim_create_autocmd({"BufWritePre"}, { pattern = {"*.tf", "*.tfvars"}, callback = function() diff --git a/.config/nvim/lua/func/popterm.lua b/.config/nvim/lua/func/popterm.lua index fd83512..5af2ee1 100644 --- a/.config/nvim/lua/func/popterm.lua +++ b/.config/nvim/lua/func/popterm.lua @@ -1,9 +1,31 @@ --- enter testmode +-- Popterm configuration with named terminals support vim.cmd([[ " nvim-only config if has('nvim') - function! OpenCenteredTerminal() + " Global dictionaries to track terminal windows and buffers by name + let g:popterm_windows = {} + let g:popterm_buffers = {} + let g:popterm_current_win = -1 + + function! ToggleNamedPopterm(name, command) + " Check if this named terminal window exists and is valid + if has_key(g:popterm_windows, a:name) && g:popterm_windows[a:name] != -1 && nvim_win_is_valid(g:popterm_windows[a:name]) + " Close the terminal window + call nvim_win_close(g:popterm_windows[a:name], v:false) + let g:popterm_windows[a:name] = -1 + let g:popterm_current_win = -1 + return + endif + + " Close any other open popterm window first + for [term_name, win_id] in items(g:popterm_windows) + if win_id != -1 && nvim_win_is_valid(win_id) + call nvim_win_close(win_id, v:false) + let g:popterm_windows[term_name] = -1 + endif + endfor + " Calculate the desired width and height as 80% of the current window size let height = float2nr((&lines * 0.8) / 1) let width = float2nr((&columns * 0.8) / 1) @@ -12,27 +34,64 @@ vim.cmd([[ let top = float2nr((&lines - height) / 2) let left = float2nr((&columns - width) / 2) - " Define options for the floating window, including its size and position - let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} + " Define options for the floating window with border + let opts = { + \ 'relative': 'editor', + \ 'row': top, + \ 'col': left, + \ 'width': width, + \ 'height': height, + \ 'style': 'minimal', + \ 'border': 'rounded', + \ 'title': ' ' . a:name . ' ', + \ 'title_pos': 'center' + \ } - " Create a new buffer for the terminal, set it to not listed and with no swapfile - let buf = nvim_create_buf(v:false, v:true) + " Reuse existing buffer for this terminal or create new one + if !has_key(g:popterm_buffers, a:name) || g:popterm_buffers[a:name] == -1 || !nvim_buf_is_valid(g:popterm_buffers[a:name]) + let g:popterm_buffers[a:name] = nvim_create_buf(v:false, v:true) + endif - " Open a new window with the terminal buffer, applying the specified options - call nvim_open_win(buf, v:true, opts) + " Open a new window with the terminal buffer + let g:popterm_windows[a:name] = nvim_open_win(g:popterm_buffers[a:name], v:true, opts) + let g:popterm_current_win = g:popterm_windows[a:name] - " Run the default shell in the terminal - call termopen($SHELL) + " Start terminal if buffer is empty or hasn't been initialized + let buffer_lines = nvim_buf_get_lines(g:popterm_buffers[a:name], 0, -1, v:false) + if empty(buffer_lines) || (len(buffer_lines) == 1 && buffer_lines[0] == '') + if a:command != '' + call termopen(a:command, {'buffer': g:popterm_buffers[a:name]}) + else + call termopen($SHELL, {'buffer': g:popterm_buffers[a:name]}) + endif + endif - " Adjust the focus to the newly opened terminal window + " Set terminal-specific key mappings for this terminal + execute 'tnoremap T :call ToggleNamedPopterm("' . a:name . '", "' . a:command . '")' + execute 'tnoremap a :call ToggleNamedPopterm("claude", "claude")' + + " Enter insert mode startinsert endfunction - " Define the :Popterm command to open the centered terminal + " Wrapper functions for specific terminals + function! TogglePopterm() + call ToggleNamedPopterm('general', '') + endfunction + + function! ToggleClaudePopterm() + call ToggleNamedPopterm('claude', 'claude') + endfunction + + " Define commands highlight Terminal guibg=#000000 guifg=none - "autocmd TermOpen * setlocal winhighlight=Normal:Terminal - command! Popterm call OpenCenteredTerminal() + command! Popterm call TogglePopterm() + command! ClaudePopterm call ToggleClaudePopterm() + + " Key mappings nnoremap T :Popterm + nnoremap :Popterm + nnoremap a :ClaudePopterm endif ]]) diff --git a/.config/nvim/lua/plug.lua b/.config/nvim/lua/plug.lua index 3a3385c..f178008 100644 --- a/.config/nvim/lua/plug.lua +++ b/.config/nvim/lua/plug.lua @@ -52,6 +52,7 @@ return require('packer').startup(function(use) use { 'rodjek/vim-puppet' } -- vim puppet enhancements use { 'jvirtanen/vim-hcl' } -- hcl syntax highlighting -- use { 'fatih/vim-go' } -- go-vim + use { 'qvalentin/helm-ls.nvim' } -- theme diff --git a/.config/password-store b/.config/password-store index c2d6545..3bd7608 160000 --- a/.config/password-store +++ b/.config/password-store @@ -1 +1 @@ -Subproject commit c2d6545132b7758551669ecdb32760490fffe0d2 +Subproject commit 3bd76085eb285eefad632f812c0e995a558c1586 diff --git a/.config/sway/config b/.config/sway/config index 6909710..982dcce 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -299,16 +299,21 @@ bindsym $mod+r mode "resize" # monitor-mode settings # use "swaymsg -t get_outputs" to list outputs set $laptop eDP-1 -set $dell1 'Dell Inc. DELL U2713HM GK0KD357412L' +set $dell1 'Dell Inc. DELL U4320Q D1QV193' set $dell2 'Dell Inc. DELL U2713HM GK0KD357413L' set $tv 'Samsung Electric Company SAMSUNG 0x01000E00' bindswitch --reload --locked lid:on output $laptop disable bindswitch --reload --locked lid:off output $laptop enable output $laptop resolution 1920x1080 position 0,0 -output $dell1 resolution 2560x1440@59.951Hz position 0,660 transform normal -output $dell2 resolution 2560x1440@59.951Hz position 2560,0 transform 270 +output $dell1 resolution 3840x2160@59.997Hz position 0,660 transform normal +output $dell2 resolution 2560x1440@59.951Hz position 3840,530 transform 270 output $tv resolution 1920x1080@59.951Hz position 0,660 transform normal +workspace $ws1 output $dell1 +workspace $ws2 output $dell2 +workspace $ws3 output $dell1 +workspace $ws4 output $dell2 + # class border bground text indicator child_border client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4 client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A diff --git a/.config/zsh/zshrc b/.config/zsh/zshrc index 38e724a..dff7ee7 100644 --- a/.config/zsh/zshrc +++ b/.config/zsh/zshrc @@ -163,3 +163,7 @@ complete -o nospace -C /usr/bin/nomad nomad complete -o nospace -C /usr/bin/vault vault eval "$(uv generate-shell-completion zsh)" eval "$(nfpm completion zsh)" + +fpath+=~/.zfunc; autoload -Uz compinit; compinit + +zstyle ':completion:*' menu select