Compare commits
11 Commits
ef8459d278
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b5dee7e0f2 | |||
| 145a25974e | |||
| 7e925b2c31 | |||
| ead675c788 | |||
| ff3f9e4604 | |||
| 60c67eecee | |||
| 3b349870d8 | |||
| 2fa4e8b410 | |||
| b8c520d600 | |||
| 0bf63bd848 | |||
| 7f2ecfaa3f |
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
[push]
|
[push]
|
||||||
default = simple
|
default = simple
|
||||||
|
autoSetupRemote = true
|
||||||
|
|
||||||
[fetch]
|
[fetch]
|
||||||
prune = true
|
prune = true
|
||||||
|
|||||||
+173
-57
@@ -37,59 +37,6 @@ require("nvim-tree").setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- mason
|
|
||||||
require("mason").setup()
|
|
||||||
require("mason-lspconfig").setup()
|
|
||||||
|
|
||||||
-- lspconfig
|
|
||||||
-- require('lspconfig')['gofumpt'].setup{}
|
|
||||||
-- require('lspconfig')['golines'].setup{}
|
|
||||||
-- require('lspconfig')['goimports'].setup{}
|
|
||||||
require('lspconfig')['gopls'].setup{
|
|
||||||
on_attach = on_attach,
|
|
||||||
cmd = {"gopls"},
|
|
||||||
filetypes = {"go", "gomod", "gowork", "dotmpl"},
|
|
||||||
settings = {
|
|
||||||
gopls = {
|
|
||||||
gofumpt = true,
|
|
||||||
completeUnimported = true,
|
|
||||||
usePlaceholders = true,
|
|
||||||
analyses = {
|
|
||||||
unusedparams = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
require('lspconfig')['pyright'].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
flags = lsp_flags,
|
|
||||||
}
|
|
||||||
require('lspconfig')['powershell_es'].setup{}
|
|
||||||
require('lspconfig')['clangd'].setup{}
|
|
||||||
require('lspconfig')['rust_analyzer'].setup{}
|
|
||||||
require('lspconfig')['ansiblels'].setup{}
|
|
||||||
require('lspconfig')['bashls'].setup{}
|
|
||||||
require('lspconfig')['lua_ls'].setup{
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { 'vim', 'on_attach', 'lsp_flags'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require('lspconfig')['yamlls'].setup{
|
|
||||||
settings = {
|
|
||||||
yaml = {
|
|
||||||
customTags = { '!vault'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require('lspconfig')['intelephense'].setup{}
|
|
||||||
require('lspconfig')['grammarly'].setup{}
|
|
||||||
require('lspconfig')['puppet'].setup{}
|
|
||||||
require('lspconfig')['terraformls'].setup{}
|
|
||||||
|
|
||||||
-- Completion Plugin Setup
|
-- Completion Plugin Setup
|
||||||
local cmp = require'cmp'
|
local cmp = require'cmp'
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
@@ -121,7 +68,7 @@ cmp.setup({
|
|||||||
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||||
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||||
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
|
||||||
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
|
||||||
{ name = 'calc'}, -- source for math calculation
|
{ name = 'calc'}, -- source for math calculation
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
@@ -143,10 +90,167 @@ cmp.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- treesitter
|
-- LSP configuration using Neovim 0.11+ vim.lsp.config() API
|
||||||
|
-- Note: Default keybindings and capabilities are automatically set
|
||||||
|
|
||||||
|
-- mason (for LSP server management)
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
automatic_installation = 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- 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' },
|
||||||
|
},
|
||||||
|
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()
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- treesitter
|
||||||
require('nvim-treesitter.configs').setup {
|
require('nvim-treesitter.configs').setup {
|
||||||
--ensure_installed = { "lua", "toml", "python", "bash", "yaml", "go" },
|
ensure_installed = { "lua", "toml", "python", "bash", "yaml", "go" },
|
||||||
ensure_installed = "all",
|
--ensure_installed = "all",
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@@ -226,3 +330,15 @@ require('mini.indentscope').setup()
|
|||||||
require('mini.splitjoin').setup()
|
require('mini.splitjoin').setup()
|
||||||
require('mini.surround').setup()
|
require('mini.surround').setup()
|
||||||
require('mini.trailspace').setup()
|
require('mini.trailspace').setup()
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufEnter", {
|
||||||
|
pattern = "*.py",
|
||||||
|
callback = function()
|
||||||
|
vim.defer_fn(function()
|
||||||
|
local venv_path = vim.fn.getcwd() .. "/.venv/bin/python"
|
||||||
|
if vim.fn.filereadable(venv_path) == 1 then
|
||||||
|
vim.cmd("PyrightSetPythonPath " .. venv_path)
|
||||||
|
end
|
||||||
|
end, 1000) -- 1 second delay (1000ms)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|||||||
@@ -39,3 +39,22 @@ vim.cmd [[
|
|||||||
autocmd FileType eruby nnoremap <buffer> <Leader>s :call ToggleERBSyntax()<CR>
|
autocmd FileType eruby nnoremap <buffer> <Leader>s :call ToggleERBSyntax()<CR>
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
-- terraform language keybindings
|
||||||
|
vim.cmd [[
|
||||||
|
augroup lang_terraform
|
||||||
|
autocmd!
|
||||||
|
autocmd BufNewFile,BufRead *.tf set filetype=terraform
|
||||||
|
augroup END
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- tmpl language keybindings
|
||||||
|
vim.cmd [[
|
||||||
|
augroup lang_tmpl
|
||||||
|
autocmd!
|
||||||
|
autocmd BufNewFile,BufRead *.yml.tmpl set filetype=yaml
|
||||||
|
autocmd BufNewFile,BufRead *.yaml.tmpl set filetype=yaml
|
||||||
|
autocmd BufNewFile,BufRead *.hcl.tmpl set filetype=hcl
|
||||||
|
augroup END
|
||||||
|
]]
|
||||||
|
|||||||
@@ -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
|
||||||
]])
|
]])
|
||||||
|
|||||||
@@ -46,6 +46,89 @@ function! OpenPuppetProfileOrRole(layout)
|
|||||||
" Initialize an empty variable for the directory
|
" Initialize an empty variable for the directory
|
||||||
let dirpath = ""
|
let dirpath = ""
|
||||||
|
|
||||||
|
" List modules in puppet-control here
|
||||||
|
let module_list = []
|
||||||
|
call add(module_list, 'certbot')
|
||||||
|
call add(module_list, 'droneci')
|
||||||
|
call add(module_list, 'frrouting')
|
||||||
|
call add(module_list, 'glauth')
|
||||||
|
call add(module_list, 'incus')
|
||||||
|
call add(module_list, 'jellyfin')
|
||||||
|
call add(module_list, 'lidarr')
|
||||||
|
call add(module_list, 'networking')
|
||||||
|
call add(module_list, 'nzbget')
|
||||||
|
call add(module_list, 'prowlarr')
|
||||||
|
call add(module_list, 'radarr')
|
||||||
|
call add(module_list, 'readarr')
|
||||||
|
call add(module_list, 'redisha')
|
||||||
|
call add(module_list, 'sonarr')
|
||||||
|
call add(module_list, 'vlcluster')
|
||||||
|
call add(module_list, 'vmcluster')
|
||||||
|
|
||||||
|
" Check if the class name starts with 'profiles::' or 'roles::'
|
||||||
|
if classname =~ '^profiles::'
|
||||||
|
let dirpath = "site/profiles/manifests/"
|
||||||
|
let classname = substitute(classname, 'profiles::', '', '')
|
||||||
|
elseif classname =~ '^roles::'
|
||||||
|
let dirpath = "site/roles/manifests/"
|
||||||
|
let classname = substitute(classname, 'roles::', '', '')
|
||||||
|
else
|
||||||
|
let matched = 0
|
||||||
|
for module in module_list
|
||||||
|
if classname =~ '^' . module . '::'
|
||||||
|
let dirpath = "modules/" . module . "/manifests/"
|
||||||
|
let parts = split(classname, '::')
|
||||||
|
if len(parts) > 1
|
||||||
|
let classname = join(parts[1:], '::')
|
||||||
|
else
|
||||||
|
let classname = 'init'
|
||||||
|
endif
|
||||||
|
let matched = 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
if matched == 0
|
||||||
|
if classname =~ '::'
|
||||||
|
echo "Unknown module"
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "Unknown class prefix, should be profiles:: or roles::, or be a listed module."
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Replace :: with / to convert class name to file path
|
||||||
|
let filepath = substitute(classname, '::', '/', 'g')
|
||||||
|
|
||||||
|
" Create the full file path
|
||||||
|
let fullpath = dirpath . filepath . ".pp"
|
||||||
|
|
||||||
|
" Open the file in a new tab
|
||||||
|
if a:layout == 'horizontal'
|
||||||
|
execute 'split ' . fullpath
|
||||||
|
elseif a:layout == 'vertical'
|
||||||
|
execute 'vsplit ' . fullpath
|
||||||
|
elseif a:layout == 'tab'
|
||||||
|
execute 'tabedit ' . fullpath
|
||||||
|
else
|
||||||
|
echo "Invalid layout specified."
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
]])
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
function! OpenPuppetProfileOrRoleOriginal(layout)
|
||||||
|
|
||||||
|
" Get the line under the cursor
|
||||||
|
let line = getline(".")
|
||||||
|
|
||||||
|
" Use a regex to find the full class name
|
||||||
|
let classname = tolower(matchstr(line, '\v\w+(\:\:\w+)+'))
|
||||||
|
|
||||||
|
" Initialize an empty variable for the directory
|
||||||
|
let dirpath = ""
|
||||||
|
|
||||||
" Check if the class name starts with 'profiles::' or 'roles::'
|
" Check if the class name starts with 'profiles::' or 'roles::'
|
||||||
if classname =~ '^profiles::'
|
if classname =~ '^profiles::'
|
||||||
let dirpath = "site/profiles/manifests/"
|
let dirpath = "site/profiles/manifests/"
|
||||||
@@ -127,7 +210,7 @@ function! OpenPuppetClassOrTemplate(layout)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Check if it's an included class (profiles:: or roles::)
|
" Check if it's an included class (profiles:: or roles::)
|
||||||
if line =~ '\(profiles\|roles\)::'
|
if line =~ '::'
|
||||||
call OpenPuppetProfileOrRole(a:layout)
|
call OpenPuppetProfileOrRole(a:layout)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ return require('packer').startup(function(use)
|
|||||||
use 'hrsh7th/cmp-path'
|
use 'hrsh7th/cmp-path'
|
||||||
use 'hrsh7th/cmp-buffer'
|
use 'hrsh7th/cmp-buffer'
|
||||||
use 'hrsh7th/vim-vsnip'
|
use 'hrsh7th/vim-vsnip'
|
||||||
|
use "rafamadriz/friendly-snippets"
|
||||||
|
|
||||||
-- telescope
|
-- telescope
|
||||||
use {
|
use {
|
||||||
@@ -49,7 +50,9 @@ return require('packer').startup(function(use)
|
|||||||
use { 'numToStr/FTerm.nvim' } -- floating terminal
|
use { 'numToStr/FTerm.nvim' } -- floating terminal
|
||||||
use { 'HampusHauffman/block.nvim' } -- code blocks in different colours
|
use { 'HampusHauffman/block.nvim' } -- code blocks in different colours
|
||||||
use { 'rodjek/vim-puppet' } -- vim puppet enhancements
|
use { 'rodjek/vim-puppet' } -- vim puppet enhancements
|
||||||
|
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
Submodule .config/password-store updated: 3546217b65...3bd76085eb
@@ -32,6 +32,8 @@ if command -v nvim >/dev/null 2>&1; then
|
|||||||
alias vi='nvim'
|
alias vi='nvim'
|
||||||
fi
|
fi
|
||||||
alias purevim='vim -u NONE'
|
alias purevim='vim -u NONE'
|
||||||
|
alias vimp='xargs nvim -p'
|
||||||
|
|
||||||
|
|
||||||
# tmux
|
# tmux
|
||||||
if [[ -n $TMUX ]]; then
|
if [[ -n $TMUX ]]; then
|
||||||
@@ -70,7 +72,7 @@ alias ypush="yadm push && yadm push origin master"
|
|||||||
# fix commands
|
# fix commands
|
||||||
alias ipcalc='~/.local/bin/ipcalc -n'
|
alias ipcalc='~/.local/bin/ipcalc -n'
|
||||||
alias mpv="mpv -hwdec=vdpau"
|
alias mpv="mpv -hwdec=vdpau"
|
||||||
alias ifstat="/usr/bin/ifstat"
|
alias ifstat="/usr/local/bin/ifstat"
|
||||||
alias snapper="sudo /usr/bin/snapper"
|
alias snapper="sudo /usr/bin/snapper"
|
||||||
alias ap="~/.local/bin/ansible-playbook"
|
alias ap="~/.local/bin/ansible-playbook"
|
||||||
|
|
||||||
|
|||||||
+61
-1
@@ -17,7 +17,8 @@ export ANSIBLE_VAULT_PASSWORD_FILE=$HOME/.local/bin/ansible-vault-pass-client
|
|||||||
# VAULT
|
# VAULT
|
||||||
export VAULT_ADDR=https://vault.service.consul:8200
|
export VAULT_ADDR=https://vault.service.consul:8200
|
||||||
vaultlogin () {
|
vaultlogin () {
|
||||||
vault login $(pass show personal/vault/syd1/token)
|
#vault login $(pass show personal/vault/syd1/token)
|
||||||
|
export VAULT_TOKEN=$(vault login --field=token --method=ldap username=benvin)
|
||||||
}
|
}
|
||||||
|
|
||||||
# CONSUL: https://developer.hashicorp.com/consul/commands
|
# CONSUL: https://developer.hashicorp.com/consul/commands
|
||||||
@@ -26,6 +27,9 @@ export CONSUL_HTTP_TOKEN_FILE=$HOME/.config/consul/token.secret
|
|||||||
export CONSUL_HTTP_SSL=true
|
export CONSUL_HTTP_SSL=true
|
||||||
export CONSUL_HTTP_SSL_VERIFY=true
|
export CONSUL_HTTP_SSL_VERIFY=true
|
||||||
|
|
||||||
|
# NOMAD
|
||||||
|
export NOMAD_ADDR=https://nomad.service.consul:4646
|
||||||
|
|
||||||
# set MPD host
|
# set MPD host
|
||||||
export MPD_HOST="$HOME/.config/mpd/socket"
|
export MPD_HOST="$HOME/.config/mpd/socket"
|
||||||
|
|
||||||
@@ -70,6 +74,10 @@ ncurl() {
|
|||||||
curl --netrc-file <(pass show personal/netrc) "$@"
|
curl --netrc-file <(pass show personal/netrc) "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
export RESTIC_REPOSITORY=s3:https://radosgw.service.consul/restic-personal
|
||||||
|
export RESTIC_PASSWORD_COMMAND="pass show personal/restic/metabox"
|
||||||
|
|
||||||
# create function later:
|
# create function later:
|
||||||
# large image heavy pdf into smaller pdf
|
# large image heavy pdf into smaller pdf
|
||||||
# below will:
|
# below will:
|
||||||
@@ -80,3 +88,55 @@ ncurl() {
|
|||||||
# pdftoppm -jpeg -r 300 input_document.pdf output_image
|
# pdftoppm -jpeg -r 300 input_document.pdf output_image
|
||||||
# jpegoptim --size=100k output_image*.jpg
|
# jpegoptim --size=100k output_image*.jpg
|
||||||
# img2pdf $(ls -v output_image*.jpg) -o output_document.pdf
|
# img2pdf $(ls -v output_image*.jpg) -o output_document.pdf
|
||||||
|
|
||||||
|
# Create a git worktree for the current repo.
|
||||||
|
# Usage: newtree <branch-name> [<from-ref>]
|
||||||
|
# - If <from-ref> is omitted, defaults to HEAD.
|
||||||
|
# - Worktree path: $HOME/src/worktrees/<repo_name>/<branch_name_sanitised>
|
||||||
|
# (slashes and dashes in the *path component only* are replaced with underscores)
|
||||||
|
newtree() {
|
||||||
|
local branch from_ref repo_root repo_name sanitized dest parent
|
||||||
|
branch="$1"
|
||||||
|
from_ref="${2:-HEAD}"
|
||||||
|
|
||||||
|
if [[ -z "$branch" ]]; then
|
||||||
|
echo "Usage: newtree <branch-name> [<from-ref>]" >&2
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure we're inside a git repo
|
||||||
|
if ! repo_root="$(git rev-parse --show-toplevel 2>/dev/null)"; then
|
||||||
|
echo "Error: not inside a git repository." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
repo_name="$(basename "$repo_root")"
|
||||||
|
|
||||||
|
# Sanitize the branch *for the path only* (keep original branch name for git)
|
||||||
|
sanitized="${branch//[\/-]/_}"
|
||||||
|
dest="$HOME/src/worktrees/$repo_name/$sanitized"
|
||||||
|
parent="$(dirname "$dest")"
|
||||||
|
|
||||||
|
# Create parent dir; git will create the final leaf
|
||||||
|
mkdir -p "$parent" || {
|
||||||
|
echo "Error: unable to create directory: $parent" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Optional: prune stale worktrees to avoid false conflicts
|
||||||
|
git -C "$repo_root" worktree prune >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Does the branch already exist?
|
||||||
|
if git -C "$repo_root" rev-parse --verify --quiet "refs/heads/$branch" >/dev/null; then
|
||||||
|
echo "Branch '$branch' exists; adding worktree at: $dest"
|
||||||
|
# --force in case the branch is already checked out elsewhere
|
||||||
|
git -C "$repo_root" worktree add --force "$dest" "$branch" || return $?
|
||||||
|
else
|
||||||
|
echo "Branch '$branch' does not exist; creating from '$from_ref' at: $dest"
|
||||||
|
git -C "$repo_root" worktree add --force -b "$branch" "$dest" "$from_ref" || return $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Jump into the new worktree
|
||||||
|
cd "$dest" || return $?
|
||||||
|
echo "✔ Worktree ready at: $dest"
|
||||||
|
}
|
||||||
|
|||||||
+10
-3
@@ -299,13 +299,20 @@ 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'
|
||||||
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ sudo dnf install -y dnf-plugins-core
|
|||||||
|
|
||||||
# enable copr
|
# enable copr
|
||||||
sudo dnf copr enable ganto/lxc4 -y
|
sudo dnf copr enable ganto/lxc4 -y
|
||||||
sudo dnf copr enable livegrenier/i3-desktop -y
|
#sudo dnf copr enable livegrenier/i3-desktop -y
|
||||||
sido dnf copr enable tokariew/i3lock-color -y
|
sido dnf copr enable tokariew/i3lock-color -y
|
||||||
|
|
||||||
# install rpmfusion
|
# install rpmfusion
|
||||||
@@ -32,3 +32,9 @@ sudo dnf install -y firefox chromium gimp libreoffice dia shotwell thunderbird i
|
|||||||
tmux udiskie upower vifm virt-manager libvirt jpegoptim poppler-utils qpdf alacritty dunst feh i3 i3blocks \
|
tmux udiskie upower vifm virt-manager libvirt jpegoptim poppler-utils qpdf alacritty dunst feh i3 i3blocks \
|
||||||
maim network-manager-applet pavucontrol sway swaylock waybar wl-clipboard grim slurp polybar mpc mpd mpv \
|
maim network-manager-applet pavucontrol sway swaylock waybar wl-clipboard grim slurp polybar mpc mpd mpv \
|
||||||
ncmpcpp openvpn
|
ncmpcpp openvpn
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# NPM
|
||||||
|
npm i opencode-ai@latest
|
||||||
|
ln -s ~/node_modules/.bin/opencode ~/bin/opencode
|
||||||
|
|||||||
@@ -154,3 +154,16 @@ export SSH_AUTH_SOCK
|
|||||||
# load shell settings
|
# load shell settings
|
||||||
test -r $XDG_CONFIG_HOME/shell/common && source $XDG_CONFIG_HOME/shell/common
|
test -r $XDG_CONFIG_HOME/shell/common && source $XDG_CONFIG_HOME/shell/common
|
||||||
test -r $XDG_CONFIG_HOME/shell/aliases && source $XDG_CONFIG_HOME/shell/aliases
|
test -r $XDG_CONFIG_HOME/shell/aliases && source $XDG_CONFIG_HOME/shell/aliases
|
||||||
|
|
||||||
|
# autocomplete tools
|
||||||
|
autoload -U +X bashcompinit && bashcompinit
|
||||||
|
complete -o nospace -C /usr/bin/terraform terraform
|
||||||
|
complete -o nospace -C /usr/bin/consul consul
|
||||||
|
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
|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/bash
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
export $(pass show personal/radosgw/benvin)
|
||||||
|
|
||||||
|
restic backup "$HOME" --exclude-caches --one-file-system \
|
||||||
|
--exclude '**/.cache' \
|
||||||
|
--exclude '**/.terraform' \
|
||||||
|
--exclude '**/.terragrunt-cache' \
|
||||||
|
--exclude '**/.local/share/containers' \
|
||||||
|
--exclude '**/go/pkg/mod' \
|
||||||
|
--exclude '**/Downloads' \
|
||||||
|
--exclude '**/.thunderbird' \
|
||||||
|
--exclude '**/backups' \
|
||||||
|
--exclude '**/Video'
|
||||||
Reference in New Issue
Block a user