Updated neovim config

This commit is contained in:
Ethan Smith-Coss 2024-10-02 17:27:37 +01:00
parent 2c2f613248
commit 44a03e92e0
Signed by: TheOnePath
GPG Key ID: 1D351CCC6D01F32B
36 changed files with 1336 additions and 719 deletions

View File

@ -1,186 +0,0 @@
local required = { 'mason', 'mason-lspconfig', 'lspconfig', 'cmp_nvim_lsp', 'fidget', 'neodev', 'mason-null-ls',
'mason-nvim-dap', 'dap', 'dapui' }
local modules = {}
for _, module in pairs(required) do
local ok, result = pcall(require, module)
if not ok then
print(module .. " is not install.")
return
end
modules[module] = result
end
local capabilities = modules['cmp_nvim_lsp'].default_capabilities()
modules['neodev'].setup()
modules["mason"].setup()
modules["mason-lspconfig"].setup {
ensure_installed = {"lua_ls"}
}
modules["mason-lspconfig"].setup_handlers {
function (server_name)
modules["lspconfig"][server_name].setup {
capabilities = capabilities
}
end,
["omnisharp"] = function ()
modules["lspconfig"]["omnisharp"].setup {
capabilities = capabilities,
on_attach = function (_,_)
local gr = vim.api.nvim_create_augroup("CS-OnAttach",{})
vim.api.nvim_create_autocmd({"BufWritePre"}, {
group = gr,
pattern = {"*.cs"},
desc = "(C#) Format before write",
callback = function ()
vim.lsp.buf.format()
end
}
)
end
}
end
}
modules['mason-null-ls'].setup({
ensure_installed = {},
automatic_installation = false,
automatic_setup = true,
})
modules['fidget'].setup{
text = {
spinner = "dots"
}
}
-- Built in diagnostic settings are also configured here
vim.diagnostic.config({
virtual_text = true,
signs = true,
underline = true,
update_in_insert = true,
severity_sort = false,
})
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, {text = icon, texthl = hl, numhl = hl})
end
local auGroupDiagHover = vim.api.nvim_create_augroup("Diagnostic_hover",{clear = true})
vim.api.nvim_create_autocmd("CursorHold",{
pattern = {"*"},
callback = function ()
vim.diagnostic.open_float(nil, {focus=false, scope="cursor"})
end,
group = auGroupDiagHover
})
-- ## DAP ## warning: here be dragons
modules['mason-nvim-dap'].setup({
automatic_setup = true,
})
modules['dapui'].setup({
icons = {
expanded = "",
collapsed = "",
current_frame = "",
},
expand_lines = vim.fn.has("nvim-0.7") == 1,
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
"stacks",
"watches",
},
size = 40, -- 40 columns
position = "left",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
controls = {
-- Requires Neovim nightly (or 0.8 when released)
enabled = true,
-- Display controls in this element
element = "repl",
icons = {
pause = "",
play = "",
step_into = "",
step_over = "",
step_out = "",
step_back = "",
run_last = "",
terminate = "",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
max_value_lines = 100, -- Can be integer or nil.
}
})
modules['dap'].listeners.after.event_initialized["dapui_config"] = function()
modules['dapui'].open()
end
modules['dap'].listeners.before.event_terminated["dapui_config"] = function()
modules['dapui'].close()
end
modules['dap'].listeners.before.event_exited["dapui_config"] = function()
modules['dapui'].close()
end
-- Also configure lspsaga here.
-- Separate require check since we don't NEED lspsaga
local ok,lspsaga = pcall(require,"lspsaga")
if not ok then
return
end
-- Wrapping since some distros still don't ship nvim 0.8
if vim.fn.exists('+winbar') ~= 0 then
lspsaga.setup({
symbol_in_winbar = {
in_custom = false,
enable = true,
seperator = '>',
show_file = true,
click_support = false
},
diagnostic_header = { "", "", "", "" },
})
else
lspsaga.setup({
diagnostic_header = { "", "", "", "" },
})
end

View File

@ -1,19 +0,0 @@
require("cmp").register_source("luasnip", require("cmp_luasnip").new())
local cmp_luasnip = vim.api.nvim_create_augroup("cmp_luasnip", {})
vim.api.nvim_create_autocmd("User", {
pattern = "LuasnipCleanup",
callback = function ()
require("cmp_luasnip").clear_cache()
end,
group = cmp_luasnip
})
vim.api.nvim_create_autocmd("User", {
pattern = "LuasnipSnippetsAdded",
callback = function ()
require("cmp_luasnip").refresh()
end,
group = cmp_luasnip
})

View File

