muchos updates

master
blob42 1 year ago
parent f1514bc67a
commit f0bb3b9021

@ -12,6 +12,7 @@ M.general = { --{{{
["jk"] = { "<esc>", "escape" },
-- navigate within insert mode
["<C-h>"] = { "<Left>", "move left" },
["<C-l>"] = { "<Right>", "move right" },
@ -37,6 +38,10 @@ M.general = { --{{{
"no highlight"
},
-- smoth scrolling with M-j M-k
["<M-j>"] = { "<C-e>", "scroll down"},
["<M-k>"] = { "<C-y>", "scroll down"},
-- switch between windows
["<C-h>"] = { "<C-w>h", "window left" },
["<C-l>"] = { "<C-w>l", "window right" },
@ -278,7 +283,7 @@ M.general = { --{{{
end
, "packer snapshot" },
["<leader>pst"] = { "<cmd> PackerStatus<CR>", "packer status" },
["<leader>psc"] = { "<cmd> PackerSync<CR>", "packer sync" },
-- ["<leader>psc"] = { "<cmd> PackerSync<CR>", "packer sync" },
["<leader>pc"] = { "<cmd> PackerCompile<CR>", "packer compile" },
["<leader>pr"] = { function()
@ -962,10 +967,11 @@ M.vimux = {
}
-- extra mappings for golang
M.golang = {
M.gonvim = {
plugin = true,
n = {
["<leader>da"] = { "<cmd> GoDebug -a<CR>", "go debug attach" },
-- ["<leader>da"] = { "<cmd> GoDebug -a<CR>", "go debug attach" },
["<leader>gotf"] = { "<cmd> GoTestFunc<CR>" },
}
}
@ -990,7 +996,10 @@ M.gitsigns = {
"Git stage buffer",
},
["<leader>gR"] = { "<cmd> lua require'gitsigns'.reset_buffer_index()<CR>",
"Git reset buffer index",
"Unstage all hunks for current buffer in the index",
},
["<leader>gr"] = { "<cmd> lua require'gitsigns'.reset_buffer()<CR>",
"Reset the lines of all hunks in the buffer",
},
["<leader>gp"] = { "<cmd> lua require'gitsigns'.preview_hunk()<CR>",
"Git preview hunk",
@ -1010,18 +1019,19 @@ M.gitsigns = {
M.grapple = {
plugin = true,
n = {
[",J"] = { "<cmd> lua require'grapple'.cycle_forward()<CR>" },
[",K"] = { "<cmd> lua require'grapple'.cycle_backward()<CR>" },
[",T"] = { "<cmd> GrappleTag<CR>"},
[",N"] = { function()
["<leader>J"] = { "<cmd> lua require'grapple'.cycle_forward()<CR>" },
["<leader>K"] = { "<cmd> lua require'grapple'.cycle_backward()<CR>" },
["<leader>T"] = { "<cmd> GrappleTag<CR>"},
["<leader>N"] = { function()
vim.ui.input({ prompt = "tag: " }, function(input)
require("grapple").tag({ name = input })
require("grapple").tag({ key = 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>" },
["<leader><leader>m"] = { "<cmd> lua require'grapple'.select({key='mappings'})<CR>" },
["<leader><leader>p"] = { "<cmd> lua require'grapple'.select({key='plugins'})<CR>" },
["<leader><leader>P"] = { "<cmd> lua require'grapple'.select({key='Plugins'})<CR>" },
["<leader><leader>g"] = { "<cmd> lua require'grapple'.popup_tags()<CR>" },
}
}
@ -1071,4 +1081,27 @@ M.zk = {
}
}
M.copilot = {
plugin = true,
n = {
-- copilot options here
}
}
M.navigator = {
plugin = true,
n = {
["<leader>gt"] = { function() require('navigator.treesitter').buf_ts() end, 'TS buf symbols'},
["<leader>gT"] = { function() require('navigator.treesitter').bufs_ts() end, 'TS bufs symbols'},
['<Leader>ct'] = { function() require('navigator.ctags').ctags() end, 'lsp ctags' },
}
}
M.refactoring = {
plugin = true,
v = {
["<leader>rr"] = {":lua require'refactoring'.select_refactor()<CR>", "refactoring using telescope", opts = { expr = false }},
}
}
return M

@ -169,7 +169,7 @@ end
local default_providers = {
"node",
"perl",
"python3",
-- "python3",
"ruby",
}

@ -16,7 +16,8 @@ local highlights = require "custom.highlights"
-- vim.tbl_deep_extend("force", M.ui.hl_add, custom_theme)
M.ui = {
theme = "gruvbox_material",
-- theme = "gruvbox_material",
theme = "ayu-dark",
theme_toggle = { "gruvbox_material", "gruvbox_light" },
transparency = true,
hl_override = highlights.override,

@ -34,6 +34,9 @@ M.override = {
St_LspInfo = {
fg = "white"
},
LineNr = {
fg = "#5f4468"
},
}
M.add = {

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

@ -11,6 +11,8 @@ local config = {
lsp_codelens = false, -- use navigator
textobjects = true,
dap_debug_keymap = false,
-- dap_debug_gui = false,
-- dap_debug_vt = false,
}
function M.setup()

@ -0,0 +1,22 @@
local ok, grapple = pcall(require, 'grapple')
if not ok then
vim.notify("missing module grapple", vim.log.levels.WARN)
return
end
local M = {}
local config = {
-- Your configuration goes here
-- Leave empty to use the default configuration
-- Please see the Configuration section below for more information
scope = "git",
log_level = "warn",
}
M.setup = function()
grapple.setup(config)
end
return M

@ -27,9 +27,11 @@ local config = {
{ key = 'gd', func = require('navigator.definition').definition, desc = 'lsp definition' },
{ key = 'gD', func = vim.lsp.buf.declaration, desc = 'lsp declaration' },
{ key = 'gp', func = require('navigator.definition').definition_preview, desc = 'lsp definition_preview' },
{ key = '<Leader>gt', func = require('navigator.treesitter').buf_ts, desc = 'lsp buf_ts' },
{ key = '<Leader>gT', func = require('navigator.treesitter').bufs_ts, desc = 'lsp bufs_ts' },
{ key = '<Leader>ct', func = require('navigator.ctags').ctags, desc = 'lsp ctags' },
-- handled by main mappings
-- { key = '<Leader>gt', func = require('navigator.treesitter').buf_ts, desc = 'lsp buf_ts' },
-- { key = '<Leader>gT', func = require('navigator.treesitter').bufs_ts, desc = 'lsp bufs_ts' },
-- { key = '<Leader>ct', func = require('navigator.ctags').ctags, desc = 'lsp ctags' },
{ key = 'K', func = vim.lsp.buf.hover, desc = 'lsp hover' },
{ key = '<M-a>', mode = 'n', func = require('navigator.codeAction').code_action, desc = 'lsp code_action' },
{ key = '<M-a>', mode = 'i', func = require('navigator.codeAction').code_action, desc = 'lsp code_action' },
@ -48,8 +50,8 @@ local config = {
{ key = '<Space>D', func = vim.lsp.buf.type_definition, desc = 'lsp type_definition' },
{ key = 'gL', func = require('navigator.diagnostics').show_diagnostics, desc = 'lsp show_diagnostics' },
{ key = 'gG', func = require('navigator.diagnostics').show_buf_diagnostics, desc = 'lsp show_buf_diagnostics' },
{ key = '<Leader>dt', func = require('navigator.diagnostics').toggle_diagnostics, desc = 'lsp toggle_diagnostics' },
{ key = '<Leader>td', func = require('spike.diagnostics').toggle, desc = 'lsp toggle_diagnostics' },
-- { key = '<Leader>dt', func = require('navigator.diagnostics').toggle_diagnostics, desc = 'lsp toggle_diagnostics' },
-- { key = '<Leader>td', func = require('spike.diagnostics').toggle, desc = 'lsp toggle_diagnostics' },
{ key = ']d', func = vim.diagnostic.goto_next, desc = 'lsp next diagnostics' },
{ key = '[d', func = vim.diagnostic.goto_prev, desc = 'lsp prev diagnostics' },
{ key = ']O', func = vim.diagnostic.set_loclist, desc = 'lsp diagnostics set loclist' },
@ -144,7 +146,7 @@ local config = {
},
diagnostic_scrollbar_sign = false,
display_diagnostic_qf = false,
disply_diagnostic_qf = false,
disable_lsp = {"clangd", "rust_analyzer"},
@ -170,6 +172,7 @@ local config = {
}
},
-- FIX: deperecated https://github.com/ray-x/navigator.lua/commit/1b2a0856f4adfffc5c4e785a6779c62759c8c926
["neodev"] = {
library = {
enabled = true,

@ -0,0 +1,34 @@
local ok, refactoring = pcall(require, 'refactoring')
if not ok then
vim.notify("missing module refactoring", vim.log.levels.WARN)
return
end
local M = {}
local config = {
-- prompt for return type
prompt_func_return_type = {
go = true,
cpp = true,
c = true,
java = true,
},
-- prompt for function parameters
prompt_func_param_type = {
go = true,
cpp = true,
c = true,
java = true,
},
}
M.setup = function()
refactoring.setup(config)
-- require("telescope").load_extension("refactoring")
end
return M

@ -114,6 +114,51 @@ return {
end
}, -- }}}
["hrsh7th/cmp-copilot"] = {
after = "copilot.vim"
},
-- Code Refactoring
["ThePrimeagen/refactoring.nvim"] = {
setup = function()
require("core.utils").load_mappings "refactoring"
end,
config = function()
require("custom.plugins.configs.refactoring").setup()
end,
after = {"telescope.nvim"},
requires = {
{"nvim-lua/pleanery.nvim"},
{"nvim-treesitter/nvim-treesitter"}
}
},
-- AI/Deep Learning Helpers
-- Github Copilot
["github/copilot.vim"] = {
opt = true,
keys = {"<leader>gpt"},
setup= function()
require("core.utils").load_mappings "copilot"
end
},
["jackMort/ChatGPT.nvim"] = {
opt = true,
config = function()
-- require("custom.plugins.configs.chatgpt").setup()
require("chatgpt").setup({
-- optional configuration
})
end,
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
},
-- snippets
["honza/vim-snippets"] = { -- {{{
module = { "cmp", "cmp_nvim_lsp" },
@ -193,7 +238,8 @@ return {
},
["rcarriga/nvim-dap-ui"] = {
tag = "*",
-- tag = "*",
commit = "1e21b3b",
after = "nvim-dap",
config = function()
require('custom.plugins.configs.dapui').setup()
@ -287,7 +333,7 @@ return {
["ibhagwan/fzf-lua"] = {
lock = true,
after = "ui",
config = function()
eonfig = function()
require("custom.plugins.configs.fzflua")
require("plugins.configs.others").devicons()
end,
@ -298,7 +344,7 @@ return {
-- Theme customization
["uga-rosa/ccc.nvim"] = { -- {{{{{{
commit = "427471b",
-- commit = "427471b",
cmd = { "Ccc*", "<Plug>(ccc-insert)" },
setup = function()
require("core.utils").load_mappings "ccc"
@ -322,20 +368,12 @@ return {
}, -- }}}
["cbochs/grapple.nvim"] = {
commit = "50b8271",
-- commit = "50b8271",
setup = function()
require("core.utils").load_mappings "grapple"
end,
config = function()
require("grapple").setup({
-- Your configuration goes here
-- 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",
})
require('custom.plugins.configs.grapple').setup()
end
},
-- tmux helpers
@ -468,6 +506,7 @@ return {
"terminal*",
"db*",
"aerial*",
"grapple",
},
})
end
@ -544,11 +583,11 @@ return {
requires = { "neovim/nvim-lspconfig", "ray-x/guihua.lua", "nvim-treesitter/nvim-treesitter" },
setup = function()
require("core.lazy_load").on_file_open "navigator.lua"
-- require("core.utils").load_mappings "navigator"
end,
config = function()
require("custom.plugins.configs.navigator").setup()
require("base46").load_highlight "lsp"
require("core.utils").load_mappings "navigator"
-- TODO: use nvchadui_lsp features manually
-- require("nvchad_ui.lsp")
@ -667,12 +706,12 @@ return {
-- golang dev
["ray-x/go.nvim"] = { -- {{{
lock = true,
-- after = {"nvim-lspconfig", "navigator.lua", "guihua.lua"},
ft = { "go" },
opt = true,
config = function()
require("custom.plugins.configs.gonvim").setup()
require("core.utils").load_mappings "gonvim"
end
}, -- }}}
@ -724,9 +763,21 @@ return {
end
},
-- Python
-- theseraus{{{
-- ["Ron89/thesaurus_query.vim"] = { },
-- setup in after/plugin/vim-lexical
-- requires a thesearus file like from here:
-- https://www.gutenberg.org/files/3202/files/
["preservim/vim-lexical"] = { },-- }}}
}

@ -161,6 +161,7 @@ local options = {
},
{ name = "nvim_lua", priority = 900 },
{ name = "path" },
{ name = "copilot" },
},
}

@ -27,7 +27,7 @@ function M.gopls_onattach(client, bufnr)
-- end
-- })
require("core.utils").load_mappings "golang"
-- require("core.utils").load_mappings "golang"
end

@ -44,4 +44,26 @@ end
end
end
-- convert timestamp under cursor in milliseconds to a human readable string
-- @param timestamp in milliseconds
-- @return human readable string
M.human_timestamp = function()
cword = vim.fn.expand('<cword>')
-- make sure cword is a number
local n = tonumber(cword)
if n == nil then return end
local time = os.date("*t", cword / (1000*1000))
format = string.format("%04d-%02d-%02d %02d:%02d:%02d", time.year, time.month, time.day, time.hour, time.min, time.sec)
vim.notify(format, vim.lsp.log_levels.INFO)
end
-- 1663878015759000
-- 1670185951498000
-- M.human_timestamp()
return M

@ -36,3 +36,18 @@ a line break is inserted before the appended text.
like from a scheduled func call or timer, save the var in vim.g and access it
as global variable
# Refactoring
* [refactoring article](https://alpha2phi.medium.com/neovim-for-beginners-refactoring-4f517d12a43f)
:argdo — Execute the command for each file in the argument list
:bufdo — Execute the command in each buffer in the buffer list
:tabdo — Execute the command in each tab page
:windo — Execute the command in each window
:cdo — Execute the command in each valid entry in the quickfix list
:cfdo — Execute the command in each file in the quickfix list
:vimgrep `:vimgrep /<pattern>/ ##` where ## is replaces with files in arg list
## Filtering quickfix
`packadd cfilter`
`:Cfilter /pattern/`
`:Lfilter /pattern`

Loading…
Cancel
Save