initial commit

This commit is contained in:
aminnairi
2025-11-08 20:46:24 +01:00
parent 72670045f3
commit 722f9db961
64 changed files with 2281 additions and 0 deletions
@@ -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,
})
+37
View File
@@ -0,0 +1,37 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local options = {
noremap = true,
silent = true
}
-- Move the current line down one line in normal mode
vim.keymap.set('n', '<A-j>', ":move .+1<CR>==", options)
-- Move the current line up one line in normal mode
vim.keymap.set('n', '<A-k>', ":move .-2<CR>==", options)
-- Move the character under the cursor one character forward in normal mode
vim.keymap.set('n', '<A-l>', "xp", options)
-- Move the character under the cursor one character backward in normal mode
vim.keymap.set('n', '<A-h>', "xhP", options)
-- Move the current range down one line in visual-line mode
vim.keymap.set('x', '<A-j>', ":move '>+1<CR>gv=gv", options)
-- Move the current range up one line in visual-line mode
vim.keymap.set('x', '<A-k>', ":move '<-2<CR>gv=gv", options)
-- Move the current line down one line in insert mode
vim.keymap.set('i', '<A-j>', "<ESC>:move .+1<CR>==gi", options)
-- Move the current line up one line in insert mode
vim.keymap.set('i', '<A-k>', "<ESC>:move .-2<CR>==gi", options)
-- Move the character under the cursor one character forward in insert mode
vim.keymap.set('i', '<A-l>', "<ESC>lxpi", options)
-- Move the character under the cursor one character backward in insert mode
vim.keymap.set('i', '<A-h>', "<ESC>lxhPi", options)
+16
View File
@@ -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,33 @@
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 }
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,45 @@
return {
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
enabled = true,
cloak_character = "·",
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
highlight_group = "Comment",
-- Applies the length of the replacement characters for all matched
-- patterns, defaults to the length of the matched pattern.
cloak_length = nil, -- Provide a number if you want to hide the true length of the value.
-- Wether it should try every pattern to find the best fit or stop after the first.
try_all_patterns = true,
patterns = {
{
-- Match any file starting with '.env'.
-- This can be a table to match multiple file patterns.
file_pattern = {
".env*",
".npmrc"
},
-- Match an equals sign and any character after it.
-- This can also be a table of patterns to cloak,
-- example: cloak_pattern = { ':.+', '-.+' } for yaml files.
cloak_pattern = {
"=.+",
":.+"
},
-- A function, table or string to generate the replacement.
-- The actual replacement will contain the 'cloak_character'
-- where it doesn't cover the original text.
-- If left emtpy the legacy behavior of keeping the first character is retained.
replace = nil,
},
},
})
require("which-key").add({
{ "<leader>c", "Cloak", },
{ "<leader>ct", ":CloakToggle<CR>", desc = "Toggle" },
{ "<leader>cd", ":CloakDisable<CR>", desc = "Disable" },
{ "<leader>ce", ":CloakEnable<CR>", desc = "Enable" },
})
end,
}
@@ -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,38 @@
return {
"stevearc/conform.nvim",
init = function()
local whichKey = require("which-key")
local conform = require("conform")
whichKey.add({
{ "<leader>f", group = "Format" },
{
"<leader>ff",
function()
local currentFileBufferNumber = vim.fn.bufnr("%")
conform.format({ bufnr = currentFileBufferNumber })
end,
desc = "Current File",
},
})
end,
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
javascript = { "eslint_d" },
php = { "phpcbf" },
elm = { "elm_format" },
fish = { "fish_indent" },
},
})
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,19 @@
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.add({
{ "<leader>i", group = "Icon" },
{ "<leader>ie", function() vim.cmd("IconPickerInsert emoji") end, group = "Emoji" },
{ "<leader>is", function() vim.cmd("IconPickerInsert symbols") end, group = "Symbol" },
{ "<leader>in", function() vim.cmd("IconPickerInsert nerd_font") end, group = "Nerd Font Symbol" },
})
end
}
@@ -0,0 +1,22 @@
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")
local linkVisitor = require("link-visitor");
whichKey.add({
{ "<leader>v", group = "Link", },
{ "<leader>vv", function() linkVisitor.visit() end, },
{ "<leader>vl", function() linkVisitor.link_under_cursor() end, },
{ "<leader>vn", function() linkVisitor.link_near_cursor() end, },
{ "<leader>vN", function() linkVisitor.link_nearest() end, },
})
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,39 @@
return {
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
},
opts = {
automatic_instalation = true,
ensure_installed = {
"angularls",
"ansiblels",
"bashls",
"biome",
"cssls",
"denols",
"docker_compose_language_service",
"dockerls",
"elmls",
"emmet_language_server",
"eslint",
"gopls",
"graphql",
"html",
"intelephense",
"jsonls",
"lua_ls",
"marksman",
"nginx_language_server",
"prismals",
"rust_analyzer",
"sqlls",
"svelte",
"templ",
"ts_ls",
"vls",
"vuels",
"yamlls",
},
},
}
@@ -0,0 +1,27 @@
return {
"WhoIsSethDaniel/mason-tool-installer.nvim",
dependencies = {
"williamboman/mason.nvim",
},
opts = {
ensure_installed = {
"stylua",
"luacheck",
"stylelint",
"shellcheck",
"rustfmt",
"jq",
"jsonlint",
"htmlbeautifier",
"eslint",
"markdownlint",
"yamllint",
"ansible-lint",
"eslint_d",
"phpcbf",
"phpcs",
},
auto_update = true,
run_on_start = true,
}
}
@@ -0,0 +1,4 @@
return {
"williamboman/mason.nvim",
opts = {}
}
@@ -0,0 +1,21 @@
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.add({
{ "<leader>g", group = "Neogit", },
{ "<leader>go", function() neogit.open() end, },
})
end
}
@@ -0,0 +1,72 @@
return {
"nvim-neorg/neorg",
build = ":Neorg sync-parsers",
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
"folke/which-key.nvim",
},
-- init = function()
-- -- Configure the key to use for keybinds used in the "core.keybinds" module
-- vim.g.maplocalleader = ","
-- end,
config = function()
require("neorg").setup({
load = {
-- Default module that imports the core modules necessary for Neorg
["core.defaults"] = {},
-- Module responsible for enhancing the icons display in Neorg files
["core.concealer"] = {
-- Configuration for the "core.concealer" module
config = {
-- Configure icons for concealed items
icons = {
-- Configure the code blocks
code_block = {
-- Conceal the "@code" and "@end" completely when in normal modej
conceal = true,
-- Add padding to a code inside a code block
padding = {
-- Add 2 spaces before the code inside a code block
left = 2
}
},
-- Configure the headings
heading = {
-- List of icons to use for all headings levels from 1 to 6
icons = {
"",
"",
"",
"",
"",
"",
},
},
},
},
},
["core.dirman"] = {
-- Configuration for "core.dirman" module
config = {
-- Workspaces are folders from where to find Neorg files
workspaces = {
-- My personal notes
notes = "~/git/github.com/aminnairi/notes",
},
},
},
-- Module for controling the presentation mode for Neorg files
["core.presenter"] = {
-- Configuration for the presenter module
config = {
-- Plugin to use, here "folke/zen-mode"
zen_mode = "zen-mode",
},
},
-- Module for controling the ability to export Neorg files
["core.export"] = {}
},
})
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,82 @@
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.add({
{ "<leader>l", group = "LSP" },
{ "<leader>lb", group = "LSP Buffer" },
{ "<leader>lbD", function() vim.lsp.buf.declaration() end, buffer = 1, desc = "Go to symbol declaration" },
{ "<leader>lbR", function() vim.lsp.buf.references() end, buffer = 1, desc = "Go to symbol references" },
{ "<leader>lbc", function() vim.lsp.buf.code_action() end, buffer = 1, desc = "LSP code action" },
{ "<leader>lbd", function() vim.lsp.buf.definition() end, buffer = 1, desc = "Go to symbol definition" },
{ "<leader>lbf", function() vim.lsp.buf.format() end, buffer = 1, desc = "Format file" },
{ "<leader>lbh", function() vim.lsp.buf.hover() end, buffer = 1, desc = "Hover symbol documentation" },
{ "<leader>lbi", function() vim.lsp.buf.implementation() end, buffer = 1, desc = "Go to symbol implementation" },
{ "<leader>lbr", function() vim.lsp.buf.rename() end, buffer = 1, desc = "Rename symbol" },
{ "<leader>lbs", function() vim.lsp.buf.signature_help() end, buffer = 1, desc = "Go to symbol signature" },
{ "<leader>lbt", function() vim.lsp.buf.type_definition() end, buffer = 1, desc = "Go to symbol type definition" },
{ "<leader>ld", group = "LSP Diagnostic" },
{ "<leader>ldn", function() vim.diagnostic.goto_next() end, desc = "Next LSP diagnostic" },
{ "<leader>ldo", function() vim.diagnostic.open_float() end, desc = "Open LSP diagnostic" },
{ "<leader>ldp", function() vim.diagnostic.goto_prev() end, desc = "Previous LSP diagnostic" },
})
end
-- Needed in order to get more completion in Lua files for Vim/Neovim
require("neodev").setup()
local languageServers = {
"angularls",
"ansiblels",
"bashls",
"biome",
"cssls",
--"denols",
"docker_compose_language_service",
"dockerls",
"elmls",
"emmet_language_server",
"eslint",
"gopls",
"graphql",
"html",
"intelephense",
"jsonls",
"lua_ls",
"marksman",
"nginx_language_server",
"prismals",
"rust_analyzer",
"sqlls",
"svelte",
"templ",
"ts_ls",
"vls",
"vuels",
"yamlls",
}
for _, languageServerName in pairs(languageServers) do
lspconfig[languageServerName].setup({
capabilities = capabilities,
on_attach = on_attach
})
end
end,
}
@@ -0,0 +1,23 @@
return {
"rcarriga/nvim-notify",
event = "VeryLazy",
config = function()
local notify = require("notify")
vim.notify = notify
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,139 @@
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
},
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",
"norg",
"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 = false,
},
-- Configure text objects
textobjects = {
-- Text objects for selections like inside word (iw) or inside html tag (it)
select = {
-- Enable text objects selection
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
-- Keymaps to use for using the following selection text objects
keymaps = {
-- The whole function
["af"] = { query = "@function.outer", desc = "Select the whole function" },
-- Inside a function
["if"] = { query = "@function.inner", desc = "Select inside a function" },
-- Inside an assignment
["i="] = { query = "@assignment.inner", desc = "Select inside of a statement" },
-- Left-hand-side of a statement
["l="] = { query = "@assignment.lhs", desc = "Select left-hand-side of a statement" },
-- Right-hand-side of a statement
["r="] = { query = "@assignment.rhs", desc = "Select right-hand-side of a statement" },
-- The whole statement
["a="] = { query = "@assignment.outer", desc = "Select the whole statement" },
-- Inside of an attribute
["ia"] = { query = "@attribute.inner", desc = "Select inside of an attribute" },
-- The whole attribute
["aa"] = { query = "@attribute.outer", desc = "Select the whole attribute" },
-- Inside of a block
["ib"] = { query = "@block.inner", desc = "Select inside a block" },
-- The whole block
["ab"] = { query = "@block.outer", desc = "Select the whole block" },
-- Inside of a class
["ic"] = { query = "@class.inner", desc = "Select inside of a class" },
-- The whole class
["ac"] = { query = "@class.outer", desc = "Select the whole class" },
-- Inside a comment
["iC"] = { query = "@comment.inner", desc = "Select inside of a comment" },
-- The whole comment
["aC"] = { query = "@comment.outer", desc = "Select the whole comment" },
-- Inside of a conditional statement
["ii"] = { query = "@conditional.inner", desc = "Select inside of a conditional statement" },
-- The whole conditional statement
["ai"] = { query = "@conditional.outer", desc = "Select the whole conditional statement" },
-- Inside a loop
["il"] = { query = "@loop.inner", desc = "Select inside a loop" },
-- The whole a loop
["al"] = { query = "@loop.outer", desc = "Select the whole loop" },
-- Inside a number
["in"] = { query = "@number.inner", desc = "Select inside a number" },
-- Inside a number
["an"] = { query = "@number.inner", desc = "Select the whole number" },
-- Inside a parameter
["ip"] = { query = "@parameter.inner", desc = "Select inside a parameter" },
-- The whole parameter
["ap"] = { query = "@parameter.outer", desc = "Select the whole parameter" },
-- Inside of a regex
["ir"] = { query = "@regex.inner", desc = "Select inside of a regex" },
-- The whole regex
["ar"] = { query = "@regex.outer", desc = "Select the whole regex" },
-- Inside of a return statement
["iR"] = { query = "@return.inner", desc = "Select inside of a return statement" },
-- The whole return statement
["aR"] = { query = "@return.outer", desc = "Select the whole return statement" },
},
-- Select surrounding white spaces as well as the selected text object
include_surrounding_whitespace = 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,175 @@
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
})
local function on_nvim_tree_attach(buffer)
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = buffer, noremap = true, silent = true, nowait = true }
end
-- default mappings
nvimTreeApi.config.mappings.default_on_attach(buffer)
-- custom mappings
vim.keymap.set('n', 'l', nvimTreeApi.node.open.edit, opts('Open file/directory'))
vim.keymap.set('n', 'h', nvimTreeApi.node.navigate.parent_close, opts('Help'))
end
require("nvim-tree").setup({
on_attach = on_nvim_tree_attach,
auto_reload_on_write = true,
sort_by = "case_sensitive",
filters = {
dotfiles = false,
},
notify = {
-- Notifies everything from the INFO severity to ERROR
threshold = vim.log.levels.INFO,
-- Notifies only the relative path instead of the absolute
absolute_path = false,
},
-- Move to the first letter of each folder/files instead of the beginning of the line
hijack_cursor = true,
-- Disable completely netrw, just in case
disable_netrw = true,
-- Reload the tree whenever a buffer is opened
reload_on_bufenter = true,
-- Allows using vim.ui.select for various operation instead of the defaut implementation
select_prompts = true,
view = {
-- dynamically get the width of the tree
width = get_width,
-- Always open the tree on the left side of the screen
side = "left",
-- Never display the number line for the tree
number = false,
},
renderer = {
-- Never add trailing slashes for folders name
add_trailing = false,
-- Never group directories in the tree for those that only have one child node
group_empty = false,
-- Never highlight any files in a special way
special_files = {},
-- Highlight files that have diagnostics
highlight_diagnostics = true
},
update_focused_file = {
-- Focus the file in the tree whenever it is focused in the editor
enable = true
},
diagnostics = {
-- Enable diagnostics for the tree
enable = true,
-- Show diagnostics for the parent folder of the incriminated file
show_on_dirs = true
}
})
local whichKey = require("which-key")
whichKey.add({
{ "<leader>n", group = "NvimTree" },
{ "<leader>nt", function() nvimTreeApi.tree.toggle() end, desc = "Toggle" },
{ "<leader>nf", function() nvimTreeApi.tree.focus() end, desc = "Focus" },
{ "<leader>ne", function() nvimTreeApi.tree.expand_all() end, desc = "Expand All" },
{ "<leader>nc", function() nvimTreeApi.tree.collapse_all() end, desc = "Collapse All" },
{ "<leader>nw", group = "Width" },
{ "<leader>nwi", increment_width, desc = "Increase" },
{ "<leader>nwd", decrement_width, desc = "Decrease" },
{ "<leader>nwa", dynamic_width, desc = "Decrease" },
{ "<leader>nt", function() nvimTreeApi.tree.toggle() end, desc = "Toggle" },
})
end,
}
@@ -0,0 +1,24 @@
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.add({
{ "<leader>t", group = "Telescope" },
{ "<leader>th", function() telescopeBuiltin.help_tags() end, desc = "Help Tags" },
{ "<leader>tt", function() telescopeBuiltin.treesitter() end, desc = "Treesitter" },
{ "<leader>tf", function() telescopeBuiltin.find_files() end, desc = "Files" },
{ "<leader>tw", function() telescopeBuiltin.live_grep() end, desc = "Words" },
{ "<leader>tc", function() telescopeBuiltin.colorscheme() end, desc = "Colorscheme" },
{ "<leader>tg", function() telescopeBuiltin.git_files() end, desc = "Colorscheme" },
})
end,
}
@@ -0,0 +1,16 @@
return {
{
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
init = function()
vim.cmd.colorscheme("tokyonight")
end,
opts = {
style = "storm",
transparent = true,
light_style = "day",
terminal_colors = true,
},
},
}
@@ -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,11 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 0
end,
config = function()
-- Nothing here
end
}
@@ -0,0 +1,5 @@
return {
"folke/zen-mode.nvim",
event = "VeryLazy",
opts = {}
}
+46
View File
@@ -0,0 +1,46 @@
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
opt.syntax = "on"
opt.wrap = false
opt.cursorline = true
opt.termguicolors = true
opt.signcolumn = "yes"
opt.splitright = true
opt.splitbelow = true
opt.conceallevel = 3
vim.api.nvim_set_hl(0, "NvimTreeNormal", { bg = "none" })