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