Run formatter on all lua files
This commit is contained in:
parent
2eca6c0d56
commit
56f0d00f96
|
@ -5,18 +5,18 @@ local bmap = vim.keymap.set
|
|||
local map_opt = { silent = true, buffer = true }
|
||||
|
||||
bmap('n', '<leader>ev', function() require('jdtls').extract_variable() end,
|
||||
{ silent = true, buffer = true, desc = 'Extract variable'})
|
||||
{ silent = true, buffer = true, desc = 'Extract variable' })
|
||||
bmap('v', '<leader>ev', function() require('jdtls').extract_variable(true) end,
|
||||
{ silent = true, buffer = true, desc = 'Extract variable'})
|
||||
{ silent = true, buffer = true, desc = 'Extract variable' })
|
||||
bmap('n', '<leader>ec', function() require('jdtls').extract_constant() end,
|
||||
{ silent = true, buffer = true, desc = 'Extract constant'})
|
||||
{ silent = true, buffer = true, desc = 'Extract constant' })
|
||||
bmap('v', '<leader>ec', function() require('jdtls').extract_constant(true) end,
|
||||
{ silent = true, buffer = true, desc = 'Extract constant'})
|
||||
{ silent = true, buffer = true, desc = 'Extract constant' })
|
||||
bmap('v', '<leader>em', function() require('jdtls').extract_method(true) end,
|
||||
{ silent = true, buffer = true, desc = 'Extract method'})
|
||||
{ silent = true, buffer = true, desc = 'Extract method' })
|
||||
bmap('n', '<leader>ro', function() require('jdtls').organize_imports() end,
|
||||
{ silent = true, buffer = true, desc = 'Organize imports'})
|
||||
{ silent = true, buffer = true, desc = 'Organize imports' })
|
||||
bmap('n', '<leader>tc', function() require 'jdtls'.test_class() end,
|
||||
{ silent = true, buffer = true, desc = 'Test class'})
|
||||
{ silent = true, buffer = true, desc = 'Test class' })
|
||||
bmap('n', '<leader>tm', function() require 'jdtls'.test_nearest_method() end,
|
||||
{ silent = true, buffer = true, desc = 'Test nearest method'})
|
||||
{ silent = true, buffer = true, desc = 'Test nearest method' })
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = { "typescript" },
|
||||
sync_install = true,
|
||||
auto_install = 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,
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = { "typescript" },
|
||||
sync_install = true,
|
||||
auto_install = 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,
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
require("trouble").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", {silent = true, noremap = true})
|
||||
vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>", {silent = true, noremap = true})
|
||||
vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>", {silent = true, noremap = true})
|
||||
vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>", {silent = true, noremap = true})
|
||||
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", {silent = true, noremap = true})
|
||||
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", {silent = true, noremap = true})
|
||||
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>", { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>", { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>", { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", { silent = true, noremap = true })
|
||||
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", { silent = true, noremap = true })
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
vim.filetype.add({
|
||||
extension = {
|
||||
},
|
||||
filename = {
|
||||
['.scalafmt.conf'] = 'hocon',
|
||||
['kitty.conf'] = 'kitty',
|
||||
['neomuttrc'] = 'neomutt',
|
||||
['template'] = 'sh',
|
||||
['mbsyncrc'] = 'mbsyncrc',
|
||||
},
|
||||
pattern = {
|
||||
['${XDG_CONFIG_HOME}/kitty/*.conf'] = 'kitty',
|
||||
['${XDG_CONFIG_HOME}/kitty/*.session'] = 'kitty-session',
|
||||
},
|
||||
extension = {
|
||||
['vtt'] = 'vtt',
|
||||
},
|
||||
filename = {
|
||||
['.scalafmt.conf'] = 'hocon',
|
||||
['kitty.conf'] = 'kitty',
|
||||
['neomuttrc'] = 'neomutt',
|
||||
['template'] = 'sh',
|
||||
['mbsyncrc'] = 'mbsyncrc',
|
||||
},
|
||||
pattern = {
|
||||
['${XDG_CONFIG_HOME}/kitty/*.conf'] = 'kitty',
|
||||
['${XDG_CONFIG_HOME}/kitty/*.session'] = 'kitty-session',
|
||||
},
|
||||
})
|
||||
|
||||
-- au BufRead,BufNewFile *.ttl set filetype=rdf-turtle
|
||||
-- au! BufNewFile,BufRead *.xwiki set ft=xwiki syntax=xwiki
|
||||
--
|
||||
--
|
||||
|
|
|
@ -7,13 +7,13 @@ vim.filetype.add({
|
|||
sc = function(path, bufnr)
|
||||
for _, line in ipairs(vim.filetype.getlines(bufnr, 1, 25)) do
|
||||
if
|
||||
vim.filetype.findany(line, {
|
||||
'var%s<',
|
||||
'classvar%s<',
|
||||
'%^this.*',
|
||||
'%+%s%w*%s{',
|
||||
'%*ar%s',
|
||||
})
|
||||
vim.filetype.findany(line, {
|
||||
'var%s<',
|
||||
'classvar%s<',
|
||||
'%^this.*',
|
||||
'%+%s%w*%s{',
|
||||
'%*ar%s',
|
||||
})
|
||||
then
|
||||
return 'supercollider'
|
||||
end
|
||||
|
|
114
lua/common.lua
114
lua/common.lua
|
@ -1,61 +1,61 @@
|
|||
-- Adapted from https://github.com/LazyVim/LazyVim/
|
||||
-- SPDX-License-Identifier: Apache-2.0
|
||||
return {
|
||||
icons = {
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
BreakpointCondition = " ",
|
||||
BreakpointRejected = { " ", "DiagnosticError" },
|
||||
LogPoint = ".>",
|
||||
},
|
||||
diagnostics = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
},
|
||||
git = {
|
||||
added = " ",
|
||||
modified = " ",
|
||||
removed = " ",
|
||||
},
|
||||
kinds = {
|
||||
Array = " ",
|
||||
Boolean = " ",
|
||||
Class = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Folder = " ",
|
||||
Function = " ",
|
||||
Interface = " ",
|
||||
Key = " ",
|
||||
Keyword = " ",
|
||||
Method = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Null = " ",
|
||||
Number = " ",
|
||||
Object = " ",
|
||||
Operator = " ",
|
||||
Package = " ",
|
||||
Property = " ",
|
||||
Reference = " ",
|
||||
Snippet = " ",
|
||||
String = " ",
|
||||
Struct = " ",
|
||||
Text = " ",
|
||||
TypeParameter = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
Variable = " ",
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
dap = {
|
||||
Stopped = { " ", "DiagnosticWarn", "DapStoppedLine" },
|
||||
Breakpoint = " ",
|
||||
BreakpointCondition = " ",
|
||||
BreakpointRejected = { " ", "DiagnosticError" },
|
||||
LogPoint = ".>",
|
||||
},
|
||||
diagnostics = {
|
||||
Error = " ",
|
||||
Warn = " ",
|
||||
Hint = " ",
|
||||
Info = " ",
|
||||
},
|
||||
git = {
|
||||
added = " ",
|
||||
modified = " ",
|
||||
removed = " ",
|
||||
},
|
||||
kinds = {
|
||||
Array = " ",
|
||||
Boolean = " ",
|
||||
Class = " ",
|
||||
Color = " ",
|
||||
Constant = " ",
|
||||
Constructor = " ",
|
||||
Copilot = " ",
|
||||
Enum = " ",
|
||||
EnumMember = " ",
|
||||
Event = " ",
|
||||
Field = " ",
|
||||
File = " ",
|
||||
Folder = " ",
|
||||
Function = " ",
|
||||
Interface = " ",
|
||||
Key = " ",
|
||||
Keyword = " ",
|
||||
Method = " ",
|
||||
Module = " ",
|
||||
Namespace = " ",
|
||||
Null = " ",
|
||||
Number = " ",
|
||||
Object = " ",
|
||||
Operator = " ",
|
||||
Package = " ",
|
||||
Property = " ",
|
||||
Reference = " ",
|
||||
Snippet = " ",
|
||||
String = " ",
|
||||
Struct = " ",
|
||||
Text = " ",
|
||||
TypeParameter = " ",
|
||||
Unit = " ",
|
||||
Value = " ",
|
||||
Variable = " ",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
-- Setup nvim-cmp.
|
||||
local cmp = require'cmp'
|
||||
local cmp = require 'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
--vim.fn["vsnip#anonymous"](args.body)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
--vim.fn["vsnip#anonymous"](args.body)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
|
||||
-- For vsnip user.
|
||||
{ name = 'vsnip' },
|
||||
-- For vsnip user.
|
||||
{ name = 'vsnip' },
|
||||
|
||||
-- For luasnip user.
|
||||
-- { name = 'luasnip' },
|
||||
-- For luasnip user.
|
||||
-- { name = 'luasnip' },
|
||||
|
||||
-- For ultisnips user.
|
||||
-- { name = 'ultisnips' },
|
||||
-- For ultisnips user.
|
||||
-- { name = 'ultisnips' },
|
||||
|
||||
{ name = 'buffer' },
|
||||
}
|
||||
{ name = 'buffer' },
|
||||
}
|
||||
})
|
||||
|
||||
-- Setup lsp.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
'uloco/bluloco.nvim',
|
||||
dependencies = { 'rktjmp/lush.nvim' },
|
||||
opts = {
|
||||
italics = true,
|
||||
},
|
||||
'uloco/bluloco.nvim',
|
||||
dependencies = { 'rktjmp/lush.nvim' },
|
||||
opts = {
|
||||
italics = true,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
return {
|
||||
'crater2150/vim-theme-chroma',
|
||||
dev = true,
|
||||
lazy = false,
|
||||
branch = 'lush',
|
||||
priority = 1000,
|
||||
config = function() vim.cmd.colorscheme("chroma") end
|
||||
'crater2150/vim-theme-chroma',
|
||||
dev = true,
|
||||
lazy = false,
|
||||
branch = 'lush',
|
||||
priority = 1000,
|
||||
config = function() vim.cmd.colorscheme("chroma") end
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
return { 'ryicoh/deepl.vim',
|
||||
return {
|
||||
'ryicoh/deepl.vim',
|
||||
keys = {
|
||||
|
||||
{ '<leader><C-e>', function() vim.fn['deepl#v']("EN") end, mode = 'v' },
|
||||
{ '<leader><C-d>', function() vim.fn['deepl#v']("DE") end, mode = 'v' },
|
||||
},
|
||||
dependencies = {{ 'tsuyoshicho/vim-pass',
|
||||
init = function ()
|
||||
dependencies = { {
|
||||
'tsuyoshicho/vim-pass',
|
||||
init = function()
|
||||
vim.g.pass_use_agent = 1
|
||||
end
|
||||
}},
|
||||
config = function ()
|
||||
} },
|
||||
config = function()
|
||||
vim.g['deepl#endpoint'] = "https://api-free.deepl.com/v2/translate"
|
||||
vim.g['deepl#auth_key'] = vim.fn['pass#get']('web/deepl.com', 'apikey')
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
return {
|
||||
'mfussenegger/nvim-lint',
|
||||
|
||||
{
|
||||
'mhartington/formatter.nvim',
|
||||
opts = function()
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
return {
|
||||
'tpope/vim-fugitive'
|
||||
}
|
||||
return { 'tpope/vim-fugitive' }
|
||||
|
|
7
lua/plugins/gen.lua
Normal file
7
lua/plugins/gen.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"David-Kunz/gen.nvim",
|
||||
opts = {
|
||||
model = "mistral", -- The default model to use.
|
||||
init = false,
|
||||
}
|
||||
}
|
14
lua/plugins/git.lua
Normal file
14
lua/plugins/git.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
'lambdalisue/gina.vim',
|
||||
'gisphm/vim-gitignore',
|
||||
'sjl/splice.vim',
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = {
|
||||
signs = {
|
||||
add = { text = '▌' },
|
||||
change = { text = '▐' },
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
|
@ -1,23 +1,23 @@
|
|||
return {
|
||||
"lewis6991/hover.nvim",
|
||||
config = function()
|
||||
require("hover").setup {
|
||||
init = function()
|
||||
require("hover.providers.lsp")
|
||||
require('hover.providers.gh')
|
||||
require('hover.providers.man')
|
||||
end,
|
||||
preview_opts = {
|
||||
border = nil
|
||||
},
|
||||
-- Whether the contents of a currently open hover window should be moved
|
||||
-- to a :h preview-window when pressing the hover keymap.
|
||||
preview_window = false,
|
||||
title = true
|
||||
}
|
||||
"lewis6991/hover.nvim",
|
||||
config = function()
|
||||
require("hover").setup {
|
||||
init = function()
|
||||
require("hover.providers.lsp")
|
||||
require('hover.providers.gh')
|
||||
require('hover.providers.man')
|
||||
end,
|
||||
preview_opts = {
|
||||
border = nil
|
||||
},
|
||||
-- Whether the contents of a currently open hover window should be moved
|
||||
-- to a :h preview-window when pressing the hover keymap.
|
||||
preview_window = false,
|
||||
title = true
|
||||
}
|
||||
|
||||
-- Setup keymaps
|
||||
vim.keymap.set("n", "K", require("hover").hover, {desc = "hover.nvim"})
|
||||
vim.keymap.set("n", "gK", require("hover").hover_select, {desc = "hover.nvim (select)"})
|
||||
end
|
||||
-- Setup keymaps
|
||||
vim.keymap.set("n", "K", require("hover").hover, { desc = "hover.nvim" })
|
||||
vim.keymap.set("n", "gK", require("hover").hover_select, { desc = "hover.nvim (select)" })
|
||||
end
|
||||
}
|
||||
|
|
|
@ -8,21 +8,24 @@ return {
|
|||
'tpope/vim-commentary',
|
||||
'tpope/vim-sleuth',
|
||||
|
||||
{"chrisgrieser/nvim-genghis", dependencies = "stevearc/dressing.nvim"},
|
||||
{ "chrisgrieser/nvim-genghis", dependencies = "stevearc/dressing.nvim" },
|
||||
|
||||
-- ic / ac
|
||||
{'glts/vim-textobj-comment',
|
||||
{
|
||||
'glts/vim-textobj-comment',
|
||||
dependencies = { 'kana/vim-textobj-user' }
|
||||
},
|
||||
-- ii / ai
|
||||
'michaeljsmith/vim-indent-object',
|
||||
'neovim/nvim-lspconfig',
|
||||
|
||||
{ 'nvim-telescope/telescope.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
},
|
||||
|
||||
{ 'ray-x/lsp_signature.nvim',
|
||||
{
|
||||
'ray-x/lsp_signature.nvim',
|
||||
config = function()
|
||||
require('lsp_signature').setup({})
|
||||
end
|
||||
|
@ -36,9 +39,10 @@ return {
|
|||
'lambdalisue/suda.vim',
|
||||
'jamessan/vim-gnupg',
|
||||
|
||||
{'lervag/vimtex',
|
||||
{
|
||||
'lervag/vimtex',
|
||||
init = function()
|
||||
vim.g.tex_conceal="agm"
|
||||
vim.g.tex_conceal = "agm"
|
||||
vim.g.vimtex_quickfix_ignorefilters = { 'overfull', 'underfull' }
|
||||
vim.g.vimtex_syntax_enabled = 0
|
||||
end,
|
||||
|
|
|
@ -1,183 +1,185 @@
|
|||
return {
|
||||
-- lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
"mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
'nvim-lua/lsp-status.nvim',
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = function() return {
|
||||
-- options for vim.diagnostic.config()
|
||||
diagnostics = {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = "if_many",
|
||||
prefix = "●",
|
||||
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||
-- prefix = "icons",
|
||||
},
|
||||
severity_sort = true,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = { require'lsp-status'.capabilities },
|
||||
servers = {
|
||||
jsonls = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
rope_autoimport = { enabled = true, },
|
||||
isort = { enabled = true, },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- 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,
|
||||
},
|
||||
} end,
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
-- diagnostics
|
||||
for name, icon in pairs(require("common").icons.diagnostics) do
|
||||
name = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||
end
|
||||
-- lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
"mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
'nvim-lua/lsp-status.nvim',
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = function()
|
||||
return {
|
||||
-- options for vim.diagnostic.config()
|
||||
diagnostics = {
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
spacing = 4,
|
||||
source = "if_many",
|
||||
prefix = "●",
|
||||
-- this will set set the prefix to a function that returns the diagnostics icon based on the severity
|
||||
-- this only works on a recent 0.10.0 build. Will be set to "●" when not supported
|
||||
-- prefix = "icons",
|
||||
},
|
||||
severity_sort = true,
|
||||
},
|
||||
-- add any global capabilities here
|
||||
capabilities = { require 'lsp-status'.capabilities },
|
||||
servers = {
|
||||
jsonls = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
rope_autoimport = { enabled = true, },
|
||||
isort = { enabled = true, },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- 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,
|
||||
},
|
||||
}
|
||||
end,
|
||||
---@param opts PluginLspOpts
|
||||
config = function(_, opts)
|
||||
-- diagnostics
|
||||
for name, icon in pairs(require("common").icons.diagnostics) do
|
||||
name = "DiagnosticSign" .. name
|
||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||
end
|
||||
|
||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||
or function(diagnostic)
|
||||
local icons = require("common").icons.diagnostics
|
||||
for d, icon in pairs(icons) do
|
||||
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
||||
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||
or function(diagnostic)
|
||||
local icons = require("common").icons.diagnostics
|
||||
for d, icon in pairs(icons) do
|
||||
if diagnostic.severity == vim.diagnostic.severity[d:upper()] then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||
vim.diagnostic.config(vim.deepcopy(opts.diagnostics))
|
||||
|
||||
local servers = opts.servers
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
require("cmp_nvim_lsp").default_capabilities(),
|
||||
opts.capabilities or {}
|
||||
)
|
||||
local servers = opts.servers
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
require("cmp_nvim_lsp").default_capabilities(),
|
||||
opts.capabilities or {}
|
||||
)
|
||||
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
capabilities = vim.deepcopy(capabilities),
|
||||
}, servers[server] or {})
|
||||
local function setup(server)
|
||||
local server_opts = vim.tbl_deep_extend("force", {
|
||||
capabilities = vim.deepcopy(capabilities),
|
||||
}, servers[server] or {})
|
||||
|
||||
if opts.setup[server] then
|
||||
if opts.setup[server](server, server_opts) then
|
||||
return
|
||||
end
|
||||
elseif opts.setup["*"] then
|
||||
if opts.setup["*"](server, server_opts) then
|
||||
return
|
||||
end
|
||||
end
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
if opts.setup[server] then
|
||||
if opts.setup[server](server, server_opts) then
|
||||
return
|
||||
end
|
||||
elseif opts.setup["*"] then
|
||||
if opts.setup["*"](server, server_opts) then
|
||||
return
|
||||
end
|
||||
end
|
||||
require("lspconfig")[server].setup(server_opts)
|
||||
end
|
||||
|
||||
-- get all the servers that are available thourgh mason-lspconfig
|
||||
local have_mason, mlsp = pcall(require, "mason-lspconfig")
|
||||
local all_mslp_servers = {}
|
||||
if have_mason then
|
||||
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
|
||||
end
|
||||
-- get all the servers that are available thourgh mason-lspconfig
|
||||
local have_mason, mlsp = pcall(require, "mason-lspconfig")
|
||||
local all_mslp_servers = {}
|
||||
if have_mason then
|
||||
all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package)
|
||||
end
|
||||
|
||||
local ensure_installed = {} ---@type string[]
|
||||
for server, server_opts in pairs(servers) do
|
||||
if server_opts then
|
||||
server_opts = server_opts == true and {} or server_opts
|
||||
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
|
||||
setup(server)
|
||||
else
|
||||
ensure_installed[#ensure_installed + 1] = server
|
||||
end
|
||||
end
|
||||
end
|
||||
local ensure_installed = {} ---@type string[]
|
||||
for server, server_opts in pairs(servers) do
|
||||
if server_opts then
|
||||
server_opts = server_opts == true and {} or server_opts
|
||||
-- run manual setup if mason=false or if this is a server that cannot be installed with mason-lspconfig
|
||||
if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then
|
||||
setup(server)
|
||||
else
|
||||
ensure_installed[#ensure_installed + 1] = server
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if have_mason then
|
||||
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||
end
|
||||
end,
|
||||
},
|
||||
if have_mason then
|
||||
mlsp.setup({ ensure_installed = ensure_installed, handlers = { setup } })
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- formatters
|
||||
-- cmdline tools and lsp servers
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"jdtls",
|
||||
"lua-language-server",
|
||||
},
|
||||
},
|
||||
---@param opts MasonSettings | {ensure_installed: string[]}
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
local mr = require("mason-registry")
|
||||
local function ensure_installed()
|
||||
for _, tool in ipairs(opts.ensure_installed) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
if mr.refresh then
|
||||
mr.refresh(ensure_installed)
|
||||
else
|
||||
ensure_installed()
|
||||
end
|
||||
end,
|
||||
},
|
||||
'mfussenegger/nvim-jdtls',
|
||||
{'nvim-lua/lsp-status.nvim',
|
||||
config = function(_, opts)
|
||||
local lsp_status = require('lsp-status')
|
||||
lsp_status.register_progress()
|
||||
end
|
||||
}
|
||||
-- formatters
|
||||
-- cmdline tools and lsp servers
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"jdtls",
|
||||
"lua-language-server",
|
||||
},
|
||||
},
|
||||
---@param opts MasonSettings | {ensure_installed: string[]}
|
||||
config = function(_, opts)
|
||||
require("mason").setup(opts)
|
||||
local mr = require("mason-registry")
|
||||
local function ensure_installed()
|
||||
for _, tool in ipairs(opts.ensure_installed) do
|
||||
local p = mr.get_package(tool)
|
||||
if not p:is_installed() then
|
||||
p:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
if mr.refresh then
|
||||
mr.refresh(ensure_installed)
|
||||
else
|
||||
ensure_installed()
|
||||
end
|
||||
end,
|
||||
},
|
||||
'mfussenegger/nvim-jdtls',
|
||||
{
|
||||
'nvim-lua/lsp-status.nvim',
|
||||
config = function(_, opts)
|
||||
local lsp_status = require('lsp-status')
|
||||
lsp_status.register_progress()
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
return {
|
||||
'rktjmp/lush.nvim',
|
||||
'rktjmp/shipwright.nvim',
|
||||
'rktjmp/shipwright.nvim',
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
return {
|
||||
'euclio/vim-markdown-composer',
|
||||
build = 'cargo build --release'
|
||||
'euclio/vim-markdown-composer',
|
||||
build = 'cargo build --release'
|
||||
}
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
return {
|
||||
'scalameta/nvim-metals',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'mfussenegger/nvim-dap',
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
ft = { 'scala', 'sbt' },
|
||||
config = function()
|
||||
local metals_config = require('metals').bare_config()
|
||||
metals_config.init_options.statusBarProvider = "on"
|
||||
metals_config.settings = {
|
||||
showImplicitArguments = true,
|
||||
superMethodLensesEnabled = true,
|
||||
}
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
require("metals").setup_dap()
|
||||
require("my_lsp").on_attach(client, bufnr)
|
||||
end
|
||||
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Debug settings if you're using nvim-dap
|
||||
local dap = require("dap")
|
||||
dap.configurations.scala = {
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "RunOrTest",
|
||||
metals = {
|
||||
runType = "runOrTestFile",
|
||||
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test Target",
|
||||
metals = {
|
||||
runType = "testTarget",
|
||||
},
|
||||
},
|
||||
}
|
||||
'scalameta/nvim-metals',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'mfussenegger/nvim-dap',
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
ft = { 'scala', 'sbt' },
|
||||
config = function()
|
||||
local metals_config = require('metals').bare_config()
|
||||
metals_config.init_options.statusBarProvider = "on"
|
||||
metals_config.settings = {
|
||||
showImplicitArguments = true,
|
||||
superMethodLensesEnabled = true,
|
||||
}
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
require("metals").setup_dap()
|
||||
require("my_lsp").on_attach(client, bufnr)
|
||||
end
|
||||
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Debug settings if you're using nvim-dap
|
||||
local dap = require("dap")
|
||||
dap.configurations.scala = {
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "RunOrTest",
|
||||
metals = {
|
||||
runType = "runOrTestFile",
|
||||
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test Target",
|
||||
metals = {
|
||||
runType = "testTarget",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- Autocmd that will actually be in charging of starting the whole thing
|
||||
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
-- NOTE: You may or may not want java included here. You will need it if you
|
||||
-- want basic Java support but it may also conflict if you are using
|
||||
-- something like nvim-jdtls which also works on a java filetype autocmd.
|
||||
pattern = { "scala", "sbt" },
|
||||
callback = function()
|
||||
require("metals").initialize_or_attach(metals_config)
|
||||
end,
|
||||
group = nvim_metals_group,
|
||||
})
|
||||
-- Autocmd that will actually be in charging of starting the whole thing
|
||||
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
-- NOTE: You may or may not want java included here. You will need it if you
|
||||
-- want basic Java support but it may also conflict if you are using
|
||||
-- something like nvim-jdtls which also works on a java filetype autocmd.
|
||||
pattern = { "scala", "sbt" },
|
||||
callback = function()
|
||||
require("metals").initialize_or_attach(metals_config)
|
||||
end,
|
||||
group = nvim_metals_group,
|
||||
})
|
||||
|
||||
return metals_config
|
||||
end
|
||||
return metals_config
|
||||
end
|
||||
}
|
||||
|
|
|
@ -1,57 +1,59 @@
|
|||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
{ 'kyazdani42/nvim-web-devicons', lazy = true },
|
||||
'nvim-lua/lsp-status.nvim',
|
||||
'crater2150/vim-theme-chroma',
|
||||
},
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts) return {
|
||||
options = {
|
||||
theme = require('chroma-theme.lualine')
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = { 'branch' },
|
||||
lualine_b = {},
|
||||
lualine_c = { { 'buffers', show_filename_only = false, symbols = { modified = " ✏️]", alternate_file = " 🔃", folder = " 📁"} ,}},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
{'tabs',
|
||||
mode=1,
|
||||
fmt = function(name, context)
|
||||
local buflist = vim.fn.tabpagebuflist(context.tabnr)
|
||||
local mod = not vim.tbl_isempty(vim.tbl_filter(
|
||||
function(bufnr) return vim.fn.getbufvar(bufnr, '&mod') == 1 end,
|
||||
buflist))
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
{ 'kyazdani42/nvim-web-devicons', lazy = true },
|
||||
'nvim-lua/lsp-status.nvim',
|
||||
'crater2150/vim-theme-chroma',
|
||||
},
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
return {
|
||||
options = {
|
||||
theme = require('chroma-theme.lualine')
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = { 'branch' },
|
||||
lualine_b = {},
|
||||
lualine_c = { { 'buffers', show_filename_only = false, symbols = { modified = " ✏️]", alternate_file = " 🔃", folder = " 📁" }, } },
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
{
|
||||
'tabs',
|
||||
mode = 1,
|
||||
fmt = function(name, context)
|
||||
local buflist = vim.fn.tabpagebuflist(context.tabnr)
|
||||
local mod = not vim.tbl_isempty(vim.tbl_filter(
|
||||
function(bufnr) return vim.fn.getbufvar(bufnr, '&mod') == 1 end,
|
||||
buflist))
|
||||
|
||||
local wincount = #vim.tbl_filter(
|
||||
function(i) return i == 'leaf' end,
|
||||
vim.tbl_flatten(vim.fn.winlayout(context.tabnr))
|
||||
)
|
||||
local wincount = #vim.tbl_filter(
|
||||
function(i) return i == 'leaf' end,
|
||||
vim.tbl_flatten(vim.fn.winlayout(context.tabnr))
|
||||
)
|
||||
|
||||
return name .. (wincount > 1 and ' +' .. (wincount - 1) or '') .. (mod and ' [✏️]]' or '')
|
||||
end
|
||||
} }
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'filename' },
|
||||
lualine_b = { 'diff', 'diagnostics' },
|
||||
lualine_x = { "require'lsp-status'.status()" },
|
||||
lualine_y = { 'filetype' },
|
||||
lualine_z = { 'searchcount', 'selectioncount', 'location' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
end,
|
||||
return name .. (wincount > 1 and ' +' .. (wincount - 1) or '') .. (mod and ' [✏️]]' or '')
|
||||
end
|
||||
} }
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'filename' },
|
||||
lualine_b = { 'diff', 'diagnostics' },
|
||||
lualine_x = { "require'lsp-status'.status()" },
|
||||
lualine_y = { 'filetype' },
|
||||
lualine_z = { 'searchcount', 'selectioncount', 'location' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build =
|
||||
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
|
||||
},
|
||||
'gbrlsnchs/telescope-lsp-handlers.nvim',
|
||||
},
|
||||
cmd = "Telescope",
|
||||
version = false,
|
||||
keys = function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local utils = require("telescope.utils")
|
||||
return {
|
||||
{ ',,', function() builtin.fd { cwd = utils.buffer_dir() } end, desc = "Find files in current file's dir" },
|
||||
{ ',ff', builtin.fd, desc = "Find files" },
|
||||
{ ',fg', builtin.git_files, desc = "Find files (git)" },
|
||||
{ ',gs', builtin.git_status, desc = "Git status" },
|
||||
{ ',s', builtin.lsp_dynamic_workspace_symbols, desc = "Symbols" },
|
||||
{ 'g/', builtin.live_grep, desc = "Live grep" },
|
||||
{ 'g:', builtin.command_history, desc = "Command history" },
|
||||
{ '<C-/>', builtin.current_buffer_fuzzy_find, desc = "Fuzzy find" },
|
||||
{ '<leader>*', builtin.grep_string, desc = "Find at cursor" },
|
||||
{ 'gb', builtin.buffers, desc = "Switch buffer" },
|
||||
{ "<leader>:", builtin.command_history, desc = "Command History" },
|
||||
{ "<leader>;", builtin.commands, desc = "Commands" },
|
||||
}
|
||||
end,
|
||||
opts = {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
},
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {}
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local telescope = require('telescope')
|
||||
telescope.setup(opts)
|
||||
telescope.load_extension('fzf')
|
||||
end,
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build =
|
||||
'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
|
||||
},
|
||||
'gbrlsnchs/telescope-lsp-handlers.nvim',
|
||||
},
|
||||
cmd = "Telescope",
|
||||
version = false,
|
||||
keys = function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local utils = require("telescope.utils")
|
||||
return {
|
||||
{ ',,', function() builtin.fd { cwd = utils.buffer_dir() } end, desc = "Find files in current file's dir" },
|
||||
{ ',ff', builtin.fd, desc = "Find files" },
|
||||
{ ',fg', builtin.git_files, desc = "Find files (git)" },
|
||||
{ ',gs', builtin.git_status, desc = "Git status" },
|
||||
{ ',s', builtin.lsp_dynamic_workspace_symbols, desc = "Symbols" },
|
||||
{ 'g/', builtin.live_grep, desc = "Live grep" },
|
||||
{ 'g:', builtin.command_history, desc = "Command history" },
|
||||
{ '<C-/>', builtin.current_buffer_fuzzy_find, desc = "Fuzzy find" },
|
||||
{ '<leader>*', builtin.grep_string, desc = "Find at cursor" },
|
||||
{ 'gb', builtin.buffers, desc = "Switch buffer" },
|
||||
{ "<leader>:", builtin.command_history, desc = "Command History" },
|
||||
{ "<leader>;", builtin.commands, desc = "Commands" },
|
||||
}
|
||||
end,
|
||||
opts = {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
},
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {}
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local telescope = require('telescope')
|
||||
telescope.setup(opts)
|
||||
telescope.load_extension('fzf')
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -1,111 +1,113 @@
|
|||
local function ts_disable(_, bufnr)
|
||||
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
||||
return vim.api.nvim_buf_line_count(bufnr) > 5000
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
init = function()
|
||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||
local enabled = false
|
||||
if opts.textobjects then
|
||||
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||
enabled = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not enabled then
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<c-space>", desc = "Increment selection" },
|
||||
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||
},
|
||||
---@type TSConfig
|
||||
opts = {
|
||||
highlight = { enable = true, disable = ts_disable },
|
||||
indent = { enable = true },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"gitignore",
|
||||
"html",
|
||||
"java",
|
||||
"json",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"scala",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
---@type table<string, boolean>
|
||||
local added = {}
|
||||
opts.ensure_installed = vim.tbl_filter(function(lang)
|
||||
if added[lang] then
|
||||
return false
|
||||
end
|
||||
added[lang] = true
|
||||
return true
|
||||
end, opts.ensure_installed --[[@as string[] ]])
|
||||
end
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
{ 'nvim-treesitter/playground',
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
cmd = {
|
||||
'TSPlaygroundToggle',
|
||||
'TSHighlightCapturesUnderCursor',
|
||||
'TSNodeUnderCursor',
|
||||
}
|
||||
},
|
||||
{ "nvim-treesitter/nvim-treesitter-context",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
cmd = { 'TSContextEnable', 'TSContextDisable', 'TSContextToggle' },
|
||||
keys = {
|
||||
{ "[c", function() require("treesitter-context").go_to_context() end, desc = "Go to context start" },
|
||||
},
|
||||
opts = { enable = true },
|
||||
config = function(_, opts)
|
||||
require'treesitter-context'.setup(opts)
|
||||
vim.api.nvim_set_hl(0, 'TreesitterContext', { bg = "#555555" })
|
||||
vim.api.nvim_set_hl(0, 'TreesitterContextLineNumber', { link = "Special" })
|
||||
end,
|
||||
}
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = ":TSUpdate",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
init = function()
|
||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||
local enabled = false
|
||||
if opts.textobjects then
|
||||
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
|
||||
if opts.textobjects[mod] and opts.textobjects[mod].enable then
|
||||
enabled = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not enabled then
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<c-space>", desc = "Increment selection" },
|
||||
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||
},
|
||||
---@type TSConfig
|
||||
opts = {
|
||||
highlight = { enable = true, disable = ts_disable },
|
||||
indent = { enable = true },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"gitignore",
|
||||
"html",
|
||||
"java",
|
||||
"json",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"scala",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(_, opts)
|
||||
if type(opts.ensure_installed) == "table" then
|
||||
---@type table<string, boolean>
|
||||
local added = {}
|
||||
opts.ensure_installed = vim.tbl_filter(function(lang)
|
||||
if added[lang] then
|
||||
return false
|
||||
end
|
||||
added[lang] = true
|
||||
return true
|
||||
end, opts.ensure_installed --[[@as string[] ]])
|
||||
end
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/playground',
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
cmd = {
|
||||
'TSPlaygroundToggle',
|
||||
'TSHighlightCapturesUnderCursor',
|
||||
'TSNodeUnderCursor',
|
||||
}
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
cmd = { 'TSContextEnable', 'TSContextDisable', 'TSContextToggle' },
|
||||
keys = {
|
||||
{ "[c", function() require("treesitter-context").go_to_context() end, desc = "Go to context start" },
|
||||
},
|
||||
opts = { enable = true },
|
||||
config = function(_, opts)
|
||||
require 'treesitter-context'.setup(opts)
|
||||
vim.api.nvim_set_hl(0, 'TreesitterContext', { bg = "#555555" })
|
||||
vim.api.nvim_set_hl(0, 'TreesitterContextLineNumber', { link = "Special" })
|
||||
end,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
vim.api.nvim_create_augroup("KeepCentered", { clear = true })
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
group = "KeepCentered",
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.o.buftype == '' then
|
||||
vim.cmd([[normal! zz]])
|
||||
end
|
||||
end,
|
||||
group = "KeepCentered",
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.o.buftype == '' then
|
||||
vim.cmd([[normal! zz]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
local sbtToScalaCLI = function()
|
||||
vim.cmd[[s/\s*libraryDependencies\s*+=\s*/\/\/> using dep /]]
|
||||
vim.cmd[[s/" \(%\+\) "/\=repeat(":", strlen(submatch(1)))/g]]
|
||||
vim.cmd [[s/\s*libraryDependencies\s*+=\s*/\/\/> using dep /]]
|
||||
vim.cmd [[s/" \(%\+\) "/\=repeat(":", strlen(submatch(1)))/g]]
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>dep", sbtToScalaCLI, { noremap = true, silent = true, desc = "Convert sbt dependency to Scala CLI" })
|
||||
|
|
Loading…
Reference in a new issue