@ -1,113 +0,0 @@
-- Configure Completion
vim.opt.completeopt = {"menu","menuone","noselect"}
vim.opt.shortmess:append "c"
local ok, lspkind = pcall(require, "lspkind")
if not ok then
print("lspkind is not installed.")
return
end
lspkind.init()
local luasnip = require("luasnip")
local status, cmp = pcall(require, "cmp")
if not status then
print("nvim-cmp is not installed.")
return
end
if cmp == nil then
return
end
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup {
enabled = function ()
-- disable complete in comments
local context = require'cmp.config.context'
-- keep command mode completion enabled when cursor is in a comment
if vim.api.nvim_get_mode().mode == 'c' then
return true
else
return not context.in_treesitter_capture("comment")
and not context.in_syntax_group("Comment")
end
end,
mapping = {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
['<C-e>'] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping(
cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
},
sources = {
{name = "nvim_lua"},
{name = "nvim_lsp"},
{name = "path"},
{name = "luasnip"},
{
name = "buffer",
option = {
keyword_length = 5,
},
},
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
--- experimental = {
--- native_menu = false,
--- ghost_text = true,
--- },
formatting = {
format = lspkind.cmp_format {
mode = 'symbol_text',
menu = {
buffer = "[BUF]",
nvim_lsp = "[LSP]",
nvim_lua = "[API]",
path = "[PTH]",
luasnip = "[SNP]"
}
}
}
}

View File

@ -1,19 +0,0 @@
local ok, ls = pcall(require, 'luasnip')
if not ok then
print("NO SNIPS?")
return
end
-- local types = require "luasnip.util.types"
ls.config.set_config{
-- remember the last snippet
history = true,
-- make dynamic snippets update with typing
updateevents = "TextChanged,TextChangedI",
--Autosnippets:
enable_autosnippets = true,
}
require("luasnip/loaders/from_vscode").lazy_load()

View File

@ -1,30 +0,0 @@
local ok, telescope = pcall(require, 'telescope')
if not ok then
print("Telescope is not installed.")
return
end
telescope.setup {
-- configuration of Telescope go here
defaults = {
prompt_prefix = "🔎 ",
layout_config = {
height = 0.90,
prompt_position = "top",
preview_height = 15,
},
sorting_strategy = "ascending",
dynamic_preview_title = true,
},
pickers = { },
extensions = {
file_browser = {
grouped = true,
hijack_netrw = true,
dir_icon = "📁",
hidden = true,
}
}
}
telescope.load_extension "file_browser"

View File

@ -1,7 +0,0 @@
local ok, trouble = pcall(require, 'trouble')
if not ok then
print("Looks like there was a little trouble...cus it's missing.")
return
end
trouble.setup {}

View File

@ -1,47 +1 @@
require('plugin') require'core'.setup()
-- Instantiate the gruvbox theme via native vimscript
-- Note: this always comes before anything, or the theme breaks
vim.cmd([[
set termguicolors
let g:gruvbox_italic=1
set cursorline
set cursorcolumn
set number
set spell
set textwidth=120 sw=4 ts=4 et colorcolumn=120
highlight ColorColumn ctermbg=0
set splitbelow splitright
autocmd BufRead,BufNewFile *.bottle set filetype=bottle
AirlineTheme catppuccin
]])
-- implement the DiffOrig command (see :h :DiffOrig for more info)
vim.cmd([[
command DiffOrig vert new | set bt=nofile | set bufhidden | set pvw
\ | r # | 0d_ | diffthis | wincmd p | diffthis
command DiffOff diffoff | pc
]])
-- Custom keybindings using the util `map` function
local map = require("utils").map
local opts = { silent=true }
vim.g.mapleader = 'e' -- leader for Edit Mode functions
--- Mappings for Edit Mode ---
map("v", "<Leader>h", ":s//") -- visual selection replace with last buffer item
map("n", "<Leader>g", "<Cmd>Telescope live_grep<CR>", opts) -- Telescope live grep search
map("n", "<Leader>o", "<Cmd>Telescope file_browser<CR>", opts) -- Open Telescope to grab new file
vim.g.mapleader = 'f' -- leader for File Mode functions
--- Mappings for File Mode ---
--map("n", "<Leader>o", "<Cmd>Telescope file_browser<CR>", opts) -- Telescope file browser
map("ni", "<C-w>T", "<Esc><Cmd>tabnew<CR> | <Cmd>Telescope file_browser<CR>", opts) -- Open a new tab buffer
map("ni", "<C-w>v", "<Esc><C-w>v<CR> | <Cmd>Telescope file_browser<CR>A", opts) -- Open a new verticle split
map("ni", "<C-w>s", "<Esc><C-w>s<CR> | <Cmd>Telescope file_browser<CR>A", opts) -- Open a new horizontal split
vim.g.mapleader = 't' -- leader for Terminal Mode functions
--- Mappings for Terminal Mode ---
map("n", "<Leader>vr", ":vert res 80") -- change verticle size of focused window to x (Default: x = 80)
map("n", "<Leader>hr", ":horizontal res ") -- change horizontal size of focused window to x (No default)

17
lua/core/init.lua Normal file
View File

@ -0,0 +1,17 @@
local M = {}
M.setup = function ()
require'core.options'
require'core.keybindings'
require'plugins'
-- implement the DiffOrig command (see :h :DiffOrig for more info)
vim.cmd([[
command DiffOrig vert new | set bt=nofile | set bufhidden | set pvw
\ | r # | 0d_ | diffthis | wincmd p | diffthis
command DiffOff diffoff | pc
]])
end
return M

23
lua/core/keybindings.lua Normal file
View File

@ -0,0 +1,23 @@
-- Custom keybindings using the util `map` function
local map = require'utils'.map
local opts = { silent=true }
vim.g.mapleader = 'e' -- leader for Edit Mode functions
--- Mappings for Edit Mode ---
map("v", "<Leader>h", ":s//") -- visual selection replace with last buffer item
map("n", "<Leader>g", "<Cmd>Telescope live_grep<CR>", opts) -- Telescope live grep search
map("n", "<Leader>o", "<Cmd>Telescope file_browser<CR>", opts) -- Open Telescope to grab new file
vim.g.mapleader = 'f' -- leader for File Mode functions
--- Mappings for File Mode ---
--map("n", "<Leader>o", "<Cmd>Telescope file_browser<CR>", opts) -- Telescope file browser
map("ni", "<C-w>T", "<Esc><Cmd>tabnew<CR> | <Cmd>Telescope file_browser<CR>", opts) -- Open a new tab buffer
map("ni", "<C-w>v", "<Esc><C-w>v<CR> | <Cmd>Telescope file_browser<CR>A", opts) -- Open a new verticle split
map("ni", "<C-w>s", "<Esc><C-w>s<CR> | <Cmd>Telescope file_browser<CR>A", opts) -- Open a new horizontal split
map("n", "<Leader>do", "<Cmd>DiffOrig<CR>", opts)
map("n", "<Leader>dc", "<Cmd>DiffOff<CR>", opts)
vim.g.mapleader = 't' -- leader for Terminal Mode functions
--- Mappings for Terminal Mode ---
map("n", "<Leader>vr", ":vert res 80") -- change verticle size of focused window to x (Default: x = 80)
map("n", "<Leader>hr", ":horizontal res ") -- change horizontal size of focused window to x (No default)

46
lua/core/options.lua Normal file
View File

@ -0,0 +1,46 @@
local opt = vim.opt
vim.g.mapleader = '\\'
vim.g.maplocalleader = ','
-- enable line numbering
opt.number = true
-- enable splitting to right and below
opt.splitright = true
opt.splitbelow = true
-- enable 24-bit colour terminal
opt.termguicolors = true
-- set terminal title
opt.title = true
-- enable spelling for EN-GB
opt.spell = true
opt.spelllang = 'en_gb'
-- ignore compiled files in completion
opt.wildignore = {
'*pycache*',
'*.o',
'*~',
'*.pyc',
}
-- enable cursor line and column
opt.cursorline = true
opt.cursorcolumn = true
-- line control
opt.expandtab = true
opt.textwidth = 80
opt.shiftwidth = 2
opt.tabstop = 2
opt.colorcolumn = '+1'
-- extra options set through vim.cmd
vim.cmd([[
let g:gruvbox_italic=1
highlight ColorColumn ctermbg=lightgrey
]])

6
lua/core/utils/icons.lua Normal file
View File

@ -0,0 +1,6 @@
return {
Error = '',
Warn = '',
Hint = '',
Info = '',
}

29
lua/core/utils/lazy.lua Normal file
View File

@ -0,0 +1,29 @@
return function(plugin)
vim.api.nvim_create_autocmd({ 'BufRead', 'BufWinEnter', 'BufNewFile', 'WinEnter' }, {
callback = function()
if vim.fn.expand('%') ~= '' then
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if plugin ~= 'nvim-treesitter' then
vim.schedule(function()
require('lazy').load { plugins = plugin }
if
plugin == 'nvim-lspconfig'
or plugin == 'null-ls.nvim'
or plugin == 'vim-matchup'
then
vim.cmd('silent! do FileType')
if plugin == 'null-ls.nvim' then
require('null-ls.state').register_conditional_sources()
end
end
end)
else
require'lazy'.load { plugins = plugin }
end
end
end,
})
end

View File

@ -1,15 +0,0 @@
--- bootstrapping Lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup( require'plugin.lazy' )

View File

@ -1,283 +0,0 @@
return {
-- lazy itself
{
'folke/lazy.nvim',
version = '*'
},
{
'catppuccin/nvim',
name = "catppuccin",
lazy = false,
priority = 1000,
config = function()
require'catppuccin'.setup({
color_overrides = {
macchiato = {
text = "#feffe9", --"#b7d69b",
subtext1 = "#a8c68f",
subtext0 = "#98b381",
overlay2 = "#879f72",
overlay1 = "#758a63",
overlay0 = "#647554",
surface2 = "#526146",
surface1 = "#414d37",
surface0 = "#303828",
base = "#262e1e",
mantle = "#1d2417",
crust = "#151a10",
}
}
})
vim.cmd([[colorscheme catppuccin-macchiato]])
end
},
{
'morhetz/gruvbox', -- Neovim editor theme (gruvbox MVP)
lazy = false,
priority = 1000,
config = function()
-- vim.cmd([[colorscheme gruvbox]])
end
},
-- treesitter
{
'nvim-treesitter/nvim-treesitter',
version = false,
event = { "BufReadPost", "BufWritePost", "BufNewFile", "VeryLazy" },
build = ":TSUpdate",
init = function(plugin)
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer trigger the **nvim-treeitter** module to be loaded in time.
-- Luckily, the only thins that those plugins need are the custom queries, which we make available
-- during startup.
require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates")
end,
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
config = function()
-- When in diff mode, we want to use the default
-- vim text objects c & C instead of the treesitter ones.
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
local configs = require("nvim-treesitter.configs")
for name, fn in pairs(move) do
if name:find("goto") == 1 then
move[name] = function(q, ...)
if vim.wo.diff then
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
for key, query in pairs(config or {}) do
if q == query and key:find("[%]%[][cC]") then
vim.cmd("normal! " .. key)
return
end
end
end
return fn(q, ...)
end
end
end
end,
},
},
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
},
-- Telescope
{
{
'nvim-telescope/telescope.nvim',
event = "VeryLazy",
dependencies = {
"nvim-telescope/telescope-file-browser.nvim",
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
'nvim-lua/plenary.nvim',
"nvim-tree/nvim-web-devicons",
},
},
},
-- cmdline tools and lsp servers
--
{
'neovim/nvim-lspconfig', -- Configurations for Nvim LSP
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = false, dependencies = { "nvim-lspconfig" } },
{ "folke/neodev.nvim", opts = {} },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
},
config = function()
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require('mason').setup()
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = { "pyright" }
}
require("lspconfig").pyright.setup {
capabilities = capabilities,
}
end
},
-- mason.nvim
{
"williamboman/mason.nvim",
cmd = "Mason",
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
build = ":MasonUpdate",
opts = {
ensure_installed = {
"stylua",
"shfmt",
-- "flake8",
},
},
---@param opts MasonSettings | {ensure_installed: string[]}
config = function(_, opts)
require("mason").setup(opts)
local mr = require("mason-registry")
mr:on("package:install:success", function()
vim.defer_fn(function()
-- trigger FileType event to possibly load this newly installed LSP server
require("lazy.core.handler.event").trigger({
event = "FileType",
buf = vim.api.nvim_get_current_buf(),
})
end, 100)
end)
local function ensure_installed()
for _, tool in ipairs(opts.ensure_installed) do
local p = mr.get_package(tool)
if not p:is_installed() then
p:install()
end
end
end
if mr.refresh then
mr.refresh(ensure_installed)
else
ensure_installed()
end
end,
},
{
'jay-babu/mason-null-ls.nvim',
lazy = true,
dependencies = {
'jose-elias-alvarez/null-ls.nvim',
'williamboman/mason.nvim'
}
},
{
'jay-babu/mason-nvim-dap.nvim',
lazy = true,
dependencies = {
'williamboman/mason.nvim',
'mfussenegger/nvim-dap'
}
},
{
'rcarriga/nvim-dap-ui',
lazy = true,
dependencies = {
"mfussenegger/nvim-dap"
}
},
--
-- auto pairs
{
"echasnovski/mini.pairs",
event = "VeryLazy",
opts = {},
keys = {{
"<leader>up",
function()
local Util = require("lazy.core.util")
vim.g.minipairs_disable = not vim.g.minipairs_disable
if vim.g.minipairs_disable then
Util.warn("Disabled auto pairs", { title = "Option" })
else
Util.info("Enabled auto pairs", { title = "Option" })
end
end,
desc = "Toggle auto pairs",
}},
},
-- auto completion
{
'hrsh7th/nvim-cmp',
version = false, -- last release is way too old
event = "InsertEnter",
dependencies = {
'hrsh7th/cmp-buffer', -- completion source
'hrsh7th/cmp-path', -- completion source
'hrsh7th/cmp-nvim-lua', -- completion source
'hrsh7th/cmp-nvim-lsp', -- completion source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
'onsails/lspkind.nvim',
},
},
-- misc
{
'vim-airline/vim-airline',
},
{
'j-hui/fidget.nvim',
tag = "legacy"
},
{
"folke/trouble.nvim",
lazy = true,
dependencies = "nvim-tree/nvim-web-devicons",
},
{
"L3MON4D3/LuaSnip",
dependencies = { "rafamadriz/friendly-snippets" },
event = "VeryLazy",
},
-- Live Preview of MD
{
"iamcco/markdown-preview.nvim",
config = function() vim.fn["mkdp#util#install"]() end,
},
-- Need to short this out properly!
-- learn this
'tpope/vim-surround',
-- differentiate brackets
'luochen1990/rainbow',
-- File tree
'preservim/nerdtree',
-- Distraction free writing
'junegunn/goyo.vim',
-- The Best Thing EVER
'vimwiki/vimwiki',
-- better comments
'scrooloose/nerdcommenter',
-- Show colours
'ap/vim-css-color',
-- Add snippets
'honza/vim-snippets',
-- highlight matching html tags
-- 'valloric/matchtagalways',
-- Syntax highlighting extension
'sheerun/vim-polyglot',
}

