multiple updates

- update swayrc with 4k monitor
- update popterm
- update nvim lsp config
- add helm-ls
- remove yaml/ansible lsps
This commit is contained in:
Ben Vincent 2025-12-07 20:50:11 +11:00
parent 145a25974e
commit b5dee7e0f2
6 changed files with 229 additions and 80 deletions

View File

@ -90,22 +90,19 @@ cmp.setup({
}, },
}) })
local capabilities = vim.lsp.protocol.make_client_capabilities() -- LSP configuration using Neovim 0.11+ vim.lsp.config() API
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) -- Note: Default keybindings and capabilities are automatically set
-- mason -- mason (for LSP server management)
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup() require("mason-lspconfig").setup({
automatic_installation = true,
})
-- lspconfig -- Go language server configuration
-- require('lspconfig')['gofumpt'].setup{} vim.lsp.config('gopls', {
-- require('lspconfig')['golines'].setup{}
-- require('lspconfig')['goimports'].setup{}
require('lspconfig')['gopls'].setup{
on_attach = on_attach,
capabilities = capabilities,
cmd = {"gopls"}, cmd = {"gopls"},
filetypes = {"go", "gomod", "gowork", "dotmpl"}, filetypes = {"go", "gomod", "gowork", "gotmpl"},
settings = { settings = {
gopls = { gopls = {
gofumpt = true, gofumpt = true,
@ -113,53 +110,136 @@ require('lspconfig')['gopls'].setup{
usePlaceholders = true, usePlaceholders = true,
analyses = { analyses = {
unusedparams = true, 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, -- Python language server
capabilities = capabilities, vim.lsp.config('pyright', {
flags = lsp_flags, settings = {
} python = {
require('lspconfig')['powershell_es'].setup{} analysis = {
require('lspconfig')['clangd'].setup{} typeCheckingMode = "basic",
require('lspconfig')['rust_analyzer'].setup{} },
require('lspconfig')['ansiblels'].setup{ },
on_attach = on_attach, },
capabilities = capabilities, })
}
require('lspconfig')['bashls'].setup{ -- PowerShell language server
on_attach = on_attach, vim.lsp.config('powershell_es', {})
capabilities = capabilities,
} -- C/C++ language server
require('lspconfig')['lua_ls'].setup{ vim.lsp.config('clangd', {})
on_attach = on_attach,
capabilities = capabilities, -- 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 = { settings = {
Lua = { Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = { diagnostics = {
globals = { 'vim', 'on_attach', 'lsp_flags'} globals = { 'vim' },
} },
} workspace = {
} library = vim.api.nvim_get_runtime_file("", true),
} checkThirdParty = false,
require('lspconfig')['yamlls'].setup{ },
on_attach = on_attach, telemetry = {
capabilities = capabilities, enable = false,
settings = { },
yaml = { hint = {
customTags = { '!vault'} enable = true,
} },
} },
} },
require('lspconfig')['intelephense'].setup{} })
require('lspconfig')['grammarly'].setup{}
require('lspconfig')['puppet'].setup{} -- vim.lsp.config('helm_ls', {
require('lspconfig')['terraformls'].setup{ -- settings = {
on_attach = on_attach, -- ['helm-ls'] = {
capabilities = capabilities, -- 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"}, { vim.api.nvim_create_autocmd({"BufWritePre"}, {
pattern = {"*.tf", "*.tfvars"}, pattern = {"*.tf", "*.tfvars"},
callback = function() callback = function()

View File

@ -1,9 +1,31 @@
-- enter testmode -- Popterm configuration with named terminals support
vim.cmd([[ vim.cmd([[
" nvim-only config " nvim-only config
if has('nvim') 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 " Calculate the desired width and height as 80% of the current window size
let height = float2nr((&lines * 0.8) / 1) let height = float2nr((&lines * 0.8) / 1)
let width = float2nr((&columns * 0.8) / 1) let width = float2nr((&columns * 0.8) / 1)
@ -12,27 +34,64 @@ vim.cmd([[
let top = float2nr((&lines - height) / 2) let top = float2nr((&lines - height) / 2)
let left = float2nr((&columns - width) / 2) let left = float2nr((&columns - width) / 2)
" Define options for the floating window, including its size and position " Define options for the floating window with border
let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} 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 " Reuse existing buffer for this terminal or create new one
let buf = nvim_create_buf(v:false, v:true) 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 " Open a new window with the terminal buffer
call nvim_open_win(buf, v:true, opts) 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 " Start terminal if buffer is empty or hasn't been initialized
call termopen($SHELL) 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 <buffer> <leader>T <C-\><C-n>:call ToggleNamedPopterm("' . a:name . '", "' . a:command . '")<CR>'
execute 'tnoremap <buffer> <leader>a <C-\><C-n>:call ToggleNamedPopterm("claude", "claude")<CR>'
" Enter insert mode
startinsert startinsert
endfunction 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 highlight Terminal guibg=#000000 guifg=none
"autocmd TermOpen * setlocal winhighlight=Normal:Terminal command! Popterm call TogglePopterm()
command! Popterm call OpenCenteredTerminal() command! ClaudePopterm call ToggleClaudePopterm()
" Key mappings
nnoremap T :Popterm<CR> nnoremap T :Popterm<CR>
nnoremap <S-t> :Popterm<CR>
nnoremap <leader>a :ClaudePopterm<CR>
endif endif
]]) ]])

View File

@ -52,6 +52,7 @@ return require('packer').startup(function(use)
use { 'rodjek/vim-puppet' } -- vim puppet enhancements use { 'rodjek/vim-puppet' } -- vim puppet enhancements
use { 'jvirtanen/vim-hcl' } -- hcl syntax highlighting use { 'jvirtanen/vim-hcl' } -- hcl syntax highlighting
-- use { 'fatih/vim-go' } -- go-vim -- use { 'fatih/vim-go' } -- go-vim
use { 'qvalentin/helm-ls.nvim' }
-- theme -- theme

@ -1 +1 @@
Subproject commit c2d6545132b7758551669ecdb32760490fffe0d2 Subproject commit 3bd76085eb285eefad632f812c0e995a558c1586

View File

@ -299,16 +299,21 @@ bindsym $mod+r mode "resize"
# monitor-mode settings # monitor-mode settings
# use "swaymsg -t get_outputs" to list outputs # use "swaymsg -t get_outputs" to list outputs
set $laptop eDP-1 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 $dell2 'Dell Inc. DELL U2713HM GK0KD357413L'
set $tv 'Samsung Electric Company SAMSUNG 0x01000E00' set $tv 'Samsung Electric Company SAMSUNG 0x01000E00'
bindswitch --reload --locked lid:on output $laptop disable bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable bindswitch --reload --locked lid:off output $laptop enable
output $laptop resolution 1920x1080 position 0,0 output $laptop resolution 1920x1080 position 0,0
output $dell1 resolution 2560x1440@59.951Hz position 0,660 transform normal output $dell1 resolution 3840x2160@59.997Hz position 0,660 transform normal
output $dell2 resolution 2560x1440@59.951Hz position 2560,0 transform 270 output $dell2 resolution 2560x1440@59.951Hz position 3840,530 transform 270
output $tv resolution 1920x1080@59.951Hz position 0,660 transform normal 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 # class border bground text indicator child_border
client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4 client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4
client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A

View File

@ -163,3 +163,7 @@ complete -o nospace -C /usr/bin/nomad nomad
complete -o nospace -C /usr/bin/vault vault complete -o nospace -C /usr/bin/vault vault
eval "$(uv generate-shell-completion zsh)" eval "$(uv generate-shell-completion zsh)"
eval "$(nfpm completion zsh)" eval "$(nfpm completion zsh)"
fpath+=~/.zfunc; autoload -Uz compinit; compinit
zstyle ':completion:*' menu select