rust: update rust config to be more realiable
This commit is contained in:
parent
27983102e4
commit
530c2fd5bf
|
@ -52,6 +52,21 @@ test -f ~/.asdf/asdf.fish
|
|||
and source ~/.asdf/asdf.fish
|
||||
|
||||
|
||||
##################################################
|
||||
# Rust tools
|
||||
##################################################
|
||||
|
||||
command -qs sccache
|
||||
or _install-sccache &> /dev/null &
|
||||
set -x RUSTC_WRAPPER sccache
|
||||
|
||||
command -qs rust-analyzer
|
||||
or _install-rust-analyzer &> /dev/null &
|
||||
|
||||
command -qs trunk
|
||||
or _install-trunk &> /dev/null &
|
||||
|
||||
|
||||
##################################################
|
||||
# Prompt
|
||||
##################################################
|
||||
|
|
|
@ -170,22 +170,13 @@ args = ["stdio"]
|
|||
|
||||
[language.rust]
|
||||
filetypes = ["rust"]
|
||||
roots = ["Cargo.toml"]
|
||||
command = "sh"
|
||||
args = [
|
||||
"-c",
|
||||
"""
|
||||
if path=$(rustup which rust-analyzer 2>/dev/null); then
|
||||
"$path"
|
||||
else
|
||||
rust-analyzer
|
||||
fi
|
||||
""",
|
||||
]
|
||||
roots = ["rust-toolchain.toml", "rust-toolchain", "Cargo.toml"]
|
||||
command = "rust-analyzer"
|
||||
[language.rust.settings.rust-analyzer]
|
||||
checkOnSave.extraArgs = ["--target-dir", "./target/check"]
|
||||
hoverActions.enable = false # kak-lsp doesn't support this at the moment
|
||||
procMacro.enable = true
|
||||
cargo.loadOutDirsFromCheck = true
|
||||
# procMacro.enable = true
|
||||
# cargo.loadOutDirsFromCheck = true
|
||||
|
||||
[language.terraform]
|
||||
filetypes = ["terraform"]
|
||||
|
|
|
@ -43,41 +43,41 @@ plug "natasky/kakoune-multi-file"
|
|||
|
||||
plug "lelgenio/kakoune-colemak-neio"
|
||||
|
||||
plug 'kak-lsp/kak-lsp' do %{
|
||||
plug 'kak-lsp/kak-lsp' tag 'v12.0.1' do %{
|
||||
cargo install --locked --force --path .
|
||||
} config %{
|
||||
map global normal <F2> ': lsp-rename-prompt<ret>'
|
||||
set global lsp_hover_max_lines 10
|
||||
# lsp-inlay-diagnostics-enable global
|
||||
set global lsp_auto_highlight_references true
|
||||
# set global lsp_inlay_diagnostic_sign "●"
|
||||
# set global lsp_diagnostic_line_error_sign "●"
|
||||
set global lsp_inlay_diagnostic_sign "●"
|
||||
set global lsp_diagnostic_line_error_sign "●"
|
||||
|
||||
# hook global BufCreate .* %{try lsp-enable}
|
||||
hook global BufCreate .* %{try lsp-enable}
|
||||
|
||||
# hook global -group rust-inlay-hints-auto WinSetOption filetype=rust %{
|
||||
# hook window -group rust-inlay-hints BufReload .* rust-analyzer-inlay-hints
|
||||
# hook window -group rust-inlay-hints NormalIdle .* rust-analyzer-inlay-hints
|
||||
# hook window -group rust-inlay-hints InsertIdle .* rust-analyzer-inlay-hints
|
||||
# hook -once -always window WinSetOption filetype=.* %{
|
||||
# remove-hooks window rust-inlay-hints
|
||||
# }
|
||||
# }
|
||||
hook global -group rust-inlay-hints-auto WinSetOption filetype=rust %{
|
||||
hook window -group rust-inlay-hints BufReload .* rust-analyzer-inlay-hints
|
||||
hook window -group rust-inlay-hints NormalIdle .* rust-analyzer-inlay-hints
|
||||
hook window -group rust-inlay-hints InsertIdle .* rust-analyzer-inlay-hints
|
||||
hook -once -always window WinSetOption filetype=.* %{
|
||||
remove-hooks window rust-inlay-hints
|
||||
}
|
||||
}
|
||||
|
||||
# define-command -override -hidden lsp-enable-decals %{
|
||||
# lsp-inlay-diagnostics-enable global
|
||||
# try %{
|
||||
# add-highlighter global/rust_analyzer_inlay_hints replace-ranges rust_analyzer_inlay_hints
|
||||
# }
|
||||
# }
|
||||
define-command -override -hidden lsp-enable-decals %{
|
||||
lsp-inlay-diagnostics-enable global
|
||||
try %{
|
||||
add-highlighter global/rust_analyzer_inlay_hints replace-ranges rust_analyzer_inlay_hints
|
||||
}
|
||||
}
|
||||
|
||||
# define-command -override -hidden lsp-disable-decals %{
|
||||
# lsp-inlay-diagnostics-disable global
|
||||
# remove-highlighter global/rust_analyzer_inlay_hints
|
||||
# }
|
||||
define-command -override -hidden lsp-disable-decals %{
|
||||
lsp-inlay-diagnostics-disable global
|
||||
remove-highlighter global/rust_analyzer_inlay_hints
|
||||
}
|
||||
|
||||
# hook global ModeChange '.*:insert:normal' %{lsp-enable-decals}
|
||||
# hook global ModeChange '.*:normal:insert' %{lsp-disable-decals}
|
||||
hook global ModeChange '.*:insert:normal' %{lsp-enable-decals}
|
||||
hook global ModeChange '.*:normal:insert' %{lsp-disable-decals}
|
||||
|
||||
hook global WinSetOption filetype=(c|cpp|rust) %{
|
||||
lsp-enable
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# {{@@ header() @@}} #
|
||||
|
||||
group_imports = "StdExternalCrate"
|
||||
imports_granularity = "Crate"
|
||||
imports_layout = "Vertical"
|
||||
# group_imports = "StdExternalCrate"
|
||||
# imports_granularity = "Crate"
|
||||
# imports_layout = "Vertical"
|
||||
tab_spaces = {{@@ indent_width @@}}
|
||||
max_width = 80
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
cd "$HOME/Projects"
|
||||
|
||||
fd -H '^\.git$' |
|
||||
fd -d5 -H '^\.git$' |
|
||||
sd '\.git$' '' |
|
||||
while read repo
|
||||
pushd "$repo"
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
rm ~/.local/bin/rust-analyzer
|
||||
mkdir -p ~/.local/bin
|
||||
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz |
|
||||
gunzip -c - > ~/.local/bin/rust-analyzer
|
||||
chmod +x ~/.local/bin/rust-analyzer
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
REPO="https://github.com/rust-analyzer/rust-analyzer"
|
||||
VERSION="2022-01-24"
|
||||
DLURL="$REPO/releases/download/$VERSION/rust-analyzer-x86_64-unknown-linux-gnu.gz"
|
||||
GZFILE="$HOME/.cache/rust-analyzer-$VERSION-x86_64-unknown-linux-gnu.gz"
|
||||
BINDIR="$HOME/.local/bin"
|
||||
|
||||
test -f "$GZFILE" ||
|
||||
wget -O "$GZFILE" "$DLURL"
|
||||
|
||||
rm -f "$BINDIR/rust-analyzer"
|
||||
gunzip "$GZFILE" --stdout > "$BINDIR/rust-analyzer"
|
||||
chmod u+x "$BINDIR/rust-analyzer"
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
REPO=https://github.com/mozilla/sccache
|
||||
VERSION=v0.2.15
|
||||
TARFILE="$HOME/.cache/sccache-$VERSION-x86_64-unknown-linux-musl.tar.gz"
|
||||
BINDIR="$HOME/.local/bin"
|
||||
|
||||
test -f "$TARFILE" ||
|
||||
wget -qO "$TARFILE" "$REPO/releases/download/$VERSION/$TARFILE.tar.gz"
|
||||
|
||||
tar -xf "$TARFILE" -C "$BINDIR" --wildcards "*/sccache"
|
||||
chmod u+x "$BINDIR/sccache"
|
|
@ -1,9 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
REPO=https://github.com/thedodd/trunk
|
||||
VERSION=v0.14.0
|
||||
TARFILE="$HOME/.cache/trunk-$VERSION-x86_64-unknown-linux-gnu.tar.gz"
|
||||
BINDIR="$HOME/.local/bin"
|
||||
|
||||
cd "$HOME/.local/bin"
|
||||
test -f "$TARFILE" ||
|
||||
wget -qO "$TARFILE" "$REPO/releases/download/$VERSION/trunk-x86_64-unknown-linux-gnu.tar.gz"
|
||||
|
||||
wget -qO- "$REPO/releases/download/$VERSION/trunk-x86_64-unknown-linux-gnu.tar.gz" |
|
||||
tar -xzf-
|
||||
tar -xf "$TARFILE" -C "$BINDIR" trunk
|
||||
chmod u+x "$BINDIR/trunk"
|
||||
|
|
|
@ -24,6 +24,7 @@ clang
|
|||
clyrics
|
||||
cmake
|
||||
cmatrix
|
||||
composer
|
||||
cool-retro-term
|
||||
cronie
|
||||
cryptsetup
|
||||
|
@ -100,6 +101,7 @@ libreoffice
|
|||
light
|
||||
linux
|
||||
lld
|
||||
lsof
|
||||
lutris
|
||||
lxappearance
|
||||
lynx
|
||||
|
@ -122,6 +124,7 @@ mpDris2
|
|||
mpc
|
||||
mpd
|
||||
mpv
|
||||
mpv-mpris
|
||||
msmtp
|
||||
mtr
|
||||
nano
|
||||
|
@ -148,6 +151,7 @@ pamixer
|
|||
papirus-folders
|
||||
par
|
||||
pass
|
||||
patch
|
||||
pavucontrol
|
||||
php-apache
|
||||
php-intl
|
||||
|
@ -159,8 +163,10 @@ plank-devel
|
|||
playerctl
|
||||
playonlinux
|
||||
polkit
|
||||
postgresql-client
|
||||
powertop
|
||||
pqiv
|
||||
preload
|
||||
procs
|
||||
protontricks
|
||||
pulseaudio
|
||||
|
@ -182,12 +188,12 @@ ripgrep
|
|||
rofi
|
||||
rsync
|
||||
rundird
|
||||
rust-analyzer
|
||||
rustup
|
||||
sassc
|
||||
sd
|
||||
seatd
|
||||
shfmt
|
||||
shotcut
|
||||
slurp
|
||||
so
|
||||
socklog
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env fish
|
||||
|
||||
xbps-query -m |
|
||||
cut -d\ -f 2 |
|
||||
string replace -ar -- '-[^-]*$' '' > void.freeze
|
Reference in New Issue