master
blob42 1 year ago
parent df39230f58
commit bd04d2a322

@ -1,6 +0,0 @@
local ok, grapple = pcall(require, "grapple")
if not ok then
vim.notify("missing module grapple", vim.log.levels.WARN)
return
end

@ -9,3 +9,4 @@
" GuiGua selected item (navigator etc )
au BufEnter * hi GuihuaListSelHl gui=underline guibg=bg

@ -0,0 +1 @@
-- require('scratch.remote-lsp').setup_lsp_dirhook()

@ -144,6 +144,7 @@ M.general = { --{{{
-- new buffer
["<leader>bb"] = { "<cmd> enew <CR>", "new buffer" },
["<leader>bv"] = { "<cmd> enew <CR>", "new buffer" },
-- new tab
["<leader><Tab>"] = { "<cmd> tabe <CR>", "new tab" },
@ -372,12 +373,12 @@ M.general = { --{{{
-- operator pending
o = {
["S"] = { "<Plug>(leap-forward-to)" },
["S"] = { "<Plug>(leap-forward-to)", opts = { remap = true} },
},
-- select mode (with completion)
-- select mode (with completion) see after/plugin/mappings.*
s = {
["<BS>"] = {"<BS>i"}, -- delete and go to insert mode
["<BS><BS>"] = {"<BS>i", "delete then go insert"},
},
-- visual exclusive mode (ignore select)
@ -805,6 +806,24 @@ M.nvterm = { --{{{
end,
"new vertical term",
},
-- Running commands
["<leader>rf"] = {function()
local nvterm_utils = require('spike.utils.nvterm')
nvterm_utils.run_cmd(nil, { mode = "float" })
end, "run cmd in floating terminal"},
["<leader>rv"] = {function()
local nvterm_utils = require('spike.utils.nvterm')
nvterm_utils.run_cmd(nil, { mode = "vertical" })
end, "run cmd in floating terminal"},
["<leader><UP>"] = {function()
local nvterm_utils = require('spike.utils.nvterm')
nvterm_utils.rerun_last_cmd()
end, "rerun last float term cmd"},
},
} --}}}
@ -864,13 +883,30 @@ M.asyncrun = { --{{{
n = {
-- TODO: find new mapping to close quickfix
-- ["``"] = { "<cmd> call asyncrun#quickfix_toggle(8)<CR>", "toggle quickfix window" },
["<leader>m"] = { ":AsyncRun -program=" .. vim.o.makeprg .. "<CR>", "make using asyncrun" },
["<leader>ar"] = { ":AsyncRun ", "custom asyncrun command" },
-- HELP:
-- adding ! after AsyncRun disables autoscroll
["<leader>m"] = { ":AsyncRun -program=" .. vim.o.makeprg .. "<CR>", "make using quickfix asyncrun" },
["<leader>mf"] = { function()
require('spike.utils.nvterm').run_cmd(vim.o.makeprg, { mode = "float"} )
end, "run make in a floating terminal" },
["<leader>rx"] = {function()
vim.ui.input( { prompt="tmux cmd:> " }, function (input)
vim.cmd("AsyncRun -mode=term -pos=tmux " .. input)
end)
end, "custom asyncrun command (tmux)" },
["<leader>pd"] = { "<cmd> AsyncRun lpr -P PDF_PRINT %<CR>", "PDF print file" },
["<leader>pp"] = { "<cmd> AsyncRun lpr %<CR>" },
},
} --}}}
M.overseer = {
plugin = true,
n = {
["<leader>oo"] = {"<cmd> OverseerOpen <CR>", "open overseer"},
["<leader>ot"] = {"<cmd> OverseerToggle <CR>", "open overseer"},
}
}
M.vim_bookmarks = { --{{{
n = {
["<BS>m"] = { "<cmd> Telescope vim_bookmarks<CR>", "show bookmarks" },
@ -978,21 +1014,55 @@ M.grapple = {
require("grapple").tag({ name = input })
end)
end, "grapple tag with name" },
--TODO: keybind for popup select names
[",,m"] = { "<cmd> lua require'grapple'.select({name='mappings'})<CR>" },
[",,p"] = { "<cmd> lua require'grapple'.select({name='plugins'})<CR>" },
[",,P"] = { "<cmd> lua require'grapple'.select({name='Plugins'})<CR>" },
}
}
local function get_zk_notedirs()
local abs_dirs = vim.fn.system("fd . -t d " .. vim.env['ZK_NOTEBOOK_DIR'])
local note_dirs = {}
for _,v in ipairs(vim.split(abs_dirs, "\n")) do
local ndir = string.gsub(v, vim.env['ZK_NOTEBOOK_DIR'] .. '/', '')
ndir = ndir:gsub("(.*)(/)$", "%1")
if ndir ~= "" then
table.insert(note_dirs,ndir)
end
end
vim.ui.select(note_dirs, { prompt = "dir:> " },
function(choice)
if choice then
require("zk.commands").get("ZkNew")({ dir = choice })
end
end)
end
M.zk = {
plugin = true,
n = {
["<leader>zn"] = {"<Cmd>ZkNew { title = vim.fn.input('Title: ') }<CR>","zk new note"},
["<leader>zk"] = {"<Cmd>ZkNotes { sort = { 'modified' }}<CR>","zk list notes"},
["<leader>zf"] = {"<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>","zk notes matching a given query"},
["<leader>zk"] = {function()
vim.ui.input({ prompt = "note title:"}, function (input)
if input then
require("zk.commands").get("ZkNew")({ title = input})
end
end)
end, "zk new note"},
["<leader>zK"] = {get_zk_notedirs, "zk new note, custom dir"},
["<leader>zo"] = {"<Cmd>ZkNotes { sort = { 'modified' }}<CR>","zk list notes"},
-- ["<leader>zf"] = {"<Cmd>ZkNotes { sort = { 'modified' }, match = vim.fn.input('Search: ') }<CR>","zk notes matching a given query"},
["<leader>zf"] = {function()
vim.ui.input({ prompt = "zk match:"}, function (input)
if input then
require("zk.commands").get("ZkNotes")({ sort = { "modified" }, match = input})
end
end)
end,"zk notes matching a given query"},
["<leader>zl"] = {"<Cmd>ZkLinks<CR>","zk links"},
["<leader>zh"] = {"<Cmd>ZkBacklinks<CR>","zk backlinks"},
-- mappings to lsp commands are in zk.lua config file
}
}

@ -66,7 +66,7 @@ opt.iskeyword:remove("-")
-- opt.foldexpr="nvim_treesitter#foldexpr()"
--
opt.foldminlines = 2
opt.foldlevelstart = 0
opt.foldlevelstart = 1
opt.conceallevel=1 -- how to show text with :syn-conceal syntax
opt.list = true -- show tabs,trailing spaces and non-breakable spaces

@ -133,7 +133,7 @@ local opts = {
-- Fold code when you open/collapse symbols in the tree.
-- Only works when manage_folds = true
link_tree_to_folds = true,
link_tree_to_folds = false,
-- Use symbol tree for folding. Set to true or false to enable/disable
-- 'auto' will manage folds if your previous foldmethod was 'manual'

@ -0,0 +1,169 @@
local ok, dressing = pcall(require, "dressing")
if not ok then
vim.notify("missing module dressing", vim.log.levels.WARN)
return
end
local M = {}
config = {
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input:",
-- Can be 'left', 'right', or 'center'
prompt_align = "left",
-- When true, <Esc> will close the modal
insert_only = true,
-- When true, input will start in insert mode.
start_in_insert = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
-- Set to `false` to disable
mappings = {
n = {
["<Esc>"] = "Close",
["<CR>"] = "Confirm",
},
i = {
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
["<Up>"] = "HistoryPrev",
["<Down>"] = "HistoryNext",
},
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
backend = { "fzf_lua", "telescope", "fzf", "builtin", "nui" },
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({...})
telescope = nil,
-- Options for fzf selector
fzf = {
window = {
width = 0.5,
height = 0.4,
},
},
-- Options for fzf_lua selector
fzf_lua = {
winopts = {
width = 0.5,
height = 0.6,
},
},
-- Options for nui Menu
nui = {
position = "50%",
size = nil,
relative = "editor",
border = {
style = "rounded",
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 10,
},
max_width = 80,
max_height = 40,
min_width = 40,
min_height = 10,
},
-- Options for built-in selector
builtin = {
-- These are passed to nvim_open_win
anchor = "NW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
-- Set to `false` to disable
mappings = {
["<Esc>"] = "Close",
["<C-c>"] = "Close",
["<CR>"] = "Confirm",
},
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
},
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
}
M.setup = function()
dressing.setup(config)
end
return M

@ -4,8 +4,6 @@ if not present then
return
end
fzf.register_ui_select()
local options = {
keymap = {

@ -151,6 +151,7 @@ local config = {
-- disable auto start of lsp per language
-- set global default on lspconfig (see lspconfig doc)
gopls = {
-- cmd = {"socat", "-" ,"tcp:localhost:4444"},
-- on_attach = require("spike.lsp.go").custom_attach,
on_attach = require("spike.lsp.go").gopls_onattach,
settings = {

@ -0,0 +1,17 @@
local ok, overseer = pcall(require, 'overseer')
if not ok then
vim.notify("missing module overseer", vim.log.levels.WARN)
return
end
opts = {
}
local M = {}
M.setup = function()
require("overseer").setup(opts)
end
return M

@ -12,6 +12,10 @@ local opts = {
name = "zk",
-- on_attach = ...
-- etc, see `:h vim.lsp.start_client()`
on_attach = function(client, bufnr)
vim.keymap.set("n", "K", "<cmd> lua vim.lsp.buf.hover()<CR>", { desc = "zk lsp hover"})
vim.keymap.set("v", "<leader>za", ":'<,'> vim.lsp.buf.range_code_action()<CR>", { desc = { "zk range code action"}})
end
},
-- automatically attach buffers in a zk notebook that match the given filetypes

@ -219,7 +219,12 @@ return {
}, -- }}}
-- User Interface / UX
--
["stevearc/dressing.nvim"] = {
config = function()
require("custom.plugins.configs.dressing").setup()
end
},
-- allows to preview commands after they are registerd by plugin
-- the current registerd norm command works by first selecting a visual selection
-- then doing the changes, it's an enhanced multi cursor
@ -302,6 +307,7 @@ return {
}, -- }}}
["cbochs/grapple.nvim"] = {
commit = "50b8271",
setup = function()
require("core.utils").load_mappings "grapple"
end,
@ -311,6 +317,8 @@ return {
-- Leave empty to use the default configuration
-- Please see the Configuration section below for more information
save_path = vim.fn.stdpath("data") .. "/" .. "grapple.json",
scope = "global",
log_level = "debug",
})
end
@ -347,7 +355,17 @@ return {
}, -- }}}
-- TODO: asynctsks vs overseer: task runner and job management
-- ["stevarc/overseer.nvim"] = {},
-- NOTE: asynctasks uses AsyncRun !!
["stevearc/overseer.nvim"] = {
cmd = {"Overseer*"},
setup = function()
require 'core.utils'.load_mappings 'overseer'
end,
config = function()
require("custom.plugins.configs.overseer").setup()
end,
},
-- Git
["lewis6991/gitsigns.nvim"] = {
@ -399,6 +417,7 @@ return {
}, -- }}}}}}
-- options are defined in plugin/globals.vim
["MattesGroeger/vim-bookmarks"] = { -- {{{
config = function()
require("core.utils").load_mappings "vim_bookmarks"

@ -16,15 +16,16 @@ function M.gopls_onattach(client, bufnr)
return
end
-- Auto import on save
-- autocmd({"BufWritePre", "InsertLeave"}, {
autocmd({"BufWritePre"}, {
group = augroup(augroupname, {clear = true}),
buffer = bufnr,
callback = function()
goformat.goimport()
end
})
-- autocmd({"BufWritePre"}, {
-- group = augroup(augroupname, {clear = true}),
-- buffer = bufnr,
-- callback = function()
-- goformat.goimport()
-- end
-- })
require("core.utils").load_mappings "golang"

@ -0,0 +1,38 @@
local ok, terminal = pcall(require, 'nvterm.terminal')
if not ok then
vim.notify("missing module nvterm.terminal", vim.log.levels.WARN)
return
end
local M = {}
M.last_cmds = {}
---run cmd using builtin terminal
---@alias mode "vertical" | "horizontal" | "float"
---@param input string command to be run in term
---@param opts? { mode: mode } options
M.run_cmd = function(input, opts)
opts = opts or { mode = "vertical" }
if input then
table.insert(M.last_cmds, 1, input)
terminal.send(input, opts.mode)
return
end
vim.ui.input({ prompt = "float term cmd:> "}, function(linput)
table.insert(M.last_cmds, 1, linput)
terminal.send(linput, opts.mode)
end)
end
M.rerun_last_cmd = function()
P(M.last_cmds)
if #M.last_cmds > 0 then terminal.send(M.last_cmds[1]) end
end
return M

@ -4,4 +4,34 @@ return {
-- s("testgo", {
-- t"Hello go snippet"
-- })
-- defer
s("def", fmt([[
defer func(){{
{}
}}()
]],
{
i(0)
})
),
-- defer and handle error from some call
s({trig = "defe", dscr = "defer with error"}, fmt([[
defer func(){{
err := {}
if err != nil {{
{}
}}
}}()
]],
{
i(1),
i(0)
})
),
}

@ -13,13 +13,15 @@ return M
-- repeat nodes
-- TODO: split dot and pull last name
s("req", fmt("local {} = require('{}')", {
-- local require
s("lreq", fmt("local {} = require('{}')", {
i(1, "default"),
rep(1)
}) ),
-- if require
s("ifreq", fmt([[
local ok, {} = pcall(require, "{}")
local ok, {} = pcall(require, '{}')
if not ok then
vim.notify("missing module {}", vim.log.levels.WARN)
return
@ -34,4 +36,17 @@ return M
),
-- add packer plugin
s({ trig = "plug", dscr = "add packer plugin"}, fmt([[
["{}"] = {{
config = function()
require("custom.plugins.configs.{}").{}
end,
}},
]], {
i(1),
i(2),
i(0)
}))
}

@ -1,4 +1,4 @@
- remember live command
- !{motion}{filter} filter text lines through ext program
- !!{filter} filter lines through ext program
- review using C-x C-l with context aware situation

Loading…
Cancel
Save