View File

@ -0,0 +1,5 @@
return {
options = {
diagnostics = 'nvim-lsp',
},
}

View File

@ -0,0 +1,63 @@
return {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = {
left = '|',
right = '|',
},
section_separators = {
left = '',
right = '',
},
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = {
'mode',
'spell_status',
},
lualine_b = {
'branch',
'diff',
'diagnostics',
},
lualine_c = {
{
'filename',
path = 1,
},
{
'filetype',
icon_only = true,
},
},
lualine_x = {
'encoding',
'fileformat',
'filetype',
{
require('lazy.status').updates,
cond = require('lazy.status').has_updates,
},
{
require('noice').api.status.mode.get,
cond = require('noice').api.status.mode.has,
},
},
lualine_y = {
'progress',
'searchcount',
},
lualine_z = {
'location',
},
},
tabline = {},
extensions = {
'neo-tree',
'quickfix',
},
}

View File

@ -0,0 +1,29 @@
return {
enable_git_status = true,
enable_diagnostics = true,
sort_case_insensitive = true,
filesystem = {
filtered_items = {
visible = false,
hide_dotfiles = true,
hide_gitignored = true,
hide_hidden = true,
},
follow_current_file = {
enabled = true,
},
hijack_netrw_behaviour = 'open_default',
use_libuv_file_watcher = true,
},
window = {
position = 'left',
},
buffers = {
follow_current_file = {
enabled = true,
},
},
}

