huge rework in order to take full advantage of ansible roles

This commit is contained in:
aminnairi
2023-12-30 17:05:26 +01:00
parent b961d14b97
commit bf3625081d
73 changed files with 506 additions and 532 deletions
+4
View File
@@ -0,0 +1,4 @@
require("settings.options")
require("settings.keymap")
require("settings.autocommands")
require("settings.lazy")
@@ -0,0 +1,9 @@
vim.api.nvim_create_autocmd("FileType", {
pattern = "php",
callback = function()
vim.bo.tabstop = 4
vim.bo.softtabstop = 4
vim.bo.shiftwidth = 4
vim.bo.expandtab = true
end,
})
@@ -0,0 +1,2 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
@@ -0,0 +1,16 @@
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("settings.lazy.plugins")
@@ -0,0 +1,67 @@
return {
"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 }
local whichKey = require("which-key")
whichKey.register({
["<leader>b"] = {
name = "Barbar",
d = {
"<cmd>BarbarDisable<cr>",
"Disable Barbar"
},
e = {
"<cmd>BarbarEnable<cr>",
"Enable Barbar"
},
c = {
name = "Close",
c = {
"<cmd>BufferCloseAllButCurrent<cr>",
"Close all buffers but the current one"
},
p = {
"<cmd>BufferCloseAllButPinned<cr>",
"Close all buffers but the pinned ones"
},
l = {
"<cmd>BufferCloseBuffersLeft<cr>",
"Close all buffers to the left"
},
r = {
"<cmd>BufferCloseBuffersRight<cr>",
"Close all buffers to the right"
}
}
}
})
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 = {},
}
@@ -0,0 +1,13 @@
return {
"utilyre/barbecue.nvim",
name = "barbecue",
event = "BufEnter",
dependencies = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons",
"folke/tokyonight.nvim",
},
opts = {
theme = "tokyonight",
},
}
@@ -0,0 +1,46 @@
return {
"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,
},
}
@@ -0,0 +1,39 @@
return {
"stevearc/conform.nvim",
init = function()
local whichKey = require("which-key");
local conform = require("conform")
whichKey.register({
["<leader>f"] = {
name = "Format",
f = {
function()
local currentFileBufferNumber = vim.fn.bufnr("%")
conform.format({ bufnr = currentFileBufferNumber })
end,
"Format the current file"
}
}
})
end,
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
javascript = { "eslint_d" },
php = { "phpcbf" },
elm = { "elm_format" }
},
})
conform.formatters.phpcbf = {
prepend_args = {
"--standard=PSR12"
}
}
end
}
@@ -0,0 +1,168 @@
return {
"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,
},
},
}
@@ -0,0 +1,36 @@
return {
"ziontee113/icon-picker.nvim",
event = "VeryLazy",
config = function()
local iconPicker = require("icon-picker")
local whichKey = require("which-key")
iconPicker.setup({
disable_legacy_commands = true
})
whichKey.register({
["<leader>i"] = {
name = "Icon Picker",
e = {
function()
vim.cmd("IconPickerInsert emoji")
end,
"Pick emoji"
},
s = {
function()
vim.cmd("IconPickerInsert symbols")
end,
"Pick symbol"
},
n = {
function()
vim.cmd("IconPickerInsert nerd_font")
end,
"Pick Nerd font symbol"
}
}
})
end
}
@@ -0,0 +1,43 @@
return {
"xiyaowong/link-visitor.nvim",
event = "BufEnter",
opts = {
open_cmd = nil,
silent = true,
skip_confirmation = true,
border = "rounded",
},
config = function()
local whichKey = require("which-key")
whichKey.register({
["<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
}
@@ -0,0 +1,12 @@
return {
"folke/lsp-colors.nvim",
dependencies = {
"neovim/nvim-lspconfig",
},
opts = {
Error = "#db4b4b",
Warning = "#e0af68",
Information = "#0db9d7",
Hint = "#10B981",
},
}
@@ -0,0 +1,36 @@
return {
"onsails/lspkind.nvim",
config = function()
require('lspkind').init({
mode = 'symbol_text',
preset = 'codicons',
symbol_map = {
Text = "󰉿",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "",
},
})
end
}
@@ -0,0 +1,47 @@
return {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
dependencies = {
"nvim-tree/nvim-web-devicons"
},
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 = {},
},
}
@@ -0,0 +1,24 @@
return {
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
},
opts = {
automatic_instalation = true,
ensure_installed = {
"cssls",
"cssmodules_ls",
"dockerls",
"elmls",
"eslint",
"intelephense",
"lua_ls",
"marksman",
"prismals",
"rust_analyzer",
"tsserver",
"volar",
"yamlls",
},
},
}
@@ -0,0 +1,29 @@
return {
"WhoIsSethDaniel/mason-tool-installer.nvim",
dependencies = {
"williamboman/mason.nvim",
},
opts = {
ensure_installed = {
"stylua",
"luacheck",
"stylelint",
"shellcheck",
"rustfmt",
"jq",
"jsonlint",
"htmlbeautifier",
"eslint",
"blade-formatter",
"markdownlint",
"yamllint",
"ansible-lint",
"eslint_d",
"phpcbf",
"phpcs",
"phpstan"
},
auto_update = true,
run_on_start = true,
}
}
@@ -0,0 +1,4 @@
return {
"williamboman/mason.nvim",
opts = {}
}
@@ -0,0 +1,34 @@
return {
"NeogitOrg/neogit",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim", -- required
"nvim-telescope/telescope.nvim", -- optional
"sindrets/diffview.nvim", -- optional
"ibhagwan/fzf-lua", -- optional
},
config = function()
local whichKey = require("which-key")
local neogit = require("neogit")
neogit.setup({})
whichKey.register({
["<leader>g"] = {
name = "Neogit",
g = {
function()
neogit.open()
end,
"Open Neogit"
},
c = {
function()
neogit.open({ "commit" })
end,
"Open Neogit commit"
}
}
})
end
}
@@ -0,0 +1,5 @@
return {
"karb94/neoscroll.nvim",
event = "BufEnter",
opts = {},
}
@@ -0,0 +1,26 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
opts = {
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
},
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
}
}
@@ -0,0 +1,5 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {},
}
@@ -0,0 +1,44 @@
return {
"mfussenegger/nvim-lint",
dependencies = {
"WhoIsSethDaniel/mason-tool-installer.nvim",
},
event = { "BufReadPre", "BufWritePost" },
init = function()
local lint = require("lint")
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
lint.try_lint()
end
})
end,
config = function()
local lint = require("lint")
local phpcs = lint.linters.phpcs
phpcs.args = {
"-q",
-- <- Add a new parameter here
"--standard=PSR12",
"--report=json",
"-",
}
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,
}
@@ -0,0 +1,150 @@
return {
"neovim/nvim-lspconfig",
event = "VeryLazy",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"hrsh7th/nvim-cmp",
"folke/neodev.nvim"
},
config = function()
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local whichKey = require("which-key")
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 on_attach = function(_, buffer)
whichKey.register({
["<leader>l"] = {
name = "LSP",
d = {
name = "LSP Diagnostic",
o = {
function()
vim.diagnostic.open_float()
end,
"Open LSP diagnostic",
},
p = {
function()
vim.diagnostic.goto_prev()
end,
"Previous LSP diagnostic",
},
n = {
function()
vim.diagnostic.goto_next()
end,
"Next LSP diagnostic",
},
},
b = {
name = "LSP Buffer",
D = {
function()
vim.lsp.buf.declaration()
end,
"Go to symbol declaration",
buffer = buffer,
},
d = {
function()
vim.lsp.buf.definition()
end,
"Go to symbol definition",
buffer = buffer,
},
h = {
function()
vim.lsp.buf.hover()
end,
"Hover symbol documentation",
buffer = buffer,
},
i = {
function()
vim.lsp.buf.implementation()
end,
"Go to symbol implementation",
buffer = buffer,
},
s = {
function()
vim.lsp.buf.signature_help()
end,
"Go to symbol signature",
buffer = buffer,
},
t = {
function()
vim.lsp.buf.type_definition()
end,
"Go to symbol type definition",
buffer = buffer,
},
r = {
function()
vim.lsp.buf.rename()
end,
"Rename symbol",
buffer = buffer,
},
c = {
function()
vim.lsp.buf.code_action()
end,
"LSP code action",
buffer = buffer,
},
R = {
function()
vim.lsp.buf.references()
end,
"Go to symbol deferences",
buffer = buffer,
},
f = {
function()
vim.lsp.buf.format({
async = true,
})
end,
"Format file",
buffer = buffer,
},
},
},
})
end
-- Needed in order to get more completion in Lua files for Vim/Neovim
require("neodev").setup()
local languageServers = {
"lua_ls",
"tsserver",
"volar",
"cssls",
"cssmodules_ls",
"prismals",
"yamlls",
"marksman",
"eslint",
"dockerls",
"rust_analyzer",
"intelephense",
"elmls",
}
for _, languageServerName in pairs(languageServers) do
lspconfig[languageServerName].setup({
capabilities = capabilities,
on_attach = on_attach
})
end
end,
}
@@ -0,0 +1,50 @@
return {
"rcarriga/nvim-notify",
event = "VeryLazy",
config = function()
local notify = require("notify")
vim.notify = notify
require("which-key").register({
["<leader>u"] = {
name = "User Interface",
n = {
name = "Notification",
e = {
function()
vim.notify = notify
end,
"Enable notifications"
},
d = {
function()
vim.notify = function() end
end,
"Disable notifications"
},
l = {
function()
require("telescope").extensions.notify.notify()
end,
"List notifications"
}
}
}
})
require("notify.config").setup({
enabled = false,
stages = "fade_in_slide_out",
timeout = 5000,
background_colour = "#1e222a",
icons = {
ERROR = "",
WARN = "",
INFO = "",
DEBUG = "",
TRACE = "",
},
})
end,
}
@@ -0,0 +1,5 @@
return {
"kylechui/nvim-surround",
event = "BufEnter",
opts = {},
}
@@ -0,0 +1,65 @@
return {
"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 = {
"bash",
"c",
"css",
"csv",
"dockerfile",
"elm",
"fish",
"javascript",
"jsdoc",
"json",
"lua",
"markdown",
"markdown_inline",
"php",
"prisma",
"query",
"regex",
"rust",
"scss",
"sql",
"ssh_config",
"svelte",
"toml",
"tsx",
"twig",
"typescript",
"vim",
"vimdoc",
"vue",
"xml",
"yaml",
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = true,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
auto_install = true,
---- 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")!
indent = {
enable = true
},
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 = true,
},
})
end,
}
@@ -0,0 +1,70 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip'
},
event = "InsertEnter",
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<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", group_index = 2 },
{ name = "path", group_index = 2 },
{ name = 'luasnip' },
}, {
{ 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,
}
@@ -0,0 +1,158 @@
local function use_nvim_tree_width(options)
if type(options) ~= "table" then
return
end
---@type number
local offset = options.offset
---@type number
local initial_width = options.initial_width
local initial_width_type = type(initial_width)
local on_width_updated = options.on_width_updated
if type(on_width_updated) ~= "function" then
on_width_updated = function() end
end
if type(offset) ~= "number" then
offset = 10
end
if initial_width_type ~= "number" and initial_width_type ~= "table" then
initial_width = 30
end
---@type number|table
local previous_width = initial_width
if initial_width_type ~= "number" then
previous_width = 30
end
---@type number|table
local width = initial_width
local function get_width()
return width
end
local function increment_width()
if type(width) == "table" then
width = previous_width
end
local new_width = width + offset
previous_width = new_width
width = new_width
on_width_updated(new_width)
end
local function decrement_width()
if type(width) == "table" then
width = previous_width
end
local new_width = width - offset
previous_width = new_width
width = new_width
on_width_updated(new_width)
end
local function dynamic_width()
width = {}
on_width_updated(width)
end
return get_width, increment_width, decrement_width, dynamic_width
end
return {
"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
local nvimTreeApi = require("nvim-tree.api")
local get_width, increment_width, decrement_width, dynamic_width = use_nvim_tree_width({
offset = 5,
initial_width = 30,
on_width_updated = function(width)
vim.cmd.NvimTreeResize(width)
end
})
require("nvim-tree").setup({
auto_reload_on_write = true,
sort_by = "case_sensitive",
view = {
width = get_width,
},
filters = {
dotfiles = false,
},
notify = {
threshold = vim.log.levels.INFO,
absolute_path = false,
},
})
local whichKey = require("which-key")
whichKey.register({
["<leader>n"] = {
name = "NvimTree",
w = {
name = "NvimTree Width",
i = {
increment_width,
"Increment NvimTree Width"
},
d = {
decrement_width,
"Increment NvimTree Width"
},
a = {
dynamic_width,
"Automatic NvimTree Width"
}
},
t = {
function()
nvimTreeApi.tree.toggle()
end,
"Toggle NvimTree",
},
f = {
function()
nvimTreeApi.tree.focus()
end,
"Focus NvimTree",
},
e = {
function()
nvimTreeApi.tree.expand_all()
end,
"Expand NvimTree",
},
c = {
function()
nvimTreeApi.tree.collapse_all()
end,
"Collapse NvimTree",
},
},
})
end,
}
@@ -0,0 +1,56 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
local telescope = require("telescope")
local telescopeBuiltin = require("telescope.builtin")
telescope.setup({})
local whichKey = require("which-key")
whichKey.register({
["<leader>t"] = {
name = "Telescope",
h = {
function()
telescopeBuiltin.help_tags()
end,
"Find help tags"
},
t = {
function()
telescopeBuiltin.treesitter()
end,
"Explore the Abstract Syntax Tree",
},
f = {
function()
telescopeBuiltin.find_files()
end,
"Find files",
},
w = {
function()
telescopeBuiltin.live_grep()
end,
"Find words",
},
c = {
function()
telescopeBuiltin.colorscheme()
end,
"Find color schemes",
},
g = {
function()
telescopeBuiltin.git_files()
end,
"Find git files",
},
},
})
end,
}
@@ -0,0 +1,16 @@
return {
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
init = function()
vim.cmd.colorscheme("tokyonight")
end,
opts = {
style = "storm",
transparent = false,
light_style = "day",
terminal_colors = true,
},
},
}
@@ -0,0 +1,122 @@
return {
"folke/trouble.nvim",
opts = {
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics",
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
cycle_results = true, -- cycle item list when reaching beginning or end of list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q",
cancel = "<esc>",
refresh = "r",
jump = { "<cr>", "<tab>", "<2-leftmouse>" },
open_split = { "<c-x>" },
open_vsplit = { "<c-v>" },
open_tab = { "<c-t>" },
jump_close = { "o" },
toggle_mode = "m",
switch_severity = "s",
toggle_preview = "P",
hover = "K",
preview = "p",
open_code_href = "c",
close_folds = { "zM", "zm" }, -- close all folds
open_folds = { "zR", "zr" }, -- open all folds
toggle_fold = { "zA", "za" }, -- toggle fold of current file
previous = "k", -- previous item
next = "j", -- next item,
help = "?" -- help menu
},
multiline = true, -- render multi-line messages
indent_lines = true,
win_config = { border = "single" },
auto_open = false,
auto_close = false,
auto_preview = true,
auto_fold = false,
auto_jump = { "lsp_definitions" },
include_declaration = { "lsp_references", "lsp_implementations", "lsp_definitions" },
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "",
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
},
config = function()
local whichKey = require("which-key")
local trouble = require("trouble")
whichKey.register({
["<leader>x"] = {
name = "Trouble",
t = {
function()
trouble.toggle()
end,
"Toggle Trouble"
},
o = {
function()
trouble.open()
end,
"Open Trouble"
},
c = {
function()
trouble.close()
end,
"Close Trouble"
},
n = {
function()
trouble.next({
skip_groups = true,
jump = true
})
end,
"Trouble next item"
},
p = {
function()
trouble.previous({
skip_groups = true,
jump = true
})
end,
"Trouble previous item"
},
f = {
function()
trouble.first({
skip_groups = true,
jump = true
})
end,
"Trouble first item"
},
l = {
function()
trouble.last({
skip_groups = true,
jump = true
})
end,
"Trouble last item"
}
}
})
end
}
@@ -0,0 +1,52 @@
return {
"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,
}
@@ -0,0 +1,36 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 0
end,
config = function()
require("which-key").register({
["<C-s>"] = {
":write<CR>",
"Persist the content of the current buffer to the file system"
},
["<C-q>"] = {
":quitall<CR>",
"Quit the editor with confirmation"
},
["<C-h>"] = {
"<C-w>h",
"Move to the window on the left"
},
["<C-l>"] = {
"<C-w>l",
"Move to the window on the right"
},
["<C-k>"] = {
"<C-w>k",
"Move to the window on the top"
},
["<C-j>"] = {
"<C-w>j",
"Move to the window on the bottom"
}
})
end
}
@@ -0,0 +1,43 @@
local opt = vim.opt
opt.autoindent = true
opt.autoread = true
opt.backspace = "indent,eol,start"
opt.bufhidden = "hide"
opt.clipboard:append("unnamedplus")
opt.confirm = true
opt.copyindent = true
opt.emoji = true
opt.encoding = "UTF-8"
opt.expandtab = true
opt.fileignorecase = true
opt.hlsearch = true
opt.ignorecase = true
opt.incsearch = true
opt.infercase = true
opt.joinspaces = true
opt.laststatus = 2
opt.lazyredraw = false
opt.backup = false
opt.breakindent = false
opt.compatible = false
opt.errorbells = false
opt.linebreak = false
opt.swapfile = false
opt.number = true
opt.relativenumber = true
opt.shiftround = true
opt.shiftwidth = 2
opt.shiftwidth = 2
opt.smartcase = true
opt.smartindent = true
opt.smarttab = true
opt.softtabstop = 2
opt.tabstop = 2
vim.syntax = "on"
opt.wrap = false
opt.cursorline = true
opt.termguicolors = true
opt.signcolumn = "yes"
opt.splitright = true
opt.splitbelow = true