mirror of
https://github.com/belsabbagh/dotfiles.git
synced 2026-04-11 09:36:46 +00:00
update
This commit is contained in:
51
nvim/lua/plugins/codeium.lua
Normal file
51
nvim/lua/plugins/codeium.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
'exafunction/codeium.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
config = function()
|
||||
require('codeium').setup {
|
||||
-- Optionally disable cmp source if using virtual text only
|
||||
enable_cmp_source = false,
|
||||
virtual_text = {
|
||||
enabled = true,
|
||||
|
||||
-- These are the defaults
|
||||
|
||||
-- Set to true if you never want completions to be shown automatically.
|
||||
manual = false,
|
||||
-- A mapping of filetype to true or false, to enable virtual text.
|
||||
filetypes = {},
|
||||
-- Whether to enable virtual text of not for filetypes not specifically listed above.
|
||||
default_filetype_enabled = true,
|
||||
-- How long to wait (in ms) before requesting completions after typing stops.
|
||||
idle_delay = 75,
|
||||
-- Priority of the virtual text. This usually ensures that the completions appear on top of
|
||||
-- other plugins that also add virtual text, such as LSP inlay hints, but can be modified if
|
||||
-- desired.
|
||||
virtual_text_priority = 65535,
|
||||
-- Set to false to disable all key bindings for managing completions.
|
||||
map_keys = true,
|
||||
-- The key to press when hitting the accept keybinding but no completion is showing.
|
||||
-- Defaults to \t normally or <c-n> when a popup is showing.
|
||||
accept_fallback = nil,
|
||||
-- Key bindings for managing completions in virtual text mode.
|
||||
key_bindings = {
|
||||
-- Accept the current completion.
|
||||
accept = '<Tab>',
|
||||
-- Accept the next word.
|
||||
accept_word = false,
|
||||
-- Accept the next line.
|
||||
accept_line = false,
|
||||
-- Clear the virtual text.
|
||||
clear = false,
|
||||
-- Cycle to the next completion.
|
||||
next = '<M-]>',
|
||||
-- Cycle to the previous completion.
|
||||
prev = '<M-[>',
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
102
nvim/lua/plugins/debugger.lua
Normal file
102
nvim/lua/plugins/debugger.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
local js_based_languages = {
|
||||
'typescript',
|
||||
'javascript',
|
||||
'typescriptreact',
|
||||
'javascriptreact',
|
||||
'vue',
|
||||
}
|
||||
|
||||
return {
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = {
|
||||
'rcarriga/nvim-dap-ui',
|
||||
'nvim-neotest/nvim-nio',
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<leader>db',
|
||||
function()
|
||||
require('dap').toggle_breakpoint()
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<leader>dr',
|
||||
function()
|
||||
require('dap').continue()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<C-'>",
|
||||
function()
|
||||
require('dap').step_over()
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<C-;>',
|
||||
function()
|
||||
require('dap').step_into()
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<C-:>',
|
||||
function()
|
||||
require('dap').step_out()
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local dap = require 'dap'
|
||||
local dapui = require 'dapui'
|
||||
dap.adapters.firefox = {
|
||||
type = 'executable',
|
||||
command = 'node',
|
||||
args = {
|
||||
require('mason-registry').get_package('firefox-debug-adapter'):get_install_path() .. '/dist/adapter.bundle.js',
|
||||
},
|
||||
}
|
||||
-- Configuration for JavaScript/TypeScript languages
|
||||
for _, language in ipairs(js_based_languages) do
|
||||
dap.configurations[language] = {
|
||||
{
|
||||
type = 'firefox',
|
||||
request = 'launch',
|
||||
name = 'Launch & Debug in Firefox',
|
||||
url = function()
|
||||
local co = coroutine.running()
|
||||
return coroutine.create(function()
|
||||
vim.ui.input({
|
||||
prompt = 'Enter URL: ',
|
||||
default = 'http://localhost:8080',
|
||||
}, function(url)
|
||||
if url == nil or url == '' then
|
||||
return
|
||||
else
|
||||
coroutine.resume(co, url)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
webRoot = vim.fn.getcwd(),
|
||||
firefoxExecutable = '/usr/bin/firefox', -- Adjust if needed
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- Set up dap-ui
|
||||
dapui.setup()
|
||||
dap.listeners.after.event_initialized['dapui_config'] = function()
|
||||
dapui.open { reset = true }
|
||||
end
|
||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||
require('nvim-dap-virtual-text').setup {
|
||||
enabled = true,
|
||||
enabled_commands = true,
|
||||
highlight_changed_variables = true,
|
||||
highlight_new_as_changed = false,
|
||||
show_stop_reason = true,
|
||||
commented = false,
|
||||
}
|
||||
end,
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, "😄")
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
50
nvim/lua/plugins/formatter.lua
Normal file
50
nvim/lua/plugins/formatter.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>cf',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[C]ode [F]ormat',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = true,
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 1000,
|
||||
},
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
|
||||
go = { 'gofmt' },
|
||||
python = { 'ruff' },
|
||||
javascript = { 'biome', 'prettier', stop_after_first = true },
|
||||
typescript = { 'biome', 'prettier', stop_after_first = true },
|
||||
yaml = { 'prettier' },
|
||||
rust = { 'rustfmt', lsp_format = 'fallback' },
|
||||
json = { 'biome', 'prettier', stop_after_first = true },
|
||||
vue = { 'biome', 'prettier' },
|
||||
php = { 'pint', 'intelephense', stop_after_first = true },
|
||||
},
|
||||
formatters = {
|
||||
biome = {
|
||||
meta = {
|
||||
url = 'https://github.com/biomejs/biome',
|
||||
description = 'A toolchain for web projects, aimed to provide functionalities to maintain them.',
|
||||
},
|
||||
command = 'biome',
|
||||
stdin = true,
|
||||
args = { 'format', '--stdin-file-path', '$FILENAME' },
|
||||
},
|
||||
intelephense = {
|
||||
command = 'intelephense',
|
||||
args = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
19
nvim/lua/plugins/git.lua
Normal file
19
nvim/lua/plugins/git.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
'kdheepak/lazygit.nvim',
|
||||
lazy = true,
|
||||
cmd = {
|
||||
'LazyGit',
|
||||
'LazyGitConfig',
|
||||
'LazyGitCurrentFile',
|
||||
'LazyGitFilter',
|
||||
'LazyGitFilterCurrentFile',
|
||||
},
|
||||
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
|
||||
keys = {
|
||||
{ '<leader>gg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
|
||||
},
|
||||
}
|
||||
61
nvim/lua/plugins/gitsigns.lua
Normal file
61
nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||
-- config. This will add also the recommended keymaps.
|
||||
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
10
nvim/lua/plugins/lazydev.lua
Normal file
10
nvim/lua/plugins/lazydev.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
|
||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
}
|
||||
83
nvim/lua/plugins/linter.lua
Normal file
83
nvim/lua/plugins/linter.lua
Normal file
@@ -0,0 +1,83 @@
|
||||
return {
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
dependencies = {
|
||||
{ 'williamboman/mason.nvim', config = true },
|
||||
},
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
-- Define a custom biome linter
|
||||
local mason_registry = require 'mason-registry'
|
||||
local biome_path = mason_registry.get_package('biome'):get_install_path() .. '/node_modules/@biomejs/biome/bin/biome'
|
||||
lint.linters.biome = {
|
||||
name = 'biome',
|
||||
cmd = biome_path, -- Command to run the linter
|
||||
args = { 'lint' }, -- Arguments for the command
|
||||
stdin = false, -- Send content via stdin
|
||||
append_fname = true, -- Automatically add the current file name to the command arguments
|
||||
stream = 'both', -- Result stream
|
||||
ignore_exitcode = true, -- Treat exit code != 1 as an error
|
||||
parser = function(output)
|
||||
local diagnostics = {}
|
||||
|
||||
-- The diagnostic details we need are spread in the first 3 lines of
|
||||
-- each error report. These variables are declared out of the FOR
|
||||
-- loop because we need to carry their values to parse multiple lines.
|
||||
local fetch_message = false
|
||||
local lnum, col, code, message
|
||||
|
||||
-- When a lnum:col:code line is detected fetch_message is set to true.
|
||||
-- While fetch_message is true we will search for the error message.
|
||||
-- When a error message is detected, we will create the diagnostic and
|
||||
-- set fetch_message to false to restart the process and get the next
|
||||
-- diagnostic.
|
||||
for _, line in ipairs(vim.fn.split(output, '\n')) do
|
||||
if fetch_message then
|
||||
_, _, message = string.find(line, '%s×(.+)')
|
||||
|
||||
if message then
|
||||
message = (message):gsub('^%s+×%s*', '')
|
||||
|
||||
table.insert(diagnostics, {
|
||||
source = 'biomejs',
|
||||
lnum = tonumber(lnum) - 1,
|
||||
col = tonumber(col),
|
||||
message = message,
|
||||
code = code,
|
||||
})
|
||||
|
||||
fetch_message = false
|
||||
end
|
||||
else
|
||||
_, _, lnum, col, code = string.find(line, '[^:]+:(%d+):(%d+)%s([%a%/]+)')
|
||||
|
||||
if lnum then
|
||||
fetch_message = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return diagnostics
|
||||
end, -- Custom parser for output
|
||||
}
|
||||
-- Set up linters by filetype
|
||||
lint.linters_by_ft = {
|
||||
vue = { 'biome' }, -- Lint Vue files using the overridden biome command
|
||||
javascript = { 'biome' },
|
||||
json = { 'biome' },
|
||||
typescript = { 'biome' },
|
||||
javascriptreact = { 'biome' },
|
||||
typescriptreact = { 'biome' },
|
||||
python = { 'ruff', 'mypy' },
|
||||
-- Add more filetypes as needed
|
||||
}
|
||||
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
156
nvim/lua/plugins/lsp.lua
Normal file
156
nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,156 @@
|
||||
return {
|
||||
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
|
||||
{ 'williamboman/mason.nvim', config = true },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or 'n'
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
local mason_registry = require 'mason-registry'
|
||||
local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() .. '/node_modules/@vue/language-server'
|
||||
local servers = {
|
||||
rust_analyzer = {
|
||||
filetypes = { 'rust' },
|
||||
capabilities = capabilities,
|
||||
},
|
||||
ts_ls = {
|
||||
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
|
||||
init_options = {
|
||||
plugins = {
|
||||
{
|
||||
name = '@vue/typescript-plugin',
|
||||
location = vue_language_server_path,
|
||||
languages = { 'javascript', 'typescript', 'vue' },
|
||||
configNamespace = 'javascript',
|
||||
enableForWorkspaceTypeScriptVersions = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
implicitProjectConfiguration = {
|
||||
checkJs = true,
|
||||
strictNullChecks = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
biome = {
|
||||
capabilities = capabilities,
|
||||
},
|
||||
phpactor = {
|
||||
filetypes = { 'php' },
|
||||
capabilities = capabilities,
|
||||
},
|
||||
volar = {
|
||||
filetypes = { 'vue' },
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
vue = {
|
||||
hybridMode = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
pyright = {
|
||||
settings = {
|
||||
pyright = {
|
||||
disableOrganizeImports = true, -- Using Ruff
|
||||
},
|
||||
python = {
|
||||
analysis = {
|
||||
ignore = { '*' }, -- Using Ruff
|
||||
typeCheckingMode = 'off', -- Using mypy
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
gopls = {
|
||||
capabilities = capabilities,
|
||||
},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require('mason').setup()
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua',
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
22
nvim/lua/plugins/lualine.lua
Normal file
22
nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {
|
||||
options = {
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = { left = '|', right = '|' },
|
||||
theme = vim.g.colors_name,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
path = 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
1
nvim/lua/plugins/luvit-meta.lua
Normal file
1
nvim/lua/plugins/luvit-meta.lua
Normal file
@@ -0,0 +1 @@
|
||||
return { 'Bilal2453/luvit-meta', lazy = true }
|
||||
9
nvim/lua/plugins/mason.lua
Normal file
9
nvim/lua/plugins/mason.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
'williamboman/mason.nvim',
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'typescript-language-server',
|
||||
'biome',
|
||||
},
|
||||
},
|
||||
}
|
||||
10
nvim/lua/plugins/mini.lua
Normal file
10
nvim/lua/plugins/mini.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
'echasnovski/mini.nvim',
|
||||
config = function()
|
||||
require('mini.ai').setup { n_lines = 500 }
|
||||
require('mini.surround').setup()
|
||||
require('mini.pairs').setup()
|
||||
require('mini.pick').setup()
|
||||
require('mini.icons').setup()
|
||||
end,
|
||||
}
|
||||
59
nvim/lua/plugins/nvim-cmp.lua
Normal file
59
nvim/lua/plugins/nvim-cmp.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = (function()
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-path',
|
||||
},
|
||||
config = function()
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-y>'] = cmp.mapping.confirm { select = true },
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'lazydev', priority = 1001 },
|
||||
{ name = 'nvim_lsp', priority = 1000 },
|
||||
{ name = 'luasnip', priority = 750 },
|
||||
{ name = 'buffer', priority = 500 },
|
||||
{ name = 'path', priority = 250 },
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
14
nvim/lua/plugins/nvim-treesitter.lua
Normal file
14
nvim/lua/plugins/nvim-treesitter.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs',
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'javascript', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'vue' },
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
}
|
||||
7
nvim/lua/plugins/oil.lua
Normal file
7
nvim/lua/plugins/oil.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
'stevearc/oil.nvim',
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {},
|
||||
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
|
||||
}
|
||||
7
nvim/lua/plugins/snippets.lua
Normal file
7
nvim/lua/plugins/snippets.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
-- follow latest release.
|
||||
version = 'v2.*', -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
-- install jsregexp (optional!).
|
||||
build = 'make install_jsregexp',
|
||||
}
|
||||
63
nvim/lua/plugins/telescope.lua
Normal file
63
nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
|
||||
build = 'make',
|
||||
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
require('telescope').setup {
|
||||
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>/', builtin.live_grep, { desc = '[/] Fuzzy Search the cwd' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader>b', builtin.buffers, { desc = 'Find existing [B]uffers' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sg', function()
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[S]earch by [G]rep' })
|
||||
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
}
|
||||
10
nvim/lua/plugins/theme.lua
Normal file
10
nvim/lua/plugins/theme.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
'Mofiqul/dracula.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
local dracula = require 'dracula'
|
||||
|
||||
vim.cmd.colorscheme 'dracula'
|
||||
end,
|
||||
}
|
||||
3
nvim/lua/plugins/vim-sleuth.lua
Normal file
3
nvim/lua/plugins/vim-sleuth.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
'tpope/vim-sleuth',
|
||||
}
|
||||
51
nvim/lua/plugins/which-key.lua
Normal file
51
nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter',
|
||||
opts = {
|
||||
icons = {
|
||||
|
||||
mappings = vim.g.have_nerd_font,
|
||||
|
||||
keys = vim.g.have_nerd_font and {} or {
|
||||
Up = '<Up> ',
|
||||
Down = '<Down> ',
|
||||
Left = '<Left> ',
|
||||
Right = '<Right> ',
|
||||
C = '<C-…> ',
|
||||
M = '<M-…> ',
|
||||
D = '<D-…> ',
|
||||
S = '<S-…> ',
|
||||
CR = '<CR> ',
|
||||
Esc = '<Esc> ',
|
||||
ScrollWheelDown = '<ScrollWheelDown> ',
|
||||
ScrollWheelUp = '<ScrollWheelUp> ',
|
||||
NL = '<NL> ',
|
||||
BS = '<BS> ',
|
||||
Space = '<Space> ',
|
||||
Tab = '<Tab> ',
|
||||
F1 = '<F1>',
|
||||
F2 = '<F2>',
|
||||
F3 = '<F3>',
|
||||
F4 = '<F4>',
|
||||
F5 = '<F5>',
|
||||
F6 = '<F6>',
|
||||
F7 = '<F7>',
|
||||
F8 = '<F8>',
|
||||
F9 = '<F9>',
|
||||
F10 = '<F10>',
|
||||
F11 = '<F11>',
|
||||
F12 = '<F12>',
|
||||
},
|
||||
},
|
||||
|
||||
spec = {
|
||||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user