master
blob42 1 year ago
parent 32a409df1a
commit 5216048827

@ -1,4 +1,4 @@
-- vim: foldmethod=marker foldlevel=1
-- n, v, i, t, c = mode name.s
local function termcodes(str)
@ -336,9 +336,34 @@ M.general = { --{{{
-- ["<leader>lsp"] = { "<cmd> lua require('custom.plugins.configs.navigator').enable()<CR>", "lsp enable"},
["<leader>lsp"] = { "<cmd> LspStart<CR>", "lsp enable" },
["<M-s><M-s>"] = { "<cmd> LspStart<CR>", "lsp enable" },
["<M-t><M-t>"] = { "<cmd> LspStop<CR>", "lsp disable" },
["<M-t><M-t>"] = {function()
local bufnr = vim.api.nvim_get_current_buf()
-- get all clients for buffer
local clients = vim.lsp.get_active_clients({
bufnr = bufnr
})
if #clients > 1 then
-- select clients to turn off
vim.ui.select(clients, {
prompt = 'Stop LSP Clients',
format_item = function (item)
return item.name
end
}, function(item)
if item then vim.lsp.stop_client(item.id) end
end)
elseif #clients == 1 then
vim.lsp.stop_client(clients[1].id)
else
return
end
end, "lsp disable" },
["<leader>lst"] = { "<cmd> LspStop<CR>", "lsp disable" },
-- My custom commands
["<leader>gB"] = {"<cmd> GitBlob<CR>"},
---------------
@ -381,6 +406,7 @@ M.general = { --{{{
-- Change Working Directory to that of the current file
["cwd"] = { "lcd %:p:h", "change dir to current file" },
["cd."] = { "lcd %:p:h", "change dir to current file" },
["cdv"] = { "lcd ~/.config/nvim<CR>", "change to vim directory" },
["w!!"] = { "w !doas tee %", "write file with root perms" },
["%%"] = { "<C-R>=fnameescape(expand('%:h')).'/'<cr>",
"alias to current working dir" },
@ -784,6 +810,10 @@ M.nvterm = { --{{{
nvterm_utils.run_cmd(nil, { mode = "vertical" })
end, "run cmd in vertical terminal"},
["<leader>rh"] = {function()
local nvterm_utils = require('spike.utils.nvterm')
nvterm_utils.run_cmd(nil, { mode = "horizontal" })
end, "run cmd in horizontal terminal"},
["<leader><UP>"] = {function()
local nvterm_utils = require('spike.utils.nvterm')
@ -975,6 +1005,23 @@ M.gitsigns = {
}
}
-- selects a grapple key given a scope and resets
-- the `git` scope
local function grapple_scope_select(scope, key)
local grapple = require("grapple")
grapple.setup({scope = scope })
grapple.select({key=key})
grapple.setup({scope = "git"})
end
local function grapple_scope_tag(scope, key)
local grapple = require("grapple")
grapple.setup({scope = scope})
grapple.tag({key=key})
grapple.setup({scope = "git"})
end
M.grapple = {
plugin = true,
n = {
@ -986,11 +1033,21 @@ M.grapple = {
require("grapple").tag({ key = input })
end)
end, "grapple tag with name" },
["<leader>GN"] = { function()
local grapple = require("grapple")
vim.ui.input({ prompt = "tag: " }, function(input)
grapple_scope_tag("global", input)
end)
end, "grapple global tag with name" },
--TODO: keybind for popup select names
["<leader><leader>m"] = { "<cmd> lua require'grapple'.select({key='mappings'})<CR>" },
["<leader><leader>p"] = { "<cmd> lua require'grapple'.select({key='plugins'})<CR>" },
-- ["<leader><leader>m"] = { "<cmd> lua require'grapple'.scope_select('global', 'mappings')<CR>" },
["<leader><leader>m"] = { function() grapple_scope_select("global", "mappings") end},
["<leader><leader>p"] = { function() grapple_scope_select("global", "plugins") end },
["<leader><leader>b"] = { function() grapple_scope_select("global", "bonzai") end },
["<leader><leader>P"] = { "<cmd> lua require'grapple'.select({key='Plugins'})<CR>" },
["<leader><leader>o"] = { "<cmd> lua require'grapple'.select({key='options'})<CR>" },
["<leader><leader>g"] = { "<cmd> lua require'grapple'.popup_tags()<CR>" },
["<leader><leader>G"] = { "<cmd> lua require'grapple'.popup_tags('global')<CR>" },
}
}

@ -26,7 +26,9 @@ opt.showmode = false
opt.title = true
opt.clipboard = "unnamed"
opt.cul = true -- cursor line
opt.colorcolumn = "80"
-- opt.colorcolumn = "80"
opt.colorcolumn = '+0' -- make colorcolumn follow text width
opt.textwidth = 80
opt.rulerformat = "%30(%=:b%n%y%m%r%w %l,%c%V %P%)" -- NvChad has custom ruler !
-- Indenting

@ -5,6 +5,37 @@ local opts = {
}
-- config for dap ui virt text
local dap_ui_virt_text_config = {
enabled = true, -- enable this plugin (the default)
enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
show_stop_reason = true, -- show stop reason when stopped for exceptions
commented = false, -- prefix virtual text with comment string
only_first_definition = true, -- only show virtual text at first definition (if there are multiple)
all_references = false, -- show virtual text on all all references of the variable (not only definitions)
filter_references_pattern = '<module', -- filter references (not definitions) pattern when all_references is activated (Lua gmatch pattern, default filters out Python modules)
-- experimental features:
virt_text_pos = 'eol', -- position of virtual text, see `:h nvim_buf_set_extmark()`
all_frames = true, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine.
virt_lines = false, -- show virtual lines instead of virtual text (will flicker!)
virt_text_win_col = 60 -- position the virtual text at a fixed window column (starting from the first text column) ,
-- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()`
}
M.setup = function()
end
M.setup_virt_text = function()
local ok, dap_virt_text = pcall(require, 'nvim-dap-virtual-text')
if not ok then
vim.notify("missing module nvim-dap-virtual-text", vim.log.levels.WARN)
return
end
P("setup dap ui virt text")
dap_virt_text.setup(dap_ui_virt_text_config)
end
return M

@ -75,8 +75,10 @@ local opts = {
}
}
M.setup = function()
dapui.setup(opts)
end
return M

@ -6,6 +6,18 @@ end
M = {}
local get_current_gomod = function()
local file = io.open('go.mod', 'r')
if file == nil then
return nil
end
local first_line = file:read()
local mod_name = first_line:gsub('module ', '')
file:close()
return mod_name
end
local config = {
debug = false,
transparency = 5,
@ -161,17 +173,49 @@ local config = {
-- on_attach = require("spike.lsp.go").custom_attach,
on_attach = require("spike.lsp.go").gopls_onattach,
settings = {
gopls = {
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
}
flags = { allow_incremental_sync = true, debounce_text_changes = 500 },
gopls = {
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
unreachable = true,
nilness = true,
unusedparams = true,
useany = true,
unusedwrite = true,
ST1003 = true,
undeclaredname = true,
fillreturns = true,
nonewvars = true,
fieldalignment = false,
shadow = true,
},
codelenses = {
generate = true, -- show the `go generate` lens.
gc_details = true, -- Show a code lens toggling the display of gc's choices.
test = true,
tidy = true,
vendor = true,
regenerate_cgo = true,
upgrade_dependency = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
matcher = 'Fuzzy',
diagnosticsDelay = '500ms',
symbolMatcher = 'fuzzy',
['local'] = get_current_gomod(),
-- gofumpt = _GO_NVIM_CFG.lsp_gofumpt or false, -- true|false, -- turn on for new repos, gofmpt is good but also create code turmoils
buildFlags = { '-tags', 'integration' },
}
}
},
pylsp = {

@ -15,7 +15,7 @@ local config = {
runtime = true, -- runtime path
types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
-- plugins = true, -- installed opt or start plugins in packpath
plugins = {"plenary.nvim"},
plugins = {"plenary.nvim", "grapple.nvim"},
-- -- plugins = {"navigator.lua", "guihua.lua", "go.nvim", "plenary.nvim"},
-- you can also specify the list of plugins to make available as a workspace library
-- plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" },

@ -28,7 +28,7 @@
-- - Execute :PackerCompile
--
-- This doesn't seem to work:
-- - XXX ~~Reload all lua modules with `"pleanery.reload".reload_module(mod)`~~ XXX
-- - XXX ~~Reload all lua modules with `"plenaery.reload".reload_module(mod)`~~ XXX
return {
@ -56,6 +56,7 @@ return {
["nvim-treesitter/nvim-treesitter"] = { -- {{{
-- commit = "4f8b2480", -- pin to latest working commit
-- custom config in chadrc -> custom.configs.treesitter
lock = true,
setup = function()
require("core.lazy_load").on_file_open "nvim-treesitter"
require("core.lazy_load").on_file_open "nvim-treesitter-textobjects"
@ -66,6 +67,7 @@ return {
end,
},
["nvim-treesitter/nvim-treesitter-textobjects"] = {
lock = true,
opt = true,
},
-- ["RRethy/nvim-treesitter-textsubjects"] = {
@ -73,6 +75,7 @@ return {
-- },
["ziontee113/syntax-tree-surfer"] = {
lock = true,
opt = true,
config = function()
require("syntax-tree-surfer").setup()
@ -80,11 +83,13 @@ return {
},
-- Treesitter dev/exploration tool
["nvim-treesitter/playground"] = {
lock = true,
opt = true,
cmd = { "TSPlayground*" },
},
["nvim-treesitter/nvim-treesitter-context"] = {
lock = true,
opt = true,
config = function()
require("custom.plugins.configs.treesitter-context").setup()
@ -129,7 +134,7 @@ return {
end,
after = {"telescope.nvim"},
requires = {
{"nvim-lua/pleanery.nvim"},
{"nvim-lua/plenary.nvim"},
{"nvim-treesitter/nvim-treesitter"}
}
},
@ -149,6 +154,7 @@ return {
},
["jackMort/ChatGPT.nvim"] = {
-- lock = true,
opt = true,
keys = {"<leader>gpt"},
module_pattern = {"chatgpt*"},
@ -207,6 +213,7 @@ return {
},
["folke/todo-comments.nvim"] = { -- {{{
lock = true,
-- commit = "6124066",
-- after = "nvim-treesitter",
setup = function()
@ -220,8 +227,10 @@ return {
["tpope/vim-surround"] = {},
["tpope/vim-abolish"] = {},
["godlygeek/tabular"] = {
lcmd = "Tabularize"
cmd = {"Tabularize"}
}, -- }}}
@ -246,6 +255,7 @@ return {
["rcarriga/nvim-dap-ui"] = {
-- tag = "*",
lock = true,
commit = "1e21b3b",
after = "nvim-dap",
config = function()
@ -255,30 +265,17 @@ return {
["theHamsta/nvim-dap-virtual-text"] = {
lock = true,
after = "nvim-dap",
-- opt = true,
after = {"nvim-dap"},
config = function()
require("nvim-dap-virtual-text").setup({
enabled = true, -- enable this plugin (the default)
enabled_commands = true, -- create commands DapVirtualTextEnable, DapVirtualTextDisable, DapVirtualTextToggle, (DapVirtualTextForceRefresh for refreshing when debug adapter did not notify its termination)
highlight_changed_variables = true, -- highlight changed values with NvimDapVirtualTextChanged, else always NvimDapVirtualText
highlight_new_as_changed = false, -- highlight new variables in the same way as changed variables (if highlight_changed_variables)
show_stop_reason = true, -- show stop reason when stopped for exceptions
commented = false, -- prefix virtual text with comment string
only_first_definition = true, -- only show virtual text at first definition (if there are multiple)
all_references = false, -- show virtual text on all all references of the variable (not only definitions)
filter_references_pattern = '<module', -- filter references (not definitions) pattern when all_references is activated (Lua gmatch pattern, default filters out Python modules)
-- experimental features:
virt_text_pos = 'eol', -- position of virtual text, see `:h nvim_buf_set_extmark()`
all_frames = true, -- show virtual text for all stack frames not only current. Only works for debugpy on my machine.
virt_lines = false, -- show virtual lines instead of virtual text (will flicker!)
virt_text_win_col = 80 -- position the virtual text at a fixed window column (starting from the first text column) ,
-- e.g. 80 to position at column 80, see `:h nvim_buf_set_extmark()`
})
require("custom.plugins.configs.dap").setup_virt_text()
-- P("config dap ui virt text")
end
}, -- }}}
-- User Interface / UX
["stevearc/dressing.nvim"] = {
lock = true,
config = function()
require("custom.plugins.configs.dressing").setup()
end
@ -288,6 +285,7 @@ return {
-- the current registerd norm command works by first selecting a visual selection
-- then doing the changes, it's an enhanced multi cursor
["smjonas/live-command.nvim"] = {
lock = true,
cmd = require("custom.plugins.configs.live-command").get_cmds(),
opt = true,
config = function()
@ -406,7 +404,7 @@ return {
-- TODO: replace with https://github.com/skywind3000/asynctasks.vim
["skywind3000/asyncrun.vim"] = { -- {{{
lock = true,
-- lock = true,
cmd = "AsyncRun",
setup = function()
require("core.utils").load_mappings "asyncrun"
@ -514,6 +512,7 @@ return {
"db*",
"aerial*",
"grapple",
"fugitive"
},
})
end
@ -551,15 +550,15 @@ return {
-- ------------------
["neovim/nvim-lspconfig"] = { -- {{{
lock = true,
after = {"mason.nvim", "mason-lspconfig.nvim", "neodev.nvim" },
module = { "lspconfig" },
lock = false,
config = function()
require("plugins.configs.lspconfig").setup()
end
},
["williamboman/mason-lspconfig.nvim"] = {
lock = false,
lock = true,
requires = { "williamboman/mason.nvim", "nvim-lspconfig" },
-- after = "mason.nvim",
module = { "mson-lspconfig.nvim", "mason.nvim" },
@ -568,7 +567,7 @@ return {
end,
},
["ray-x/guihua.lua"] = {
-- lock = true,
lock = true,
module = { "navigator" },
module_pattern = {"guihua*"},
run = "cd lua/fzy && make",
@ -584,7 +583,7 @@ return {
-- ["https://git.sp4ke.xyz/sp4ke/navigator.lua"] =
--
["ray-x/navigator.lua"] = {
lock = false,
lock = true,
opt = true,
module = "navigator",
after = { "nvim-lspconfig", "base46", "ui", "mason.nvim", "mason-lspconfig.nvim", "neodev.nvim", "null-ls.nvim"},
@ -612,6 +611,7 @@ return {
}, -- }}}
["jose-elias-alvarez/null-ls.nvim"] = {
lock = true,
requires = {"nvim-lua/plenary.nvim"},
setup = function()
require('core.utils').load_mappings 'null_ls'
@ -631,7 +631,7 @@ return {
--
['stevearc/aerial.nvim'] = {
-- lock = true,
lock = true,
after = { "base46" },
keys = { "<Right>" },
cmd = { "Aerial*" },
@ -714,6 +714,7 @@ return {
-- neodev (replaces lua-dev)
["folke/neodev.nvim"] = {
lock = true,
-- commit = "d6212c1"
-- module = "neodev",
ft = {'lua'},
@ -729,6 +730,7 @@ return {
-- golang dev
["ray-x/go.nvim"] = { -- {{{
lock = true,
-- after = {"nvim-lspconfig", "navigator.lua", "guihua.lua"},
ft = { "go" },
opt = true,
@ -779,6 +781,7 @@ return {
-- zk nvim
["mickael-menu/zk-nvim"] = {
lock = true,
setup = function()
require("core.utils").load_mappings "zk"
end,
@ -801,7 +804,9 @@ return {
-- },
-- jupyter notebook
-- dependencies: jupyter jupytext
["luk400/vim-jukit"] = {
lock = true,
keys = '<leader>jup',
setup = function()
patterns = {

@ -16,13 +16,11 @@ M.select_sources = function()
vim.ui.select(sources, {
prompt = "select source to toggle:",
format_item = function (item)
P(item)
local enabled = item._disabled
local entry = item._disabled and '' or ''
local filetypes = ''
for ft, _ in pairs(item.filetypes) do
P(ft)
filetypes = filetypes .. ft .. '|'
end
filetypes = filetypes:gsub('|$', '')

@ -1,4 +1,9 @@
---@diagnostic disable: undefined-global
--
-- TODO!: how to cleanly exec system processes (fn.execute vs os.execute vs jobstart)
-- local function gen_uuid(args, parent)
-- t = os.execute("uuidgen")
-- end
return {
-- s("sniptest", {
@ -17,4 +22,8 @@ return {
s("pwd", f(function()
return vim.fn.getcwd()
end))
}, { --autosnippets
-- s("uuid#", f(gen_uuid))
}
--

@ -0,0 +1 @@
iabbrev .-

@ -9,3 +9,9 @@ command! -bang WA wa<bang>
command! -bang Q q<bang>
command! -bang QA qa<bang>
command! -bang Qa qa<bang>
" preview markdown in browser
command! -bang MDPreview silent !md2html --github % | pipe-to-browser
" migrate git config to blob42
command! -bang GitBlob42 %S/sp4ke.{xyz,com}/blob42.xyz/ge|%S/sp4ke/blob42/ge

Loading…
Cancel
Save