View File

@ -0,0 +1,28 @@
return {
lsp = {
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
['cmp.entry.get_documentation'] = true,
},
},
presets = {
bottom_search = true,
command_palette = true,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = false,
},
hover = {
enabled = true,
},
signature = {
enabled = true,
auto_open = {
enabled = true,
trigger = true, -- Automatically show signature help when typing a trigger character from the LSP
luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes
throttle = 50, -- Debounce lsp signature help request by 50ms
},
},
}

View File

@ -0,0 +1,46 @@
M = {}
M.config = {
plugins = {
marks = true,
registers = true,
spelling = {
enabled = true,
suggestions = 10,
},
presets = {
operators = true,
motions = true,
text_objects = true,
windows = true,
nav = true,
z = true,
g = true,
},
},
icons = {
breadcrumb = '󰇘',
separator = '󰇼',
group = '󰋃',
},
win = {
border = 'single',
},
-- ignore_missing = true,
disable = {
filetypes = { 'TelescopePrompt' },
},
}
M.default_bindings = {
{ '<leader>c', group = 'NerdComment' },
{ '<leader>f', group = 'File' },
{ '<leader>l', group = 'LSP' },
{ '<leader>t', group = 'telescope' },
{ '<leader>ts', group = 'tresitter' },
{ '<leader>w', group = 'vimwiki' },
}
return M

View File

@ -0,0 +1,25 @@
return {
window = {
backdrop = 0.95,
width = 0.80,
height = 0.50,
options = {
signcolumn = 'no',
number = false,
relativenumber = false,
cursorline = true,
cursorcolumn = false,
foldcolumn = '0',
list = false,
},
},
plugins = {
options = {
enabled = true,
ruler = false,
showcmd = false,
},
twilight = { enabled = true },
gitsigns = { enabled = true },
},
}

