rewrote date inserter to insert at the cursor

This commit is contained in:
2025-12-29 10:36:57 -06:00
parent 17962caff1
commit 4eca421fa7
4 changed files with 2923 additions and 57 deletions

View File

@@ -34,8 +34,8 @@ vim.call('plug#end')
--└──────────────┘
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.numberwidth = 4
vim.opt.wrap = true
vim.opt.numberwidth = 5
vim.opt.wrap = false
vim.opt.breakindent = true
--┌────────┐
@@ -87,6 +87,7 @@ vim.opt.autochdir = true
vim.opt.mouse = ""
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.cpoptions:append("J")
--┌─────────────┐
--│ │
@@ -96,22 +97,23 @@ vim.opt.splitright = true
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.keymap.set({"n" , "v"} , "<leader>'" , ":e .<CR>" , { desc = "OPEN THE CURRENT BUFFER'S DIRECTORY" })
--vim.keymap.set({"n" , "v"} , "<leader><leader>" , ":HopWord<CR>" , { desc = "HOP TO WORDS" })
vim.keymap.set({"n" , "v"} , "<leader>C" , ":put =execute('lua =" , { desc = "QUICK LUA CALCULATION AND INSERT" })
vim.keymap.set({"n" , "v"} , "<leader>E" , ":set ve=none<CR>" , { desc = "DISABLE VISUAL EDIT MODE" })
vim.keymap.set({"n" , "v"} , "<leader>b" , "ly$h%p" , { desc = "COPY CONTEXT COMMENT TO OTHER END OF SCOPE" })
vim.keymap.set({"n" , "v"} , "<leader>c" , ":lua =" , { desc = "QUICK LUA CALCULATION" })
vim.keymap.set({"n" , "v"} , "<leader>d" , ":put =strftime('%Y-%m-%d-%H:%M:%S')<CR> :normal I[<ESC>A]<ESC>kJ" , { desc = "APPEND TIMESTAMP TO LINE" })
vim.keymap.set({"n" , "v"} , "<leader>e" , ":set ve=all<CR>" , { desc = "ENABLE VISUAL EDIT MODE" })
vim.keymap.set({"n" , "v"} , "<leader>o" , ":buffer<Space>" , { desc = "BUFFER MENU" })
vim.keymap.set({"n" , "v"} , "<leader>p" , "\"*p" , { desc = "PASTE FROM CLIPBOARD" })
vim.keymap.set({"n" , "v"} , "<leader>te" , ":Tabularize /=<CR>" , { desc = "FORMAT MARKDOWN TABLES" })
vim.keymap.set({"n" , "v"} , "<leader>tt" , ":Tabularize /|/l0<CR>" , { desc = "FORMAT MARKDOWN TABLES" })
vim.keymap.set({"n" , "v"} , "<leader>v" , ":VBoxO<CR>" , { desc = "DISABLE VISUAL EDIT MODE" })
vim.keymap.set({"n" , "v"} , "<leader>w" , "<C-w><C-w>" , { desc = "SWITCH WINDOW" })
vim.keymap.set({"n" , "v"} , "<leader>x<Space>" , ":%s/ \\+$//<CR>" , { desc = "REMOVE ALL TRAILING SPACES" })
vim.keymap.set({"n" , "v"} , "<leader>y" , "\"+y" , { desc = "YANK TO CLIPBOARD" })
vim.keymap.set({"n" , "v"} , "<leader>'" , ":e .<CR>" , { desc = "OPEN THE CURRENT BUFFER'S DIRECTORY" })
--vim.keymap.set({"n" , "v"} , "<leader><leader>" , ":HopWord<CR>" , { desc = "HOP TO WORDS" })
vim.keymap.set({"n" , "v"} , "<leader>C" , ":put =execute('lua =" , { desc = "QUICK LUA CALCULATION AND INSERT" })
vim.keymap.set({"n" , "v"} , "<leader>E" , ":set ve=none<CR>" , { desc = "DISABLE VISUAL EDIT MODE" })
vim.keymap.set({"n" , "v"} , "<leader>b" , "ly$h%p" , { desc = "COPY CONTEXT COMMENT TO OTHER END OF SCOPE" })
vim.keymap.set({"n" , "v"} , "<leader>c" , ":lua =" , { desc = "QUICK LUA CALCULATION" })
--vim.keymap.set({"n" , "v"} , "<leader>d" , ":put =strftime('%Y-%m-%d-%H:%M:%S')<CR> :normal I[<ESC>A]<ESC>kJ" , { desc = "APPEND TIMESTAMP TO LINE" })
vim.keymap.set({"n"} , "<leader>d" , function() vim.api.nvim_put({os.date('%Y-%m-%d-%H:%M:%S')},'c',true,true) end , { desc = "APPEND TIMESTAMP TO LINE" })
vim.keymap.set({"n" , "v"} , "<leader>e" , ":set ve=all<CR>" , { desc = "ENABLE VISUAL EDIT MODE" })
vim.keymap.set({"n" , "v"} , "<leader>o" , ":buffer<Space>" , { desc = "BUFFER MENU" })
vim.keymap.set({"n" , "v"} , "<leader>p" , "\"*p" , { desc = "PASTE FROM CLIPBOARD" })
vim.keymap.set({"n" , "v"} , "<leader>te" , ":Tabularize /=<CR>" , { desc = "FORMAT MARKDOWN TABLES" })
vim.keymap.set({"n" , "v"} , "<leader>tt" , ":Tabularize /|/l0<CR>" , { desc = "FORMAT MARKDOWN TABLES" })
vim.keymap.set({"n" , "v"} , "<leader>v" , ":VBoxO<CR>" , { desc = "DISABLE VISUAL EDIT MODE" })
vim.keymap.set({"n" , "v"} , "<leader>w" , "<C-w><C-w>" , { desc = "SWITCH WINDOW" })
vim.keymap.set({"n" , "v"} , "<leader>x<Space>" , ":%s/ \\+$//<CR>" , { desc = "REMOVE ALL TRAILING SPACES" })
vim.keymap.set({"n" , "v"} , "<leader>y" , "\"+y" , { desc = "YANK TO CLIPBOARD" })
--┌───────────┐
--│ │
@@ -134,39 +136,25 @@ vim.opt.clipboard:append("unnamedplus")
--│ Treesitter │
--│ │
--└────────────┘
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "javascript", "html", "nginx", "bash", "cmake"},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = false,
-- List of parsers to ignore installing (or "all")
--ignore_install = { "javascript" },
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
highlight = {
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
--disable = { "c", "rust" },
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
require'nvim-treesitter'.setup{
ensure_installed = { "bash", "c", "css", "cpp", "go", "html", "java", "javascript", "json", "lua", "markdown", "markdown_inline", "python", "rust", "tsx", "typescript" },
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
additional_vim_regex_highlighting = false,
},
-- incremental_selection = {
-- enable = true,
-- keymaps = {
-- init_selection = "gnn", -- set to `false` to disable one of the mappings
-- node_incremental = "grn",
-- scope_incremental = "grc",
-- node_decremental = "grm",
-- },
-- },
}
--┌──────────────┐