Iniital upload
Removing from my nixos config to add congruency with all nvim installs
This commit is contained in:
9
lua/autocmds.lua
Normal file
9
lua/autocmds.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
local vim = vim
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
|
||||
group = vim.api.nvim_create_augroup("TWTask", { clear = true }),
|
||||
pattern = "*.wiki", -- Pattern to match Markdown files
|
||||
callback = function()
|
||||
vim.cmd('TWSyncTasks')
|
||||
end,
|
||||
})
|
||||
112
lua/completion.lua
Normal file
112
lua/completion.lua
Normal file
@@ -0,0 +1,112 @@
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<C-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "copilot", group_index = 3 },
|
||||
{ name = "nvim_lsp", group_index = 1 },
|
||||
{ name = "path", group_index = 3 },
|
||||
{ name = "luasnip", group_index = 2 },
|
||||
{ name = "buffer" },
|
||||
{ name = "calc" },
|
||||
{ name = 'orgmode' },
|
||||
-- { name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
{ name = "crates" },
|
||||
-- { name = 'cmdline' },
|
||||
-- { name = 'neorg' },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
{ name = "cmdline" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Set up lspconfig.
|
||||
-- require("cmp_nvim_lsp").default_capabilities()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
require("lspconfig").clangd.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").taplo.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").marksman.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").lua_ls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").rust_analyzer.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").zls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
require("lspconfig").pyright.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
-- require'lspconfig'.jedi_language_server.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- }
|
||||
60
lua/diagnostics.lua
Normal file
60
lua/diagnostics.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
require("tiny-inline-diagnostic").setup({
|
||||
-- Style preset for diagnostic messages
|
||||
-- Available options:
|
||||
-- "modern", "classic", "minimal", "powerline",
|
||||
-- "ghost", "simple", "nonerdfont", "amongus"
|
||||
preset = "modern",
|
||||
transparent_bg = false, -- Set the background of the diagnostic to transparent
|
||||
transparent_cursorline = false, -- Set the background of the cursorline to transparent (only one the first diagnostic)
|
||||
hi = {
|
||||
error = "DiagnosticError", -- Highlight group for error messages
|
||||
warn = "DiagnosticWarn", -- Highlight group for warning messages
|
||||
info = "DiagnosticInfo", -- Highlight group for informational messages
|
||||
hint = "DiagnosticHint", -- Highlight group for hint or suggestion messages
|
||||
arrow = "NonText", -- Highlight group for diagnostic arrows
|
||||
background = "CursorLine",
|
||||
mixing_color = "None",
|
||||
},
|
||||
|
||||
options = {
|
||||
show_source = {
|
||||
enabled = false,
|
||||
if_many = false,
|
||||
},
|
||||
use_icons_from_diagnostic = false,
|
||||
set_arrow_to_diag_color = false,
|
||||
add_messages = true,
|
||||
throttle = 20,
|
||||
softwrap = 30,
|
||||
multilines = {
|
||||
enabled = false,
|
||||
always_show = false,
|
||||
trim_whitespaces = false,
|
||||
tabstop = 4,
|
||||
},
|
||||
show_all_diags_on_cursorline = false,
|
||||
enable_on_insert = false,
|
||||
enable_on_select = false,
|
||||
|
||||
overflow = {
|
||||
mode = "wrap",
|
||||
padding = 0,
|
||||
},
|
||||
break_line = {
|
||||
enabled = false,
|
||||
after = 30,
|
||||
},
|
||||
format = nil,
|
||||
virt_texts = {
|
||||
priority = 2048,
|
||||
},
|
||||
severity = {
|
||||
vim.diagnostic.severity.ERROR,
|
||||
vim.diagnostic.severity.WARN,
|
||||
vim.diagnostic.severity.INFO,
|
||||
vim.diagnostic.severity.HINT,
|
||||
},
|
||||
overwrite_events = nil,
|
||||
},
|
||||
disabled_ft = {} -- List of filetypes to disable the plugin
|
||||
})
|
||||
166
lua/functions.lua
Normal file
166
lua/functions.lua
Normal file
@@ -0,0 +1,166 @@
|
||||
local vim = vim
|
||||
local fzflua = require("fzf-lua")
|
||||
local Job = require'plenary.job'
|
||||
|
||||
function t3_find_file()
|
||||
-- local file_name = vim.fn.input("Find File: ", "", "file")
|
||||
fzflua.files()
|
||||
end
|
||||
|
||||
function t3_recent_files()
|
||||
fzflua.oldfiles()
|
||||
end
|
||||
|
||||
function t3_org_files()
|
||||
fzflua.files({ cwd = '~/org/'})
|
||||
end
|
||||
|
||||
function t3_project_files()
|
||||
fzflua.files({ cwd = '~/Projects/'})
|
||||
end
|
||||
|
||||
function t3_dot_files()
|
||||
fzflua.files({ cwd = '~/.dotfiles/'})
|
||||
end
|
||||
|
||||
function t3_config_files()
|
||||
fzflua.files({ cwd = '~/.dotfiles/'})
|
||||
end
|
||||
|
||||
function t3_snip_capture(name)
|
||||
if type(name) ~= "string" or name == "" then
|
||||
print("Error: Invalid snippet name")
|
||||
return
|
||||
end
|
||||
-- local timestamp = os.date("%Y%m%d%H%M%S")
|
||||
local snippet_path = "~/.config/nvim/snippets/"
|
||||
local filename = snippet_path .. name:gsub("%s+", "_") .. ".lua"
|
||||
local file = io.open(vim.fn.expand(filename), "w")
|
||||
if file == nil then
|
||||
print("Error: Could not open file for editing.")
|
||||
return
|
||||
end
|
||||
local previous_buffer = vim.api.nvim_get_current_buf()
|
||||
file:write("local ls = require('luasnip')\n\nls.add_snippets(\"{}\", {\n\tls.parser.parse_snippet(\n\t\t'{}',\n\t\t'{}'),\n})")
|
||||
file:close()
|
||||
vim.cmd("e " .. filename)
|
||||
vim.bo.filetype = 'lua'
|
||||
-- vim.cmd("Neorg inject-metadata")
|
||||
-- Set an autocmd to return to the previous buffer when the note buffer is closed
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
buffer = 0, -- Current buffer (the note buffer)
|
||||
callback = function()
|
||||
load_snippets_from_directory(snippet_path)
|
||||
vim.cmd("buffer " .. previous_buffer)
|
||||
end,
|
||||
})
|
||||
print("Captured snippet: " .. filename)
|
||||
end
|
||||
|
||||
function t3_org_capture(name)
|
||||
if type(name) ~= "string" or name == "" then
|
||||
print("Error: Invalid note name")
|
||||
return
|
||||
end
|
||||
local timestamp = os.date("%Y%m%d%H%M%S")
|
||||
local org_path = "~/org/.org-roam/"
|
||||
local filename = org_path .. timestamp .. "-" .. name:gsub("%s+", "_") .. ".norg"
|
||||
local file = io.open(vim.fn.expand(filename), "w")
|
||||
if file == nil then
|
||||
print("Error: Could not open file for editing.")
|
||||
return
|
||||
end
|
||||
local previous_buffer = vim.api.nvim_get_current_buf()
|
||||
file:write("* " .. name .. "\n\n")
|
||||
file:close()
|
||||
vim.cmd("e " .. filename)
|
||||
vim.bo.filetype = 'norg'
|
||||
vim.cmd("Neorg inject-metadata")
|
||||
-- Set an autocmd to return to the previous buffer when the note buffer is closed
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
buffer = 0, -- Current buffer (the note buffer)
|
||||
callback = function()
|
||||
vim.cmd("buffer " .. previous_buffer)
|
||||
end,
|
||||
})
|
||||
print("Captured note: " .. filename)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'NeorgCapture',
|
||||
function()
|
||||
-- local title = vim.fn.input("Title: ")
|
||||
local current_workspace = vim.g.neorg_workspace_name
|
||||
if not current_workspace then
|
||||
vim.cmd("Neorg workspace default")
|
||||
end
|
||||
vim.ui.input({ prompt = "Enter note name: "}, function(note_name)
|
||||
if not note_name or note_name == "" then
|
||||
print("Error: Note name required!")
|
||||
return
|
||||
end
|
||||
t3_org_capture(note_name)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ nargs = 0, desc = "Capture a Neorg note" }
|
||||
)
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'CaptureSnip',
|
||||
function()
|
||||
-- local title = vim.fn.input("Title: ")
|
||||
-- local current_workspace = vim.g.neorg_workspace_name
|
||||
-- if not current_workspace then
|
||||
-- vim.cmd("Neorg workspace default")
|
||||
-- end
|
||||
vim.ui.input({ prompt = "Enter snippet name: "}, function(snip_name)
|
||||
if not snip_name or snip_name == "" then
|
||||
print("Error: Snippet name required!")
|
||||
return
|
||||
end
|
||||
t3_snip_capture(snip_name)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ nargs = 0, desc = "Capture a Neorg note" }
|
||||
)
|
||||
function t3_buffers()
|
||||
fzflua.buffers()
|
||||
end
|
||||
|
||||
function t3_tabs()
|
||||
fzflua.tabs()
|
||||
end
|
||||
|
||||
function t3_live_grep(state)
|
||||
state = state or 0
|
||||
if state == 0 then
|
||||
fzflua.live_grep()
|
||||
else
|
||||
fzflua.live_grep_resume()
|
||||
end
|
||||
end
|
||||
|
||||
function t3_grep(state)
|
||||
state = state or 0
|
||||
if state == 0 then
|
||||
fzflua.grep_project()
|
||||
else
|
||||
fzflua.grep()
|
||||
end
|
||||
end
|
||||
function t3_make_ctags()
|
||||
Job:new({
|
||||
command = 'ctags',
|
||||
args = { '-R .' },
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown", "norg", "md", "wiki" }, -- Set for markdown file type
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "<C-i>", "o* [ ] ", { noremap = true, silent = true })
|
||||
vim.api.nvim_buf_set_keymap(0, "i", "<C-i>", "<Esc>0wi* [ ] ", { noremap = true, silent = true })
|
||||
end,
|
||||
})
|
||||
112
lua/keymaps.lua
Normal file
112
lua/keymaps.lua
Normal file
@@ -0,0 +1,112 @@
|
||||
local vim = vim
|
||||
|
||||
vim.keymap.set("n", "<C-w>s", function()
|
||||
vim.cmd("split")
|
||||
vim.cmd("wincmd j")
|
||||
end, { noremap = true })
|
||||
|
||||
vim.keymap.set("n", "<C-w>v", function()
|
||||
vim.cmd("vsplit")
|
||||
vim.cmd("wincmd l")
|
||||
end, { noremap = true })
|
||||
|
||||
-- Leader Maps
|
||||
vim.keymap.set("n", "<leader>f", "", { desc = "Files"})
|
||||
vim.keymap.set("n", "<leader>ff", ":FzfLua files<CR>", { desc = "File Finder"})
|
||||
-- vim.keymap.set("n", "<leader>fe", ":Pick files<CR>", { desc = "File Picker"})
|
||||
vim.keymap.set("n", "<leader>ft", t3_toggle_netrw, { desc = "File Tree"})
|
||||
|
||||
vim.keymap.set("n", "<leader>b", "", { desc = "Buffers"})
|
||||
vim.keymap.set("n", "<leader>bb", ":Pick buffers<CR>", { desc = "Buffer Picker"})
|
||||
vim.keymap.set("n", "<leader>bp", ":bp<CR>", { desc = "Previous"})
|
||||
vim.keymap.set("n", "<leader>bn", ":bn<CR>", { desc = "Next"})
|
||||
vim.keymap.set("n", "<leader>bd", ":bd<CR>", { desc = "Delete"})
|
||||
|
||||
vim.keymap.set("n", "<leader>g", "", { desc = "Grep"})
|
||||
vim.keymap.set("n", "<leader>gg", ":FzfLua grep<CR>", { desc = "Grep"})
|
||||
vim.keymap.set("n", "<leader>gr", ":FzfLua grep resume=true<CR>", { desc = "Resume Grep"})
|
||||
|
||||
vim.keymap.set("n", "<leader>G", "", { desc = "Git"})
|
||||
vim.keymap.set("n", "<leader>Gg", ":LazyGit<CR>", { desc = "LazyGit"})
|
||||
vim.keymap.set("n", "<leader>GC", ":LazyGitConfig<CR>", { desc = "LazyGit Config"})
|
||||
vim.keymap.set("n", "<leader>Gc", ":LazyGitFilter<CR>", { desc = "Commits"})
|
||||
vim.keymap.set("n", "<leader>Gl", ":LazyGitLog<CR>", { desc = "Log"})
|
||||
|
||||
vim.keymap.set("n", "<leader><Tab>", "", { desc = "Tabs"})
|
||||
vim.keymap.set("n", "<leader><Tab><Tab>", ":tabnew<CR>", { desc = "New Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>p", ":tabprevious<CR>", { desc = "Previous Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>n", ":tabnext<CR>", { desc = "Next Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>d", ":tabclose<CR>", { desc = "Delete Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>l", ":tablast<CR>", { desc = "Last Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>f", ":tabfirst<CR>", { desc = "First Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>m", ":tabmove<CR>", { desc = "Move Tab"})
|
||||
vim.keymap.set("n", "<leader><Tab>r", ":tabrenumber<CR>", { desc = "Renumber Tabs"})
|
||||
vim.keymap.set("n", "<leader><Tab>c", ":tabclose!<CR>", { desc = "Force Close Tab"})
|
||||
|
||||
vim.keymap.set("n", "gR", "<CMD>Glance references<CR>", { desc = "Glance References" })
|
||||
vim.keymap.set("n", "gD", "<CMD>Glance definitions<CR>", { desc = "Glance Definitions" })
|
||||
vim.keymap.set("n", "gY", "<CMD>Glance type_definitions<CR>", { desc = "Glance Type Definitions" })
|
||||
vim.keymap.set("n", "gM", "<CMD>Glance implementations<CR>", { desc = "Glance Implementations" })
|
||||
|
||||
vim.keymap.set("n", "<A-Tab>", ":b#<CR>", { desc = "Switch to Last Buffer" })
|
||||
vim.keymap.set("n", "<A-Left>", ":bprevious<CR>", { desc = "Previous Buffer" })
|
||||
vim.keymap.set("n", "<A-Right>", ":bnext<CR>", { desc = "Next Buffer" })
|
||||
vim.keymap.set("n", "<A-Up>", ":tabprevious<CR>", { desc = "Previous Tab" })
|
||||
vim.keymap.set("n", "<A-Down>", ":tabnext<CR>", { desc = "Next Tab" })
|
||||
vim.keymap.set("n", "<A-1>", "<Cmd>BufferGoto 1<CR>", { desc = "Go to Buffer 1" })
|
||||
vim.keymap.set("n", "<A-2>", "<Cmd>BufferGoto 2<CR>", { desc = "Go to Buffer 2" })
|
||||
vim.keymap.set("n", "<A-3>", "<Cmd>BufferGoto 3<CR>", { desc = "Go to Buffer 3" })
|
||||
vim.keymap.set("n", "<A-4>", "<Cmd>BufferGoto 4<CR>", { desc = "Go to Buffer 4" })
|
||||
vim.keymap.set("n", "<A-5>", "<Cmd>BufferGoto 5<CR>", { desc = "Go to Buffer 5" })
|
||||
vim.keymap.set("n", "<A-6>", "<Cmd>BufferGoto 6<CR>", { desc = "Go to Buffer 6" })
|
||||
vim.keymap.set("n", "<A-7>", "<Cmd>BufferGoto 7<CR>", { desc = "Go to Buffer 7" })
|
||||
vim.keymap.set("n", "<A-8>", "<Cmd>BufferGoto 8<CR>", { desc = "Go to Buffer 8" })
|
||||
vim.keymap.set("n", "<A-9>", "<Cmd>BufferGoto 9<CR>", { desc = "Go to Buffer 9" })
|
||||
vim.keymap.set("n", "<A-0>", "<Cmd>BufferLast<CR>", { desc = "Go to Last Buffer" })
|
||||
|
||||
-- Meta X Maps
|
||||
vim.keymap.set("n", "<M-x><M-x>", ":Telescope commands<CR>", { desc = "Commands"})
|
||||
vim.keymap.set("n", "<M-x>b", ":Telescope buffers<CR>", { desc = "Buffers"})
|
||||
vim.keymap.set("n", "<M-x>f", ":Telescope find_files<CR>", { desc = "Find Files"})
|
||||
vim.keymap.set("n", "<M-x>g", ":Telescope live_grep<CR>", { desc = "Live Grep"})
|
||||
vim.keymap.set("n", "<M-x>h", ":Telescope help_tags<CR>", { desc = "Help Tags"})
|
||||
vim.keymap.set("n", "<M-x>p", ":Telescope project<CR>", { desc = "Projects"})
|
||||
vim.keymap.set("n", "<M-x>l", ":Telescope resume<CR>", { desc = "Resume Last Search"})
|
||||
vim.keymap.set("n", "<M-x>c", ":Telescope colorscheme<CR>", { desc = "Colorschemes"})
|
||||
vim.keymap.set("n", "<M-x>n", ":enew<CR>", { desc = "New File"})
|
||||
vim.keymap.set("n", "<M-x>s", ":w<CR>", { desc = "Save File"})
|
||||
vim.keymap.set("n", "<M-x>q", ":q<CR>", { desc = "Quit"})
|
||||
vim.keymap.set("n", "<M-x>w", ":bd<CR>", { desc = "Close Buffer"})
|
||||
vim.keymap.set("n", "<M-x>a", "ggVG", { desc = "Select All"})
|
||||
vim.keymap.set("n", "<M-x>z", "u", { desc = "Undo"})
|
||||
vim.keymap.set("n", "<M-x>y", "<C-r>", { desc = "Redo"})
|
||||
vim.keymap.set("n", "<M-x>/", ":nohlsearch<CR>", { desc = "Clear Search Highlight"})
|
||||
vim.keymap.set("n", "<M-x>=", ":vertical resize +5<CR>", { desc = "Increase Window Width"})
|
||||
vim.keymap.set("n", "<M-x>-"," :vertical resize -5<CR>", { desc = "Decrease Window Width"})
|
||||
vim.keymap.set("n", "<M-x>+", ":resize +5<CR>", { desc = "Increase Window Height"})
|
||||
vim.keymap.set("n", "<M-x>_", ":resize -5<CR>", { desc = "Decrease Window Height"})
|
||||
vim.keymap.set("n", "<M-x>Left", ":vertical resize -5<CR>", { desc = "Decrease Window Width"})
|
||||
vim.keymap.set("n", "<M-x>Right"," :vertical resize +5<CR>", { desc = "Increase Window Width"})
|
||||
vim.keymap.set("n", "<M-x>Up", ":resize +5<CR>", { desc = "Increase Window Height"})
|
||||
vim.keymap.set("n", "<M-x>Down", ":resize -5<CR>", { desc = "Decrease Window Height"})
|
||||
vim.keymap.set("n", "<M-x>Enter", ":ToggleTerm<CR>", { desc = "Toggle Terminal"})
|
||||
|
||||
|
||||
-- CTRL X Maps
|
||||
vim.keymap.set("n", "<C-x><C-b>", ":Pick buffers<CR>", { desc = "Buffer Picker"})
|
||||
vim.keymap.set("n", "<C-x><C-f>", ":Pick files<CR>", { desc = "File Picker"})
|
||||
vim.keymap.set("n", "<C-x><C-h>", ":Pick help<CR>", { desc = "Help Picker"})
|
||||
vim.keymap.set("n", "<C-x><C-g>", "", { desc = "Grep"})
|
||||
vim.keymap.set("n", "<C-x><C-g>g", ":Pick grep<CR>", { desc = "Grep"})
|
||||
vim.keymap.set("n", "<C-x><C-g>l", ":Pick grep_live<CR>", { desc = "Live Grep"})
|
||||
vim.keymap.set("n", "<C-x><C-n>", "", { desc = "Notes"})
|
||||
vim.keymap.set("n", "<C-x><C-n>e", "<cmd>TWEditTask<cr>", { desc = "TaskWarrior Edit", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-x><C-n>v", "<cmd>TWView<cr>", { desc = "View Tasks", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-x><C-n>u", "<cmd>TWUpdateCurrent<cr>", { desc="Update Tasks", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-x><C-n>s", "<cmd>TWSyncTasks<cr>", { desc = "Sync Tasks", noremap = true, silent = true })
|
||||
vim.keymap.set("n", "<C-x><C-n><c-space>", "<cmd>TWToggle<cr>", { desc = "Toggle Taskwarrior", silent = true })
|
||||
|
||||
vim.keymap.set("v", "<C-;><C-c>", ":'<,'>SnipRun<CR>", { silent = true, desc = "Run Selection" })
|
||||
vim.keymap.set("n", "<C-;><C-c>", ":<Plug>SnipRun<CR>", { desc = "Run Current Line" })
|
||||
vim.keymap.set("n", "<C-;><C-b>", ":%SnipRun<CR>", { desc = "Run Buffer" })
|
||||
vim.keymap.set("n", "<C-;><C-k>", "<Plug>SnipReset<CR>", { desc = "Run Buffer" })
|
||||
57
lua/lsp.lua
Normal file
57
lua/lsp.lua
Normal file
@@ -0,0 +1,57 @@
|
||||
local vim = vim
|
||||
-- vim.cmd [[
|
||||
-- augroup LspCompletion
|
||||
-- autocmd!
|
||||
-- autocmd InsertEnter * setlocal omnifunc=v:lua.vim.lsp.omnifunc
|
||||
-- autocmd TextChangedI * if pumvisible() == 0 | silent! lua vim.fn.complete(vim.fn.col('.'), vim.fn["vim.lsp.omnifunc"]()) | endif
|
||||
-- augroup END
|
||||
-- ]]
|
||||
vim.lsp.enable('lua_ls')
|
||||
vim.lsp.enable('gopls', {
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
unusedwrite = true,
|
||||
shadow = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
usePlaceholders = true,
|
||||
hints = {
|
||||
assignVariableTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
compositeLiteralTypes = true,
|
||||
functionTypeParameters = true,
|
||||
parameterNames = true,
|
||||
rangeVariableTypes = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require("lsp_signature").setup({
|
||||
debug = false,
|
||||
bind = true, -- registers signature handler
|
||||
doc_lines = 10,
|
||||
max_height = 12,
|
||||
max_width = function() return math.floor(vim.api.nvim_win_get_width(0) * 0.8) end,
|
||||
wrap = true,
|
||||
floating_window = true, -- show the popup
|
||||
floating_window_above_cur_line = true,
|
||||
floating_window_off_x = 1,
|
||||
floating_window_off_y = 0,
|
||||
|
||||
-- IMPORTANT: don’t inline (you can change later if you want)
|
||||
hint_enable = true,
|
||||
hint_inline = function() return false end,
|
||||
|
||||
hint_prefix = "🐼 ",
|
||||
hint_scheme = "String",
|
||||
hi_parameter = "LspSignatureActiveParameter",
|
||||
handler_opts = { border = "rounded" },
|
||||
|
||||
always_trigger = false,
|
||||
extra_trigger_chars = { "(", "," }, -- good default
|
||||
zindex = 200,
|
||||
padding = "",
|
||||
timer_interval = 200,
|
||||
})
|
||||
55
lua/options.lua
Normal file
55
lua/options.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
local vim = vim
|
||||
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
vim.o.tabstop = 2
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.wrap = false
|
||||
vim.o.scrolloff = 5
|
||||
vim.o.colorcolumn = "80"
|
||||
vim.o.wildmenu = true
|
||||
vim.o.wildmode = "longest:full,full"
|
||||
vim.o.wildoptions = "pum"
|
||||
vim.g.mapleader = " "
|
||||
vim.o.termguicolors = true
|
||||
vim.o.winborder = "shadow"
|
||||
vim.o.clipboard = "unnamedplus"
|
||||
vim.o.completeopt = "menuone"
|
||||
-- vim.o.completeopt = "menuone,noinsert,noselect"
|
||||
vim.o.cursorline = true
|
||||
vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||
vim.g.netrw_keepdir = 1
|
||||
vim.g.netrw_winsize = 20
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_localcopydircmd = 'cp -avr'
|
||||
vim.g.netrw_liststyle = 3
|
||||
vim.g.netrw_browse_split = 4
|
||||
|
||||
vim.o.foldmethod = "expr"
|
||||
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
vim.o.foldlevel = 1
|
||||
vim.o.foldenable = true
|
||||
|
||||
vim.o.undofile = true
|
||||
vim.o.undodir = vim.fn.stdpath("data") .. "/undo"
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "help",
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = ".wiki",
|
||||
callback = function()
|
||||
vim.cmd("VimwikiGenerateLinks")
|
||||
end,
|
||||
})
|
||||
138
lua/plugins.lua
Normal file
138
lua/plugins.lua
Normal file
@@ -0,0 +1,138 @@
|
||||
local vim = vim
|
||||
local host = vim.loop.os_gethostname()
|
||||
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/folke/tokyonight.nvim" },
|
||||
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
|
||||
{ src = "https://github.com/ibhagwan/fzf-lua" },
|
||||
{ src = "https://github.com/echasnovski/mini.pick" },
|
||||
{ src = "https://github.com/echasnovski/mini.icons" },
|
||||
{ src = "https://github.com/echasnovski/mini.files" },
|
||||
{ src = "https://github.com/echasnovski/mini.pairs" },
|
||||
{ src = "https://github.com/echasnovski/mini.notify" },
|
||||
{ src = "https://github.com/echasnovski/mini.surround" },
|
||||
{ src = "https://github.com/echasnovski/mini.indentscope" },
|
||||
{ src = "https://github.com/echasnovski/mini.fuzzy" },
|
||||
{ src = "https://github.com/echasnovski/mini.tabline" },
|
||||
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
|
||||
{ src = "https://github.com/folke/which-key.nvim" },
|
||||
{ src = "https://github.com/L3MON4D3/LuaSnip" },
|
||||
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||
{ src = "https://github.com/hrsh7th/nvim-cmp" },
|
||||
{ src = "https://github.com/hrsh7th/cmp-nvim-lsp" },
|
||||
{ src = "https://github.com/hrsh7th/cmp-buffer" },
|
||||
{ src = "https://github.com/hrsh7th/cmp-path" },
|
||||
{ src = "https://github.com/hrsh7th/cmp-cmdline" },
|
||||
{ src = "https://github.com/hrsh7th/cmp-nvim-lua" },
|
||||
{ src = "https://github.com/saadparwaiz1/cmp_luasnip" },
|
||||
{ src = "https://github.com/github/copilot.vim" },
|
||||
{ src = "https://github.com/pysan3/pathlib.nvim" },
|
||||
{ src = "https://github.com/nvim-orgmode/org-bullets.nvim" },
|
||||
{ src = "https://github.com/lukas-reineke/headlines.nvim" },
|
||||
{ src = "https://github.com/michaelb/sniprun", run = "bash install.sh 1" },
|
||||
{ src = "https://github.com/akinsho/toggleterm.nvim" },
|
||||
{ src = "https://github.com/kdheepak/lazygit.nvim" },
|
||||
{ src = "https://github.com/saecki/crates.nvim" },
|
||||
{ src = "https://github.com/nvim-treesitter/nvim-treesitter" },
|
||||
{ src = "https://github.com/folke/trouble.nvim" },
|
||||
{ src = "https://github.com/folke/todo-comments.nvim" },
|
||||
{ src = "https://github.com/MunifTanjim/nui.nvim" },
|
||||
{ src = "https://github.com/huantrinh1802/m_taskwarrior_d.nvim" },
|
||||
{ src = "https://github.com/rmagatti/auto-session" },
|
||||
{ src = "https://github.com/romgrk/barbar.nvim" },
|
||||
{ src = "https://github.com/christoomey/vim-tmux-navigator" },
|
||||
{ src = "https://github.com/rachartier/tiny-inline-diagnostic.nvim" },
|
||||
{ src = "https://github.com/zeioth/garbage-day.nvim" },
|
||||
{ src = "https://github.com/ray-x/lsp_signature.nvim" },
|
||||
{ src = "https://github.com/DNLHC/glance.nvim" },
|
||||
{ src = "https://github.com/rmagatti/logger.nvim" },
|
||||
{ src = "https://github.com/rmagatti/goto-preview" },
|
||||
{ src = "https://github.com/norcalli/nvim-colorizer.lua" },
|
||||
{ src = "https://github.com/nvim-lua/plenary.nvim" },
|
||||
{ src = "https://github.com/nvim-telescope/telescope.nvim" },
|
||||
{ src = "https://github.com/nvim-telescope/telescope-project.nvim"},
|
||||
{ src = "https://github.com/nvim-telescope/telescope-ui-select.nvim" },
|
||||
{ src = "https://github.com/luckasRanarison/nvim-devdocs" },
|
||||
{ src = "https://github.com/folke/noice.nvim" },
|
||||
{ src = "https://github.com/mbbill/undotree.git" },
|
||||
})
|
||||
|
||||
if host == "xps13" then
|
||||
end
|
||||
|
||||
require('mini.icons').setup({})
|
||||
require('mini.pick').setup({})
|
||||
require('mini.pairs').setup({})
|
||||
require('mini.notify').setup({})
|
||||
require('mini.surround').setup({})
|
||||
require('mini.indentscope').setup({})
|
||||
require('mini.tabline').setup({})
|
||||
require('mini.fuzzy').setup({})
|
||||
require('lualine').setup({ options = { theme = 'tokyonight' } })
|
||||
require('which-key').setup({})
|
||||
require('fzf-lua').setup({})
|
||||
require('crates').setup({})
|
||||
require('todo-comments').setup({
|
||||
options = {
|
||||
keywords = {
|
||||
FIX = {
|
||||
icon = " ", -- icon used for the sign, and in search results
|
||||
color = "error", -- can be a hex color, or a named color (see below)
|
||||
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
|
||||
-- signs = false, -- configure signs for some keywords individually
|
||||
},
|
||||
TODO = { icon = " ", color = "info" },
|
||||
HACK = { icon = " ", color = "warning" },
|
||||
WARN = { icon = " ", color = "warning", alt = { "WARNING", "XXX" } },
|
||||
PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
|
||||
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||
TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
|
||||
},
|
||||
}
|
||||
})
|
||||
require('trouble').setup({})
|
||||
require('org-bullets').setup({})
|
||||
require('headlines').setup({})
|
||||
require('sniprun').setup({
|
||||
binary_path = '/home/th3r00t/.local/share/nvim/site/pack/core/opt/sniprun/\
|
||||
target/release/sniprun'
|
||||
})
|
||||
require('toggleterm').setup({
|
||||
size = 20,
|
||||
open_mapping = [[<c- >]],
|
||||
hide_numbers = true,
|
||||
shade_filetypes = {},
|
||||
shading_factor = 2,
|
||||
start_in_insert = true,
|
||||
insert_mappings = true,
|
||||
persist_size = true,
|
||||
direction = 'horizontal',
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
})
|
||||
require('m_taskwarrior_d').setup({})
|
||||
require("auto-session").setup({
|
||||
suppressed_dirs = { "~/Downloads", "~/Documents", "~/Projects", "~/" },
|
||||
})
|
||||
require('barbar').setup({})
|
||||
require('goto-preview').setup({ default_mappings = true })
|
||||
require('colorizer').setup({})
|
||||
require('telescope').setup({})
|
||||
require('nvim-devdocs').setup({})
|
||||
require('noice').setup({
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
bottom_search = true, -- use a classic bottom cmdline for search
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
})
|
||||
|
||||
32
lua/telescope_configuration.lua
Normal file
32
lua/telescope_configuration.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
local vim = vim
|
||||
local host = vim.loop.os_gethostname()
|
||||
|
||||
require('telescope').load_extension('project')
|
||||
require('telescope').load_extension('ui-select')
|
||||
|
||||
require('telescope').setup{
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-u>"] = false,
|
||||
["<C-d>"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
-- Default configuration for builtin pickers goes here:
|
||||
-- picker_name = {
|
||||
-- picker_config_key = value,
|
||||
-- ...
|
||||
-- }
|
||||
-- Now the picker_config_key will be applied every time you call this
|
||||
-- builtin picker
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {
|
||||
-- even more opts
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
11
lua/terminal.lua
Normal file
11
lua/terminal.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = { buffer = 0 }
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
end
|
||||
|
||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
11
lua/treesitter.lua
Normal file
11
lua/treesitter.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
local configs = require('nvim-treesitter.configs')
|
||||
configs.setup({
|
||||
-- ensure_installed = {
|
||||
-- "ini", "bash", "c", "lua", "vim", "vimdoc", "query", "python",
|
||||
-- "rust", "zig", "typescript", "svelte", "css", "html", "nix"
|
||||
-- },
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { "norg" }, },
|
||||
incremental_selection = { enable = true },
|
||||
})
|
||||
11
lua/utils/reload.lua
Normal file
11
lua/utils/reload.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
for name,_ in pairs(package.loaded) do
|
||||
if name:match("^t3")
|
||||
or name:match("^options")
|
||||
or name:match("^overrides")
|
||||
or name:match("^plugins")
|
||||
or name:match("keymaps")
|
||||
or name:match("^reload")
|
||||
then
|
||||
package.loaded[name] = nil
|
||||
end
|
||||
end
|
||||
187
lua/utils/t3_functions.lua
Normal file
187
lua/utils/t3_functions.lua
Normal file
@@ -0,0 +1,187 @@
|
||||
local vim = vim
|
||||
local fzflua = require("fzf-lua")
|
||||
|
||||
function t3_find_file()
|
||||
-- local file_name = vim.fn.input("Find File: ", "", "file")
|
||||
fzflua.files()
|
||||
end
|
||||
|
||||
function t3_recent_files()
|
||||
fzflua.oldfiles()
|
||||
end
|
||||
|
||||
function t3_org_files()
|
||||
fzflua.files({ cwd = '~/org/'})
|
||||
end
|
||||
|
||||
function t3_project_files()
|
||||
fzflua.files({ cwd = '~/Projects/'})
|
||||
end
|
||||
|
||||
function t3_dot_files()
|
||||
fzflua.files({ cwd = '~/.dotfiles/'})
|
||||
end
|
||||
|
||||
function t3_config_files()
|
||||
fzflua.files({ cwd = '~/.dotfiles/'})
|
||||
end
|
||||
|
||||
function t3_snip_capture(name)
|
||||
if type(name) ~= "string" or name == "" then
|
||||
print("Error: Invalid snippet name")
|
||||
return
|
||||
end
|
||||
-- local timestamp = os.date("%Y%m%d%H%M%S")
|
||||
local snippet_path = "~/.config/nvim/snippets/"
|
||||
local filename = snippet_path .. name:gsub("%s+", "_") .. ".lua"
|
||||
local file = io.open(vim.fn.expand(filename), "w")
|
||||
if file == nil then
|
||||
print("Error: Could not open file for editing.")
|
||||
return
|
||||
end
|
||||
local previous_buffer = vim.api.nvim_get_current_buf()
|
||||
file:write("local ls = require('luasnip')\n\nls.add_snippets(\"{}\", {\n\tls.parser.parse_snippet(\n\t\t'{}',\n\t\t'{}'),\n})")
|
||||
file:close()
|
||||
vim.cmd("e " .. filename)
|
||||
vim.bo.filetype = 'lua'
|
||||
-- vim.cmd("Neorg inject-metadata")
|
||||
-- Set an autocmd to return to the previous buffer when the note buffer is closed
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
buffer = 0, -- Current buffer (the note buffer)
|
||||
callback = function()
|
||||
load_snippets_from_directory(snippet_path)
|
||||
vim.cmd("buffer " .. previous_buffer)
|
||||
end,
|
||||
})
|
||||
print("Captured snippet: " .. filename)
|
||||
end
|
||||
|
||||
function t3_org_capture(name)
|
||||
if type(name) ~= "string" or name == "" then
|
||||
print("Error: Invalid note name")
|
||||
return
|
||||
end
|
||||
local timestamp = os.date("%Y%m%d%H%M%S")
|
||||
local org_path = "~/org/.org-roam/"
|
||||
local filename = org_path .. timestamp .. "-" .. name:gsub("%s+", "_") .. ".norg"
|
||||
local file = io.open(vim.fn.expand(filename), "w")
|
||||
if file == nil then
|
||||
print("Error: Could not open file for editing.")
|
||||
return
|
||||
end
|
||||
local previous_buffer = vim.api.nvim_get_current_buf()
|
||||
file:write("* " .. name .. "\n\n")
|
||||
file:close()
|
||||
vim.cmd("e " .. filename)
|
||||
vim.bo.filetype = 'norg'
|
||||
vim.cmd("Neorg inject-metadata")
|
||||
-- Set an autocmd to return to the previous buffer when the note buffer is closed
|
||||
vim.api.nvim_create_autocmd("BufLeave", {
|
||||
buffer = 0, -- Current buffer (the note buffer)
|
||||
callback = function()
|
||||
vim.cmd("buffer " .. previous_buffer)
|
||||
end,
|
||||
})
|
||||
print("Captured note: " .. filename)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'NeorgCapture',
|
||||
function()
|
||||
-- local title = vim.fn.input("Title: ")
|
||||
local current_workspace = vim.g.neorg_workspace_name
|
||||
if not current_workspace then
|
||||
vim.cmd("Neorg workspace default")
|
||||
end
|
||||
vim.ui.input({ prompt = "Enter note name: "}, function(note_name)
|
||||
if not note_name or note_name == "" then
|
||||
print("Error: Note name required!")
|
||||
return
|
||||
end
|
||||
t3_org_capture(note_name)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ nargs = 0, desc = "Capture a Neorg note" }
|
||||
)
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'CaptureSnip',
|
||||
function()
|
||||
-- local title = vim.fn.input("Title: ")
|
||||
-- local current_workspace = vim.g.neorg_workspace_name
|
||||
-- if not current_workspace then
|
||||
-- vim.cmd("Neorg workspace default")
|
||||
-- end
|
||||
vim.ui.input({ prompt = "Enter snippet name: "}, function(snip_name)
|
||||
if not snip_name or snip_name == "" then
|
||||
print("Error: Snippet name required!")
|
||||
return
|
||||
end
|
||||
t3_snip_capture(snip_name)
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ nargs = 0, desc = "Capture a Neorg note" }
|
||||
)
|
||||
function t3_buffers()
|
||||
fzflua.buffers()
|
||||
end
|
||||
|
||||
function t3_tabs()
|
||||
fzflua.tabs()
|
||||
end
|
||||
|
||||
function t3_live_grep(state)
|
||||
state = state or 0
|
||||
if state == 0 then
|
||||
fzflua.live_grep()
|
||||
else
|
||||
fzflua.live_grep_resume()
|
||||
end
|
||||
end
|
||||
|
||||
function t3_grep(state)
|
||||
state = state or 0
|
||||
if state == 0 then
|
||||
fzflua.grep_project()
|
||||
else
|
||||
fzflua.grep()
|
||||
end
|
||||
end
|
||||
|
||||
local function is_netrw_open()
|
||||
for _, win in ipairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||
local buf = vim.api.nvim_win_get_buf(win)
|
||||
if vim.bo[buf].filetype == "netrw" then
|
||||
return true, win
|
||||
end
|
||||
end
|
||||
return false, nil
|
||||
end
|
||||
|
||||
function t3_toggle_netrw()
|
||||
local is_open, win = is_netrw_open()
|
||||
if is_open then
|
||||
vim.api.nvim_win_close(win, true)
|
||||
else
|
||||
vim.cmd("Lexplore")
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown", "norg", "md", "wiki" }, -- Set for markdown file type
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_keymap(0, "n", "<C-i>", "o* [ ] ", { noremap = true, silent = true })
|
||||
vim.api.nvim_buf_set_keymap(0, "i", "<C-i>", "<Esc>0wi* [ ] ", { noremap = true, silent = true })
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_user_command("Split", function()
|
||||
vim.cmd("split")
|
||||
vim.cmd("wincmd j")
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("Vsplit", function()
|
||||
vim.cmd("vsplit")
|
||||
vim.cmd("wincmd l")
|
||||
end, {})
|
||||
5
lua/utils/t3_overrides.lua
Normal file
5
lua/utils/t3_overrides.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
-- vim.api.nvim_create_autocmd("winNew", {
|
||||
-- callback = function()
|
||||
-- vim.cmd("wincmd w")
|
||||
-- end,
|
||||
-- })
|
||||
155
lua/vimwiki.lua
Normal file
155
lua/vimwiki.lua
Normal file
@@ -0,0 +1,155 @@
|
||||
local vim = vim
|
||||
local opt = vim.opt
|
||||
-- opt.wildmenu = true
|
||||
-- vim.g.netrw_keepdir = 0
|
||||
-- vim.treesitter.language.register("markdown", "vimwiki")
|
||||
-- vim.g.vimwiki_folding = 'expr'
|
||||
-- vim.g.vimwiki_header_type = "="
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
-- pattern = "*.wiki", -- Adjust this pattern if your Vimwiki files have a different extension
|
||||
-- callback = function()
|
||||
-- vim.cmd("TWSyncTasks")
|
||||
-- end,
|
||||
-- })
|
||||
-- Sync the current wiki's assets directory into its path_html/assets
|
||||
-- local function sync_assets_for_current_wiki()
|
||||
-- local vget = vim.fn['vimwiki#vars#get_wikilocal']
|
||||
-- local wiki_root = vim.fn.expand(vget('path'))
|
||||
-- local html_root = vim.fn.expand(vget('path_html'))
|
||||
-- if wiki_root == '' or html_root == '' then return end
|
||||
--
|
||||
-- local src = wiki_root .. "/assets"
|
||||
-- local dst = html_root .. "/assets"
|
||||
--
|
||||
-- -- Ensure dst exists; prefer rsync if available, else shell cp -a
|
||||
-- vim.fn.mkdir(dst, "p")
|
||||
-- local has_rsync = vim.fn.executable("rsync") == 1
|
||||
--
|
||||
-- local cmd
|
||||
-- if has_rsync then
|
||||
-- cmd = { "rsync", "-a", "--delete", src .. "/", dst .. "/" }
|
||||
-- else
|
||||
-- -- cp -a keeps tree; the dot copies contents, not the dir itself
|
||||
-- cmd = { "sh", "-lc", string.format("mkdir -p %q && cp -a %q. %q", dst, src .. "/", dst .. "/") }
|
||||
-- end
|
||||
--
|
||||
-- vim.fn.jobstart(cmd, { detach = true })
|
||||
-- end
|
||||
--
|
||||
-- -- After each wiki page save, give Vimwiki a moment to write HTML, then sync assets
|
||||
-- vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
-- pattern = "*.wiki",
|
||||
-- callback = function()
|
||||
-- vim.defer_fn(sync_assets_for_current_wiki, 150)
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- -- Also sync when you edit files under the wiki's assets dir (js/css/images)
|
||||
-- -- Adjust the glob if your wiki path differs
|
||||
-- vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
-- pattern = {
|
||||
-- vim.fn.expand("~/wiki/assets/*"),
|
||||
-- vim.fn.expand("~/wiki/assets/**/*"),
|
||||
-- },
|
||||
-- callback = function()
|
||||
-- sync_assets_for_current_wiki()
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- -- Optional: a manual command you can run anytime
|
||||
-- vim.api.nvim_create_user_command("VimwikiSyncAssets", sync_assets_for_current_wiki, {})
|
||||
|
||||
-- Autocommand to trigger LuaSnip snippet expansion for new diary files
|
||||
vim.api.nvim_create_autocmd("BufNewFile", {
|
||||
pattern = "diary/*.wiki", -- Adjust this path to match your diary directory
|
||||
callback = function()
|
||||
-- Expand the 'diary_template' snippet automatically
|
||||
ls.snip_expand(ls.snippets.diary_template[1])
|
||||
end,
|
||||
})
|
||||
vim.g.vimwiki_automatic_nested_syntaxes = 1
|
||||
vim.g.vimwiki_list = {
|
||||
{
|
||||
name = "PersonalWiki",
|
||||
path = '~/wiki/',
|
||||
path_html = '~/Public/html/',
|
||||
syntax = 'default',
|
||||
ext = '.wiki',
|
||||
diary_rel_path = 'diary/',
|
||||
diary_index = "diary_index",
|
||||
auto_tags = 1,
|
||||
auto_toc = 1,
|
||||
auto_export = 1,
|
||||
template_path = "~/wiki/templates/",
|
||||
template_default = "default",
|
||||
template_ext = ".html",
|
||||
css_name = "main.css",
|
||||
maxhi = 1, -- BUG: Can be a source of lag.
|
||||
diary_caption_level = 1,
|
||||
bullet_types = { "-", "*", "#", "→" },
|
||||
cycle_bullets = 1,
|
||||
generated_links_caption = 1,
|
||||
listsyms = '✗○◐●✓',
|
||||
-- listsym_rejected = '✗',
|
||||
auto_diary_index = 1,
|
||||
auto_generate_links = 1,
|
||||
auto_generate_tags = 1,
|
||||
exclude_files = { "**/README.md" },
|
||||
rss_name = "feed.rss",
|
||||
base_url = "https://th3r00t.net",
|
||||
}
|
||||
}
|
||||
vim.g.vimwiki_syntax_plugins = {
|
||||
codeblock = {
|
||||
["```lua"] = { parser = "lua" },
|
||||
["```python"] = { parser = "python" },
|
||||
["```javascript"] = { parser = "javascript" },
|
||||
["```bash"] = { parser = "bash" },
|
||||
["```html"] = { parser = "html" },
|
||||
["```css"] = { parser = "css" },
|
||||
["```c"] = { parser = "c" },
|
||||
["```zig"] = { parser = "zig" },
|
||||
},
|
||||
}
|
||||
vim.g.vimwiki_toc_header = "Nav"
|
||||
vim.g.vimwiki_toc_header_level = 2
|
||||
vim.g.vimwiki_hl_cb_checked = 1
|
||||
vim.g.vimwiki_global_ext = 1
|
||||
vim.g.vimwiki_auto_chdir = 1
|
||||
vim.g.wimwiki_markdown_link_ext = 1
|
||||
-- vim.g.vimwiki_folding = 'list'
|
||||
vim.g.vimwiki_folding = 'expr'
|
||||
vim.g.vimwiki_use_calendar = 1
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ww', '<Cmd>VimwikiIndex<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>wt', '<Cmd>VimwikiTabIndex<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Leader>ws', '<Cmd>VimwikiUISelect<CR>', { noremap = true, silent = true })
|
||||
local function setup_vimwiki_highlights()
|
||||
-- Define color scheme mappings
|
||||
local colors = {
|
||||
header1 = "#81a1c1", -- Tokyo Night blue
|
||||
header2 = "#88c0d0", -- Tokyo Night light blue
|
||||
header3 = "#8fbcbb", -- Tokyo Night greenish blue
|
||||
bold = "#eceff4", -- Tokyo Night bright white
|
||||
italic = "#5e81ac", -- Tokyo Night dark blue
|
||||
link = "#b48ead", -- Tokyo Night purple
|
||||
list = "#d08770", -- Tokyo Night orange
|
||||
}
|
||||
|
||||
-- Apply highlights for vimwiki syntax elements
|
||||
vim.api.nvim_set_hl(0, "VimwikiHeader1", { fg = colors.header1, bold = true })
|
||||
vim.api.nvim_set_hl(0, "VimwikiHeader2", { fg = colors.header2, bold = true })
|
||||
vim.api.nvim_set_hl(0, "VimwikiHeader3", { fg = colors.header3, bold = true })
|
||||
vim.api.nvim_set_hl(0, "VimwikiBold", { fg = colors.bold, bold = true })
|
||||
vim.api.nvim_set_hl(0, "VimwikiItalic", { fg = colors.italic, italic = true })
|
||||
vim.api.nvim_set_hl(0, "VimwikiLink", { fg = colors.link, underline = true })
|
||||
vim.api.nvim_set_hl(0, "VimwikiList", { fg = colors.list })
|
||||
end
|
||||
setup_vimwiki_highlights()
|
||||
-- Define the Lua function for generating the diary template
|
||||
--
|
||||
vim.pack.add({
|
||||
{ src = "https://github.com/vimwiki/vimwiki", opt = true },
|
||||
})
|
||||
|
||||
vim.cmd.packadd("vimwiki")
|
||||
Reference in New Issue
Block a user