View File

@ -0,0 +1,140 @@
local M = {}
local luasnip = require('luasnip')
local cmp = require('cmp')
local compare = require('cmp.config.compare')
local lspkind = require('lspkind')
-- Global config table
M.cmp = {
preselect = cmp.PreselectMode.None,
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
window = {
completion = {
scrollbar = false,
},
},
mapping = {
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
['<CR>'] = cmp.mapping {
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }
else
fallback()
end
end,
s = cmp.mapping.confirm { select = false },
c = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = false,
},
},
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-d>'] = cmp.mapping(function(fallback)
if cmp.visible() then
if cmp.visible_docs() then
cmp.close_docs()
else
cmp.open_docs()
end
end
fallback()
end),
['<C-e>'] = cmp.mapping.abort(),
},
sources = cmp.config.sources {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'lazydev', group_index = 0 },
{ name = 'path' },
{ name = 'buffer', keyword_length = 5 },
{ name = 'conjure' },
{ name = 'emoji', priority = -20 },
},
formatting = {
format = lspkind.cmp_format {
mode = 'symbol_text',
menu = {
buffer = '[BUF]',
nvim_lsp = '[LSP]',
path = '[PTH]',
luasnip = '[SNP]',
emoji = '[EMJ]',
},
maxwidth = 50,
ellipsis_char = '',
},
},
experimental = {
ghost_text = true,
},
sorting = {
priority_weight = 0.8,
comparators = {
compare.score,
compare.exact,
compare.offset,
compare.sort_text,
compare.scopes,
compare.recently_used,
compare.order,
compare.kind,
compare.length,
},
},
performance = {
fetching_timeout = 30,
},
}
--- Configure completion for commandline
M.cmd = function()
-- completion for searches
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' },
},
})
cmp.setup.cmdline({ '@' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'cmdline' },
},
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' },
}, {
{ name = 'cmdline' },
}),
})
end
return M

View File

@ -0,0 +1,102 @@
local M = {}
M.on_attach = function()
local auGroupOnAttach = vim.api.nvim_create_augroup('on_attach', { clear = true })
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client == nil then return end
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true, nil, bufnr)
end
if client.server_capabilities.documentFormattingProvider then
vim.keymap.set({ 'n' }, '<leader>lf', function()
vim.lsp.buf.format()
end, { desc = 'Format buffer' })
end
end,
group = auGroupOnAttach,
})
end
M.setup = function(opts)
local servers_to_not_setup = opts.servers_to_not_setup
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument = {
completion = {
completionItem = {
documentationFormat = { 'markdown', 'plaintext' },
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } },
resolveSupport = {
properties = {
'documentation',
'detail',
'additionalTextEdits',
},
},
},
},
foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
},
}
local checkIfExists = function(val, arr)
local y = false
for i in ipairs(arr) do
if arr[i] == val and y ~= true then y = true end
end
return y
end
local servers = opts.servers
local function setup(server)
if not checkIfExists(server, servers_to_not_setup) then
local server_opts = vim.tbl_deep_extend('force', {
capabilities = vim.deepcopy(capabilities),
}, servers[server] or {})
if opts.setup[server] then
if opts.setup[server](server, server_opts) then return end
elseif opts.setup['*'] then
if opts.setup['*'](server, server_opts) then return end
end
require('lspconfig')[server].setup(server_opts)
M.on_attach()
end
end
-- get all the servers that are available through mason-lspconfig
local have_mason, mlsp = pcall(require, 'mason-lspconfig')
local all_mslp_servers = {}
if have_mason then
all_mslp_servers =
vim.tbl_keys(require('mason-lspconfig.mappings.server').lspconfig_to_package)
end
local ensure_installed = {} ---@type string[]
for server, server_opts in pairs(servers) do
server_opts = server_opts == true and {} or server_opts
if not vim.tbl_contains(all_mslp_servers, server) then
setup(server)
else
ensure_installed[#ensure_installed + 1] = server
end
end
if have_mason then mlsp.setup { ensure_installed = ensure_installed, handlers = { setup } } end
end
return M

View File

@ -0,0 +1,6 @@
local icons = require('core.utils.icons')
for name, icon in pairs(icons) do
name = 'DiagnosticSign' .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = '' })
end

View File

View File

@ -0,0 +1,115 @@
return {
ensure_installed = {
'bash',
'c',
'cpp',
'css',
'c_sharp',
'diff',
'git_config',
'git_rebase',
'gitcommit',
'gitignore',
'go',
'gomod',
'html',
'ini',
'javascript',
'jsonnet',
'latex',
'lua',
'luadoc',
'luap',
'make',
'markdown',
'markdown_inline',
'python',
'query',
'regex',
'rust',
'scss',
'toml',
'vim',
'vimdoc',
'yuck',
'yaml',
'zig',
},
auto_install = true,
highlight = {
enable = true,
},
indent = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<CR>',
scope_incremental = '<CR>',
node_incremental = '<TAB>',
node_decremental = '<S-TAB>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
['af'] = { query = '@function.outer', desc = 'Select outer part of function' },
['if'] = { query = '@function.inner', desc = 'Select inner part of function' },
['ac'] = { query = '@class.outer', desc = 'Select outer part of class' },
['ic'] = { query = '@class.inner', desc = 'Select inner part of class' },
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
[']m'] = { query = '@function.outer', desc = 'Next Function start' },
[']]'] = { query = '@class.outer', desc = 'Next class start' },
[']o'] = { query = '@loop.*', desc = 'Next loop component' },
[']z'] = { query = '@fold', query_group = 'folds', desc = 'Next Fold' },
},
goto_next_end = {
[']M'] = { query = '@function.outer', desc = 'Next Function end' },
[']['] = { query = '@class.outer', desc = 'Next class end' },
},
goto_previous_start = {
['[m'] = { query = '@function.outer', desc = 'Previous Function start' },
['[]'] = { query = '@class.outer', desc = 'Previous class start' },
['[o'] = { query = '@loop.*', desc = 'Previous loop component' },
['[z'] = { query = '@fold', query_group = 'folds', desc = 'Previous Fold' },
},
goto_previous_end = {
['[M'] = { query = '@function.outer', desc = 'Previous Function end' },
['[['] = { query = '@class.outer', desc = 'Previous class end' },
},
goto_next = {
[']d'] = { query = '@conditional.*', desc = 'Next Conditional' },
},
goto_previous = {
['[d'] = { query = '@conditional.*', desc = 'previous Conditional' },
},
},
lsp_interop = {
enable = true,
border = 'none',
floating_preview_opts = {},
peek_definition_code = {
['<leader>tsdf'] = { query = '@function.outer', desc = 'Peek function definition' },
['<leader>tsdF'] = { query = '@class.outer', desc = 'Peek class definition' },
},
},
},
}

View File

@ -0,0 +1,20 @@
local rainbow = require('rainbow-delimiters')
return {
strategy = {
[''] = rainbow.strategy['global'],
},
query = {
[''] = 'rainbow-delimiters',
lua = 'rainbow-blocks',
latex = 'rainbow-blocks',
},
highlight = {
'RainbowDelimiterRed',
'RainbowDelimiterYellow',
'RainbowDelimiterBlue',
'RainbowDelimiterOrange',
'RainbowDelimiterGreen',
'RainbowDelimiterViolet',
'RainbowDelimiterCyan',
},
}

42
lua/plugins/init.lua Normal file
View File

@ -0,0 +1,42 @@
--- bootstrapping Lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require"lazy".setup( { import = 'plugins.specs' }, {
defaults = {
lazy = true,
version = false,
},
install = {
missing = true,
colorscheme = { 'catppuccino' },
},
checker = {
enabled = true,
},
performance = {
rtp = {
disabled_plugins = {
'tutor',
'gzip',
'tarPlugin',
'zipPlugin',
'netrwPlugin'
},
},
},
})

60
lua/plugins/lazy.lua.bak Normal file
View File

@ -0,0 +1,60 @@
return {
-- lazy itself
{
'folke/lazy.nvim',
version = '*'
},
{
'jay-babu/mason-null-ls.nvim',
lazy = true,
dependencies = {
'jose-elias-alvarez/null-ls.nvim',
'williamboman/mason.nvim'
}
},
-- misc
{
'j-hui/fidget.nvim',
tag = "legacy"
},
{
"folke/trouble.nvim",
lazy = true,
dependencies = "nvim-tree/nvim-web-devicons",
},
-- Live Preview of MD
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = function() vim.fn["mkdp#util#install"]() end,
},
-- Need to short this out properly!
-- learn this
'tpope/vim-surround',
-- differentiate brackets
'luochen1990/rainbow',
-- File tree
'preservim/nerdtree',
-- Distraction free writing
'junegunn/goyo.vim',
-- The Best Thing EVER
'vimwiki/vimwiki',
-- better comments
'scrooloose/nerdcommenter',
-- Show colours
'ap/vim-css-color',
-- Add snippets
'honza/vim-snippets',
-- highlight matching html tags
-- 'valloric/matchtagalways',
-- Syntax highlighting extension
'sheerun/vim-polyglot',
}

View File

@ -0,0 +1,45 @@
-- Completion config.
return {
{
'L3MON4D3/LuaSnip', -- snippet engine
build = function()
if vim.fn.has('win32') == 0 then
return "echo -e 'NOTE: jsregexp is optional, failure here is ok' ; make install_jsregexp"
end
vim.fn.system({"make", "install_jsregexp"})
return nil
end,
config = function()
local lua_snippets = vim.fn.stdpath('config') .. '/luasnip'
local vscode_snippets = vim.fn.stdpath('config') .. '/snippets'
require('luasnip.loaders.from_vscode').lazy_load() -- load friendly-snippets
require('luasnip.loaders.from_vscode').lazy_load { paths = { vscode_snippets } }
require('luasnip.loaders.from_lua').lazy_load { paths = { lua_snippets } }
end,
dependencies = {
'rafamadriz/friendly-snippets',
},
},
{
'hrsh7th/nvim-cmp',
opts = function()
return require('plugins.configs.completion.cmp')
end,
config = function(_, opts)
local cmp = require('cmp')
cmp.setup(opts.cmp)
opts.cmd()
end,
event = { 'InsertEnter', 'VeryLazy', 'CmdlineEnter' },
dependencies = {
'LuaSnip',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-emoji',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'onsails/lspkind.nvim',
'saadparwaiz1/cmp_luasnip',
},
},
}

View File

@ -0,0 +1,8 @@
return {
{ 'munifTanjim/nui.nvim' },
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-lua/popup.nvim' },
{ 'nvim-tree/nvim-web-devicons' },
}

View File

@ -0,0 +1,31 @@
return {
{
'mfussenegger/nvim-dap'
},
{ -- nvim-dap-virtual-text
'theHamsta/nvim-dap-virtual-text',
dependencies = {
'mfussenegger/nvim-dap',
'nvim-treesitter/nvim-treesitter',
},
},
{ -- nvim-dap-ui
'rcarriga/nvim-dap-ui',
dependencies = {
'mfussenegger/nvim-dap',
'theHamsta/nvim-dap-virtual-text',
'nvim-neotest/nvim-nio',
},
opts = {},
keys = {
{
'<leader>dt',
function()
require('dapui').toggle()
end,
desc = 'open dapui',
},
},
},
}

View File

@ -0,0 +1,63 @@
return {
{ -- treesitter
'nvim-treesitter/nvim-treesitter',
opts = function()
return require('plugins.configs.treesitter')
end,
config = function(_, opts)
-- to ensure the configuration can happen we need to do this here
-- otherwise the configuration of treesitter can't find it
require('nvim-treesitter.configs').setup(opts)
end,
init = function()
require'core.utils.lazy'('nvim-treesitter')
end,
build = ':TSUpdate',
dependencies = {
{ 'nvim-treesitter/nvim-treesitter-textobjects' },
},
},
{ -- rainbow-delimiters
'hiphish/rainbow-delimiters.nvim',
config = false,
event = 'VeryLazy',
dependencies = {
'nvim-treesitter',
},
init = function()
vim.g.rainbow_delimiters = require'plugins.configs.treesitter.rainbow-delims'
end,
},
{ -- nerd commenter
'preservim/nerdcommenter',
event = 'VeryLazy',
init = function()
vim.g.NERDSpaceDelims = 1
vim.g.NERDCompaceSexyComs = 1
end,
keys = {
{ '<leader>cc', nil, desc = 'Comment line' },
{ '<leader>cn', nil, desc = 'Comment line force nesting' },
{ '<leader>c<space>', nil, desc = 'Toggle comment selection' },
{ '<leader>cm', nil, desc = 'Comment Minimal' },
{ '<leader>ci', nil, desc = 'Toggle comment line' },
{ '<leader>cs', nil, desc = 'Comment Sexy' },
{ '<leader>cy', nil, desc = 'Comment and yank' },
{ '<leader>c$', nil, desc = 'Comment to EOL' },
{ '<leader>cA', nil, desc = 'Append comment' },
{ '<leader>ca', nil, desc = 'Switch comment delimiters' },
{ '<leader>cl', nil, desc = 'Comment align left' },
{ '<leader>cb', nil, desc = 'Comment alight both' },
{ '<leader>cu', nil, desc = 'Uncomment lines' },
},
},
{
'mcauley-penney/tidy.nvim',
config = true,
event = 'BufWritePre',
},
}

120
lua/plugins/specs/lsp.lua Normal file
View File

@ -0,0 +1,120 @@
return {
{ -- mason
'williamboman/mason.nvim',
config = true,
},
{ -- mason-lspconfig
'williamboman/mason-lspconfig.nvim',
dependencies = {
'mason.nvim',
},
},
{ -- nvim-lspconfig
'neovim/nvim-lspconfig',
opts = function()
return {
servers_to_not_setup = {},
servers = {
bashls = {},
lua_ls = {
settings = {
Lua = {
hint = {
enable = true,
arrayIndex = 'Disable',
},
runtime = {
pathStrict = true,
},
workspace = {
checkThirdParty = false,
},
},
},
},
pyright = {
pyright = {
autoImportCompletion = true,
},
},
efm = {
init_options = { documentFormatting = true },
settings = {
rootMarkers = { '.git/' },
languages = {
lua = {
{
formatCommand = 'stylua -s --verify --color Never -',
formatStdin = true,
},
},
},
},
},
texlab = {},
cssls = {},
clangd = {},
ts_ls = {},
},
setup = {},
}
end,
init = function()
require'core.utils.lazy'('nvim-lspconfig')
end,
config = function(_, opts)
require('plugins.configs.lsp.config').setup(opts)
require('plugins.configs.lsp.native')
end,
dependencies = {
'mason-lspconfig.nvim',
},
},
{ -- lazydev
'folke/lazydev.nvim',
ft = 'lua',
opts = {},
},
{ -- lspsaga
'nvimdev/lspsaga.nvim',
event = 'LspAttach',
config = function()
require('lspsaga').setup {
code_action = {
num_shortcut = true,
show_server_name = true,
extend_gitsigns = true,
},
lightbulb = {
enable = true,
enable_in_insert = false,
sign = true,
virtual_text = false,
},
hover = {
open_browser = '!$BROWSER',
},
symbol_in_winbar = {
in_custom = false,
enable = true,
seperator = '>',
show_file = true,
respect_root = true,
},
}
end,
keys = {
{ '<leader>ld', '<cmd>Lspsaga hover_doc<CR>', desc = '[lspsaga hoverdoc]' },
},
dependencies = {
'nvim-lspconfig',
'nvim-treesitter',
},
},
}

View File

@ -0,0 +1,89 @@
local telescope = {}
telescope.opts = {}
-- default dependencies
telescope.dependencies = { ---@string[]
'nvim-treesitter',
'nvim-web-devicons',
'plenary.nvim',
'popup.nvim',
'project.nvim',
}
-- This must exist even if we keep it empty for later configuration to work
telescope.opts.opts = {
defaults = {
prompt_prefix = "🔎 ",
layout_config = {
height = 0.90,
prompt_position = "top",
},
sorting_strategy = "ascending",
dynamic_preview_title = true,
},
pickers = {},
extensions = {
file_browser = {
grouped = true,
hijack_netrw = true,
dir_icon = "📁",
hidden = true,
},
},
}
-- TESTS for telescope-media-files
if vim.fn.executable('chafa') then
-- if chafa is installed then we set a flag and add the dependency to telescope
telescope.opts.has_chafa = true
table.insert(telescope.dependencies, 'nvim-telescope/telescope-media-files.nvim')
telescope.opts.opts.extensions.media_files = {
filetypes = { 'png', 'jpg', 'jpeg', 'webp', 'svg' },
}
end
-- TESTS for telescope-fzf-native
-- If not windows then attempt to build and use it.
-- We also check a global flag here that we can set if we can't build fzf-native
if vim.fn.has('win32') == 0 and not vim.g.no_fzf then
-- NOTE: has returns 0 when we don't have a feature
telescope.opts.do_fzf = true
table.insert(telescope.dependencies, 'telescope-fzf-native.nvim')
end
-- TESTS for fzf-native
telescope.config = function(_, opts)
require('telescope').setup(opts.opts)
if opts.has_chafa then require('telescope').load_extension('media_files') end
if opts.do_fzf then require('telescope').load_extension('fzf') end
require('telescope').load_extension('projects')
end
return {
{
'nvim-telescope/telescope.nvim',
cmd = 'Telescope',
opts = telescope.opts,
config = telescope.config,
keys = telescope.keys,
dependencies = telescope.dependencies,
},
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'make',
cond = function()
return vim.fn.has('win32') == 0 and not vim.g.no_fzf
end,
},
{
'ahmedkhalf/project.nvim',
opts = {
detection_methods = { 'pattern' },
},
config = true,
main = 'project_nvim',
},
}

124
lua/plugins/specs/ui.lua Normal file
View File

@ -0,0 +1,124 @@
return {
{
'catppuccin/nvim',
name = "catppuccin",
lazy = false,
priority = 1000,
config = function()
require'catppuccin'.setup({
color_overrides = {
macchiato = {
text = "#feffe9", --"#b7d69b",
subtext1 = "#a8c68f",
subtext0 = "#98b381",
overlay2 = "#879f72",
overlay1 = "#758a63",
overlay0 = "#647554",
surface2 = "#526146",
surface1 = "#414d37",
surface0 = "#303828",
base = "#262e1e",
mantle = "#1d2417",
crust = "#151a10",
}
}
})
vim.cmd([[colorscheme catppuccin-macchiato]])
end
},
{ -- lualine
'nvim-lualine/lualine.nvim',
opts = function()
--return require('plugins.configs.UI.lualine')
end,
config = true,
event = 'VeryLazy',
dependencies = {
'nvim-web-devicons',
-- 'sherlock5512/lualine-spell-status', -- custom lualine module
},
},
{ -- neo-tree
'nvim-neo-tree/neo-tree.nvim',
version = '^3',
init = function()
vim.g.neo_tree_remove_legacy_commands = 1
end,
opts = function()
return require('plugins.configs.UI.neo-tree')
end,
config = true,
-- can't lazy load as the netrw replacement functionality
-- requires hooking to be done early in the startup process
lazy = false,
dependencies = {
'plenary.nvim',
'nvim-web-devicons',
'nui.nvim',
},
keys = {
{
'<leader>n',
'<CMD>Neotree action=focus source=filesystem position=left toggle=true<CR>',
desc = 'toggle neotree',
},
},
},
{ -- zen-mode
'folke/zen-mode.nvim',
opts = function()
return require('plugins.configs.UI.zen')
end,
config = true,
cmd = { 'ZenMode' },
keys = {
{
'<leader>z',
function()
require('zen-mode').toggle()
end,
desc = 'zen-mode',
},
},
dependencies = 'folke/twilight.nvim',
},
{ -- trouble.nvim
'folke/trouble.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
cmd = {
'Trouble',
'TroubleClose',
'TroubleToggle',
'TroubleRefresh',
},
opts = {},
},
{ -- todo-comments
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {},
cmd = {
'TodoTrouble',
'TodoTelescope',
},
event = {
'BufEnter',
},
},
{
"nvim-telescope/telescope-file-browser.nvim",
dependencies = {
"nvim-telescope/telescope.nvim",
"nvim-lua/plenary.nvim"
},
},
}

View File

@ -0,0 +1,53 @@
return {
'vimwiki/vimwiki',
init = function()
-- Get the XDG_DOCUMENTS_DIR if it exists
-- Otherwise use `$HOME/Documents` as default
local docdir = vim.env.HOME .. '/Documents'
if vim.env.XDG_DOCUMENTS_DIR then docdir = vim.env.XDG_DOCUMENTS_DIR end
-- Logical layout for vimwiki, also stores it in Documents
-- keeping my home directory clean
local wikiroot = docdir .. '/vimwiki'
local mainWiki = {
path = wikiroot .. '/src',
path_html = wikiroot .. '/html',
template_path = wikiroot .. '/templates',
template_default = 'default',
auto_tags = 1, -- regenerate tag file on save
auto_diary_index = 1, -- update diary index on open
auto_export = 1, -- generate HTML on save
cycle_bullets = 1,
auto_toc = 1,
}
vim.g.vimwiki_list = { mainWiki }
vim.g.vimwiki_global_ext = 0
vim.g.vimwiki_dir_link = 'index'
end,
-- Perfect Lazy-loading of everything.
ft = 'vimwiki',
cmd = {
'VimwikiIndex',
'VimwikiTabIndex',
'VimwikiUISelect',
'VimwikiVar',
'VimwikiDiaryIndex',
'VimwikiMakeDiaryNote',
'VimwikiTabMakeDiaryNote',
'VimwikiMakeYesterdayDiaryNote',
'VimwikiMakeTomorrowDiaryNote',
},
keys = {
{ '<leader>ww', nil, desc = '[vimwiki] index' },
{ '<leader>wt', nil, desc = '[vimwiki] index ﱚ' },
{ '<leader>ws', nil, desc = '[vimwiki] select' },
{ '<leader>wi', nil, desc = '[vimwiki] diary index' },
{ '<leader>w<leader>w', nil, desc = '[vimwiki] diary today' },
{ '<leader>w<leader>t', nil, desc = '[vimwiki] diary today ﱚ' },
{ '<leader>w<leader>y', nil, desc = '[vimwiki] diary yesterday' },
{ '<leader>w<leader>m', nil, desc = '[vimwiki] diary tomorrow' },
{ '<localleader>t', '<CMD>VimwikiTOC<CR>', desc = '[vimwiki] TOC' },
},
}