broken-rust
This commit is contained in:
parent
3368536455
commit
2a99ca3ef9
@ -1,4 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
-- Set completeopt to have a better completion experience
|
||||
-- :help completeopt
|
||||
-- menuone: popup even when there's only one match
|
||||
|
21
default.nix
21
default.nix
@ -20,7 +20,6 @@ in
|
||||
{
|
||||
|
||||
programs.neovim = {
|
||||
|
||||
# https://github.com/nix-community/home-manager/blob/master/modules/programs/neovim.nix
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
@ -32,10 +31,10 @@ in
|
||||
diffview-nvim
|
||||
vim-airline
|
||||
zephyr-nvim
|
||||
vim-nix
|
||||
vim-toml
|
||||
elm-vim
|
||||
vim-markdown
|
||||
vim-mergetool
|
||||
split-term-vim
|
||||
# vim-grammarous
|
||||
markdown-preview-nvim
|
||||
@ -60,19 +59,14 @@ in
|
||||
cmp-cmdline
|
||||
rustaceanvim
|
||||
(if config.programs.neovim.package.version == "0.10.0" then throw "lsp-inlayhints-nvim may be removed" else lsp-inlayhints-nvim) # https://github.com/mrcjkb/rustaceanvim/discussions/46#discussioncomment-7620822
|
||||
cmp-conventionalcommits
|
||||
cmp-calc
|
||||
cmp-cmdline
|
||||
rustaceanvim
|
||||
(if config.programs.neovim.package.version == "0.10.0" then throw "lsp-inlayhints-nvim may be removed" else lsp-inlayhints-nvim) # https://github.com/mrcjkb/rustaceanvim/discussions/46#discussioncomment-7620822
|
||||
plenary-nvim
|
||||
crates-nvim
|
||||
nvim-lspconfig
|
||||
telescope-nvim
|
||||
telescope-undo-nvim
|
||||
oil-nvim
|
||||
distant-nvim
|
||||
];
|
||||
|
||||
extraLuaConfig =
|
||||
let
|
||||
# tries to compute a package set required to make package resolution in lua
|
||||
@ -83,7 +77,7 @@ in
|
||||
{ nativeBuildInputs = [ pkgs.gnused ]; __contentAddressed = true; } ''
|
||||
sed -nr 's/.*(deps\.(.*)_path|deps\["(.*)"\]).*/\2/p' ${file} | uniq > $out
|
||||
'');
|
||||
names = lib.splitString "\n" (lib.traceVal out);
|
||||
names = lib.splitString "\n" out;
|
||||
in
|
||||
filter (name: name != "") names;
|
||||
paths = (listToAttrs (map (name: { inherit name; value = builtins.getAttr name pkgs; }) (packages "${confDir}/*.lua"))) // {
|
||||
@ -91,14 +85,13 @@ in
|
||||
rust_analyzer = rust-analyzer;
|
||||
typst_lsp = pkgs.typst-lsp;
|
||||
};
|
||||
pathsLua = pkgs.writeTextFile {
|
||||
name = "nvim-deps.lua";
|
||||
text = ''
|
||||
pathsLua = let name = "nvim-deps.lua"; in (pkgs.writeTextDir "/${name}"
|
||||
''
|
||||
deps = {}
|
||||
${concatStringsSep "\n" (mapAttrsToList (name: path: ''deps["${name}_path"] = "${path}"'') paths)}
|
||||
return deps
|
||||
'';
|
||||
};
|
||||
'') + "/${name}";
|
||||
|
||||
confDir = lib.sourceFilesBySuffices ./. [ "lua" "vim" ];
|
||||
in
|
||||
with lib; ''
|
||||
|
15
init.lua
15
init.lua
@ -2,8 +2,6 @@ local deps = require("nvim-deps")
|
||||
vim.opt.termguicolors = true
|
||||
vim.notify = require("notify")
|
||||
vim.notify.setup({background_colour = "#000000"})
|
||||
local distant = require('distant')
|
||||
distant:setup()
|
||||
require("oil").setup()
|
||||
local telescope = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', telescope.find_files, {})
|
||||
@ -132,21 +130,16 @@ lspconfig.typst_lsp.setup {
|
||||
cmd = {(deps["typst-lsp_path"] .. "/bin/typst-lsp")},
|
||||
settings = {
|
||||
exportPdf = "onType", -- Choose onType, onSave or never.
|
||||
serverPath = (deps["typst-lsp_path"] .. "/bin/typst-lsp"), -- Normally, there is no need to uncomment it.
|
||||
serverPath = (deps["typst-lsp_path"] .. "/bin/typst-lsp") -- Normally, there is no need to uncomment it.
|
||||
}
|
||||
}
|
||||
lspconfig.nil_ls.setup {
|
||||
cmd = {(deps.nil_path .. "/bin/nil")},
|
||||
-- https://github.com/oxalica/nil/blob/main/docs/configuration.md
|
||||
settings = {
|
||||
command = {
|
||||
formatting = "nixpkgs-fmt", },
|
||||
},
|
||||
flake = {
|
||||
autoArchive = true,
|
||||
autoEvalInputs = true,
|
||||
},
|
||||
settings = {command = {formatting = "nixpkgs-fmt"}},
|
||||
flake = {autoArchive = true, autoEvalInputs = true}
|
||||
}
|
||||
|
||||
require("lsp-inlayhints").setup()
|
||||
require("rust.lua")
|
||||
require("completion")
|
||||
|
130
rust.lua
130
rust.lua
@ -114,7 +114,7 @@ vim.g.rustaceanvim = {
|
||||
-- standalone file support
|
||||
-- setting it to false may improve startup time
|
||||
standalone = true,
|
||||
cmd = {(deps.rust-analyzer_path .. "/bin/rust-analyzer")},
|
||||
cmd = {(deps.rust_analyzer_path .. "/bin/rust-analyzer")},
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(c),
|
||||
on_attach = function(client, bufnr)
|
||||
require("lsp-inlayhints").on_attach(client, bufnr)
|
||||
@ -165,131 +165,3 @@ vim.g.rustaceanvim = {
|
||||
}
|
||||
}
|
||||
}
|
||||
local rt = require("rust-tools")
|
||||
local deps = require("nvim-deps")
|
||||
|
||||
rt.setup({
|
||||
tools = { -- rust-tools options
|
||||
|
||||
-- how to execute terminal commands
|
||||
-- options right now: termopen / quickfix / toggleterm / vimux
|
||||
executor = require("rust-tools.executors").termopen,
|
||||
|
||||
-- callback to execute once rust-analyzer is done initializing the workspace
|
||||
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
|
||||
on_initialized = nil,
|
||||
|
||||
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
|
||||
reload_workspace_from_cargo_toml = true,
|
||||
|
||||
-- These apply to the default RustSetInlayHints command
|
||||
inlay_hints = {
|
||||
-- automatically set inlay hints (type hints)
|
||||
-- default: true
|
||||
auto = true,
|
||||
|
||||
-- Only show inlay hints for the current line
|
||||
only_current_line = false,
|
||||
|
||||
-- whether to show parameter hints with the inlay hints or not
|
||||
-- default: true
|
||||
show_parameter_hints = true,
|
||||
|
||||
-- prefix for parameter hints
|
||||
-- default: "<-"
|
||||
parameter_hints_prefix = "<- ",
|
||||
|
||||
-- prefix for all the other hints (type, chaining)
|
||||
-- default: "=>"
|
||||
other_hints_prefix = "=> ",
|
||||
|
||||
-- whether to align to the length of the longest line in the file
|
||||
max_len_align = false,
|
||||
|
||||
-- padding from the left if max_len_align is true
|
||||
max_len_align_padding = 1,
|
||||
|
||||
-- whether to align to the extreme right or not
|
||||
right_align = false,
|
||||
|
||||
-- padding from the right if right_align is true
|
||||
right_align_padding = 7,
|
||||
|
||||
-- The color of the hints
|
||||
highlight = "Comment"
|
||||
},
|
||||
|
||||
-- options same as lsp hover / vim.lsp.util.open_floating_preview()
|
||||
hover_actions = {
|
||||
|
||||
-- the border that is used for the hover window
|
||||
-- see vim.api.nvim_open_win()
|
||||
border = {
|
||||
{"╭", "FloatBorder"}, {"─", "FloatBorder"},
|
||||
{"╮", "FloatBorder"}, {"│", "FloatBorder"},
|
||||
{"╯", "FloatBorder"}, {"─", "FloatBorder"},
|
||||
{"╰", "FloatBorder"}, {"│", "FloatBorder"}
|
||||
},
|
||||
|
||||
-- Maximal width of the hover window. Nil means no max.
|
||||
max_width = nil,
|
||||
|
||||
-- Maximal height of the hover window. Nil means no max.
|
||||
max_height = nil,
|
||||
|
||||
-- whether the hover action window gets automatically focused
|
||||
-- default: false
|
||||
auto_focus = false
|
||||
},
|
||||
|
||||
-- settings for showing the crate graph based on graphviz and the dot
|
||||
-- command
|
||||
crate_graph = {
|
||||
-- Backend used for displaying the graph
|
||||
-- see: https://graphviz.org/docs/outputs/
|
||||
-- default: x11
|
||||
backend = "x11",
|
||||
-- where to store the output, nil for no output stored (relative
|
||||
-- path from pwd)
|
||||
-- default: nil
|
||||
output = nil,
|
||||
-- true for all crates.io and external crates, false only the local
|
||||
-- crates
|
||||
-- default: true
|
||||
full = true,
|
||||
|
||||
-- List of backends found on: https://graphviz.org/docs/outputs/
|
||||
-- Is used for input validation and autocompletion
|
||||
-- Last updated: 2021-08-26
|
||||
enabled_graphviz_backends = {
|
||||
"bmp", "cgimage", "canon", "dot", "gv", "xdot", "xdot1.2",
|
||||
"xdot1.4", "eps", "exr", "fig", "gd", "gd2", "gif", "gtk",
|
||||
"ico", "cmap", "ismap", "imap", "cmapx", "imap_np", "cmapx_np",
|
||||
"jpg", "jpeg", "jpe", "jp2", "json", "json0", "dot_json",
|
||||
"xdot_json", "pdf", "pic", "pct", "pict", "plain", "plain-ext",
|
||||
"png", "pov", "ps", "ps2", "psd", "sgi", "svg", "svgz", "tga",
|
||||
"tiff", "tif", "tk", "vml", "vmlz", "wbmp", "webp", "xlib",
|
||||
"x11"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
-- all the opts to send to nvim-lspconfig
|
||||
-- these override the defaults set by rust-tools.nvim
|
||||
-- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
||||
server = {
|
||||
-- standalone file support
|
||||
-- setting it to false may improve startup time
|
||||
standalone = true,
|
||||
cmd = {(deps.rust-analyzer_path .. "/bin/rust-analyzer")}
|
||||
}, -- rust-analyzer options
|
||||
|
||||
-- debugging stuff
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "executable",
|
||||
command = deps.lldb_path .. "lldb-vscode",
|
||||
name = "rt_lldb"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user