forked from foxora/nix
added formatter and format on save!!!
This commit is contained in:
parent
62b01c6294
commit
583cc19589
14 changed files with 620 additions and 494 deletions
|
|
@ -22,23 +22,35 @@ local function load_colors()
|
||||||
-- ensure the table has enough entries to avoid indexing issues
|
-- ensure the table has enough entries to avoid indexing issues
|
||||||
if #new_colors >= 18 then
|
if #new_colors >= 18 then
|
||||||
colors = new_colors
|
colors = new_colors
|
||||||
require('base16-colorscheme').setup({
|
require("base16-colorscheme").setup({
|
||||||
base00 = colors[17], base01 = colors[1], base02 = colors[3], base03 = colors[3],
|
base00 = colors[17],
|
||||||
base04 = colors[5], base05 = colors[8], base06 = colors[5], base07 = colors[8],
|
base01 = colors[1],
|
||||||
base08 = colors[18], base09 = colors[4], base0A = colors[11], base0B = colors[5],
|
base02 = colors[3],
|
||||||
base0C = colors[6], base0D = colors[7], base0E = colors[6], base0F = colors[16],
|
base03 = colors[3],
|
||||||
|
base04 = colors[5],
|
||||||
|
base05 = colors[8],
|
||||||
|
base06 = colors[5],
|
||||||
|
base07 = colors[8],
|
||||||
|
base08 = colors[18],
|
||||||
|
base09 = colors[4],
|
||||||
|
base0A = colors[11],
|
||||||
|
base0B = colors[5],
|
||||||
|
base0C = colors[6],
|
||||||
|
base0D = colors[7],
|
||||||
|
base0E = colors[6],
|
||||||
|
base0F = colors[16],
|
||||||
})
|
})
|
||||||
|
|
||||||
-- set colors for blink.cmp's completion menu
|
-- set colors for blink.cmp's completion menu
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenu', { bg = colors[17] })
|
vim.api.nvim_set_hl(0, "BlinkCmpMenu", { bg = colors[17] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenuBorder', { bg = colors[17], fg = colors[13] })
|
vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { bg = colors[17], fg = colors[13] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { bg = colors[15], fg = colors[17] })
|
vim.api.nvim_set_hl(0, "BlinkCmpMenuSelection", { bg = colors[15], fg = colors[17] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpScrollBarThumb', { bg = colors[18] })
|
vim.api.nvim_set_hl(0, "BlinkCmpScrollBarThumb", { bg = colors[18] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpKind', { bg = colors[17], fg = colors[14] })
|
vim.api.nvim_set_hl(0, "BlinkCmpKind", { bg = colors[17], fg = colors[14] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabel', { bg = colors[17], fg = colors[18] })
|
vim.api.nvim_set_hl(0, "BlinkCmpLabel", { bg = colors[17], fg = colors[18] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabelMatch', { bg = colors[17], fg = colors[18] })
|
vim.api.nvim_set_hl(0, "BlinkCmpLabelMatch", { bg = colors[17], fg = colors[18] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabelDetail', { bg = colors[17], fg = colors[18] })
|
vim.api.nvim_set_hl(0, "BlinkCmpLabelDetail", { bg = colors[17], fg = colors[18] })
|
||||||
vim.api.nvim_set_hl(0, 'BlinkCmpLabelDescription', { bg = colors[17], fg = colors[18] })
|
vim.api.nvim_set_hl(0, "BlinkCmpLabelDescription", { bg = colors[17], fg = colors[18] })
|
||||||
else
|
else
|
||||||
print("Error: Not enough colors in file")
|
print("Error: Not enough colors in file")
|
||||||
end
|
end
|
||||||
|
|
@ -66,4 +78,3 @@ local function watch_colorscheme()
|
||||||
end
|
end
|
||||||
|
|
||||||
watch_colorscheme()
|
watch_colorscheme()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,53 +6,60 @@ function M.on_attach(_, bufnr)
|
||||||
|
|
||||||
local nmap = function(keys, func, desc)
|
local nmap = function(keys, func, desc)
|
||||||
if desc then
|
if desc then
|
||||||
desc = 'LSP: ' .. desc
|
desc = "LSP: " .. desc
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||||
|
|
||||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
||||||
|
|
||||||
-- NOTE: why are these functions that call the telescope builtin?
|
-- NOTE: why are these functions that call the telescope builtin?
|
||||||
-- because otherwise they would load telescope eagerly when this is defined.
|
-- because otherwise they would load telescope eagerly when this is defined.
|
||||||
-- due to us using the on_require handler to make sure it is available.
|
-- due to us using the on_require handler to make sure it is available.
|
||||||
if nixCats('general.telescope') then
|
if nixCats("general.telescope") then
|
||||||
nmap('gr', function() require('telescope.builtin').lsp_references() end, '[G]oto [R]eferences')
|
nmap("gr", function()
|
||||||
nmap('gI', function() require('telescope.builtin').lsp_implementations() end, '[G]oto [I]mplementation')
|
require("telescope.builtin").lsp_references()
|
||||||
nmap('<leader>ds', function() require('telescope.builtin').lsp_document_symbols() end, '[D]ocument [S]ymbols')
|
end, "[G]oto [R]eferences")
|
||||||
nmap('<leader>ws', function() require('telescope.builtin').lsp_dynamic_workspace_symbols() end, '[W]orkspace [S]ymbols')
|
nmap("gI", function()
|
||||||
nmap('<leader>dd', "<cmd>Telescope diagnostics bufnr=0<CR>", '[D]ocument [D]iagnostics')
|
require("telescope.builtin").lsp_implementations()
|
||||||
nmap('<leader>wd', "<cmd>Telescope diagnostics<CR>", '[W]orkspace [D]iagnostics')
|
end, "[G]oto [I]mplementation")
|
||||||
|
nmap("<leader>ds", function()
|
||||||
|
require("telescope.builtin").lsp_document_symbols()
|
||||||
|
end, "[D]ocument [S]ymbols")
|
||||||
|
nmap("<leader>ws", function()
|
||||||
|
require("telescope.builtin").lsp_dynamic_workspace_symbols()
|
||||||
|
end, "[W]orkspace [S]ymbols")
|
||||||
|
nmap("<leader>dd", "<cmd>Telescope diagnostics bufnr=0<CR>", "[D]ocument [D]iagnostics")
|
||||||
|
nmap("<leader>wd", "<cmd>Telescope diagnostics<CR>", "[W]orkspace [D]iagnostics")
|
||||||
end -- TODO: someone who knows the builtin versions of these to do instead help me out please.
|
end -- TODO: someone who knows the builtin versions of these to do instead help me out please.
|
||||||
|
|
||||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
||||||
nmap('<leader>e', vim.diagnostic.open_float, 'Show [E]rror')
|
nmap("<leader>e", vim.diagnostic.open_float, "Show [E]rror")
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
-- See `:help K` for why this keymap
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
-- Lesser used LSP functionality
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
||||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
|
||||||
nmap('<leader>wl', function()
|
nmap("<leader>wl", function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, '[W]orkspace [L]ist Folders')
|
end, "[W]orkspace [L]ist Folders")
|
||||||
|
|
||||||
-- Create a command `:Format` local to the LSP buffer
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||||
vim.lsp.buf.format()
|
vim.lsp.buf.format()
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
end, { desc = "Format current buffer with LSP" })
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get(server_name)
|
function M.get(server_name)
|
||||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||||
|
|
||||||
return capabilities
|
return capabilities
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -11,38 +11,38 @@ return {
|
||||||
vim.cmd.packadd(name)
|
vim.cmd.packadd(name)
|
||||||
end,
|
end,
|
||||||
after = function(plugin)
|
after = function(plugin)
|
||||||
local blink = require('blink.cmp')
|
local blink = require("blink.cmp")
|
||||||
|
|
||||||
blink.setup({
|
blink.setup({
|
||||||
keymap = {
|
keymap = {
|
||||||
preset = 'default',
|
preset = "default",
|
||||||
},
|
},
|
||||||
|
|
||||||
appearance = {
|
appearance = {
|
||||||
nerd_font_variant = 'mono',
|
nerd_font_variant = "mono",
|
||||||
},
|
},
|
||||||
|
|
||||||
sources = {
|
sources = {
|
||||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
default = { "lsp", "path", "snippets", "buffer" },
|
||||||
providers = {
|
providers = {
|
||||||
lsp = {
|
lsp = {
|
||||||
name = 'LSP',
|
name = "LSP",
|
||||||
module = 'blink.cmp.sources.lsp',
|
module = "blink.cmp.sources.lsp",
|
||||||
enabled = true,
|
enabled = true,
|
||||||
},
|
},
|
||||||
path = {
|
path = {
|
||||||
name = 'Path',
|
name = "Path",
|
||||||
module = 'blink.cmp.sources.path',
|
module = "blink.cmp.sources.path",
|
||||||
enabled = true,
|
enabled = true,
|
||||||
},
|
},
|
||||||
snippets = {
|
snippets = {
|
||||||
name = 'Snippets',
|
name = "Snippets",
|
||||||
module = 'blink.cmp.sources.snippets',
|
module = "blink.cmp.sources.snippets",
|
||||||
enabled = true,
|
enabled = true,
|
||||||
},
|
},
|
||||||
buffer = {
|
buffer = {
|
||||||
name = 'Buffer',
|
name = "Buffer",
|
||||||
module = 'blink.cmp.sources.buffer',
|
module = "blink.cmp.sources.buffer",
|
||||||
enabled = true,
|
enabled = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -56,14 +56,14 @@ return {
|
||||||
},
|
},
|
||||||
|
|
||||||
menu = {
|
menu = {
|
||||||
border = 'rounded',
|
border = "rounded",
|
||||||
max_height = 12,
|
max_height = 12,
|
||||||
scrolloff = 2,
|
scrolloff = 2,
|
||||||
|
|
||||||
draw = {
|
draw = {
|
||||||
columns = {
|
columns = {
|
||||||
{ "kind_icon", gap = 1, },
|
{ "kind_icon", gap = 1 },
|
||||||
{ "label", "label_description", gap = 1, },
|
{ "label", "label_description", gap = 1 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -71,7 +71,7 @@ return {
|
||||||
documentation = {
|
documentation = {
|
||||||
auto_show = false,
|
auto_show = false,
|
||||||
window = {
|
window = {
|
||||||
border = 'rounded',
|
border = "rounded",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -79,10 +79,10 @@ return {
|
||||||
signature = {
|
signature = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
window = {
|
window = {
|
||||||
border = 'rounded',
|
border = "rounded",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
require("lze").load {
|
require("lze").load({
|
||||||
{ import = "lsp.completion", },
|
{ import = "lsp.completion" },
|
||||||
}
|
})
|
||||||
|
|
||||||
require("lsp.indentation")
|
require("lsp.indentation")
|
||||||
require("lsp.lsp")
|
require("lsp.lsp")
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ servers.lua_ls = {
|
||||||
},
|
},
|
||||||
signatureHelp = { enable = true },
|
signatureHelp = { enable = true },
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = { 'nixCats', 'vim' },
|
globals = { "nixCats", "vim" },
|
||||||
-- disable = { 'missing-fields' },
|
-- disable = { 'missing-fields' },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
|
|
@ -67,7 +67,7 @@ local java_home = os.getenv("JAVA_HOME")
|
||||||
servers.jdtls = {
|
servers.jdtls = {
|
||||||
settings = {
|
settings = {
|
||||||
java = {
|
java = {
|
||||||
contentProvider = { preferred = 'fernflower' },
|
contentProvider = { preferred = "fernflower" },
|
||||||
configuration = {
|
configuration = {
|
||||||
runtimes = {
|
runtimes = {
|
||||||
{
|
{
|
||||||
|
|
@ -78,10 +78,10 @@ servers.jdtls = {
|
||||||
name = "OpenJDK 21",
|
name = "OpenJDK 21",
|
||||||
path = os.getenv("OPENJDK_21"),
|
path = os.getenv("OPENJDK_21"),
|
||||||
},
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Taken from nixCats example:
|
-- Taken from nixCats example:
|
||||||
|
|
@ -90,14 +90,14 @@ servers.jdtls = {
|
||||||
-- nvim-lspconfig, it would do the same thing.
|
-- nvim-lspconfig, it would do the same thing.
|
||||||
-- come to think of it, it might be better because then lspconfig doesnt have to be called before lsp attach?
|
-- come to think of it, it might be better because then lspconfig doesnt have to be called before lsp attach?
|
||||||
-- but you would still end up triggering on a FileType event anyway, so, it makes little difference.
|
-- but you would still end up triggering on a FileType event anyway, so, it makes little difference.
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup('nixCats-lsp-attach', { clear = true }),
|
group = vim.api.nvim_create_augroup("nixCats-lsp-attach", { clear = true }),
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
require('lsp.capabilities').on_attach(vim.lsp.get_client_by_id(event.data.client_id), event.buf)
|
require("lsp.capabilities").on_attach(vim.lsp.get_client_by_id(event.data.client_id), event.buf)
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
require("lze").load {
|
require("lze").load({
|
||||||
{
|
{
|
||||||
"nvim-lspconfig",
|
"nvim-lspconfig",
|
||||||
event = "FileType",
|
event = "FileType",
|
||||||
|
|
@ -105,7 +105,7 @@ require("lze").load {
|
||||||
-- Just register configs, don't enable yet
|
-- Just register configs, don't enable yet
|
||||||
for server_name, cfg in pairs(servers) do
|
for server_name, cfg in pairs(servers) do
|
||||||
vim.lsp.config(server_name, {
|
vim.lsp.config(server_name, {
|
||||||
capabilities = require('lsp.capabilities').get(server_name),
|
capabilities = require("lsp.capabilities").get(server_name),
|
||||||
settings = (cfg or {}).settings,
|
settings = (cfg or {}).settings,
|
||||||
filetypes = (cfg or {}).filetypes,
|
filetypes = (cfg or {}).filetypes,
|
||||||
cmd = (cfg or {}).cmd,
|
cmd = (cfg or {}).cmd,
|
||||||
|
|
@ -117,7 +117,7 @@ require("lze").load {
|
||||||
for server_name, cfg in pairs(servers) do
|
for server_name, cfg in pairs(servers) do
|
||||||
local filetypes = cfg.filetypes or vim.lsp.config[server_name].filetypes
|
local filetypes = cfg.filetypes or vim.lsp.config[server_name].filetypes
|
||||||
if filetypes then
|
if filetypes then
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = filetypes,
|
pattern = filetypes,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.enable(server_name)
|
vim.lsp.enable(server_name)
|
||||||
|
|
@ -127,4 +127,4 @@ require("lze").load {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"dressing.nvim"
|
"dressing.nvim",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
homes/modules/programs/neovim/lua/plugins/format.lua
Normal file
33
homes/modules/programs/neovim/lua/plugins/format.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
-- docs -> https://github.com/stevearc/conform.nvim
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"conform.nvim",
|
||||||
|
enabled = nixCats("format") or false,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>p", desc = "Format File (pretty :3)" },
|
||||||
|
},
|
||||||
|
after = function(plugin)
|
||||||
|
local conform = require("conform")
|
||||||
|
|
||||||
|
conform.setup({
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = nixCats("lang.lua.format") and { "stylua" } or nil,
|
||||||
|
nix = nixCats("lang.nix.format") and { "nixfmt" } or nil,
|
||||||
|
rust = nixCats("lang.rust.format") and { "rustfmt", lsp_format = "fallback" } or nil,
|
||||||
|
haskell = nixCats("lang.haskell.format") and { "ormolu" } or nil,
|
||||||
|
},
|
||||||
|
format_on_save = {
|
||||||
|
timeout_ms = 500,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set({ "n", "v" }, "<leader>p", function()
|
||||||
|
conform.format({
|
||||||
|
lsp_fallback = false,
|
||||||
|
async = false,
|
||||||
|
timeout_ms = 1000,
|
||||||
|
})
|
||||||
|
end, { desc = "Format File (pretty :3)" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,14 @@ return {
|
||||||
"fyler.nvim",
|
"fyler.nvim",
|
||||||
cmd = { "Fyler" },
|
cmd = { "Fyler" },
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>tf", function() return require('fyler').toggle({ kind = "split_right" }) end, mode = {"n"}, desc = 'Open [F]yler' },
|
{
|
||||||
|
"<leader>tf",
|
||||||
|
function()
|
||||||
|
return require("fyler").toggle({ kind = "split_right" })
|
||||||
|
end,
|
||||||
|
mode = { "n" },
|
||||||
|
desc = "Open [F]yler",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
load = function(name)
|
load = function(name)
|
||||||
vim.cmd.packadd(name)
|
vim.cmd.packadd(name)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
require("lze").load {
|
require("lze").load({
|
||||||
{ import = "plugins.dressing", },
|
{ import = "plugins.dressing" },
|
||||||
{ import = "plugins.telescope", },
|
{ import = "plugins.telescope" },
|
||||||
{ import = "plugins.treesitter", },
|
{ import = "plugins.treesitter" },
|
||||||
{ import = "plugins.fyler", },
|
{ import = "plugins.fyler" },
|
||||||
{ import = "plugins.mini-hipatterns", },
|
{ import = "plugins.mini-hipatterns" },
|
||||||
}
|
{ import = "plugins.format" },
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ return {
|
||||||
---@param match string
|
---@param match string
|
||||||
---@return string
|
---@return string
|
||||||
local hex_color_short = function(_, match)
|
local hex_color_short = function(_, match)
|
||||||
local style = 'fg' -- 'fg' or 'bg', for extmark_opts_inline use 'fg'
|
local style = "fg" -- 'fg' or 'bg', for extmark_opts_inline use 'fg'
|
||||||
local r, g, b = match:sub(2, 2), match:sub(3, 3), match:sub(4, 4)
|
local r, g, b = match:sub(2, 2), match:sub(3, 3), match:sub(4, 4)
|
||||||
local hex = string.format('#%s%s%s%s%s%s', r, r, g, g, b, b)
|
local hex = string.format("#%s%s%s%s%s%s", r, r, g, g, b, b)
|
||||||
return hipatterns.compute_hex_color_group(hex, style)
|
return hipatterns.compute_hex_color_group(hex, style)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -20,9 +20,9 @@ return {
|
||||||
---@param match string
|
---@param match string
|
||||||
---@return string
|
---@return string
|
||||||
local hex_color_alpha = function(_, match)
|
local hex_color_alpha = function(_, match)
|
||||||
local style = 'fg' -- 'fg' or 'bg', for extmark_opts_inline use 'fg'
|
local style = "fg" -- 'fg' or 'bg', for extmark_opts_inline use 'fg'
|
||||||
local r, g, b = match:sub(2, 3), match:sub(4, 5), match:sub(6, 7)
|
local r, g, b = match:sub(2, 3), match:sub(4, 5), match:sub(6, 7)
|
||||||
local hex = string.format('#%s%s%s', r, g, b)
|
local hex = string.format("#%s%s%s", r, g, b)
|
||||||
return hipatterns.compute_hex_color_group(hex, style)
|
return hipatterns.compute_hex_color_group(hex, style)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -32,8 +32,8 @@ return {
|
||||||
---@return table
|
---@return table
|
||||||
local extmark_opts_inline = function(_, _, data)
|
local extmark_opts_inline = function(_, _, data)
|
||||||
return {
|
return {
|
||||||
virt_text = { { '', data.hl_group } },
|
virt_text = { { "", data.hl_group } },
|
||||||
virt_text_pos = 'inline',
|
virt_text_pos = "inline",
|
||||||
right_gravity = false,
|
right_gravity = false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -44,8 +44,8 @@ return {
|
||||||
---@return table
|
---@return table
|
||||||
local extmark_opts_inline_alpha = function(_, _, data)
|
local extmark_opts_inline_alpha = function(_, _, data)
|
||||||
return {
|
return {
|
||||||
virt_text = { { '', data.hl_group } },
|
virt_text = { { "", data.hl_group } },
|
||||||
virt_text_pos = 'inline',
|
virt_text_pos = "inline",
|
||||||
right_gravity = false,
|
right_gravity = false,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
@ -55,7 +55,7 @@ return {
|
||||||
-- #rrggbb
|
-- #rrggbb
|
||||||
hex_color = hipatterns.gen_highlighter.hex_color({
|
hex_color = hipatterns.gen_highlighter.hex_color({
|
||||||
style = "inline",
|
style = "inline",
|
||||||
inline_text = '',
|
inline_text = "",
|
||||||
}),
|
}),
|
||||||
-- #rgb
|
-- #rgb
|
||||||
hex_color_short = {
|
hex_color_short = {
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,54 @@ return {
|
||||||
"telescope.nvim",
|
"telescope.nvim",
|
||||||
cmd = { "Telescope" },
|
cmd = { "Telescope" },
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>f", function() return require('telescope.builtin').find_files() end, mode = {"n"}, desc = 'Telescope search [F]iles' },
|
{
|
||||||
{ "<leader>tr", function() return require('telescope.builtin').oldfiles() end, mode = {"n"}, desc = '[T]elescope search [R]ecent files' },
|
"<leader>f",
|
||||||
{ "<leader>ts", function() return require('telescope.builtin').live_grep() end, mode = {"n"}, desc = '[T]elescope [S]earch cwd with grep' },
|
function()
|
||||||
{ "<leader>tw", function() return require('telescope.builtin').grep_string() end, mode = {"n"}, desc = '[T]elescope search current [W]ord' },
|
return require("telescope.builtin").find_files()
|
||||||
{ "<leader>tk", function() return require('telescope.builtin').keymaps() end, mode = {"n"}, desc = '[T]elescope search [K]eymaps' },
|
end,
|
||||||
{ "<leader>tb", function() return require('telescope.builtin').buffers() end, mode = {"n"}, desc = '[T]elescope search [B]uffers' },
|
mode = { "n" },
|
||||||
|
desc = "Telescope search [F]iles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tr",
|
||||||
|
function()
|
||||||
|
return require("telescope.builtin").oldfiles()
|
||||||
|
end,
|
||||||
|
mode = { "n" },
|
||||||
|
desc = "[T]elescope search [R]ecent files",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>ts",
|
||||||
|
function()
|
||||||
|
return require("telescope.builtin").live_grep()
|
||||||
|
end,
|
||||||
|
mode = { "n" },
|
||||||
|
desc = "[T]elescope [S]earch cwd with grep",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tw",
|
||||||
|
function()
|
||||||
|
return require("telescope.builtin").grep_string()
|
||||||
|
end,
|
||||||
|
mode = { "n" },
|
||||||
|
desc = "[T]elescope search current [W]ord",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tk",
|
||||||
|
function()
|
||||||
|
return require("telescope.builtin").keymaps()
|
||||||
|
end,
|
||||||
|
mode = { "n" },
|
||||||
|
desc = "[T]elescope search [K]eymaps",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>tb",
|
||||||
|
function()
|
||||||
|
return require("telescope.builtin").buffers()
|
||||||
|
end,
|
||||||
|
mode = { "n" },
|
||||||
|
desc = "[T]elescope search [B]uffers",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
load = function(name)
|
load = function(name)
|
||||||
vim.cmd.packadd(name)
|
vim.cmd.packadd(name)
|
||||||
|
|
@ -18,17 +60,17 @@ return {
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
|
|
||||||
telescope.setup {
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist
|
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
pcall(telescope.load_extension, "fzf")
|
pcall(telescope.load_extension, "fzf")
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -58,33 +58,33 @@ return {
|
||||||
vim.g.no_plugin_maps = true
|
vim.g.no_plugin_maps = true
|
||||||
end,
|
end,
|
||||||
after = function(plugin)
|
after = function(plugin)
|
||||||
require("nvim-treesitter-textobjects").setup {
|
require("nvim-treesitter-textobjects").setup({
|
||||||
select = {
|
select = {
|
||||||
lookahead = true,
|
lookahead = true,
|
||||||
selection_modes = {
|
selection_modes = {
|
||||||
['@parameter.outer'] = 'v', -- charwise
|
["@parameter.outer"] = "v", -- charwise
|
||||||
['@function.outer'] = 'V', -- linewise
|
["@function.outer"] = "V", -- linewise
|
||||||
},
|
},
|
||||||
include_surrounding_whitespace = false,
|
include_surrounding_whitespace = false,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
-- keymaps
|
-- keymaps
|
||||||
vim.keymap.set({ "x", "o" }, "am", function()
|
vim.keymap.set({ "x", "o" }, "am", function()
|
||||||
require "nvim-treesitter-textobjects.select".select_textobject("@function.outer", "textobjects")
|
require("nvim-treesitter-textobjects.select").select_textobject("@function.outer", "textobjects")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set({ "x", "o" }, "im", function()
|
vim.keymap.set({ "x", "o" }, "im", function()
|
||||||
require "nvim-treesitter-textobjects.select".select_textobject("@function.inner", "textobjects")
|
require("nvim-treesitter-textobjects.select").select_textobject("@function.inner", "textobjects")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set({ "x", "o" }, "ac", function()
|
vim.keymap.set({ "x", "o" }, "ac", function()
|
||||||
require "nvim-treesitter-textobjects.select".select_textobject("@class.outer", "textobjects")
|
require("nvim-treesitter-textobjects.select").select_textobject("@class.outer", "textobjects")
|
||||||
end)
|
end)
|
||||||
vim.keymap.set({ "x", "o" }, "ic", function()
|
vim.keymap.set({ "x", "o" }, "ic", function()
|
||||||
require "nvim-treesitter-textobjects.select".select_textobject("@class.inner", "textobjects")
|
require("nvim-treesitter-textobjects.select").select_textobject("@class.inner", "textobjects")
|
||||||
end)
|
end)
|
||||||
-- You can also use captures from other query groups like `locals.scm`
|
-- You can also use captures from other query groups like `locals.scm`
|
||||||
vim.keymap.set({ "x", "o" }, "as", function()
|
vim.keymap.set({ "x", "o" }, "as", function()
|
||||||
require "nvim-treesitter-textobjects.select".select_textobject("@local.scope", "locals")
|
require("nvim-treesitter-textobjects.select").select_textobject("@local.scope", "locals")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- NOTE: for more textobjects options, see the following link.
|
-- NOTE: for more textobjects options, see the following link.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
# TODO: look into changing to this:
|
||||||
|
# https://github.com/BirdeeHub/nix-wrapper-modules
|
||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
spkgs,
|
spkgs,
|
||||||
|
|
@ -56,31 +58,38 @@ in {
|
||||||
tree-sitter
|
tree-sitter
|
||||||
];
|
];
|
||||||
lang = with pkgs; {
|
lang = with pkgs; {
|
||||||
lua = [
|
lua = {
|
||||||
lua-language-server
|
lsp = [ lua-language-server ];
|
||||||
];
|
format = [ stylua ];
|
||||||
nix = [
|
};
|
||||||
|
nix = {
|
||||||
|
lsp = [
|
||||||
nil
|
nil
|
||||||
nix-doc
|
nix-doc # TODO: i forgot what this is for
|
||||||
];
|
];
|
||||||
rust = with pkgs; [
|
format = [ nixfmt ];
|
||||||
|
};
|
||||||
|
rust = {
|
||||||
|
lsp = [
|
||||||
cargo
|
cargo
|
||||||
mpkgs.rust-analyzer
|
mpkgs.rust-analyzer
|
||||||
];
|
];
|
||||||
zig = with pkgs; [
|
format = [ rustfmt ];
|
||||||
|
};
|
||||||
|
zig = [
|
||||||
spkgs.zls # FIX: using spkgs version as zls is broken rn ;-;
|
spkgs.zls # FIX: using spkgs version as zls is broken rn ;-;
|
||||||
];
|
];
|
||||||
elixir = with pkgs; [
|
elixir = [
|
||||||
elixir-ls
|
elixir-ls
|
||||||
];
|
];
|
||||||
gleam = with pkgs; [
|
gleam = [
|
||||||
gleam
|
gleam
|
||||||
];
|
];
|
||||||
haskell = with pkgs; [
|
haskell = [
|
||||||
haskell-language-server
|
haskell-language-server
|
||||||
ormolu
|
ormolu
|
||||||
];
|
];
|
||||||
java = with pkgs; [
|
java = [
|
||||||
jdt-language-server
|
jdt-language-server
|
||||||
javaPackages.compiler.openjdk17
|
javaPackages.compiler.openjdk17
|
||||||
javaPackages.compiler.openjdk21
|
javaPackages.compiler.openjdk21
|
||||||
|
|
@ -138,6 +147,9 @@ in {
|
||||||
cmp-cmdline-history
|
cmp-cmdline-history
|
||||||
lspkind-nvim
|
lspkind-nvim
|
||||||
];
|
];
|
||||||
|
format = with pkgs.vimPlugins; [
|
||||||
|
conform-nvim
|
||||||
|
];
|
||||||
lang = with pkgs.vimPlugins; {
|
lang = with pkgs.vimPlugins; {
|
||||||
java = [
|
java = [
|
||||||
nvim-jdtls
|
nvim-jdtls
|
||||||
|
|
@ -214,16 +226,29 @@ in {
|
||||||
fyler = true;
|
fyler = true;
|
||||||
lsp = true;
|
lsp = true;
|
||||||
completion = true;
|
completion = true;
|
||||||
|
format = true;
|
||||||
treesitter = true;
|
treesitter = true;
|
||||||
|
|
||||||
lang = {
|
lang = {
|
||||||
lua = true;
|
lua = {
|
||||||
nix = true;
|
lsp = true;
|
||||||
rust = true;
|
format = true;
|
||||||
|
};
|
||||||
|
nix = {
|
||||||
|
lsp = true;
|
||||||
|
format = true;
|
||||||
|
};
|
||||||
|
rust = {
|
||||||
|
lsp = true;
|
||||||
|
format = true;
|
||||||
|
};
|
||||||
zig = true;
|
zig = true;
|
||||||
elixir = true;
|
elixir = true;
|
||||||
gleam = true;
|
gleam = true;
|
||||||
haskell = true;
|
haskell = {
|
||||||
|
lsp = true;
|
||||||
|
format = true;
|
||||||
|
};
|
||||||
java = true;
|
java = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue