feat: use lazy.nvim

This commit is contained in:
nullchilly 2023-04-11 23:45:26 +07:00
parent 2664b49a62
commit 5c8c442da4
37 changed files with 892 additions and 809 deletions

View file

@ -0,0 +1,44 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- From THE one and only "Primeagen"
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move line up" })
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move line down" })
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Move page down with cursor centered" })
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Move page up with cursor centered" })
vim.keymap.set("n", "n", "nzzzv", { desc = "Find next with cursor centered" })
vim.keymap.set("n", "N", "Nzzzv", { desc = "Find last with cursor centered" })
vim.keymap.set("n", "<leader>pv", function()
vim.cmd("Explore")
end, { desc = "Show file explorer" })
vim.keymap.set("n", "J", "mzJ`z", { desc = "Join line below without moving cursor" })
vim.keymap.set({ "n", "x", "v" }, "<leader>d", '"_d', { desc = "Delete without cutting" })
vim.keymap.set({ "n", "x", "v" }, "<leader>c", '"_dc', { desc = "Change without cutting" })
vim.keymap.set({ "n", "x", "v" }, "<leader>p", '"_dP', { desc = "Paste without copying selected" })
vim.keymap.set({ "n", "x", "v" }, "<leader>y", '"+y', { desc = "Copy to system clipboard" })
vim.keymap.set("n", "Q", "<nop>", { desc = "It's the worse place in the universe" })
vim.keymap.set("n", "<leader>nf", function()
vim.cmd("enew")
end, { desc = "Open new buffer" })
vim.keymap.set(
"n",
"<leader>s",
[[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
{ desc = "Replace current word", noremap = true }
)
vim.keymap.set("c", "#lm", [[\{-}]], { desc = "[L]azy [M]atch" })
vim.keymap.set("c", "#capl", [[\(.\{-}\)]], { desc = "[CAP]ture [L]ess" })
vim.keymap.set("c", "#capm", [[\(.*\)]], { desc = "[CAP]ture [M]ore" })
vim.keymap.set("n", "j", "gj", { desc = "J that works with line wrap" })
vim.keymap.set("n", "k", "gk", { desc = "K that works with line wrap" })
vim.keymap.set("n", "<Down>", "g<Down>", { desc = "<Down> that works with line wrap" })
vim.keymap.set("n", "<Up>", "g<Up>", { desc = "<Up> that works with line wrap" })

View file

@ -1,36 +0,0 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- From THE one and only "Primeagen"
vim.keymap.set('v', "J", ":m '>+1<CR>gv=gv", { desc = "Move line up" })
vim.keymap.set('v', "K", ":m '<-2<CR>gv=gv", { desc = "Move line down" })
vim.keymap.set('n', "<C-d>", "<C-d>zz", { desc = "Move page down with cursor centered" })
vim.keymap.set('n', "<C-u>", "<C-u>zz", { desc = "Move page up with cursor centered" })
vim.keymap.set('n', "n", "nzzzv", { desc = "Find next with cursor centered" })
vim.keymap.set('n', "N", "Nzzzv", { desc = "Find last with cursor centered" })
vim.keymap.set('n', "<leader>pv", function() vim.cmd("Explore") end, { desc = "Show file explorer" })
vim.keymap.set('n', "J", "mzJ`z", { desc = "Join line below without moving cursor" })
vim.keymap.set({ 'n', 'x', 'v' }, "<leader>d", '"_d', { desc = "Delete without cutting" })
vim.keymap.set({ 'n', 'x', 'v' }, "<leader>c", '"_dc', { desc = "Change without cutting" })
vim.keymap.set({ 'n', 'x', 'v' }, "<leader>p", '"_dP', { desc = "Paste without copying selected" })
vim.keymap.set({ 'n', 'x', 'v' }, "<leader>y", '"+y', { desc = "Copy to system clipboard" })
vim.keymap.set('n', "Q", "<nop>", { desc = "It's the worse place in the universe" })
vim.keymap.set('n', "<leader>nf", function() vim.cmd("enew") end, { desc = "Open new buffer" })
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
{ desc = "Replace current word", noremap = true })
vim.keymap.set('c', "#lm", [[\{-}]], { desc = "[L]azy [M]atch" })
vim.keymap.set('c', "#capl", [[\(.\{-}\)]], { desc = "[CAP]ture [L]ess" })
vim.keymap.set('c', "#capm", [[\(.*\)]], { desc = "[CAP]ture [M]ore" })
vim.keymap.set('n', "j", "gj", { desc = "J that works with line wrap" })
vim.keymap.set('n', "k", "gk", { desc = "K that works with line wrap" })
vim.keymap.set('n', "<Down>", "g<Down>", { desc = "<Down> that works with line wrap" })
vim.keymap.set('n', "<Up>", "g<Up>", { desc = "<Up> that works with line wrap" })

View file

@ -19,7 +19,7 @@ vim.opt.backup = false
vim.opt.undofile = true
vim.opt.termguicolors = true
vim.opt.mouse = 'a'
vim.opt.mouse = "a"
vim.opt.ignorecase = true
vim.opt.smartcase = true
@ -27,12 +27,10 @@ vim.opt.smartindent = true
vim.opt.scrolloff = 14
vim.api.nvim_create_autocmd(
"TextYankPost",
{
callback = function() vim.highlight.on_yank() end,
group = vim.api.nvim_create_augroup("YankHighlight", {}),
pattern = '*',
}
)
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank()
end,
group = vim.api.nvim_create_augroup("YankHighlight", {}),
pattern = "*",
})

View file

@ -0,0 +1,224 @@
return {
-- Can't live without
{
"lewis6991/gitsigns.nvim",
opts = {
signs = {
add = { text = "+" },
change = { text = "~" },
delete = { text = "-" },
topdelete = { text = "-" },
changedelete = { text = "~" },
untracked = { text = "·" },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 2500,
follow_files = true,
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "right_align", -- 'eol' | 'overlay' | 'right_align'
delay = 0,
ignore_whitespace = false,
},
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
yadm = {
enable = false,
},
},
},
{ "lukas-reineke/indent-blankline.nvim", opts = {
char = "",
show_trailing_blankline_indent = false,
} },
{
"lukoshkin/trailing-whitespace",
opts = {
patterns = { "\\s\\+$" },
palette = { markdown = "#CCCCCC" },
default_color = "#EEEEEE",
},
},
{
"ThePrimeagen/harpoon",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("harpoon").setup()
local ui = require("harpoon.ui")
local mark = require("harpoon.mark")
-- add and view
vim.keymap.set({ "n", "i" }, "<A-a>", function()
mark.add_file()
end, { desc = "add file to harpoon" })
vim.keymap.set({ "n", "i" }, "<A-e>", function()
ui.toggle_quick_menu()
end, { desc = "show harpoon menu" })
-- switch it up!
vim.keymap.set({ "n", "i" }, "<A-h>", function()
ui.nav_file(1)
end, { desc = "harpoon 1 (the magic finger)" })
vim.keymap.set({ "n", "i" }, "<A-t>", function()
ui.nav_file(2)
end, { desc = "harpoon 2" })
vim.keymap.set({ "n", "i" }, "<A-n>", function()
ui.nav_file(3)
end, { desc = "harpoon 3" })
vim.keymap.set({ "n", "i" }, "<A-s>", function()
ui.nav_file(4)
end, { desc = "harpoon 4" })
end,
},
{
"tpope/vim-fugitive",
config = function()
vim.keymap.set("n", "<leader>G", vim.cmd.Git, { desc = "open fugitive" })
end,
},
{
"folke/todo-comments.nvim",
dependencies = "nvim-lua/plenary.nvim",
config = function()
require("todo-comments").setup({
signs = true, -- show icons in the signs column
sign_priority = 10, -- sign priority
-- keywords recognized as todo comments
keywords = {
FIX = { icon = "", color = "error", alt = { "FIXME", "BUG", "FIXIT", "ISSUE" } },
TODO = { icon = "", color = "info" },
HACK = { icon = "!", color = "warning" },
WARN = { icon = "!", color = "warning", alt = { "WARNING", "XXX" } },
NOTE = { icon = "·", color = "hint", alt = { "INFO" } },
TEST = { icon = "T", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
Q = { icon = "?", color = "warning" },
},
gui_style = {
fg = "NONE", -- The gui style to use for the fg highlight group.
bg = "BOLD", -- The gui style to use for the bg highlight group.
},
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
-- highlighting of the line containing the todo comment
-- * before: highlights before the keyword (typically comment characters)
-- * keyword: highlights of the keyword
-- * after: highlights after the keyword (todo text)
highlight = {
multiline = true, -- enable multine todo comments
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
multiline_context = 8, -- extra lines that will be re-evaluated when changing a line
before = "", -- "fg" or "bg" or empty
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
after = "bg", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlightng (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 400, -- ignore lines longer than this
exclude = {}, -- list of file types to exclude highlighting
},
-- list of named colors where we try to extract the guifg from the
-- list of highlight groups or use the hex color if hl not found as a fallback
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
info = { "DiagnosticInfo", "#2563EB" },
hint = { "DiagnosticHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
test = { "Identifier", "#FF00FF" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
-- regex that will be used to match keywords.
-- don't replace the (KEYWORDS) placeholder
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
},
})
end,
},
{
"mbbill/undotree",
keys = {
"<leader>u",
"UndotreeToggle",
desc = "Toggle undotree view",
},
},
"rafamadriz/friendly-snippets",
{
"mizlan/iswap.nvim",
config = function()
require("iswap").setup({
-- The keys that will be used as a selection, in order
-- ('asdfghjklqwertyuiopzxcvbnm' by default)
-- keys = "aoeuhtns",
-- Grey out the rest of the text when making a selection
-- (enabled by default)
grey = "disable",
-- Highlight group for the sniping value (asdf etc.)
-- default 'Search'
-- hl_snipe = 'ErrorMsg',
-- Highlight group for the visual selection of terms
-- default 'Visual'
-- hl_selection = 'WarningMsg',
-- Highlight group for the greyed background
-- default 'Comment'
-- hl_grey = 'LineNr',
-- Post-operation flashing highlight style,
-- either 'simultaneous' or 'sequential', or false to disable
-- default 'sequential'
-- flash_style = false,
-- Highlight group for flashing highlight afterward
-- default 'IncSearch'
-- hl_flash = 'ModeMsg',
-- Move cursor to the other element in ISwap*With commands
-- default false
-- move_cursor = true,
-- Automatically swap with only two arguments
-- default nil
autoswap = true,
-- Other default options you probably should not change:
debug = nil,
hl_grey_priority = "1000",
})
vim.keymap.set("n", "s<Left>", ":ISwapNodeWithLeft<CR>", { desc = "Swap argument with left" })
vim.keymap.set("n", "s<Right>", ":ISwapNodeWithRight<CR>", { desc = "Swap argument with right" })
end,
},
{ "wintermute-cell/gitignore.nvim", dependencies = { "nvim-telescope/telescope.nvim" } },
}

View file

@ -0,0 +1,67 @@
return {
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./snippets" } })
local has_words_before = function()
unpack = unpack or table.unpack
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({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
-- ['<C-Space>'] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
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" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
})
end,
},
{ "windwp/nvim-autopairs", config = true },
"numToStr/Comment.nvim",
{ "ur4ltz/surround.nvim", opts = {
mappings_style = "surround",
} },
}

View file

@ -0,0 +1,4 @@
return {
"Th3Whit3Wolf/one-nvim",
{ "catppuccin/nvim", name = "catppuccin" },
}

View file

@ -0,0 +1,46 @@
return {
{
"nvim-lualine/lualine.nvim",
opts = {
options = {
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {},
},
},
}

View file

@ -0,0 +1,253 @@
return {
"lukas-reineke/lsp-format.nvim",
{
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"folke/neodev.nvim",
},
config = function()
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {},
automatic_installation = false,
})
require("neodev").setup()
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "open diagnostic in a float window" })
vim.keymap.set("n", "<leader>pe", vim.diagnostic.goto_prev, { desc = "goto [P]revious [E]rror" })
vim.keymap.set("n", "<leader>ne", vim.diagnostic.goto_next, { desc = "goto [N]ext [E]rror" })
vim.keymap.set("n", "<leader>el", vim.diagnostic.setloclist, { desc = "show [E]rror [L]ocations" })
local on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
-- See `:help vim.lsp.*`
local bufopts = { buffer = bufnr }
local rename = function()
vim.ui.input({ prompt = "Rename symbol: " }, function(new_name)
if new_name ~= nil then
vim.lsp.buf.rename(new_name)
end
end)
end
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts)
vim.keymap.set("n", "gtd", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts)
vim.keymap.set("n", "gu", vim.lsp.buf.references, bufopts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format({ async = true })
end, bufopts)
vim.keymap.set("n", "<leader>r", rename, bufopts)
end
-- Gutter symbols setup
vim.fn.sign_define(
"DiagnosticSignError",
{ text = "E", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" }
)
vim.fn.sign_define(
"DiagnosticSignWarn",
{ text = "W", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" }
)
vim.fn.sign_define(
"DiagnosticSignHint",
{ text = "H", texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" }
)
vim.fn.sign_define(
"DiagnosticSignInfo",
{ text = "·", texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" }
)
-- Border setup
local border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
}
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
-- Language servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Spell check
local common_dictionary = {
"Yu",
"Hui",
"Léana",
"Chiang",
"ISTIC",
}
require("lspconfig").ltex.setup({
on_attach = on_attach,
cmd = { "ltex-ls" },
filetypes = { "markdown", "text", "gitcommit" },
settings = {
ltex = {
language = "auto",
additionalRules = {
motherTongue = "en-US",
},
trace = { server = "verbose" },
dictionary = {
["en-US"] = common_dictionary,
["fr"] = common_dictionary,
},
},
},
flags = { debounce_text_changes = 10000 },
capabilities = capabilities,
})
-- JSON
require("lspconfig").jsonls.setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- XML
require("lspconfig").lemminx.setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- CSS
require("lspconfig").cssls.setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- Lua
require("lspconfig").lua_ls.setup({
on_attach = on_attach,
capabilities = capabilities,
settings = {
lua = {
formatting = {
enable = true,
indent = 2,
},
},
},
})
-- Rust
require("lspconfig").rust_analyzer.setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- Python
require("lspconfig").pylsp.setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- Scala
require("lspconfig").metals.setup({
on_attach = on_attach,
capabilities = capabilities,
})
-- C
require("lspconfig").clangd.setup({
on_attach = on_attach,
capabilities = capabilities,
})
end,
},
{
"j-hui/fidget.nvim",
opts = {
text = {
spinner = "dots",
-- done = "[Ok]",
},
},
},
{
"simrat39/symbols-outline.nvim",
keys = {
{
"<leader><leader>",
function()
vim.cmd("SymbolsOutline")
end,
desc = "Open symbols outline",
},
},
opts = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = "left",
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = "Pmenu",
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { "", "" },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" },
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "<leader>rn",
code_actions = "a",
fold = "h",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
-- symbols = {
-- File = { icon = "", hl = "@text.uri" },
-- Module = { icon = "", hl = "@namespace" },
-- Namespace = { icon = "", hl = "@namespace" },
-- Package = { icon = "", hl = "@namespace" },
-- Class = { icon = "𝓒", hl = "@type" },
-- Method = { icon = "ƒ", hl = "@method" },
-- Property = { icon = "", hl = "@method" },
-- Field = { icon = "", hl = "@field" },
-- Constructor = { icon = "", hl = "@constructor" },
-- Enum = { icon = "", hl = "@type" },
-- Interface = { icon = "ﰮ", hl = "@type" },
-- Function = { icon = "", hl = "@function" },
-- Variable = { icon = "", hl = "@constant" },
-- Constant = { icon = "", hl = "@constant" },
-- String = { icon = "𝓐", hl = "@string" },
-- Number = { icon = "#", hl = "@number" },
-- Boolean = { icon = "⊨", hl = "@boolean" },
-- Array = { icon = "", hl = "@constant" },
-- Object = { icon = "⦿", hl = "@type" },
-- Key = { icon = "🔐", hl = "@type" },
-- Null = { icon = "NULL", hl = "@type" },
-- EnumMember = { icon = "", hl = "@field" },
-- Struct = { icon = "𝓢", hl = "@type" },
-- Event = { icon = "🗲", hl = "@type" },
-- Operator = { icon = "+", hl = "@operator" },
-- TypeParameter = { icon = "𝙏", hl = "@parameter" },
-- Component = { icon = "", hl = "@function" },
-- Fragment = { icon = "", hl = "@constant" },
-- },
},
},
}

View file

@ -0,0 +1,49 @@
return {
-- Misc
"ThePrimeagen/vim-be-good",
{
"andweeb/presence.nvim",
opts = {
-- General options
-- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
auto_update = true,
-- Text displayed when hovered over the Neovim image
neovim_image_text = "I use NeoVim btw",
-- Main image display (either "neovim" or "file")
main_image = "file",
-- Use your own Discord application client id (not recommended)
client_id = "793271441293967371",
-- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
log_level = nil,
-- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
debounce_timeout = 10,
-- Displays the current line number instead of the current project
enable_line_number = false,
-- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
blacklist = {},
-- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
buttons = true,
-- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
file_assets = {},
-- Show the timer
show_time = false,
-- Rich Presence text options
-- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
editing_text = "Editing %s",
-- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
file_explorer_text = "Browsing %s",
-- Format string rendered when committing changes in git (either string or function(filename: string): string)
git_commit_text = "Committing changes",
-- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
plugin_manager_text = "Managing plugins",
-- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
reading_text = "Reading %s",
-- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
workspace_text = "Natural Habitat: %s/",
-- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
line_number_text = "Line %s out of %s",
},
},
"Eandrju/cellular-automaton.nvim",
}

View file

@ -0,0 +1,29 @@
return {
-- Nice to have
"tpope/vim-sleuth",
"mg979/vim-visual-multi",
{ "norcalli/nvim-colorizer.lua", config = true },
{
"ellisonleao/glow.nvim",
opts = {
glow_path = "glow", -- will be filled automatically with your glow bin in $PATH, if any
install_path = "~/.local/bin", -- default path for installing glow binary
border = "shadow", -- floating window border config
style = "light", -- filled automatically with your current editor background, you can override using glow json style
pager = false,
width = 80,
height = 100,
width_ratio = 0.7, -- maximum width of the Glow window compared to the nvim window size (overrides `width`)
height_ratio = 0.7,
},
},
"nvim-tree/nvim-web-devicons",
{
"akinsho/toggleterm.nvim",
tag = "*",
opts = {
open_mapping = "<C-`>",
size = 20,
},
},
}

View file

@ -0,0 +1,105 @@
return {
-- Power tools
{
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
local themes = require("telescope.themes")
telescope.setup({
defaults = {
mappings = {
i = {
["<esc>"] = actions.close,
},
},
},
})
-- Enable telescope fzf native, if installed
pcall(require("telescope").load_extension, "fzf")
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>?", builtin.oldfiles, { desc = "[?] Find recently opened files" })
vim.keymap.set("n", "<leader>/", function()
builtin.current_buffer_fuzzy_find(themes.get_dropdown({ previewer = false }))
end, { desc = "[/] Fuzzily search in current buffer]" })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "Search [A]ll [F]iles" })
vim.keymap.set("n", "<leader>gf", builtin.git_files, { desc = "Search [G]it [F]iles" })
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
vim.keymap.set("n", "<leader>b", builtin.buffers, { desc = "Search [B]uffers" })
end,
},
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make", cond = vim.fn.executable("make") == 1 },
{
"nvim-treesitter/nvim-treesitter",
run = function()
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
ts_update()
end,
opts = {
{
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = {
"c",
"cpp",
"lua",
"vim",
"help",
"rust",
"scala",
"python",
},
-- 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 = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
-- set to `false` to disable one of the mappings
init_selection = "false",
scope_incremental = "false",
node_incremental = "<A-Up>",
node_decremental = "<A-Down>",
},
},
refactor = {
smart_rename = {
enable = true,
keymaps = {
smart_rename = "grr",
},
},
},
},
},
},
{
"nvim-treesitter/nvim-treesitter-context",
opts = {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = "topline", -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
zindex = 20, -- The Z-index of the context window
},
},
}