mirror of
https://github.com/aminnairi/dotfiles.git
synced 2026-09-14 12:12:13 +02:00
1068 lines
29 KiB
Lua
1068 lines
29 KiB
Lua
vim.o.autoindent = true
|
|
vim.o.autoread = true
|
|
vim.o.backspace = "indent,eol,start"
|
|
vim.o.bufhidden = "hide"
|
|
vim.o.clipboard = "unnamedplus"
|
|
vim.o.confirm = true
|
|
vim.o.copyindent = true
|
|
vim.o.emoji = true
|
|
vim.o.encoding = "UTF-8"
|
|
vim.o.expandtab = true
|
|
vim.o.fileignorecase = true
|
|
vim.o.hlsearch = true
|
|
vim.o.ignorecase = true
|
|
vim.o.incsearch = true
|
|
vim.o.infercase = true
|
|
vim.o.joinspaces = true
|
|
vim.o.laststatus = 2
|
|
vim.o.lazyredraw = true
|
|
vim.o.nobackup = true
|
|
vim.o.nobreakindent = true
|
|
vim.o.nocompatible = true
|
|
vim.o.noerrorbells = true
|
|
vim.o.nofoldenable = true
|
|
vim.o.nolinebreak = true
|
|
vim.o.noswapfile = true
|
|
vim.o.nowrap = true
|
|
vim.o.number = true
|
|
vim.o.path = vim.o.path .. "**"
|
|
vim.o.relativenumber = true
|
|
vim.o.shiftround = true
|
|
vim.o.shiftwidth = 2
|
|
vim.o.shiftwidth = 2
|
|
vim.o.smartcase = true
|
|
vim.o.smartindent = true
|
|
vim.o.smarttab = true
|
|
vim.o.softtabstop = 2
|
|
vim.o.tabstop = 2
|
|
vim.o.wildignore = "*.o,*.obj,./node_modules/*"
|
|
vim.o.wildignorecase = true
|
|
vim.syntax = "on"
|
|
|
|
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", { silent = true })
|
|
vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", { silent = true })
|
|
vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", { silent = true })
|
|
vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", { silent = true })
|
|
vim.api.nvim_set_keymap("n", "<C-q>", ":wqa!<cr>", { silent = true })
|
|
|
|
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({
|
|
{
|
|
"folke/tokyonight.nvim",
|
|
lazy = false,
|
|
priority = 1000,
|
|
init = function()
|
|
vim.cmd([[colorscheme tokyonight]])
|
|
end,
|
|
opts = {
|
|
style = "storm",
|
|
light_style = "day",
|
|
transparent = false,
|
|
terminal_colors = true,
|
|
},
|
|
},
|
|
{
|
|
"nvim-tree/nvim-tree.lua",
|
|
dependencies = {
|
|
"nvim-tree/nvim-web-devicons",
|
|
},
|
|
config = function()
|
|
vim.g.loaded_netrw = 1
|
|
vim.g.loaded_netrwPlugin = 1
|
|
vim.opt.termguicolors = true
|
|
|
|
require("nvim-tree").setup({
|
|
auto_reload_on_write = true,
|
|
sort_by = "case_sensitive",
|
|
view = {
|
|
width = 30,
|
|
},
|
|
filters = {
|
|
dotfiles = false,
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"nvim-telescope/telescope.nvim",
|
|
dependencies = {
|
|
"nvim-lua/plenary.nvim",
|
|
},
|
|
config = function()
|
|
require("telescope").setup({})
|
|
end,
|
|
},
|
|
{
|
|
"hrsh7th/nvim-cmp",
|
|
dependencies = {
|
|
"L3MON4D3/LuaSnip",
|
|
"saadparwaiz1/cmp_luasnip",
|
|
"hrsh7th/cmp-nvim-lsp",
|
|
"hrsh7th/cmp-buffer",
|
|
"hrsh7th/cmp-path",
|
|
"hrsh7th/cmp-cmdline",
|
|
},
|
|
config = function()
|
|
local cmp = require("cmp")
|
|
|
|
cmp.setup({
|
|
snippet = {
|
|
expand = function(args)
|
|
require("luasnip").lsp_expand(args.body)
|
|
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 = true }),
|
|
}),
|
|
sources = cmp.config.sources({
|
|
{ name = "nvim_lsp" },
|
|
{ name = "luasnip" },
|
|
{ name = "path" },
|
|
}, {
|
|
{ name = "buffer" },
|
|
}),
|
|
})
|
|
|
|
-- Set configuration for specific filetype.
|
|
cmp.setup.filetype("gitcommit", {
|
|
sources = cmp.config.sources({
|
|
{ name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
|
}, {
|
|
{ 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" },
|
|
},
|
|
})
|
|
|
|
-- 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" },
|
|
}),
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"williamboman/mason.nvim",
|
|
opts = {}
|
|
},
|
|
{
|
|
"williamboman/mason-lspconfig.nvim",
|
|
dependencies = {
|
|
"williamboman/mason.nvim",
|
|
},
|
|
opts = {
|
|
ensure_installed = {
|
|
"tsserver",
|
|
"lua_ls",
|
|
"volar",
|
|
"cssls",
|
|
"cssmodules_ls",
|
|
"prismals",
|
|
"yamlls",
|
|
"marksman"
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
event = "VeryLazy",
|
|
dependencies = {
|
|
"williamboman/mason-lspconfig.nvim",
|
|
},
|
|
init = function()
|
|
local whichKey = require("which-key")
|
|
|
|
-- Use LspAttach autocommand to only map the following keys
|
|
-- after the language server attaches to the current buffer
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
callback = function(ev)
|
|
-- Enable completion triggered by <c-x><c-o>
|
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
|
|
|
whichKey.register({
|
|
["<leader>l"] = {
|
|
name = "LSP",
|
|
d = {
|
|
name = "Diagnostic",
|
|
o = {
|
|
function()
|
|
vim.diagnostic.open_float()
|
|
end,
|
|
"Open",
|
|
},
|
|
p = {
|
|
function()
|
|
vim.diagnostic.goto_prev()
|
|
end,
|
|
"Previous",
|
|
},
|
|
n = {
|
|
function()
|
|
vim.diagnostic.goto_next()
|
|
end,
|
|
"Next",
|
|
},
|
|
},
|
|
b = {
|
|
name = "File",
|
|
d = {
|
|
function()
|
|
vim.lsp.buf.declaration()
|
|
end,
|
|
"Declaration",
|
|
buffer = ev.buf,
|
|
},
|
|
D = {
|
|
function()
|
|
vim.lsp.buf.definition()
|
|
end,
|
|
"Definition",
|
|
buffer = ev.buf,
|
|
},
|
|
h = {
|
|
function()
|
|
vim.lsp.buf.hover()
|
|
end,
|
|
"Hover",
|
|
buffer = ev.buf,
|
|
},
|
|
i = {
|
|
function()
|
|
vim.lsp.buf.implementation()
|
|
end,
|
|
"Implementation",
|
|
buffer = ev.buf,
|
|
},
|
|
s = {
|
|
function()
|
|
vim.lsp.buf.signature_help()
|
|
end,
|
|
"Signature",
|
|
buffer = ev.buf,
|
|
},
|
|
t = {
|
|
function()
|
|
vim.lsp.buf.type_definition()
|
|
end,
|
|
"Type definition",
|
|
buffer = ev.buf,
|
|
},
|
|
r = {
|
|
function()
|
|
vim.lsp.buf.rename()
|
|
end,
|
|
"Rename",
|
|
buffer = ev.buf,
|
|
},
|
|
c = {
|
|
function()
|
|
vim.lsp.buf.code_action()
|
|
end,
|
|
"Code action",
|
|
buffer = ev.buf,
|
|
},
|
|
R = {
|
|
function()
|
|
vim.lsp.buf.references()
|
|
end,
|
|
"References",
|
|
buffer = ev.buf,
|
|
},
|
|
f = {
|
|
function()
|
|
vim.lsp.buf.format({
|
|
async = true,
|
|
})
|
|
end,
|
|
"Format",
|
|
buffer = ev.buf,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
})
|
|
end,
|
|
config = function()
|
|
local lspconfig = require("lspconfig")
|
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
|
|
lspconfig.lua_ls.setup({
|
|
capabilities = capabilities,
|
|
settings = {
|
|
Lua = {
|
|
runtime = {
|
|
-- Tell the language server which version of Lua you"re using (most likely LuaJIT in the case of Neovim)
|
|
version = "LuaJIT",
|
|
},
|
|
diagnostics = {
|
|
-- Get the language server to recognize the `vim` global
|
|
globals = { "vim" },
|
|
},
|
|
workspace = {
|
|
-- Make the server aware of Neovim runtime files
|
|
library = vim.api.nvim_get_runtime_file("", true),
|
|
},
|
|
-- Do not send telemetry data containing a randomized but unique identifier
|
|
telemetry = {
|
|
enable = false,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
lspconfig.tsserver.setup({
|
|
capabilities = capabilities,
|
|
})
|
|
|
|
lspconfig.volar.setup({
|
|
capabilities = capabilities,
|
|
filetypes = {
|
|
"javascript",
|
|
"typescript",
|
|
"vue"
|
|
},
|
|
})
|
|
|
|
lspconfig.cssls.setup({
|
|
capabilities = capabilities,
|
|
filetypes = {
|
|
"css",
|
|
"scss",
|
|
"sass",
|
|
"less",
|
|
},
|
|
})
|
|
|
|
lspconfig.cssmodules_ls.setup({
|
|
capabilities = capabilities,
|
|
filetypes = {
|
|
"javascript",
|
|
"javascriptreact",
|
|
"typescript",
|
|
"typescriptreact",
|
|
},
|
|
})
|
|
|
|
lspconfig.prismals.setup({
|
|
filetypes = {
|
|
"prisma"
|
|
},
|
|
capabilities = capabilities
|
|
})
|
|
|
|
lspconfig.yamlls.setup({
|
|
capabilities = capabilities,
|
|
filetypes = {
|
|
"yaml"
|
|
},
|
|
})
|
|
|
|
lspconfig.marksman.setup({
|
|
capabilities = capabilities,
|
|
filetypes = {
|
|
"markdown"
|
|
}
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
|
dependencies = {
|
|
"williamboman/mason.nvim",
|
|
},
|
|
opts = {
|
|
ensure_installed = {
|
|
"stylua",
|
|
"luacheck",
|
|
"stylelint",
|
|
"shellcheck",
|
|
"rustfmt",
|
|
"phpcbf",
|
|
"phpstan",
|
|
"jq",
|
|
"jsonlint",
|
|
"htmlbeautifier",
|
|
"eslint_d",
|
|
"blade-formatter",
|
|
"markdownlint",
|
|
"yamllint",
|
|
"ansible-lint"
|
|
},
|
|
auto_update = true,
|
|
run_on_start = true,
|
|
}
|
|
},
|
|
{
|
|
"stevearc/conform.nvim",
|
|
dependencies = {
|
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
|
},
|
|
events = { "BufReadPre", "BufNewFile" },
|
|
opts = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
css = { "stylelint" },
|
|
sh = { "shellcheck" },
|
|
rust = { "rustfmt" },
|
|
php = { "php_cs_fixer", "phpcbf" },
|
|
json = { "jq" },
|
|
html = { "htmlbeautifier" },
|
|
javascript = { "eslint" },
|
|
typescript = { "eslint" },
|
|
javascriptreact = { "eslint" },
|
|
typescriptreact = { "eslint" },
|
|
vue = { "eslint" },
|
|
blade = { "blade-formatter" },
|
|
yaml = { "ansible_lint" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"mfussenegger/nvim-lint",
|
|
dependencies = {
|
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
|
},
|
|
events = { "BufReadPre", "BufWritePost" },
|
|
init = function()
|
|
local lint = require("lint")
|
|
|
|
vim.api.nvim_create_autocmd({ "TextChanged", "TextChangedI", "BufEnter", "BufReadPre", "BufWritePost", "CursorHold", "CursorHoldI" }, {
|
|
callback = function()
|
|
lint.try_lint()
|
|
end,
|
|
})
|
|
end,
|
|
config = function()
|
|
local lint = require("lint")
|
|
|
|
lint.linters_by_ft = {
|
|
lua = { "luacheck" },
|
|
javascript = { "eslint" },
|
|
typescript = { "eslint" },
|
|
javascriptreact = { "eslint" },
|
|
typescriptreact = { "eslint" },
|
|
vue = { "eslint" },
|
|
sh = { "shellcheck" },
|
|
fish = { "fish" },
|
|
json = { "jsonlint", },
|
|
markdown = { "markdownlint" },
|
|
php = { "php", "phpcs", "phpstan" },
|
|
css = { "stylelint" },
|
|
yaml = { "yamllint" }
|
|
}
|
|
end
|
|
},
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
event = "VeryLazy",
|
|
config = function()
|
|
require("nvim-treesitter.configs").setup({
|
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
|
ensure_installed = {
|
|
"c",
|
|
"css",
|
|
"lua",
|
|
"vim",
|
|
"vimdoc",
|
|
"query",
|
|
"typescript",
|
|
"javascript",
|
|
"tsx",
|
|
"json",
|
|
"vue",
|
|
"prisma"
|
|
},
|
|
|
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
|
sync_install = false,
|
|
|
|
-- Automatically install missing parsers when entering buffer
|
|
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
|
|
auto_install = false,
|
|
|
|
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
|
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
|
|
|
highlight = {
|
|
enable = true,
|
|
|
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
|
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
|
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
-- Instead of true it can also be a list of languages
|
|
additional_vim_regex_highlighting = false,
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"stevearc/dressing.nvim",
|
|
event = "VeryLazy",
|
|
opts = {
|
|
input = {
|
|
-- Set to false to disable the vim.ui.input implementation
|
|
enabled = true,
|
|
|
|
-- Default prompt string
|
|
default_prompt = "Input:",
|
|
|
|
-- Can be 'left', 'right', or 'center'
|
|
title_pos = "left",
|
|
|
|
-- When true, <Esc> will close the modal
|
|
insert_only = true,
|
|
|
|
-- When true, input will start in insert mode.
|
|
start_in_insert = true,
|
|
|
|
-- These are passed to nvim_open_win
|
|
border = "rounded",
|
|
-- 'editor' and 'win' will default to being centered
|
|
relative = "cursor",
|
|
|
|
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
|
|
prefer_width = 40,
|
|
width = nil,
|
|
-- min_width and max_width can be a list of mixed types.
|
|
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
|
|
max_width = { 140, 0.9 },
|
|
min_width = { 20, 0.2 },
|
|
|
|
buf_options = {},
|
|
win_options = {
|
|
-- Window transparency (0-100)
|
|
winblend = 10,
|
|
-- Disable line wrapping
|
|
wrap = false,
|
|
-- Indicator for when text exceeds window
|
|
list = true,
|
|
listchars = "precedes:…,extends:…",
|
|
-- Increase this for more context when text scrolls off the window
|
|
sidescrolloff = 0,
|
|
},
|
|
|
|
-- Set to `false` to disable
|
|
mappings = {
|
|
n = {
|
|
["<Esc>"] = "Close",
|
|
["<CR>"] = "Confirm",
|
|
},
|
|
i = {
|
|
["<C-c>"] = "Close",
|
|
["<CR>"] = "Confirm",
|
|
["<Up>"] = "HistoryPrev",
|
|
["<Down>"] = "HistoryNext",
|
|
},
|
|
},
|
|
|
|
override = function(conf)
|
|
-- This is the config that will be passed to nvim_open_win.
|
|
-- Change values here to customize the layout
|
|
return conf
|
|
end,
|
|
|
|
-- see :help dressing_get_config
|
|
get_config = nil,
|
|
},
|
|
select = {
|
|
-- Set to false to disable the vim.ui.select implementation
|
|
enabled = true,
|
|
|
|
-- Priority list of preferred vim.select implementations
|
|
backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
|
|
|
|
-- Trim trailing `:` from prompt
|
|
trim_prompt = true,
|
|
|
|
-- Options for telescope selector
|
|
-- These are passed into the telescope picker directly. Can be used like:
|
|
-- telescope = require('telescope.themes').get_ivy({...})
|
|
telescope = nil,
|
|
|
|
-- Options for fzf selector
|
|
fzf = {
|
|
window = {
|
|
width = 0.5,
|
|
height = 0.4,
|
|
},
|
|
},
|
|
|
|
-- Options for fzf-lua
|
|
fzf_lua = {
|
|
-- winopts = {
|
|
-- height = 0.5,
|
|
-- width = 0.5,
|
|
-- },
|
|
},
|
|
|
|
-- Options for nui Menu
|
|
nui = {
|
|
position = "50%",
|
|
size = nil,
|
|
relative = "editor",
|
|
border = {
|
|
style = "rounded",
|
|
},
|
|
buf_options = {
|
|
swapfile = false,
|
|
filetype = "DressingSelect",
|
|
},
|
|
win_options = {
|
|
winblend = 10,
|
|
},
|
|
max_width = 80,
|
|
max_height = 40,
|
|
min_width = 40,
|
|
min_height = 10,
|
|
},
|
|
|
|
-- Options for built-in selector
|
|
builtin = {
|
|
-- These are passed to nvim_open_win
|
|
border = "rounded",
|
|
-- 'editor' and 'win' will default to being centered
|
|
relative = "editor",
|
|
|
|
buf_options = {},
|
|
win_options = {
|
|
-- Window transparency (0-100)
|
|
winblend = 10,
|
|
cursorline = true,
|
|
cursorlineopt = "both",
|
|
},
|
|
|
|
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
|
|
-- the min_ and max_ options can be a list of mixed types.
|
|
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
|
|
width = nil,
|
|
max_width = { 140, 0.8 },
|
|
min_width = { 40, 0.2 },
|
|
height = nil,
|
|
max_height = 0.9,
|
|
min_height = { 10, 0.2 },
|
|
|
|
-- Set to `false` to disable
|
|
mappings = {
|
|
["<Esc>"] = "Close",
|
|
["<C-c>"] = "Close",
|
|
["<CR>"] = "Confirm",
|
|
},
|
|
|
|
override = function(conf)
|
|
-- This is the config that will be passed to nvim_open_win.
|
|
-- Change values here to customize the layout
|
|
return conf
|
|
end,
|
|
},
|
|
|
|
-- Used to override format_item. See :help dressing-format
|
|
format_item_override = {},
|
|
|
|
-- see :help dressing_get_config
|
|
get_config = nil,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"kylechui/nvim-surround",
|
|
event = "BufEnter",
|
|
opts = {},
|
|
},
|
|
{
|
|
"romgrk/barbar.nvim",
|
|
event = "BufNew",
|
|
dependencies = {
|
|
"lewis6991/gitsigns.nvim",
|
|
"nvim-tree/nvim-web-devicons",
|
|
},
|
|
init = function()
|
|
vim.g.barbar_auto_setup = false
|
|
|
|
local map = vim.api.nvim_set_keymap
|
|
local opts = { noremap = true, silent = true }
|
|
|
|
map("n", "<A-,>", "<Cmd>BufferPrevious<CR>", opts)
|
|
map("n", "<A-.>", "<Cmd>BufferNext<CR>", opts)
|
|
map("n", "<A-<>", "<Cmd>BufferMovePrevious<CR>", opts)
|
|
map("n", "<A->>", "<Cmd>BufferMoveNext<CR>", opts)
|
|
map("n", "<A-1>", "<Cmd>BufferGoto 1<CR>", opts)
|
|
map("n", "<A-2>", "<Cmd>BufferGoto 2<CR>", opts)
|
|
map("n", "<A-3>", "<Cmd>BufferGoto 3<CR>", opts)
|
|
map("n", "<A-4>", "<Cmd>BufferGoto 4<CR>", opts)
|
|
map("n", "<A-5>", "<Cmd>BufferGoto 5<CR>", opts)
|
|
map("n", "<A-6>", "<Cmd>BufferGoto 6<CR>", opts)
|
|
map("n", "<A-7>", "<Cmd>BufferGoto 7<CR>", opts)
|
|
map("n", "<A-8>", "<Cmd>BufferGoto 8<CR>", opts)
|
|
map("n", "<A-9>", "<Cmd>BufferGoto 9<CR>", opts)
|
|
map("n", "<A-0>", "<Cmd>BufferLast<CR>", opts)
|
|
map("n", "<A-p>", "<Cmd>BufferPin<CR>", opts)
|
|
map("n", "<A-c>", "<Cmd>BufferClose<CR>", opts)
|
|
map("n", "<A-p>", "<Cmd>BufferPick<CR>", opts)
|
|
end,
|
|
opts = {},
|
|
},
|
|
{
|
|
"RRethy/vim-illuminate",
|
|
event = "BufEnter",
|
|
config = function()
|
|
require("illuminate").configure({
|
|
-- providers: provider used to get references in the buffer, ordered by priority
|
|
providers = {
|
|
"lsp",
|
|
"treesitter",
|
|
"regex",
|
|
},
|
|
-- delay: delay in milliseconds
|
|
delay = 100,
|
|
-- filetype_overrides: filetype specific overrides.
|
|
-- The keys are strings to represent the filetype while the values are tables that
|
|
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
|
|
filetype_overrides = {},
|
|
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
|
|
filetypes_denylist = {
|
|
"dirvish",
|
|
"fugitive",
|
|
},
|
|
-- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist
|
|
filetypes_allowlist = {},
|
|
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
|
|
-- See `:help mode()` for possible values
|
|
modes_denylist = {},
|
|
-- modes_allowlist: modes to illuminate, this is overriden by modes_denylist
|
|
-- See `:help mode()` for possible values
|
|
modes_allowlist = {},
|
|
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
|
|
-- Only applies to the 'regex' provider
|
|
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
|
providers_regex_syntax_denylist = {},
|
|
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist
|
|
-- Only applies to the 'regex' provider
|
|
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
|
|
providers_regex_syntax_allowlist = {},
|
|
-- under_cursor: whether or not to illuminate under the cursor
|
|
under_cursor = true,
|
|
-- large_file_cutoff: number of lines at which to use large_file_config
|
|
-- The `under_cursor` option is disabled when this cutoff is hit
|
|
large_file_cutoff = nil,
|
|
-- large_file_config: config to use for large files (based on large_file_cutoff).
|
|
-- Supports the same keys passed to .configure
|
|
-- If nil, vim-illuminate will be disabled for large files.
|
|
large_file_overrides = nil,
|
|
-- min_count_to_highlight: minimum number of matches required to perform highlighting
|
|
min_count_to_highlight = 1,
|
|
})
|
|
end,
|
|
},
|
|
{
|
|
"karb94/neoscroll.nvim",
|
|
event = "BufEnter",
|
|
opts = {},
|
|
},
|
|
{
|
|
"folke/lsp-colors.nvim",
|
|
dependencies = {
|
|
"neovim/nvim-lspconfig",
|
|
},
|
|
opts = {
|
|
Error = "#db4b4b",
|
|
Warning = "#e0af68",
|
|
Information = "#0db9d7",
|
|
Hint = "#10B981",
|
|
},
|
|
},
|
|
{
|
|
"xiyaowong/link-visitor.nvim",
|
|
event = "BufEnter",
|
|
opts = {
|
|
open_cmd = nil,
|
|
silent = true,
|
|
skip_confirmation = true,
|
|
border = "rounded",
|
|
},
|
|
},
|
|
{
|
|
"numToStr/Comment.nvim",
|
|
opts = {
|
|
---Add a space b/w comment and the line
|
|
padding = true,
|
|
---Whether the cursor should stay at its position
|
|
sticky = true,
|
|
---Lines to be ignored while (un)comment
|
|
ignore = nil,
|
|
---LHS of toggle mappings in NORMAL mode
|
|
toggler = {
|
|
---Line-comment toggle keymap
|
|
line = "gcc",
|
|
---Block-comment toggle keymap
|
|
block = "gbc",
|
|
},
|
|
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
|
opleader = {
|
|
---Line-comment keymap
|
|
line = "gc",
|
|
---Block-comment keymap
|
|
block = "gb",
|
|
},
|
|
---LHS of extra mappings
|
|
extra = {
|
|
---Add comment on the line above
|
|
above = "gcO",
|
|
---Add comment on the line below
|
|
below = "gco",
|
|
---Add comment at the end of line
|
|
eol = "gcA",
|
|
},
|
|
---Enable keybindings
|
|
---NOTE: If given `false` then the plugin won't create any mappings
|
|
mappings = {
|
|
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
|
basic = true,
|
|
---Extra mapping; `gco`, `gcO`, `gcA`
|
|
extra = true,
|
|
},
|
|
---Function to call before (un)comment
|
|
pre_hook = nil,
|
|
---Function to call after (un)comment
|
|
post_hook = nil,
|
|
},
|
|
},
|
|
{
|
|
"nvim-lualine/lualine.nvim",
|
|
event = "VeryLazy",
|
|
requires = {
|
|
"nvim-tree/nvim-web-devicons",
|
|
opt = true,
|
|
},
|
|
opts = {
|
|
options = {
|
|
icons_enabled = true,
|
|
theme = "tokyonight",
|
|
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", "fileformat", "filetype" },
|
|
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 = {},
|
|
},
|
|
},
|
|
{
|
|
"utilyre/barbecue.nvim",
|
|
name = "barbecue",
|
|
event = "BufEnter",
|
|
dependencies = {
|
|
"SmiteshP/nvim-navic",
|
|
"nvim-tree/nvim-web-devicons",
|
|
"folke/tokyonight.nvim",
|
|
},
|
|
opts = {
|
|
theme = "tokyonight",
|
|
},
|
|
},
|
|
{
|
|
"windwp/nvim-autopairs",
|
|
event = "InsertEnter",
|
|
opts = {},
|
|
},
|
|
{
|
|
"folke/which-key.nvim",
|
|
event = "VeryLazy",
|
|
init = function()
|
|
vim.o.timeout = true
|
|
vim.o.timeoutlen = 0
|
|
end,
|
|
config = function()
|
|
local whichKey = require("which-key")
|
|
|
|
whichKey.register({
|
|
["<leader>n"] = {
|
|
name = "NvimTree",
|
|
t = {
|
|
function()
|
|
require("nvim-tree.api").tree.toggle()
|
|
end,
|
|
"Toggle",
|
|
},
|
|
f = {
|
|
function()
|
|
require("nvim-tree.api").tree.focus()
|
|
end,
|
|
"Focus",
|
|
},
|
|
e = {
|
|
function()
|
|
require("nvim-tree.api").tree.expand_all()
|
|
end,
|
|
"Expand",
|
|
},
|
|
c = {
|
|
function()
|
|
require("nvim-tree.api").tree.collapse_all()
|
|
end,
|
|
"Collapse",
|
|
},
|
|
},
|
|
["<leader>t"] = {
|
|
name = "Telescope",
|
|
t = {
|
|
function()
|
|
require("telescope.builtin").treesitter()
|
|
end,
|
|
"Explore the Abstract Syntax Tree",
|
|
},
|
|
f = {
|
|
function()
|
|
require("telescope.builtin").find_files()
|
|
end,
|
|
"Find files",
|
|
},
|
|
w = {
|
|
function()
|
|
require("telescope.builtin").live_grep()
|
|
end,
|
|
"Find words",
|
|
},
|
|
c = {
|
|
function()
|
|
require("telescope.builtin").colorscheme()
|
|
end,
|
|
"Find color schemes",
|
|
},
|
|
g = {
|
|
function()
|
|
require("telescope.builtin").git_files()
|
|
end,
|
|
"Find git files",
|
|
},
|
|
l = {
|
|
name = "LSP",
|
|
e = {
|
|
function()
|
|
require("telescope.builtin").diagnostics()
|
|
end,
|
|
"List diagnostics for all open buffers",
|
|
},
|
|
r = {
|
|
function()
|
|
require("telescope.builtin").lsp_references()
|
|
end,
|
|
"List all references for the word under the cursor",
|
|
},
|
|
i = {
|
|
function()
|
|
require("telescope.builtin").lsp_implementation()
|
|
end,
|
|
"Go to the implementation of the word under the cursor",
|
|
},
|
|
d = {
|
|
function()
|
|
require("telescope.builtin").lsp_definition()
|
|
end,
|
|
"Go to the definition of the word under the cursor",
|
|
},
|
|
t = {
|
|
function()
|
|
require("telescope.builtin").lsp_type_definition()
|
|
end,
|
|
"Go to the type definition of the word under the cursor",
|
|
},
|
|
},
|
|
},
|
|
["<leader>v"] = {
|
|
name = "Visit link",
|
|
v = {
|
|
function()
|
|
require("link-visitor").visit()
|
|
end,
|
|
"Visit",
|
|
},
|
|
l = {
|
|
function()
|
|
require("link-visitor").link_under_cursor()
|
|
end,
|
|
"Under cursor",
|
|
},
|
|
n = {
|
|
function()
|
|
require("link-visitor").link_near_cursor()
|
|
end,
|
|
"Near cursor",
|
|
},
|
|
N = {
|
|
function()
|
|
require("link-visitor").link_nearest()
|
|
end,
|
|
"Near cursor",
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
})
|