477 lines
13 KiB
Lua
477 lines
13 KiB
Lua
local map = require 'config.helpers.keymap'
|
|
local n = map 'n'
|
|
local nv = map { 'n', 'v' }
|
|
|
|
|
|
---@type LazyPluginSpec[]
|
|
return {
|
|
|
|
-- Theme
|
|
{
|
|
'rebelot/kanagawa.nvim',
|
|
lazy = false,
|
|
priority = math.huge,
|
|
config = function()
|
|
vim.cmd 'colorscheme kanagawa'
|
|
end,
|
|
},
|
|
|
|
-- Status line
|
|
{
|
|
'nvim-lualine/lualine.nvim',
|
|
dependencies = {
|
|
'nvim-tree/nvim-web-devicons',
|
|
},
|
|
config = true,
|
|
},
|
|
|
|
-- Fuzzy search
|
|
{
|
|
'nvim-telescope/telescope.nvim',
|
|
branch = '0.1.x',
|
|
dependencies = {
|
|
'nvim-lua/plenary.nvim',
|
|
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
|
},
|
|
config = function()
|
|
local telescope = require 'telescope'
|
|
local builtin = require 'telescope.builtin'
|
|
local ext = telescope.extensions
|
|
|
|
telescope.load_extension 'fzf'
|
|
telescope.load_extension 'notify'
|
|
|
|
telescope.setup {
|
|
extensions = {
|
|
fzf = {
|
|
fuzzy = true,
|
|
override_generic_sorter = true,
|
|
override_file_sorter = true,
|
|
case_mode = 'smart_case',
|
|
}
|
|
}
|
|
}
|
|
|
|
n '<leader>ff' (builtin.find_files) 'Telescope: files'
|
|
n '<leader>fb' (builtin.buffers) 'Telescope: buffers'
|
|
n '<leader>fg' (builtin.live_grep) 'Telescope: grep'
|
|
n '<leader>fh' (builtin.help_tags) 'Telescope: docs'
|
|
n '<Leader>fk' (builtin.keymaps) 'Telescope: keymaps'
|
|
n '<leader>fn' (ext.notify.notify) 'Telescope: notifications'
|
|
end,
|
|
},
|
|
|
|
-- Treesitter
|
|
{
|
|
'nvim-treesitter/nvim-treesitter',
|
|
build = ':TSUpdate',
|
|
dependencies = {
|
|
'nvim-treesitter/nvim-treesitter-textobjects'
|
|
},
|
|
config = function()
|
|
local configs = require 'nvim-treesitter.configs'
|
|
|
|
configs.setup {
|
|
modules = {},
|
|
auto_install = false,
|
|
sync_install = false,
|
|
ignore_install = {},
|
|
ensure_installed = {
|
|
-- neovim
|
|
'vimdoc', 'lua', 'query', 'fennel',
|
|
-- data
|
|
'json', 'xml', 'yaml', 'toml',
|
|
-- markdown
|
|
'markdown', 'markdown_inline',
|
|
-- latex
|
|
'latex', 'bibtex',
|
|
-- git
|
|
'gitcommit', 'gitignore', 'diff',
|
|
-- misc
|
|
'comment', 'dockerfile', 'regex',
|
|
-- shell
|
|
'bash',
|
|
-- python
|
|
'python',
|
|
-- systems
|
|
'rust', 'c',
|
|
-- webdev
|
|
'html', 'css', 'scss', 'javascript', 'jsdoc', 'typescript', 'tsx', 'astro', 'svelte',
|
|
-- haskell
|
|
'haskell',
|
|
},
|
|
highlight = { enable = true },
|
|
indent = { enable = true },
|
|
incremental_selection = {
|
|
enable = true,
|
|
keymaps = {
|
|
node_incremental = 'v',
|
|
node_decremental = 'V',
|
|
},
|
|
},
|
|
textobjects = {
|
|
select = {
|
|
enable = true,
|
|
keymaps = {
|
|
['af'] = '@function.outer',
|
|
['if'] = '@function.inner',
|
|
['a?'] = '@conditional.outer',
|
|
['i?'] = '@conditional.inner',
|
|
}
|
|
},
|
|
move = {
|
|
enable = true,
|
|
goto_next_start = {
|
|
[']f'] = '@function.outer',
|
|
},
|
|
goto_previous_start = {
|
|
['[f'] = '@function.outer',
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end,
|
|
init = function()
|
|
local lang = vim.treesitter.language
|
|
|
|
lang.register('markdown', 'mdx')
|
|
lang.register('markdown', 'lhaskell')
|
|
end,
|
|
},
|
|
|
|
-- Keymap hints
|
|
{
|
|
'folke/which-key.nvim',
|
|
init = function()
|
|
vim.o.timeout = true
|
|
vim.o.timeoutlen = 300
|
|
end,
|
|
config = true
|
|
},
|
|
|
|
-- Notifications
|
|
{
|
|
'rcarriga/nvim-notify',
|
|
config = function()
|
|
vim.notify = require 'notify'
|
|
end
|
|
},
|
|
|
|
-- Project errors
|
|
{
|
|
"folke/trouble.nvim",
|
|
branch = "dev",
|
|
config = function ()
|
|
local trouble = require 'trouble'
|
|
|
|
n '<leader>tt' '<cmd>Trouble diagnostics toggle<cr>' 'Trouble: Diagnostics'
|
|
n '<leader>tT' '<cmd>Trouble diagnostics toggle filter.buf=0<cr>' 'Trouble: Diagnostics (buffer)'
|
|
n '<leader>ts' '<cmd>Trouble symbols toggle focus=false<cr>' 'Trouble: Symbols'
|
|
-- n '<leader>cl' '<cmd>Trouble lsp toggle focus=false win.position=right<cr>' 'LSP Definitions / references / ... (Trouble)'
|
|
-- n '<leader>xL' '<cmd>Trouble loclist toggle<cr>' 'Location List (Trouble)'
|
|
-- n '<leader>xQ' '<cmd>Trouble qflist toggle<cr>' 'Quickfix List (Trouble)'
|
|
|
|
trouble.setup {}
|
|
end,
|
|
},
|
|
|
|
-- Breadcrumbs
|
|
{
|
|
'Bekaboo/dropbar.nvim',
|
|
dependencies = {
|
|
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
|
}
|
|
},
|
|
|
|
-- Git - file hunks
|
|
{
|
|
'lewis6991/gitsigns.nvim',
|
|
config = function()
|
|
local gs = require 'gitsigns'
|
|
|
|
gs.setup {
|
|
on_attach = function()
|
|
n '<Leader>hp' (gs.preview_hunk) 'Hunk: preview'
|
|
n '<Leader>hs' (gs.stage_hunk) 'Hunk: stage'
|
|
n '<Leader>hu' (gs.undo_stage_hunk) 'Hunk: unstage'
|
|
n '<Leader>hr' (gs.reset_hunk) 'Hunk: reset'
|
|
n '<leader>hS' (gs.stage_buffer) 'Hunk: buffer stage'
|
|
n '<leader>hR' (gs.reset_buffer) 'Hunk: buffer reset'
|
|
n '<leader>hd' (gs.toggle_deleted) 'Hunk: show deleted'
|
|
end
|
|
}
|
|
end,
|
|
},
|
|
|
|
-- Git - project diff
|
|
{
|
|
'sindrets/diffview.nvim',
|
|
dependencies = {
|
|
'nvim-lua/plenary.nvim',
|
|
'nvim-tree/nvim-web-devicons',
|
|
},
|
|
config = function()
|
|
local lib = require 'diffview.lib'
|
|
|
|
local function toggle(name)
|
|
return function()
|
|
if not next(lib.views) then
|
|
vim.cmd(name)
|
|
else
|
|
vim.cmd 'DiffviewClose'
|
|
end
|
|
end
|
|
end
|
|
|
|
n '<Leader>gd' (toggle 'DiffviewOpen') 'Git: Diff'
|
|
n '<Leader>gh' (toggle 'DiffviewFileHistory') 'Git: History'
|
|
end
|
|
},
|
|
|
|
-- Color hints
|
|
{
|
|
'NvChad/nvim-colorizer.lua',
|
|
ft = { 'css', 'scss' },
|
|
config = true,
|
|
},
|
|
|
|
-- {
|
|
-- dir = '~/Desktop/disasm.nvim',
|
|
-- ft = { 'c' },
|
|
-- config = function()
|
|
-- local disasm = require 'disasm'
|
|
--
|
|
-- n '<Leader>a' (disasm.disassemble) 'Disasm: Disassemble'
|
|
-- n '<Leader>Af' (disasm.disassemble_full) 'Disasm: Disassemble full'
|
|
-- n '<Leader>Ac' (disasm.reconfigure) 'Disasm: Configure'
|
|
-- n '<Leader>AC' (disasm.save_config) 'Disasm: Save config'
|
|
--
|
|
-- disasm.setup()
|
|
-- end
|
|
-- },
|
|
|
|
-- Completion
|
|
{
|
|
'hrsh7th/nvim-cmp',
|
|
dependencies = {
|
|
'hrsh7th/cmp-cmdline',
|
|
'hrsh7th/cmp-buffer',
|
|
'hrsh7th/cmp-path',
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
},
|
|
config = require 'config.plugins.nvim-cmp'
|
|
},
|
|
|
|
-- Debugger adapter support
|
|
{
|
|
'mfussenegger/nvim-dap',
|
|
dependencies = {
|
|
'nvim-neotest/nvim-nio',
|
|
'rcarriga/nvim-dap-ui',
|
|
},
|
|
config = function()
|
|
local dap = require 'dap'
|
|
local ui = require 'dapui'
|
|
|
|
n '<F5>' (dap.continue) 'Debugger: continue'
|
|
n '<F10>' (dap.step_over) 'Debugger: step over'
|
|
n '<F11>' (dap.step_into) 'Debugger: step into'
|
|
n '<F12>' (dap.step_out) 'Debugger: step out'
|
|
n '<leader>db' (dap.toggle_breakpoint) 'Debugger: toggle breakpoint'
|
|
|
|
n '<leader>du' (ui.toggle) 'Debugger: toggle UI'
|
|
nv '<leader>de' (ui.eval) 'Debugger: eval'
|
|
|
|
-- vim.api.nvim_set_hl(0, 'DapBreakpoint', { ctermbg = 0, fg = '#993939', bg = '#31353f' })
|
|
-- vim.api.nvim_set_hl(0, 'DapLogPoint', { ctermbg = 0, fg = '#61afef', bg = '#31353f' })
|
|
-- vim.api.nvim_set_hl(0, 'DapStopped', { ctermbg = 0, fg = '#98c379', bg = '#31353f' })
|
|
--
|
|
-- vim.fn.sign_define('DapBreakpoint', { text='', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl='DapBreakpoint' })
|
|
-- vim.fn.sign_define('DapBreakpointCondition', { text='ﳁ', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl='DapBreakpoint' })
|
|
-- vim.fn.sign_define('DapBreakpointRejected', { text='', texthl='DapBreakpoint', linehl='DapBreakpoint', numhl= 'DapBreakpoint' })
|
|
-- vim.fn.sign_define('DapLogPoint', { text='', texthl='DapLogPoint', linehl='DapLogPoint', numhl= 'DapLogPoint' })
|
|
-- vim.fn.sign_define('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' })
|
|
|
|
ui.setup()
|
|
dap.listeners.after.event_initialized["dapui_config"] = ui.open
|
|
dap.listeners.after.event_terminated["dapui_config"] = ui.close
|
|
dap.listeners.before.event_exited["dapui_config"] = ui.close
|
|
end,
|
|
},
|
|
|
|
-- Mason
|
|
{
|
|
'williamboman/mason.nvim',
|
|
config = true,
|
|
},
|
|
|
|
-- Automatic LSP server setup for Mason
|
|
{
|
|
'williamboman/mason-lspconfig.nvim',
|
|
dependencies = {
|
|
'williamboman/mason.nvim',
|
|
'neovim/nvim-lspconfig',
|
|
},
|
|
config = function()
|
|
local config = require 'mason-lspconfig'
|
|
local lsp = require 'lspconfig'
|
|
local cmp = require 'cmp_nvim_lsp'
|
|
|
|
local noop = function() end
|
|
|
|
config.setup {
|
|
automatic_installation = true,
|
|
-- NOTE: hls is installed via GHCup
|
|
ensure_installed = {
|
|
'lua_ls', -- Lua
|
|
'fennel_ls', -- Fennel
|
|
'rust_analyzer', -- Rust
|
|
-- 'clangd', -- C
|
|
-- 'bashls', -- Bash
|
|
'html', -- HTML
|
|
'cssls', -- CSS / SCSS
|
|
'tsserver', -- TypeScript
|
|
-- 'svelte', -- Svelte
|
|
-- 'pyright', -- Python
|
|
-- 'rnix', -- Nix
|
|
-- 'purescriptls', -- Purescript
|
|
'ltex', -- Literate - LaTeX, Markdown, etc.
|
|
-- 'rescriptls', -- ReScript
|
|
},
|
|
}
|
|
|
|
config.setup_handlers {
|
|
function(name)
|
|
lsp[name].setup {
|
|
single_file_support = true,
|
|
capabilities = cmp.default_capabilities(),
|
|
}
|
|
end,
|
|
['rust_analyzer'] = noop, -- this is started by rustaceanvim
|
|
['lua_ls'] = noop, -- this is started by neodev
|
|
}
|
|
|
|
local signs = {
|
|
Error = "",
|
|
Warn = "",
|
|
Hint = "",
|
|
Info = "",
|
|
}
|
|
|
|
for sign, text in pairs(signs) do
|
|
local name = 'DiagnosticSign' .. sign
|
|
vim.fn.sign_define(name, { text = text, texthl = name })
|
|
end
|
|
end,
|
|
},
|
|
|
|
-- Automatic debugger install
|
|
{
|
|
'jay-babu/mason-nvim-dap.nvim',
|
|
dependencies = {
|
|
'mfussenegger/nvim-dap',
|
|
'williamboman/mason.nvim',
|
|
},
|
|
config = function()
|
|
local config = require 'mason-nvim-dap'
|
|
|
|
config.setup {
|
|
automatic_installation = true,
|
|
ensure_installed = {
|
|
'codelldb',
|
|
--'js-debug-adapter',
|
|
},
|
|
}
|
|
end,
|
|
},
|
|
|
|
-- Tools for Neovim
|
|
{
|
|
'folke/neodev.nvim',
|
|
ft = 'lua',
|
|
dependencies = {
|
|
'neovim/nvim-lspconfig',
|
|
},
|
|
config = function()
|
|
local neodev = require 'neodev'
|
|
local lsp = require 'lspconfig'
|
|
|
|
neodev.setup()
|
|
lsp.lua_ls.setup {
|
|
settings = {
|
|
Lua = { completion = { callSnippet = 'Replace' } }
|
|
}
|
|
}
|
|
end
|
|
},
|
|
|
|
-- Tools for Rust
|
|
{
|
|
'mrcjkb/rustaceanvim',
|
|
version = '^3',
|
|
ft = { 'rust' },
|
|
init = function()
|
|
require 'config.plugins.rustaceanvim'
|
|
end
|
|
},
|
|
|
|
-- Tools for Haskell
|
|
{
|
|
'mrcjkb/haskell-tools.nvim',
|
|
version = '^3',
|
|
ft = { 'haskell', 'lhaskell', 'cabal', 'cabalproject' },
|
|
dependencies = {
|
|
'nvim-lua/plenary.nvim',
|
|
'nvim-telescope/telescope.nvim',
|
|
},
|
|
init = require 'config.plugins.haskell-tools'
|
|
},
|
|
|
|
-- JS debugger
|
|
-- {
|
|
-- 'mxsdev/nvim-dap-vscode-js',
|
|
-- dependencies = {
|
|
-- 'microsoft/vscode-js-debug',
|
|
-- version = '1.x',
|
|
-- build = 'npm i && npm run compile vsDebugServerBundle && mv dist out',
|
|
-- },
|
|
-- config = function()
|
|
-- local dap = require 'dap'
|
|
-- --local utils = require 'dap.utils'
|
|
-- local dap_js = require 'dap-vscode-js'
|
|
-- --local mason = require 'mason-registry'
|
|
--
|
|
-- ---@diagnostic disable-next-line: missing-fields
|
|
-- dap_js.setup {
|
|
-- -- debugger_path = mason.get_package('js-debug-adapter'):get_install_path(),
|
|
-- debugger_path = vim.fn.stdpath 'data' .. '/lazy/vscode-js-debug',
|
|
-- adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
|
|
-- }
|
|
--
|
|
-- local langs = { 'javascript', 'typescript', 'svelte', 'astro' }
|
|
-- for _, lang in ipairs(langs) do
|
|
-- dap.configurations[lang] = {
|
|
-- {
|
|
-- type = 'pwa-node',
|
|
-- request = 'attach',
|
|
-- name = 'Attach debugger to existing `node --inspect` process',
|
|
-- cwd = '${workspaceFolder}',
|
|
-- skipFiles = {
|
|
-- '${workspaceFolder}/node_modules/**/*.js',
|
|
-- '${workspaceFolder}/packages/**/node_modules/**/*.js',
|
|
-- '${workspaceFolder}/packages/**/**/node_modules/**/*.js',
|
|
-- '<node_internals>/**',
|
|
-- 'node_modules/**',
|
|
-- },
|
|
-- sourceMaps = true,
|
|
-- resolveSourceMapLocations = {
|
|
-- '${workspaceFolder}/**',
|
|
-- '!**/node_modules/**',
|
|
-- },
|
|
-- },
|
|
-- }
|
|
-- end
|
|
-- end,
|
|
-- },
|
|
}
|