mirror of
https://github.com/thegeneralist01/config.git
synced 2026-03-10 02:30:29 +01:00
packages: add libiconv for mac, fix nvim lsp
This commit is contained in:
parent
572647d7c4
commit
26fe71c022
2 changed files with 299 additions and 285 deletions
|
|
@ -1,16 +1,31 @@
|
||||||
{ pkgs, ... }: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
# TODO: check these out: https://github.com/RGBCube/ncc/blob/86212e148b2642a51814e873a81be73fbc494e86/modules/common/rust.nix#L15-L24
|
# TODO: check these out: https://github.com/RGBCube/ncc/blob/86212e148b2642a51814e873a81be73fbc494e86/modules/common/rust.nix#L15-L24
|
||||||
environment.systemPackages = with pkgs; [
|
environment = {
|
||||||
(fenix.complete.withComponents [
|
variables = {
|
||||||
"cargo"
|
LIBRARY_PATH = lib.mkIf (!config.onLinux) <| lib.makeLibraryPath [ pkgs.libiconv ];
|
||||||
"clippy"
|
};
|
||||||
"rust-src"
|
|
||||||
"rustc"
|
|
||||||
"rustfmt"
|
|
||||||
])
|
|
||||||
rust-analyzer-nightly
|
|
||||||
|
|
||||||
nixd
|
systemPackages = with pkgs; [
|
||||||
nixfmt-rfc-style
|
(fenix.complete.withComponents [
|
||||||
];
|
"cargo"
|
||||||
|
"clippy"
|
||||||
|
"rust-src"
|
||||||
|
"rustc"
|
||||||
|
"rustfmt"
|
||||||
|
])
|
||||||
|
rust-analyzer-nightly
|
||||||
|
|
||||||
|
# for nil
|
||||||
|
nixd
|
||||||
|
nixfmt-rfc-style
|
||||||
|
|
||||||
|
libiconv
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,287 +1,286 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"saghen/blink.cmp",
|
"saghen/blink.cmp",
|
||||||
-- "folke/neodev.nvim",
|
-- "folke/neodev.nvim",
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
"mason-org/mason-registry",
|
"mason-org/mason-registry",
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer",
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-cmdline",
|
"hrsh7th/cmp-cmdline",
|
||||||
-- "hrsh7th/nvim-cmp",
|
-- "hrsh7th/nvim-cmp",
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
"j-hui/fidget.nvim",
|
"j-hui/fidget.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local lspkind = require("lspkind")
|
local lspkind = require("lspkind")
|
||||||
-- local cmp = require("cmp")
|
-- local cmp = require("cmp")
|
||||||
-- local cmp_lsp = require("cmp_nvim_lsp")
|
-- local cmp_lsp = require("cmp_nvim_lsp")
|
||||||
-- 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(),
|
||||||
-- cmp_lsp.default_capabilities()
|
-- cmp_lsp.default_capabilities()
|
||||||
-- )
|
-- )
|
||||||
|
|
||||||
require("fidget").setup({})
|
require("fidget").setup({})
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
|
|
||||||
-- local vue_typescript_plugin = require("mason-registry")
|
-- local vue_typescript_plugin = require("mason-registry")
|
||||||
-- .get_package("vue-language-server")
|
-- .get_package("vue-language-server")
|
||||||
-- :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin"
|
-- :get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin"
|
||||||
|
|
||||||
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
local capabilities = require("blink.cmp").get_lsp_capabilities()
|
||||||
vim.lsp.enable("nil_ls")
|
vim.lsp.enable("nil_ls")
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
automatic_enable = true,
|
automatic_enable = true,
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"rust_analyzer",
|
"ts_ls",
|
||||||
"ts_ls",
|
"cssls",
|
||||||
"cssls",
|
"tailwindcss",
|
||||||
"tailwindcss",
|
"pyright",
|
||||||
"pyright",
|
},
|
||||||
},
|
handlers = {
|
||||||
handlers = {
|
function(server_name) -- default handler (optional)
|
||||||
function(server_name) -- default handler (optional)
|
-- if server_name == "rust_analyzer" then
|
||||||
-- if server_name == "rust_analyzer" then
|
-- return
|
||||||
-- return
|
-- end
|
||||||
-- end
|
require("lspconfig")[server_name].setup({
|
||||||
require("lspconfig")[server_name].setup({
|
capabilities = capabilities,
|
||||||
capabilities = capabilities,
|
})
|
||||||
})
|
end,
|
||||||
end,
|
|
||||||
|
|
||||||
["lua_ls"] = function()
|
["lua_ls"] = function()
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
lspconfig.lua_ls.setup({
|
lspconfig.lua_ls.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = { "vim", "it", "describe", "before_each", "after_each" },
|
globals = { "vim", "it", "describe", "before_each", "after_each" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
["ts_ls"] = function()
|
["ts_ls"] = function()
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
lspconfig.ts_ls.setup({
|
lspconfig.ts_ls.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
-- settings = {
|
-- settings = {
|
||||||
-- },
|
-- },
|
||||||
-- init_options = {
|
-- init_options = {
|
||||||
-- plugins = {
|
-- plugins = {
|
||||||
-- {
|
-- {
|
||||||
-- name = "@vue/typescript-plugin",
|
-- name = "@vue/typescript-plugin",
|
||||||
-- location = vue_typescript_plugin,
|
-- location = vue_typescript_plugin,
|
||||||
-- languages = { "vue" },
|
-- languages = { "vue" },
|
||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"javascript",
|
"javascript",
|
||||||
"javascriptreact",
|
"javascriptreact",
|
||||||
"javascript.jsx",
|
"javascript.jsx",
|
||||||
"typescript",
|
"typescript",
|
||||||
"typescriptreact",
|
"typescriptreact",
|
||||||
"typescript.tsx",
|
"typescript.tsx",
|
||||||
-- "vue",
|
-- "vue",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local c = vim.lsp.get_client_by_id(args.data.client_id)
|
local c = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
if not c then
|
if not c then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.bo.filetype == "lua" then
|
if vim.bo.filetype == "lua" then
|
||||||
-- Format the current buffer on save
|
-- Format the current buffer on save
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
buffer = args.buf,
|
buffer = args.buf,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.buf.format({ bufnr = args.buf, id = c.id })
|
vim.lsp.buf.format({ bufnr = args.buf, id = c.id })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
-- local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||||
|
|
||||||
--- Select item next/prev, taking into account whether the cmp window is
|
--- Select item next/prev, taking into account whether the cmp window is
|
||||||
--- top-down or bottoom-up so that the movement is always in the same direction.
|
--- top-down or bottoom-up so that the movement is always in the same direction.
|
||||||
-- local select_item_smart = function(dir, opts)
|
-- local select_item_smart = function(dir, opts)
|
||||||
-- return function(fallback)
|
-- return function(fallback)
|
||||||
-- if cmp.visible() then
|
-- if cmp.visible() then
|
||||||
-- opts = opts or { behavior = cmp.SelectBehavior.Select }
|
-- opts = opts or { behavior = cmp.SelectBehavior.Select }
|
||||||
-- if cmp.core.view.custom_entries_view:is_direction_top_down() then
|
-- if cmp.core.view.custom_entries_view:is_direction_top_down() then
|
||||||
-- ({ next = cmp.select_next_item, prev = cmp.select_prev_item })[dir](opts)
|
-- ({ next = cmp.select_next_item, prev = cmp.select_prev_item })[dir](opts)
|
||||||
-- else
|
-- else
|
||||||
-- ({ prev = cmp.select_next_item, next = cmp.select_prev_item })[dir](opts)
|
-- ({ prev = cmp.select_next_item, next = cmp.select_prev_item })[dir](opts)
|
||||||
-- end
|
-- end
|
||||||
-- else
|
-- else
|
||||||
-- fallback()
|
-- fallback()
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- cmp.setup({
|
-- cmp.setup({
|
||||||
-- snippet = {
|
-- snippet = {
|
||||||
-- expand = function(args)
|
-- expand = function(args)
|
||||||
-- require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
-- require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
||||||
-- end,
|
-- end,
|
||||||
-- },
|
-- },
|
||||||
-- completion = {
|
-- completion = {
|
||||||
-- completeopt = "menu,menuone,noinsert",
|
-- completeopt = "menu,menuone,noinsert",
|
||||||
-- },
|
-- },
|
||||||
-- -- No idea what this is
|
-- -- No idea what this is
|
||||||
-- matching = {
|
-- matching = {
|
||||||
-- disallow_fuzzy_matching = false,
|
-- disallow_fuzzy_matching = false,
|
||||||
-- disallow_fullfuzzy_matching = false,
|
-- disallow_fullfuzzy_matching = false,
|
||||||
-- disallow_partial_fuzzy_matching = false,
|
-- disallow_partial_fuzzy_matching = false,
|
||||||
-- },
|
-- },
|
||||||
-- performance = {
|
-- performance = {
|
||||||
-- -- debounce = 50,
|
-- -- debounce = 50,
|
||||||
-- debounce = 25,
|
-- debounce = 25,
|
||||||
-- -- max_view_entries = 20,
|
-- -- max_view_entries = 20,
|
||||||
-- },
|
-- },
|
||||||
-- That crazy window
|
-- That crazy window
|
||||||
-- window = {
|
-- window = {
|
||||||
-- completion = cmp.config.window.bordered({
|
-- completion = cmp.config.window.bordered({
|
||||||
-- border = "single",
|
-- border = "single",
|
||||||
-- side_padding = 2,
|
-- side_padding = 2,
|
||||||
-- col_offset = -3,
|
-- col_offset = -3,
|
||||||
-- max_width = 80,
|
-- max_width = 80,
|
||||||
-- }),
|
-- }),
|
||||||
-- documentation = cmp.config.window.bordered({
|
-- documentation = cmp.config.window.bordered({
|
||||||
-- max_width = 50,
|
-- max_width = 50,
|
||||||
-- }),
|
-- }),
|
||||||
-- },
|
-- },
|
||||||
-- mapping = cmp.mapping.preset.insert({
|
-- mapping = cmp.mapping.preset.insert({
|
||||||
-- ["<C-p>"] = select_item_smart("prev", cmp_select),
|
-- ["<C-p>"] = select_item_smart("prev", cmp_select),
|
||||||
-- ["<C-n>"] = select_item_smart("next", cmp_select),
|
-- ["<C-n>"] = select_item_smart("next", cmp_select),
|
||||||
-- ["<C-e>"] = cmp.mapping.close(),
|
-- ["<C-e>"] = cmp.mapping.close(),
|
||||||
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||||
-- ["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
-- ["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
||||||
-- ["<C-B>"] = cmp.mapping.complete(),
|
-- ["<C-B>"] = cmp.mapping.complete(),
|
||||||
-- ["<C-u>"] = cmp.mapping.scroll_docs(-3),
|
-- ["<C-u>"] = cmp.mapping.scroll_docs(-3),
|
||||||
-- ["<C-d>"] = cmp.mapping.scroll_docs(3),
|
-- ["<C-d>"] = cmp.mapping.scroll_docs(3),
|
||||||
-- ["<C-g>"] = cmp.mapping.abort(),
|
-- ["<C-g>"] = cmp.mapping.abort(),
|
||||||
-- }),
|
-- }),
|
||||||
-- sorting = {
|
-- sorting = {
|
||||||
-- comparators = {
|
-- comparators = {
|
||||||
-- cmp.config.compare.locality,
|
-- cmp.config.compare.locality,
|
||||||
-- cmp.config.compare.offset,
|
-- cmp.config.compare.offset,
|
||||||
-- cmp.config.compare.recently_used,
|
-- cmp.config.compare.recently_used,
|
||||||
-- cmp.config.compare.exact,
|
-- cmp.config.compare.exact,
|
||||||
-- cmp.config.compare.order,
|
-- cmp.config.compare.order,
|
||||||
-- cmp.config.compare.length,
|
-- cmp.config.compare.length,
|
||||||
-- function(entry1, entry2)
|
-- function(entry1, entry2)
|
||||||
-- local _, entry1_under = entry1.completion_item.label:find("^_+")
|
-- local _, entry1_under = entry1.completion_item.label:find("^_+")
|
||||||
-- local _, entry2_under = entry2.completion_item.label:find("^_+")
|
-- local _, entry2_under = entry2.completion_item.label:find("^_+")
|
||||||
-- entry1_under = entry1_under or 0
|
-- entry1_under = entry1_under or 0
|
||||||
-- entry2_under = entry2_under or 0
|
-- entry2_under = entry2_under or 0
|
||||||
-- if entry1_under > entry2_under then
|
-- if entry1_under > entry2_under then
|
||||||
-- return false
|
-- return false
|
||||||
-- elseif entry1_under < entry2_under then
|
-- elseif entry1_under < entry2_under then
|
||||||
-- return true
|
-- return true
|
||||||
-- end
|
-- end
|
||||||
-- end,
|
-- end,
|
||||||
-- cmp.config.compare.kind,
|
-- cmp.config.compare.kind,
|
||||||
-- cmp.config.compare.sort_text,
|
-- cmp.config.compare.sort_text,
|
||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
-- sources = cmp.config.sources({
|
-- sources = cmp.config.sources({
|
||||||
-- { name = "neopyter" },
|
-- { name = "neopyter" },
|
||||||
-- { name = "nvim_lsp" },
|
-- { name = "nvim_lsp" },
|
||||||
-- { name = "codeium" },
|
-- { name = "codeium" },
|
||||||
-- { name = "luasnip" }, -- For luasnip users.
|
-- { name = "luasnip" }, -- For luasnip users.
|
||||||
-- }, {
|
-- }, {
|
||||||
-- { name = "buffer" },
|
-- { name = "buffer" },
|
||||||
-- }),
|
-- }),
|
||||||
-- formatting = {
|
-- formatting = {
|
||||||
-- fields = {
|
-- fields = {
|
||||||
-- "abbr",
|
-- "abbr",
|
||||||
-- "kind",
|
-- "kind",
|
||||||
-- "menu",
|
-- "menu",
|
||||||
-- },
|
-- },
|
||||||
-- expandable_indicator = true,
|
-- expandable_indicator = true,
|
||||||
-- format = lspkind.cmp_format({
|
-- format = lspkind.cmp_format({
|
||||||
-- mode = "symbol_text",
|
-- mode = "symbol_text",
|
||||||
-- maxwidth = 50,
|
-- maxwidth = 50,
|
||||||
-- ellipsis_char = "...",
|
-- ellipsis_char = "...",
|
||||||
-- menu = {
|
-- menu = {
|
||||||
-- neopyter = "[Neopyter]",
|
-- neopyter = "[Neopyter]",
|
||||||
-- },
|
-- },
|
||||||
-- symbol_map = {
|
-- symbol_map = {
|
||||||
-- -- specific complete item kind icon
|
-- -- specific complete item kind icon
|
||||||
-- ["Magic"] = "🪄",
|
-- ["Magic"] = "🪄",
|
||||||
-- ["Path"] = "📁",
|
-- ["Path"] = "📁",
|
||||||
-- ["Dict key"] = "🔑",
|
-- ["Dict key"] = "🔑",
|
||||||
-- ["Instance"] = "",
|
-- ["Instance"] = "",
|
||||||
-- ["Statement"] = "",
|
-- ["Statement"] = "",
|
||||||
-- },
|
-- },
|
||||||
-- }),
|
-- }),
|
||||||
-- },
|
-- },
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
-- -- menu item highlight
|
-- -- menu item highlight
|
||||||
-- vim.api.nvim_set_hl(0, "CmpItemKindMagic", { bg = "NONE", fg = "#D4D434" })
|
-- vim.api.nvim_set_hl(0, "CmpItemKindMagic", { bg = "NONE", fg = "#D4D434" })
|
||||||
-- vim.api.nvim_set_hl(0, "CmpItemKindPath", { link = "CmpItemKindFolder" })
|
-- vim.api.nvim_set_hl(0, "CmpItemKindPath", { link = "CmpItemKindFolder" })
|
||||||
-- vim.api.nvim_set_hl(0, "CmpItemKindDictkey", { link = "CmpItemKindKeyword" })
|
-- vim.api.nvim_set_hl(0, "CmpItemKindDictkey", { link = "CmpItemKindKeyword" })
|
||||||
-- vim.api.nvim_set_hl(0, "CmpItemKindInstance", { link = "CmpItemKindVariable" })
|
-- vim.api.nvim_set_hl(0, "CmpItemKindInstance", { link = "CmpItemKindVariable" })
|
||||||
-- vim.api.nvim_set_hl(0, "CmpItemKindStatement", { link = "CmpItemKindVariable" })
|
-- vim.api.nvim_set_hl(0, "CmpItemKindStatement", { link = "CmpItemKindVariable" })
|
||||||
|
|
||||||
-- vim.diagnostic.config({
|
-- vim.diagnostic.config({
|
||||||
-- -- update_in_insert = true, -- Update diagnostics in Insert mode
|
-- -- update_in_insert = true, -- Update diagnostics in Insert mode
|
||||||
-- -- ^ (if false, diagnostics are updated on InsertLeave)
|
-- -- ^ (if false, diagnostics are updated on InsertLeave)
|
||||||
--
|
--
|
||||||
-- underline = true,
|
-- underline = true,
|
||||||
--
|
--
|
||||||
-- virtual_text = true,
|
-- virtual_text = true,
|
||||||
--
|
--
|
||||||
-- severity_sort = true, -- high -> low
|
-- severity_sort = true, -- high -> low
|
||||||
--
|
--
|
||||||
-- -- float = {
|
-- -- float = {
|
||||||
-- -- focusable = false,
|
-- -- focusable = false,
|
||||||
-- -- style = "minimal",
|
-- -- style = "minimal",
|
||||||
-- -- border = "rounded",
|
-- -- border = "rounded",
|
||||||
-- -- source = true,
|
-- -- source = true,
|
||||||
-- -- header = { " Diagnostics", "String" },
|
-- -- header = { " Diagnostics", "String" },
|
||||||
-- -- prefix = function(_, _, _)
|
-- -- prefix = function(_, _, _)
|
||||||
-- -- return " ", "String"
|
-- -- return " ", "String"
|
||||||
-- -- end,
|
-- -- end,
|
||||||
-- -- },
|
-- -- },
|
||||||
-- })
|
-- })
|
||||||
|
|
||||||
-- treesitter jupyter notebook stuff
|
-- treesitter jupyter notebook stuff
|
||||||
-- require("nvim-treesitter.configs").setup({
|
-- require("nvim-treesitter.configs").setup({
|
||||||
-- textobjects = {
|
-- textobjects = {
|
||||||
-- move = {
|
-- move = {
|
||||||
-- enable = true,
|
-- enable = true,
|
||||||
-- goto_next_start = {
|
-- goto_next_start = {
|
||||||
-- ["]j"] = "@cellseparator",
|
-- ["]j"] = "@cellseparator",
|
||||||
-- ["]c"] = "@cellcontent",
|
-- ["]c"] = "@cellcontent",
|
||||||
-- },
|
-- },
|
||||||
-- goto_previous_start = {
|
-- goto_previous_start = {
|
||||||
-- ["[j"] = "@cellseparator",
|
-- ["[j"] = "@cellseparator",
|
||||||
-- ["[c"] = "@cellcontent",
|
-- ["[c"] = "@cellcontent",
|
||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
-- })
|
-- })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue