Merge branch 'master' of gitea.srvlan:sp4ke/my-nvim-lua

master
moonblade 1 year ago
commit be356fa4da

@ -1 +1,7 @@
set formatoptions+=r " auto add comments on line return
" formatting with gofmt
" au BufEnter *.go set formatprg=gofmt\ -s
" au BufEnter *.go set formatprg=goimports
"
nnoremap <Space>fm :%!goimports<CR>

@ -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" },
@ -267,6 +272,7 @@ M.general = { --{{{
["g."] = { ":cwd<CR>", "change dir to current file", opts = { remap = true } },
["<leader>g."] = { ":Gcd<CR>", "change dir to git root" },
-- Packer commands
--
-- PackerSnapshot
@ -277,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()
@ -961,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>" },
}
}
@ -989,9 +996,12 @@ 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>gp"] = { "<cmd> lua require'gitsigns'.preview_hunk()<CR>",
["<leader>gr"] = { "<cmd> lua require'gitsigns'.reset_buffer()<CR>",
"Reset the lines of all hunks in the buffer",
},
["<leader>gpr"] = { "<cmd> lua require'gitsigns'.preview_hunk()<CR>",
"Git preview hunk",
},
["<leader>gu"] = { "<cmd> lua require'gitsigns'.undo_stage_hunk()<CR>",
@ -1009,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>" },
}
}
@ -1070,4 +1081,38 @@ 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 }},
}
}
M.null_ls = {
plugin = true,
n = {
["<leader>nlr"] = {function()
require('null-ls').toggle({
name = 'revive'
})
end, "null-ls toggle golang linter <revive>"},
}
}
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,11 +34,14 @@ M.override = {
St_LspInfo = {
fg = "white"
},
LineNr = {
fg = "#5f4468"
},
}
M.add = {
Visual = {
bg = "blue",
bg = "#ff7775",
fg = "black",
},
BookmarkSign = {

@ -0,0 +1,91 @@
local M = {}
M.load_api_key = function()
local openai_api_key_path = vim.fn.expand('$XDG_CONFIG_HOME') .. '/openai/token'
local openai_api_key = vim.fn.readfile(openai_api_key_path, '', 1)
vim.fn.setenv('OPENAI_API_KEY', openai_api_key[1])
end
local config = {
-- welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
loading_text = "loading",
question_sign = "", -- you can use emoji if you want e.g. 🙂
answer_sign = "", -- 🤖
max_line_length = 120,
yank_register = "+",
chat_layout = {
relative = "editor",
position = "50%",
size = {
height = "80%",
width = "80%",
},
},
settings_window = {
border = {
style = "rounded",
text = {
top = " Settings ",
},
},
},
chat_window = {
filetype = "chatgpt",
border = {
highlight = "FloatBorder",
style = "rounded",
text = {
top = " ChatGPT ",
},
},
},
chat_input = {
prompt = "",
border = {
highlight = "FloatBorder",
style = "rounded",
text = {
top_align = "center",
top = " Prompt ",
},
},
},
openai_params = {
model = "text-davinci-003",
frequency_penalty = 0,
presence_penalty = 0,
max_tokens = 300,
temperature = 0,
top_p = 1,
n = 1,
},
openai_edit_params = {
model = "code-davinci-edit-001",
temperature = 0,
top_p = 1,
n = 1,
},
keymaps = {
close = { "<C-c>", "<Esc>" },
yank_last = "<C-y>",
scroll_up = "<C-u>",
scroll_down = "<C-d>",
toggle_settings = "<C-o>",
new_session = "<C-n>",
cycle_windows = "<Tab>",
},
}
M.setup = function()
local ok, chatgpt = pcall(require, 'chatgpt')
if not ok then
vim.notify("missing module chatgpt", vim.log.levels.WARN)
return
end
chatgpt.setup(config)
end
return M

@ -1,3 +1,8 @@
local ok, null_ls = pcall(require, 'null-ls')
if not ok then
vim.notify("missing module null-ls", vim.log.levels.WARN)
end
local M = {}
local config = {
@ -11,10 +16,17 @@ local config = {
lsp_codelens = false, -- use navigator
textobjects = true,
dap_debug_keymap = false,
-- dap_debug_gui = false,
-- dap_debug_vt = false,
log_path = vim.fn.stdpath('cache') .. '/gonvim.log',
}
function M.setup()
require("go").setup(config)
require("go").setup(config)
local gotest = require('go.null_ls').gotest()
local gotest_codeaction = require("go.null_ls").gotest_action()
null_ls.register(gotest)
null_ls.register(gotest_codeaction)
end
return M

@ -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

@ -10,7 +10,7 @@ local config = {
}
M = {}
local M = {}
M.setup = function()
signature.setup(config)
end

@ -4,6 +4,7 @@ if not present then
return
end
local M = {}
local types = require("luasnip.util.types")
local options = {

@ -5,7 +5,7 @@ if not present then
end
M = {}
local M = {}
local config = {
bookmark_0 = {

@ -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"},
@ -169,18 +171,22 @@ local config = {
}
}
},
sumneko_lua = {
before_init=require("neodev.lsp").before_init,
}
["neodev"] = {
library = {
enabled = true,
runtime = true,
-- plugins = true,
plugins = {"plenary.nvim"},
-- plugins = {"navigator.lua", "guihua.lua", "go.nvim", "plenary.nvim"},
types = true,
},
setup_jsonls = true,
},
-- FIX: deperecated https://github.com/ray-x/navigator.lua/commit/1b2a0856f4adfffc5c4e785a6779c62759c8c926
-- ["neodev"] = {
-- library = {
-- enabled = true,
-- runtime = true,
-- -- plugins = true,
-- plugins = {"plenary.nvim"},
-- -- plugins = {"navigator.lua", "guihua.lua", "go.nvim", "plenary.nvim"},
-- types = true,
-- },
-- setup_jsonls = true,
-- },
}
}

@ -0,0 +1,45 @@
local present, neodev = pcall(require, "neodev")
if not present then
return
end
local M = {}
local config = {
library = {
enabled = true, -- when not enabled, neodev will not change any settings to the LSP server
-- these settings will be used for your Neovim config directory
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 = {"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" },
},
setup_jsonls = true, -- configures jsonls to provide completion for project specific .luarc.json files
-- for your Neovim config directory, the config.library settings will be used as is
-- for plugin directories (root_dirs having a /lua directory), config.library.plugins will be disabled
-- for any other directory, config.library.enabled will be set to false
-- override = function(root_dir, options) end,
-- NOTE: using navigator I have to include the custom before_init
-- With lspconfig, Neodev will automatically setup your lua-language-server
-- If you disable this, then you have to set {before_init=require("neodev.lsp").before_init}
-- in your lsp start options
lspconfig = true,
-- much faster, but needs a recent built of lua-language-server
-- needs lua-language-server >= 3.6.0
pathStrict = true,
}
M.setup = function()
neodev.setup(config)
end
return M

@ -0,0 +1,47 @@
local ok, null_ls = pcall(require, 'null-ls')
if not ok then
vim.notify("missing module null-ls", vim.log.levels.WARN)
return
end
local vim, api = vim, vim.api
local M = {}
M.config = {
debounce = 1000,
default_timeout = 5000,
sources = {
null_ls.builtins.code_actions.gitsigns,
-- null_ls.builtins.diagnostics.golangci_lint,
-- golang revive
null_ls.builtins.diagnostics.revive,
},
on_attach = function(client, bufnr)
local util = require('navigator.util')
local log = util.log
local trace = util.trace
require('navigator.lspclient.highlight').add_highlight()
require('navigator.lspclient.highlight').diagnositc_config_sign()
api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
require('navigator.lspclient.mapping').setup({
client = client,
bufnr = bufnr,
})
if client.server_capabilities.documentHighlightProvider == true then
trace('attaching doc highlight: ', bufnr, client.name)
vim.defer_fn(function()
require('navigator.dochighlight').documentHighlight(bufnr)
end, 50) -- allow a bit time for it to settle down
else
log('skip doc highlight: ', bufnr, client.name)
end
require('navigator.lspclient.lspkind').init()
end
}
M.setup = function()
null_ls.setup(M.config)
end
return M

@ -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

@ -4,7 +4,7 @@ if not present then
return
end
M = {}
local M = {}
local config = {
keywords = {
@ -25,7 +25,7 @@ local config = {
},
highlight = {
-- multiline = false,
after = "fg",
after = "",
}
}

@ -114,6 +114,58 @@ 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>ghp"},
setup= function()
require("core.utils").load_mappings "copilot"
end
},
["MunifTanjim/nui.nvim"] = {
module = {"nui.layout", "nui.popup"},
module_pattern = {"nui.*"}
},
["jackMort/ChatGPT.nvim"] = {
opt = true,
keys = {"<leader>gpt"},
module_pattern = {"chatgpt*"},
after = {"nui.nvim", "telescope.nvim"},
setup = function()
require("custom.plugins.configs.chat-gpt").load_api_key()
end,
config = function()
require("custom.plugins.configs.chat-gpt").setup()
end,
requires = {
"MunifTanjim/nui.nvim",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
}
},
-- snippets
["honza/vim-snippets"] = { -- {{{
module = { "cmp", "cmp_nvim_lsp" },
@ -156,7 +208,7 @@ return {
["folke/todo-comments.nvim"] = { -- {{{
-- commit = "6124066",
after = "nvim-treesitter",
-- after = "nvim-treesitter",
setup = function()
-- require("core.lazy_load").on_file_open "todo-comments"
require("core.utils").load_mappings "todo-comments"
@ -176,7 +228,7 @@ return {
-- ["p00f/nvim-ts-rainbow"] = {
-- opt = true,
-- },
--
-- dap
@ -193,7 +245,8 @@ return {
},
["rcarriga/nvim-dap-ui"] = {
tag = "*",
-- tag = "*",
commit = "1e21b3b",
after = "nvim-dap",
config = function()
require('custom.plugins.configs.dapui').setup()
@ -248,6 +301,15 @@ return {
keys = { "<leader>", "<BS>", "<Space>", "\"", "`", "'", "z", "g" }
},
-- scren saver
["folke/drop.nvim"] = {
opt = true,
config = function()
require("drop").setup()
end
},
-- repeat operator for plugin commands
["tpope/vim-repeat"] = {
keys = { "." },
@ -278,7 +340,7 @@ return {
["ibhagwan/fzf-lua"] = {
lock = true,
after = "ui",
config = function()
eonfig = function()
require("custom.plugins.configs.fzflua")
require("plugins.configs.others").devicons()
end,
@ -289,7 +351,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"
@ -313,20 +375,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
@ -459,6 +513,7 @@ return {
"terminal*",
"db*",
"aerial*",
"grapple",
},
})
end
@ -496,7 +551,7 @@ return {
-- ------------------
["neovim/nvim-lspconfig"] = { -- {{{
after = { "neodev.nvim", "mason.nvim", "mason-lspconfig.nvim" },
after = {"mason.nvim", "mason-lspconfig.nvim", "neodev.nvim" },
module = { "lspconfig" },
lock = false,
config = function()
@ -531,15 +586,15 @@ return {
lock = false,
opt = true,
module = "navigator",
after = { "nvim-lspconfig", "base46", "ui", "mason.nvim", "mason-lspconfig.nvim", "neodev.nvim" },
after = { "nvim-lspconfig", "base46", "ui", "mason.nvim", "mason-lspconfig.nvim", "neodev.nvim", "null-ls.nvim"},
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")
@ -555,6 +610,16 @@ return {
}, -- }}}
["jose-elias-alvarez/null-ls.nvim"] = {
requires = {"nvim-lua/plenary.nvim"},
setup = function()
require('core.utils').load_mappings 'null_ls'
end,
config = function()
require("custom.plugins.configs.null-ls").setup()
end,
},
-- side panel with symbols (replaced by Navigator :LspSymbols cmd)
-- ["liuchengxu/vista.vim"] = {
-- cmd = "Vista",
@ -650,6 +715,11 @@ return {
["folke/neodev.nvim"] = {
-- commit = "d6212c1"
-- module = "neodev",
ft = {'lua'},
module = {'neodev'},
config = function()
require('custom.plugins.configs.neodev').setup()
end
},
["hrsh7th/cmp-nvim-lua"] = { -- NOTE: needs to be disabled for neodev
disable = true,
@ -658,12 +728,13 @@ return {
-- golang dev
["ray-x/go.nvim"] = { -- {{{
lock = true,
-- after = {"nvim-lspconfig", "navigator.lua", "guihua.lua"},
ft = { "go" },
opt = true,
after = {"null-ls.nvim"},
config = function()
require("custom.plugins.configs.gonvim").setup()
require("core.utils").load_mappings "gonvim"
end
}, -- }}}
@ -698,7 +769,7 @@ return {
-- https://github.com/kristijanhusak/vim-dadbod-ui
["tpope/vim-dadbod"] = {
ft = "sql",
cmd = {"DBUI"},
cmd = {"DBUI"},
},
["kristijanhusak/vim-dadbod-ui"] = {
after = {"vim-dadbod"},
@ -715,9 +786,17 @@ return {
end
},
-- Python
["dccsillag/magma-nvim"] = {
opt = true,
run = ':UpdateRemotePlugins',
},
-- 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"] = { },-- }}}
}

@ -107,6 +107,11 @@ return {
local Lsp = vim.lsp.util.get_progress_messages()[1]
-- hide spammy null-ls progress
if Lsp and Lsp.name:match "null%-ls" then
return ""
end
if vim.o.columns < 120 or not Lsp then
return ""
end

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

@ -1,7 +1,7 @@
local libmodal = require 'libmodal'
local daputils = require 'spike.dap.utils'
M = {}
local M = {}
M.layer = nil

@ -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,23 @@ 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 (entry itself not the file)
: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`
## Delete lines matching pattern
!! Use the :global command
:g/profile/d

Loading…
Cancel
Save