Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
8708fff1e2 | |||
e739799fb6 | |||
f907a2be6b | |||
|
93bfe0e577 | ||
|
859043b7c6 | ||
|
2bf7985db1 | ||
|
7112bca390 | ||
|
499c4553cc | ||
|
46a309f25e | ||
|
ebfa8a1088 | ||
|
e84d6e57b8 | ||
|
680f6101e9 |
152
.bashrc
Normal file
152
.bashrc
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
|
||||||
|
# git aliases
|
||||||
|
alias ga='git add'
|
||||||
|
alias gaa='git add -A'
|
||||||
|
alias gb='git branch'
|
||||||
|
alias gbs='git switch -C'
|
||||||
|
alias gc='git commit -m'
|
||||||
|
alias gcl='git clone'
|
||||||
|
alias gck='git checkout'
|
||||||
|
alias gd='git diff'
|
||||||
|
alias gdh='git diff HEAD~1'
|
||||||
|
alias gf='git fetch'
|
||||||
|
alias gfa='git fetch --all'
|
||||||
|
alias gg='git log --graph --all --decorate --color=always --oneline'
|
||||||
|
alias gi='git init'
|
||||||
|
alias gl='git log'
|
||||||
|
alias gm='git merge'
|
||||||
|
alias gmc='git merge --continue'
|
||||||
|
alias gp='git push'
|
||||||
|
alias gpl='git pull'
|
||||||
|
alias gpt='git push --follow-tags'
|
||||||
|
alias gr='git reset'
|
||||||
|
alias gra='git remote add'
|
||||||
|
alias grb='git rebase'
|
||||||
|
alias grc='git rebase --continue'
|
||||||
|
alias grt='git restore'
|
||||||
|
alias grv='git remote -v'
|
||||||
|
alias gs='git status'
|
||||||
|
alias gsd='git switch develop'
|
||||||
|
alias gsm='git switch master'
|
||||||
|
alias gsmain='git switch main'
|
||||||
|
alias gst='git stash'
|
||||||
|
alias gsta='git stash apply'
|
||||||
|
alias gsw='git switch'
|
||||||
|
alias gt='git tag -ma'
|
||||||
|
alias gitauthor='git ls-files -z | xargs -0n1 git blame -w --line-porcelain | grep -a "^author " | sort -f | uniq -c | sort -n'
|
||||||
|
alias pcra='pre-commit run --all'
|
||||||
|
|
||||||
|
gpb () {
|
||||||
|
branch=$(git branch --show-current)
|
||||||
|
git push origin $branch $@
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
create_watermark () {
|
||||||
|
input_pdf=$1
|
||||||
|
watermark=$2
|
||||||
|
new_pdf="${input_pdf::-4}_watermarked.pdf"
|
||||||
|
|
||||||
|
# create watermark template
|
||||||
|
cd ~/Documents/prog/latex/watermark/
|
||||||
|
sed -i 's/\(\\def\\watermark{\).*}/\1'"${watermark}"'}/g' watermark_template.tex
|
||||||
|
latexmk -pdf watermark_template.tex > /dev/null
|
||||||
|
|
||||||
|
cd -
|
||||||
|
pdftk $input_pdf multistamp ~/Documents/prog/latex/watermark/watermark_template.pdf output $new_pdf && evince $new_pdf
|
||||||
|
}
|
||||||
|
|
||||||
|
alias lzg='lazygit'
|
||||||
|
|
||||||
|
# django
|
||||||
|
alias loadstatic='./manage.sh collectstatic --noinput'
|
||||||
|
|
||||||
|
# perso aliases
|
||||||
|
alias gcepita='git config user.email "hugo.meens@epita.fr"; git config user.name "Hugo Meens"'
|
||||||
|
alias gcgrimhilt='git config user.email "grimhilt@users.noreply.github.com"; git config user.name "grimhilt"'
|
||||||
|
alias gcprolo='git config user.email "hugo.meens@prologin.org"; git config user.name "hugo.meens"'
|
||||||
|
alias sshusiobe='ssh grimhilt@192.168.1.116 -p 2367'
|
||||||
|
alias sshusiobecom='ssh grimhilt@usiobe.com -p 2367'
|
||||||
|
alias nextsync='~/Documents/prog/rust/nextsync/target/debug/nextsync'
|
||||||
|
alias ns='~/Documents/prog/rust/nextsync/target/debug/nextsync'
|
||||||
|
|
||||||
|
# path alias
|
||||||
|
alias n='nvim'
|
||||||
|
alias p='cd ~/Documents/prog'
|
||||||
|
alias ing='cd ~/Documents/ing'
|
||||||
|
alias cd='z'
|
||||||
|
|
||||||
|
# tiger
|
||||||
|
alias tiger='cd ~/Documents/prog/cpp/tiger'
|
||||||
|
alias tfixme='grep -r "FIXME: Some code was deleted here."'
|
||||||
|
alias tdev='nix develop --extra-experimental-features nix-command --extra-experimental-features flakes'
|
||||||
|
|
||||||
|
alias cf='clang-format -i'
|
||||||
|
cfa() {
|
||||||
|
find -name "*.hh" -exec clang-format -i {} \; -print
|
||||||
|
find -name "*.cc" -exec clang-format -i {} \; -print
|
||||||
|
find -name "*.hxx" -exec clang-format -i {} \; -print
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# c aliases
|
||||||
|
alias ge='gcc -std=c99 -pedantic -Werror -Wall -Wextra -Wvla -o main'
|
||||||
|
alias gef='gcc -g -fsanitize=address -std=c99 -Wall -Wextra -Wvla -D_DEFAULT_SOURCE -o main'
|
||||||
|
alias gec='gcc -g -fsanitize=address -std=c99 -Wall -Wextra -Wvla -o main -lcriterion'
|
||||||
|
alias vlg='valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes'
|
||||||
|
alias vlgv='valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose'
|
||||||
|
|
||||||
|
#
|
||||||
|
shut() {
|
||||||
|
if [ "$CURRENT_LAYOUT" = "us" ]; then
|
||||||
|
echo $(date -u +%Y-%m-%d_%H:%M:%S) "fr" >> ~/.config/sxhkd/switch_layout_log
|
||||||
|
else
|
||||||
|
echo $(date -u +%Y-%m-%d_%H:%M:%S) "us" >> ~/.config/sxhkd/switch_layout_log
|
||||||
|
fi
|
||||||
|
shutdown -h now
|
||||||
|
}
|
||||||
|
|
||||||
|
# utils aliases
|
||||||
|
alias count_lines='S=0; for file in $(find -name "*.c" -o -name "*.h" -o -name "*.sh"); do S1=$(wc -l < $file); echo -e $file $S1; S=$(($S1 + $S)); done; echo $S'
|
||||||
|
alias count_lines='S=0; for file in $(find -name "*.py" -o -name "*.js" -o -name "*.html" -o -name "*.css"); do S1=$(wc -l < $file); echo -e $file $S1; S=$(($S1 + $S)); done; echo $S'
|
||||||
|
|
||||||
|
# config
|
||||||
|
alias xtouch='xinput set-prop 12 327 0 && xinput set-prop 11 333 1'
|
||||||
|
sboot()
|
||||||
|
{
|
||||||
|
xtouch
|
||||||
|
pkill polybar
|
||||||
|
MONITOR=eDP-1 polybar -q 2>/dev/null &
|
||||||
|
MONITOR=DP-3 polybar -q 2>/dev/null &
|
||||||
|
}
|
||||||
|
alias sourceb='source ~/.bashrc'
|
||||||
|
|
||||||
|
# docker
|
||||||
|
alias dls='docker ps'
|
||||||
|
alias dip="docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
|
||||||
|
alias dockercontainerrm='docker rm -f $(docker ps -aq)'
|
||||||
|
alias dockervolumerm='docker volume rm -f $(docker volume ls -q)'
|
||||||
|
|
||||||
|
# xrandr
|
||||||
|
alias xepita='xrandr --output eDP-1 --output DP-3 --mode 3840x2160 --same-as eDP-1 --scale 0.69'
|
||||||
|
alias depita='xrandr --output DP-3 --primary --scale 1 --auto --output eDP-1 --left-of DP-3'
|
||||||
|
alias xhome='xrandr --output DP-3 --primary --scale 1.3 --auto --output eDP-1 --left-of DP-3'
|
||||||
|
alias xmono='xrandr --output eDP-1 --primary'
|
||||||
|
|
||||||
|
# prompt command
|
||||||
|
get_branch_name()
|
||||||
|
{
|
||||||
|
branch_name=$(git branch --show-current 2>/dev/null)
|
||||||
|
if [ -n "$branch_name" ]; then
|
||||||
|
echo -e '(\e[38;5;135m'$branch_name'\e[0m)'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
PROMPT_COMMAND='PS1_CMD1=$(get_branch_name)'; PS1='[\[\e[92m\]\w\[\e[0m\]] ${PS1_CMD1}\n$? \$ '
|
||||||
|
|
||||||
|
# postgres
|
||||||
|
export PGDATA="$HOME/postgres_data"
|
||||||
|
export PGHOST="/tmp"
|
||||||
|
|
||||||
|
eval "$(zoxide init bash)"
|
||||||
|
eval "$(direnv hook bash)"
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
[General]
|
[General]
|
||||||
contrastOpacity=163
|
contrastOpacity=163
|
||||||
drawColor=#1e0000
|
drawColor=#2c2321
|
||||||
savePath=/home/grimhilt/Documents/spe/international
|
savePath=/home/grimhilt/Documents/spe/international
|
||||||
showHelp=false
|
showHelp=false
|
||||||
showStartupLaunchMessage=false
|
showStartupLaunchMessage=false
|
||||||
|
51
.config/i3lock/lock.sh
Executable file
51
.config/i3lock/lock.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Background (--color=rrggbb or --image=path)
|
||||||
|
#BACKGROUND="--image=${HOME}/wallpaper-lock.jpg"
|
||||||
|
|
||||||
|
# Foreground color (rrggbbaa)
|
||||||
|
COLOR_FG="ffffffff"
|
||||||
|
COLOR_SCREEN="000000ff";
|
||||||
|
|
||||||
|
# Ring color during incorrect password flash (rrggbbaa)
|
||||||
|
COLOR_RINGWRONG="ff0000ff";
|
||||||
|
|
||||||
|
COLOR_TEXT="ffffffff";
|
||||||
|
# Date string format (see `man strftime.3`)
|
||||||
|
FORMAT_DATE="%A, %B %e"
|
||||||
|
FORMAT_TIME="%H:%M"
|
||||||
|
|
||||||
|
# Main font (for time and greeter)
|
||||||
|
FONT="sans-serif:light"
|
||||||
|
# Alternative font (for date)
|
||||||
|
FONT_ALT="sans-serif:thin"
|
||||||
|
|
||||||
|
# Time font size
|
||||||
|
SIZE_TIME=144
|
||||||
|
# Date font size
|
||||||
|
SIZE_DATE=48
|
||||||
|
|
||||||
|
# "${BACKGROUND}" \
|
||||||
|
i3lock-color \
|
||||||
|
--force-clock \
|
||||||
|
--ignore-empty-password \
|
||||||
|
--screen=0 \
|
||||||
|
--color="${COLOR_SCREEN}" \
|
||||||
|
--show-failed-attempts \
|
||||||
|
--inside-color="${COLOR_SCREEN}" \
|
||||||
|
--ring-color="${COLOR_SCREEN}" \
|
||||||
|
--insidever-color="${COLOR_SCREEN}" \
|
||||||
|
--ringver-color="${COLOR_SCREEN}" \
|
||||||
|
--insidewrong-color="${COLOR_SCREEN}" \
|
||||||
|
--ringwrong-color="${COLOR_RINGWRONG}" \
|
||||||
|
--layout-color="${COLOR_TEXT}" \
|
||||||
|
--time-color="${COLOR_TEXT}" \
|
||||||
|
--date-color="${COLOR_TEXT}" \
|
||||||
|
--greeter-color="${COLOR_TEXT}" \
|
||||||
|
--date-str="${FORMAT_DATE}" \
|
||||||
|
--time-str="${FORMAT_TIME}" \
|
||||||
|
--noinput-text="clear" \
|
||||||
|
--pass-screen-keys \
|
||||||
|
--pass-power-keys \
|
||||||
|
--pass-volume-keys \
|
||||||
|
--radius=105 \
|
18
.config/nixpkgs/csharp.nix
Normal file
18
.config/nixpkgs/csharp.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let
|
||||||
|
dotnet_pkgs = pkgs.dotnet-sdk_7;
|
||||||
|
in pkgs.stdenv.mkDerivation {
|
||||||
|
src = ./src;
|
||||||
|
name = "rider";
|
||||||
|
buildInputs = [
|
||||||
|
dotnet_pkgs
|
||||||
|
pkgs.jetbrains.rider
|
||||||
|
pkgs.mono
|
||||||
|
pkgs.msbuild
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
export DOTNET_ROOT="${dotnet_pkgs}"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
39
.config/nixpkgs/nextsync.nix
Normal file
39
.config/nixpkgs/nextsync.nix
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{ lib, fetchFromGitHub, rustPlatform, pkgconfig, openssl, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
in
|
||||||
|
rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "nextsync";
|
||||||
|
version = "master";
|
||||||
|
#version = "0.1.0";
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
buildPhase = ''
|
||||||
|
export PKG_CONFIG_PATH="${openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||||
|
'';
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "grimhilt";
|
||||||
|
repo = pname;
|
||||||
|
rev = version;
|
||||||
|
sha256 = lib.fakeSha256;
|
||||||
|
#"sha256-WIpbaaNZiYZd6ja6BB/fCem4yji0nY50XT4Aaox/vxw=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoSha256 = lib.fakeSha256;
|
||||||
|
#"sha256-VDWR+f/nisv3uzyFsbzAc3K9dyBnahNwRuang4Z4buw=";
|
||||||
|
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A fast line-oriented regex search tool, similar to ag and ack";
|
||||||
|
homepage = "https://github.com/grimhilt/nextsync";
|
||||||
|
license = licenses.unlicense;
|
||||||
|
maintainers = [];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#nix-build -E "with import <nixpkgs> {}; callPackage ./default.nix {}"
|
@ -15,6 +15,12 @@ in
|
|||||||
libinput
|
libinput
|
||||||
clang-tools_15
|
clang-tools_15
|
||||||
valgrind
|
valgrind
|
||||||
|
xorg.xcbutil
|
||||||
|
xorg.xcbutilkeysyms
|
||||||
|
criterion
|
||||||
|
clang-tools_16
|
||||||
|
python311Packages.pip
|
||||||
|
dash
|
||||||
];
|
];
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
pkg-config
|
pkg-config
|
||||||
|
11
.config/nixshell/caml.nix
Normal file
11
.config/nixshell/caml.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
ocaml
|
||||||
|
pkg-config
|
||||||
|
opam
|
||||||
|
xorg.libX11
|
||||||
|
];
|
||||||
|
}
|
8
.config/nixshell/haskell.nix
Normal file
8
.config/nixshell/haskell.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
ghc
|
||||||
|
];
|
||||||
|
}
|
8
.config/nixshell/lisp.nix
Normal file
8
.config/nixshell/lisp.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
sbcl
|
||||||
|
];
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
let pkgs = import <nixpkgs> { overlays = [ (import ./cypress-overlay.nix) ]; };
|
let pkgs = import <nixpkgs> { overlays = [ (import ./cypress-overlay.nix) ]; };
|
||||||
|
unstable = import <unstable> {};
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
name = "matrix-shell";
|
name = "matrix-shell";
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
yarn
|
yarn
|
||||||
|
nodejs
|
||||||
docker
|
docker
|
||||||
act
|
act
|
||||||
gtk2
|
gtk2
|
||||||
@ -26,14 +28,14 @@ in pkgs.mkShell {
|
|||||||
xorg.libxcb libsecret libuuid at-spi2-atk at-spi2-core libdbusmenu
|
xorg.libxcb libsecret libuuid at-spi2-atk at-spi2-core libdbusmenu
|
||||||
libdrm
|
libdrm
|
||||||
mesa # required for libgbm
|
mesa # required for libgbm
|
||||||
cypress
|
unstable.cypress
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export NAME="matrix-shell"
|
export NAME="matrix-shell"
|
||||||
export NODE_OPTIONS=--openssl-legacy-provider
|
|
||||||
export CYPRESS_INSTALL_BINARY=0
|
export CYPRESS_INSTALL_BINARY=0
|
||||||
export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress
|
export CYPRESS_RUN_BINARY=${unstable.cypress}/bin/Cypress
|
||||||
'';
|
'';
|
||||||
|
# export NODE_OPTIONS=--openssl-legacy-provider
|
||||||
}
|
}
|
||||||
|
|
||||||
#https://gist.github.com/r-k-b/2485f977b476aa3f76a47329ce7f9ad4?permalink_comment_id=4402925
|
#https://gist.github.com/r-k-b/2485f977b476aa3f76a47329ce7f9ad4?permalink_comment_id=4402925
|
||||||
|
@ -4,8 +4,8 @@ let
|
|||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
unstable.mongodb
|
#unstable.mongodb
|
||||||
mongosh
|
#mongosh
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
'';
|
'';
|
||||||
|
50
.config/nixshell/python.nix
Normal file
50
.config/nixshell/python.nix
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> {};
|
||||||
|
my-python-packages = ps: with ps; [
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
tkinter
|
||||||
|
gunicorn
|
||||||
|
python-vlc
|
||||||
|
mpv
|
||||||
|
(
|
||||||
|
buildPythonPackage rec {
|
||||||
|
pname = "tkVideo";
|
||||||
|
version = "0.1";
|
||||||
|
src = fetchPypi {
|
||||||
|
inherit pname version;
|
||||||
|
sha256 = "sha256-nxSWlqwC7rlPJbJQGtlb1AP75omUZWK2sNVgQJYVGfU=";
|
||||||
|
};
|
||||||
|
doCheck = false;
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
imageio
|
||||||
|
];
|
||||||
|
}
|
||||||
|
)
|
||||||
|
opencv4
|
||||||
|
#(
|
||||||
|
# buildPythonPackage rec {
|
||||||
|
# pname = "opencv-python-headless";
|
||||||
|
# version = "4.8.0.76";
|
||||||
|
# src = fetchPypi {
|
||||||
|
# inherit pname version;
|
||||||
|
# sha256 = "sha256-vBVyYYfa4m2KCHd/r2vHHTjyDHhcECZ39Yug6TUAOvs=";
|
||||||
|
# };
|
||||||
|
# doCheck = false;
|
||||||
|
# propagatedBuildInputs = [
|
||||||
|
# ];
|
||||||
|
# }
|
||||||
|
#)
|
||||||
|
|
||||||
|
pillow
|
||||||
|
flask
|
||||||
|
flask_sqlalchemy
|
||||||
|
flask_login
|
||||||
|
flask-cors
|
||||||
|
imageio
|
||||||
|
imageio-ffmpeg
|
||||||
|
pyavm
|
||||||
|
];
|
||||||
|
my-python = pkgs.python310.withPackages my-python-packages;
|
||||||
|
in
|
||||||
|
my-python.env
|
@ -8,6 +8,7 @@ in
|
|||||||
cargo
|
cargo
|
||||||
libressl
|
libressl
|
||||||
rustfmt
|
rustfmt
|
||||||
|
mdbook
|
||||||
];
|
];
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
pkg-config
|
pkg-config
|
||||||
|
8
.config/nvim/README.md
Normal file
8
.config/nvim/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
nodejs
|
||||||
|
|
||||||
|
clang
|
||||||
|
|
||||||
|
|
||||||
|
:CocInstall coc-clangd
|
||||||
|
|
||||||
|
:CocCommand clangd.install
|
7
.config/nvim/coc-settings.json
Normal file
7
.config/nvim/coc-settings.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
"languageserver": {
|
||||||
|
"clangd": {
|
||||||
|
"command": "clangd",
|
||||||
|
"rootPatterns": ["compile_flags.txt", "compile_commands.json"],
|
||||||
|
"filetypes": ["c", "cc", "cpp", "c++", "objc", "objcpp"]
|
||||||
|
}
|
||||||
|
}
|
781
.config/nvim/init.lua
Normal file → Executable file
781
.config/nvim/init.lua
Normal file → Executable file
@ -1,11 +1,55 @@
|
|||||||
vim.g.mapleader = " "
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ' '
|
||||||
vim.o.relativenumber = true
|
vim.o.relativenumber = true
|
||||||
|
vim.o.colorcolumn = "80"
|
||||||
vim.o.number = true
|
vim.o.number = true
|
||||||
vim.o.tabstop = 4
|
vim.o.tabstop = 4
|
||||||
vim.o.softtabstop = 4
|
vim.o.softtabstop = 4
|
||||||
vim.o.shiftwidth = 4
|
vim.o.shiftwidth = 4
|
||||||
vim.o.expandtab = true
|
vim.o.expandtab = true
|
||||||
vim.o.smartindent = true
|
vim.o.smartindent = true
|
||||||
|
-- [[ Setting options ]]
|
||||||
|
-- See `:help vim.o`
|
||||||
|
-- NOTE: You can change these options as you wish!
|
||||||
|
|
||||||
|
-- Make line numbers default
|
||||||
|
vim.wo.number = true
|
||||||
|
|
||||||
|
-- Enable mouse mode
|
||||||
|
vim.o.mouse = 'a'
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
end)
|
||||||
|
vim.o.clipboard = 'unnamedplus'
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- Enable break indent
|
||||||
|
vim.o.breakindent = true
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
vim.o.undofile = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Decrease update time
|
||||||
|
vim.o.updatetime = 250
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
|
-- Set completeopt to have a better completion experience
|
||||||
|
vim.o.completeopt = 'menuone,noselect'
|
||||||
|
|
||||||
|
-- NOTE: You should make sure your terminal supports this
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
|
||||||
|
--vim.o.listchars="eol:$"
|
||||||
|
|
||||||
--vim.keymap.set({"n", "v", "i"}, "<leader><leader>", "<Esc>", {noremap = true})
|
--vim.keymap.set({"n", "v", "i"}, "<leader><leader>", "<Esc>", {noremap = true})
|
||||||
|
|
||||||
@ -15,9 +59,11 @@ vim.o.smartcase = true
|
|||||||
|
|
||||||
--number of line to show around the cursor
|
--number of line to show around the cursor
|
||||||
vim.o.scrolloff = 8
|
vim.o.scrolloff = 8
|
||||||
|
vim.g.rustfmt_autosave = 1
|
||||||
|
|
||||||
--
|
--
|
||||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||||
|
vim.keymap.set("n", "<leader>h", ":noh<CR>")
|
||||||
|
|
||||||
--move line shortcut
|
--move line shortcut
|
||||||
vim.keymap.set("n", "<M-j>", ":m +1<CR>==", {noremap = true})
|
vim.keymap.set("n", "<M-j>", ":m +1<CR>==", {noremap = true})
|
||||||
@ -51,5 +97,734 @@ vim.keymap.set("n", "<leader>fp", ":bprev<CR>", {noremap = true})
|
|||||||
-- wrap toggle
|
-- wrap toggle
|
||||||
vim.keymap.set("n", "<leader>w", function() vim.o.wrap = not vim.o.wrap end, {noremap = true})
|
vim.keymap.set("n", "<leader>w", function() vim.o.wrap = not vim.o.wrap end, {noremap = true})
|
||||||
|
|
||||||
require('packer-plugins')
|
|
||||||
require('telescope')
|
--[[
|
||||||
|
|
||||||
|
- https://learnxinyminutes.com/docs/lua/
|
||||||
|
|
||||||
|
And then you can explore or search through `:help lua-guide`
|
||||||
|
- https://neovim.io/doc/user/lua-guide.html
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
|
-- https://github.com/folke/lazy.nvim
|
||||||
|
-- `:help lazy.nvim.txt` for more info
|
||||||
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system {
|
||||||
|
'git',
|
||||||
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
|
'--branch=stable', -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- [[ Configure plugins ]]
|
||||||
|
-- NOTE: Here is where you install your plugins.
|
||||||
|
-- You can configure plugins using the `config` key.
|
||||||
|
--
|
||||||
|
-- You can also configure plugins after the setup call,
|
||||||
|
-- as they will be available in your neovim runtime.
|
||||||
|
require('lazy').setup({
|
||||||
|
-- NOTE: First, some plugins that don't require any configuration
|
||||||
|
|
||||||
|
-- Git related plugins
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
'tpope/vim-rhubarb',
|
||||||
|
|
||||||
|
-- harpoon
|
||||||
|
-- {
|
||||||
|
-- 'ThePrimeagen/harpoon',
|
||||||
|
-- branch = "harpoon2",
|
||||||
|
-- dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
|
-- },
|
||||||
|
{
|
||||||
|
'ThePrimeagen/harpoon',
|
||||||
|
branch = 'harpoon2',
|
||||||
|
opts = {
|
||||||
|
menu = {
|
||||||
|
width = vim.api.nvim_win_get_width(0) - 4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>q',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():add()
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon File',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<C-e>',
|
||||||
|
function()
|
||||||
|
local harpoon = require('harpoon')
|
||||||
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon Quick Menu',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-q>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(1)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-w>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(2)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-e>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(3)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-r>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(4)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-t>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(5)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 5',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Mini
|
||||||
|
{ 'echasnovski/mini.files', version = false },
|
||||||
|
|
||||||
|
-- Detect tabstop and shiftwidth automatically
|
||||||
|
-- 'tpope/vim-sleuth',
|
||||||
|
|
||||||
|
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||||
|
-- The configuration is done below. Search for lspconfig to find it below.
|
||||||
|
{
|
||||||
|
-- LSP Configuration & Plugins
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
-- Automatically install LSPs to stdpath for neovim
|
||||||
|
{ 'williamboman/mason.nvim', config = true },
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
|
-- Useful status updates for LSP
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
|
'folke/neodev.nvim',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Autocompletion
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
dependencies = {
|
||||||
|
-- Snippet Engine & its associated nvim-cmp source
|
||||||
|
{
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
build = (function()
|
||||||
|
-- Build Step is needed for regex support in snippets
|
||||||
|
-- This step is not supported in many windows environments
|
||||||
|
-- Remove the below condition to re-enable on windows
|
||||||
|
if vim.fn.has 'win32' == 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return 'make install_jsregexp'
|
||||||
|
end)(),
|
||||||
|
},
|
||||||
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
|
||||||
|
-- Adds LSP completion capabilities
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
|
||||||
|
-- Adds a number of user-friendly snippets
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- auto pair
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function() require("nvim-autopairs").setup {} end
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Rust
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
|
||||||
|
-- Useful plugin to show you pending keybinds.
|
||||||
|
-- { 'folke/which-key.nvim', opts = {} },
|
||||||
|
--{
|
||||||
|
-- -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
-- 'lewis6991/gitsigns.nvim',
|
||||||
|
-- opts = {
|
||||||
|
-- -- See `:help gitsigns.txt`
|
||||||
|
-- signs = {
|
||||||
|
-- add = { text = '+' },
|
||||||
|
-- change = { text = '~' },
|
||||||
|
-- delete = { text = '_' },
|
||||||
|
-- topdelete = { text = '‾' },
|
||||||
|
-- changedelete = { text = '~' },
|
||||||
|
-- },
|
||||||
|
-- on_attach = function(bufnr)
|
||||||
|
-- local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
-- local function map(mode, l, r, opts)
|
||||||
|
-- opts = opts or {}
|
||||||
|
-- opts.buffer = bufnr
|
||||||
|
-- vim.keymap.set(mode, l, r, opts)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- -- Navigation
|
||||||
|
-- map({ 'n', 'v' }, ']c', function()
|
||||||
|
-- if vim.wo.diff then
|
||||||
|
-- return ']c'
|
||||||
|
-- end
|
||||||
|
-- vim.schedule(function()
|
||||||
|
-- gs.next_hunk()
|
||||||
|
-- end)
|
||||||
|
-- return '<Ignore>'
|
||||||
|
-- end, { expr = true, desc = 'Jump to next hunk' })
|
||||||
|
|
||||||
|
-- map({ 'n', 'v' }, '[c', function()
|
||||||
|
-- if vim.wo.diff then
|
||||||
|
-- return '[c'
|
||||||
|
-- end
|
||||||
|
-- vim.schedule(function()
|
||||||
|
-- gs.prev_hunk()
|
||||||
|
-- end)
|
||||||
|
-- return '<Ignore>'
|
||||||
|
-- end, { expr = true, desc = 'Jump to previous hunk' })
|
||||||
|
|
||||||
|
-- -- Actions
|
||||||
|
-- -- visual mode
|
||||||
|
-- map('v', '<leader>hs', function()
|
||||||
|
-- gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
-- end, { desc = 'stage git hunk' })
|
||||||
|
-- map('v', '<leader>hr', function()
|
||||||
|
-- gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
-- end, { desc = 'reset git hunk' })
|
||||||
|
-- -- normal mode
|
||||||
|
-- map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
||||||
|
-- map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
||||||
|
-- map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
||||||
|
-- map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
||||||
|
-- map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
||||||
|
-- map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
||||||
|
-- map('n', '<leader>hb', function()
|
||||||
|
-- gs.blame_line { full = false }
|
||||||
|
-- end, { desc = 'git blame line' })
|
||||||
|
-- map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
||||||
|
-- map('n', '<leader>hD', function()
|
||||||
|
-- gs.diffthis '~'
|
||||||
|
-- end, { desc = 'git diff against last commit' })
|
||||||
|
|
||||||
|
-- -- Toggles
|
||||||
|
-- map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
||||||
|
-- map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
||||||
|
|
||||||
|
-- -- Text object
|
||||||
|
-- map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
--},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Theme inspired by Atom
|
||||||
|
'navarasu/onedark.nvim',
|
||||||
|
priority = 1000,
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require('onedark').setup {
|
||||||
|
-- Set a style preset. 'dark' is default.
|
||||||
|
style = 'dark', -- dark, darker, cool, deep, warm, warmer, light
|
||||||
|
}
|
||||||
|
require('onedark').load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- bar
|
||||||
|
--{
|
||||||
|
-- -- Set lualine as statusline
|
||||||
|
-- 'nvim-lualine/lualine.nvim',
|
||||||
|
-- -- See `:help lualine.txt`
|
||||||
|
-- opts = {
|
||||||
|
-- options = {
|
||||||
|
-- icons_enabled = false,
|
||||||
|
-- theme = 'auto',
|
||||||
|
-- component_separators = '|',
|
||||||
|
-- section_separators = '',
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
--},
|
||||||
|
|
||||||
|
-- coloration and indentation
|
||||||
|
--{
|
||||||
|
-- -- Add indentation guides even on blank lines
|
||||||
|
-- 'lukas-reineke/indent-blankline.nvim',
|
||||||
|
-- -- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
|
-- -- See `:help ibl`
|
||||||
|
-- main = 'ibl',
|
||||||
|
-- opts = {},
|
||||||
|
--},
|
||||||
|
|
||||||
|
-- `gcc` - Toggles the current line using linewise comment
|
||||||
|
-- `gbc` - Toggles the current line using blockwise comment
|
||||||
|
-- `[count]gcc` - Toggles the number of line given as a prefix-count using linewise
|
||||||
|
-- `[count]gbc` - Toggles the number of line given as a prefix-count using blockwise
|
||||||
|
-- `gc[count]{motion}` - (Op-pending) Toggles the region using linewise comment
|
||||||
|
-- `gb[count]{motion}` - (Op-pending) Toggles the region using blockwise comment
|
||||||
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
branch = '0.1.x',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
|
-- Only load if `make` is available. Make sure you have the system
|
||||||
|
-- requirements installed.
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
-- NOTE: If you are having trouble with this installation,
|
||||||
|
-- refer to the README for telescope-fzf-native for more instructions.
|
||||||
|
build = 'make',
|
||||||
|
cond = function()
|
||||||
|
return vim.fn.executable 'make' == 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
},
|
||||||
|
build = ':TSUpdate',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
|
-- Uncomment any of the lines below to enable them.
|
||||||
|
-- require 'kickstart.plugins.autoformat',
|
||||||
|
-- require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
|
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||||
|
-- up-to-date with whatever is in the kickstart repo.
|
||||||
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
|
--
|
||||||
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
|
-- { import = 'custom.plugins' },
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
-- Keymaps for better default experience
|
||||||
|
-- See `:help vim.keymap.set()`
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
|
|
||||||
|
-- Remap for dealing with word wrap
|
||||||
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>d', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
|
-- [[ Highlight on yank ]]
|
||||||
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
--local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||||
|
--vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.highlight.on_yank()
|
||||||
|
-- end,
|
||||||
|
-- group = highlight_group,
|
||||||
|
-- pattern = '*',
|
||||||
|
--})
|
||||||
|
|
||||||
|
-- Enable telescope fzf native, if installed
|
||||||
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
|
|
||||||
|
-- Telescope live_grep in git root
|
||||||
|
-- Function to find the git root directory based on the current buffer's path
|
||||||
|
local function find_git_root()
|
||||||
|
-- Use the current buffer's path as the starting point for the git search
|
||||||
|
local current_file = vim.api.nvim_buf_get_name(0)
|
||||||
|
local current_dir
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
-- If the buffer is not associated with a file, return nil
|
||||||
|
if current_file == '' then
|
||||||
|
current_dir = cwd
|
||||||
|
else
|
||||||
|
-- Extract the directory from the current file's path
|
||||||
|
current_dir = vim.fn.fnamemodify(current_file, ':h')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find the Git root directory from the current file's path
|
||||||
|
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
print 'Not a git repository. Searching on current working directory'
|
||||||
|
return cwd
|
||||||
|
end
|
||||||
|
return git_root
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Custom live_grep function to search in git root
|
||||||
|
local function live_grep_git_root()
|
||||||
|
local git_root = find_git_root()
|
||||||
|
if git_root then
|
||||||
|
require('telescope.builtin').live_grep {
|
||||||
|
search_dirs = { git_root },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
||||||
|
|
||||||
|
-- See `:help telescope.builtin`
|
||||||
|
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||||
|
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||||
|
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
|
winblend = 10,
|
||||||
|
previewer = false,
|
||||||
|
})
|
||||||
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
|
local function telescope_live_grep_open_files()
|
||||||
|
require('telescope.builtin').live_grep {
|
||||||
|
grep_open_files = true,
|
||||||
|
prompt_title = 'Live Grep in Open Files',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
||||||
|
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
|
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||||
|
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
|
vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by [G]rep on Git Root' })
|
||||||
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||||
|
|
||||||
|
-- [[ Configure Treesitter ]]
|
||||||
|
-- See `:help nvim-treesitter`
|
||||||
|
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||||
|
vim.defer_fn(function()
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
|
ensure_installed = { 'rust', 'vimdoc', 'vim', 'bash' },
|
||||||
|
|
||||||
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
|
auto_install = false,
|
||||||
|
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
-- List of parsers to ignore installing
|
||||||
|
ignore_install = {},
|
||||||
|
-- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- },
|
||||||
|
modules = {},
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = '<c-space>',
|
||||||
|
node_incremental = '<c-space>',
|
||||||
|
scope_incremental = '<c-s>',
|
||||||
|
node_decremental = '<M-space>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
['aa'] = '@parameter.outer',
|
||||||
|
['ia'] = '@parameter.inner',
|
||||||
|
['af'] = '@function.outer',
|
||||||
|
['if'] = '@function.inner',
|
||||||
|
['ac'] = '@class.outer',
|
||||||
|
['ic'] = '@class.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true, -- whether to set jumps in the jumplist
|
||||||
|
goto_next_start = {
|
||||||
|
[']m'] = '@function.outer',
|
||||||
|
[']]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
[']M'] = '@function.outer',
|
||||||
|
[']['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
['[m'] = '@function.outer',
|
||||||
|
['[['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
['[M'] = '@function.outer',
|
||||||
|
['[]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
['<leader>a'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
['<leader>A'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end, 0)
|
||||||
|
|
||||||
|
-- [[ Configure LSP ]]
|
||||||
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||||
|
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||||
|
-- many times.
|
||||||
|
--
|
||||||
|
-- In this case, we create a function that lets us more easily define mappings specific
|
||||||
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||||
|
local nmap = function(keys, func, desc)
|
||||||
|
if desc then
|
||||||
|
desc = 'LSP: ' .. desc
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
nmap('<leader>ca', function()
|
||||||
|
vim.lsp.buf.code_action { context = { only = { 'quickfix', 'refactor', 'source' } } }
|
||||||
|
end, '[C]ode [A]ction')
|
||||||
|
|
||||||
|
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||||
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
|
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||||
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
|
-- See `:help K` for why this keymap
|
||||||
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
|
-- Lesser used LSP functionality
|
||||||
|
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>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||||
|
nmap('<leader>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, '[W]orkspace [L]ist Folders')
|
||||||
|
|
||||||
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- document existing key chains
|
||||||
|
-- require('which-key').register {
|
||||||
|
-- ['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
|
-- }
|
||||||
|
-- -- register which-key VISUAL mode
|
||||||
|
-- -- required for visual <leader>hs (hunk stage) to work
|
||||||
|
-- require('which-key').register({
|
||||||
|
-- ['<leader>'] = { name = 'VISUAL <leader>' },
|
||||||
|
-- ['<leader>h'] = { 'Git [H]unk' },
|
||||||
|
-- }, { mode = 'v' })
|
||||||
|
|
||||||
|
-- mason-lspconfig requires that these setup functions are called in this order
|
||||||
|
-- before setting up the servers.
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
|
-- vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
|
||||||
|
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
-- group = "LspAttach_inlayhints",
|
||||||
|
-- callback = function(args)
|
||||||
|
-- if not (args.data and args.data.client_id) then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local bufnr = args.buf
|
||||||
|
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
-- require("lsp-inlayhints").on_attach(client, bufnr)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- rust
|
||||||
|
require("rust-tools").setup({
|
||||||
|
tools = {
|
||||||
|
inlay_hints = {
|
||||||
|
auto = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.inlay_hint.enable(true, { 0 })
|
||||||
|
end
|
||||||
|
-- whatever other lsp config you want
|
||||||
|
end
|
||||||
|
})
|
||||||
|
-- toggle inlay hint
|
||||||
|
vim.keymap.set("n", "<leader>ri", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({0}), {0}) end)
|
||||||
|
|
||||||
|
-- Enable the following language servers
|
||||||
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
|
--
|
||||||
|
-- Add any additional override configuration in the following tables. They will be passed to
|
||||||
|
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||||
|
--
|
||||||
|
-- If you want to override the default filetypes that your language server will attach to you can
|
||||||
|
-- define the property 'filetypes' to the map in question.
|
||||||
|
local servers = {
|
||||||
|
-- clangd = {},
|
||||||
|
-- gopls = {},
|
||||||
|
-- pyright = {},
|
||||||
|
rust_analyzer = {
|
||||||
|
imports = {
|
||||||
|
granularity = {
|
||||||
|
group = "module",
|
||||||
|
},
|
||||||
|
prefix = "self",
|
||||||
|
},
|
||||||
|
cargo = {
|
||||||
|
buildScripts = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
experimental = {
|
||||||
|
enable = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- tsserver = {},
|
||||||
|
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||||
|
|
||||||
|
lua_ls = {
|
||||||
|
Lua = {
|
||||||
|
workspace = { checkThirdParty = false },
|
||||||
|
telemetry = { enable = false },
|
||||||
|
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||||
|
-- diagnostics = { disable = { 'missing-fields' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Setup neovim lua configuration
|
||||||
|
require('neodev').setup()
|
||||||
|
|
||||||
|
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
|
|
||||||
|
-- Ensure the servers above are installed
|
||||||
|
local mason_lspconfig = require 'mason-lspconfig'
|
||||||
|
|
||||||
|
mason_lspconfig.setup {
|
||||||
|
ensure_installed = vim.tbl_keys(servers),
|
||||||
|
-- ensure_installed = { "rust-analyzer" }
|
||||||
|
}
|
||||||
|
|
||||||
|
mason_lspconfig.setup_handlers {
|
||||||
|
function(server_name)
|
||||||
|
require('lspconfig')[server_name].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = servers[server_name],
|
||||||
|
filetypes = (servers[server_name] or {}).filetypes,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- [[ Configure nvim-cmp ]]
|
||||||
|
-- See `:help cmp`
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
luasnip.config.setup {}
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
completeopt = 'menu,menuone,noinsert',
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete {},
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_locally_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
28
.config/nvim/lazy-lock.json
Normal file
28
.config/nvim/lazy-lock.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
|
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
|
||||||
|
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
|
"mini.files": { "branch": "main", "commit": "2e262838a773c0bc3ccbc9c4bcf4a1a012497ea2" },
|
||||||
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "6bfd9210e312af6cfedba05d272e85618c93ab0d" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "585860a1865853d2c287c8ef534297da8115818e" },
|
||||||
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "41e3abf6bfd9a9a681eb1f788bdeba91c9004b2b" },
|
||||||
|
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||||
|
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
|
||||||
|
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
|
||||||
|
}
|
@ -1,36 +1,56 @@
|
|||||||
return require('packer').startup(function()
|
return require('packer').startup(function()
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
use 'sonph/onehalf'
|
use 'sonph/onehalf'
|
||||||
|
use 'navarasu/onedark.nvim'
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
'nvim-telescope/telescope.nvim', tag = '0.1.4',
|
||||||
-- or , branch = '0.1.x',
|
-- or , branch = '0.1.x',
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
}
|
}
|
||||||
use({
|
|
||||||
'rose-pine/neovim',
|
|
||||||
as = 'rose-pine',
|
|
||||||
config = function()
|
|
||||||
vim.cmd('colorscheme rose-pine')
|
|
||||||
end
|
|
||||||
})
|
|
||||||
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
|
||||||
use {
|
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
|
||||||
branch = 'v2.x',
|
|
||||||
requires = {
|
|
||||||
-- LSP Support
|
|
||||||
{'neovim/nvim-lspconfig'},
|
|
||||||
{'williamboman/mason.nvim', run = function()
|
|
||||||
pcall(vim.cmd, 'MasonUpdate')
|
|
||||||
end,},
|
|
||||||
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
|
||||||
|
|
||||||
-- Autocompletion
|
require('onedark').setup {
|
||||||
{'hrsh7th/nvim-cmp'}, -- Required
|
style = 'darker'
|
||||||
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
|
||||||
{'L3MON4D3/LuaSnip'}, -- Required
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
require('onedark').load()
|
||||||
|
-- use({
|
||||||
|
-- 'rose-pine/neovim',
|
||||||
|
-- as = 'rose-pine',
|
||||||
|
-- config = function()
|
||||||
|
-- vim.cmd('colorscheme rose-pine')
|
||||||
|
-- end
|
||||||
|
-- })
|
||||||
|
|
||||||
|
use {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
'neovim/nvim-lspconfig'
|
||||||
|
}
|
||||||
|
use 'hrsh7th/nvim-cmp' -- Autocompletion plugin
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp' -- Autocompletion with LSPs
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
|
||||||
|
use {'neoclide/coc.nvim', branch = 'release'}
|
||||||
|
|
||||||
|
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||||
|
|
||||||
|
--use {
|
||||||
|
-- 'VonHeikemen/lsp-zero.nvim',
|
||||||
|
-- branch = 'v2.x',
|
||||||
|
-- requires = {
|
||||||
|
-- -- LSP Support
|
||||||
|
-- {'neovim/nvim-lspconfig'},
|
||||||
|
-- {'williamboman/mason.nvim', run = function()
|
||||||
|
-- pcall(vim.cmd, 'MasonUpdate')
|
||||||
|
-- end,},
|
||||||
|
-- {'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||||
|
|
||||||
|
-- -- Autocompletion
|
||||||
|
-- {'hrsh7th/nvim-cmp'}, -- Required
|
||||||
|
-- {'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||||
|
-- {'L3MON4D3/LuaSnip'}, -- Required
|
||||||
|
-- }
|
||||||
|
--}
|
||||||
|
|
||||||
-- Auto pairs
|
-- Auto pairs
|
||||||
use {
|
use {
|
||||||
@ -40,4 +60,34 @@ return require('packer').startup(function()
|
|||||||
|
|
||||||
--harpoon
|
--harpoon
|
||||||
use("theprimeagen/harpoon")
|
use("theprimeagen/harpoon")
|
||||||
|
|
||||||
|
---- neogen
|
||||||
|
--local i = require("neogen.types.template").item
|
||||||
|
--local annotation = {
|
||||||
|
-- { nil, "/**", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "** \\file", { no_results = true, type = { "file" } } },
|
||||||
|
-- { nil, "** \\brief $1", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "*/", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "", { no_results = true, type = { "file" } } },
|
||||||
|
|
||||||
|
-- { nil, "/**", { type = { "func", "class", "type" } } },
|
||||||
|
-- { i.ClassName, "** @class %s", { type = { "class" } } },
|
||||||
|
-- { i.Type, "** @typedef %s", { type = { "type" } } },
|
||||||
|
-- { nil, "** \\brief $1", { type = { "func", "class", "type" } } },
|
||||||
|
-- { nil, "**", { type = { "func", "class", "type" } } },
|
||||||
|
-- { i.Tparam, "** \\tparam %s $1" },
|
||||||
|
-- { i.Parameter, "** \\param %s $1" },
|
||||||
|
-- { i.Return, "** \\return $1" },
|
||||||
|
-- { nil, "*/", { type = { "func", "class", "type" } } },
|
||||||
|
--}
|
||||||
|
--require("neogen").setup({
|
||||||
|
-- languages = {
|
||||||
|
-- c = {
|
||||||
|
-- template = {
|
||||||
|
-- annotation_convention = "my_annotation",
|
||||||
|
-- my_annotation = annotation
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
--})
|
||||||
end)
|
end)
|
||||||
|
50
.config/nvim/lua_back/packer-plugins.lua
Normal file
50
.config/nvim/lua_back/packer-plugins.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
return require('packer').startup(function()
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
--use 'sonph/onehalf'
|
||||||
|
use 'navarasu/onedark.nvim'
|
||||||
|
require("onedark").setup({
|
||||||
|
style = 'cool'
|
||||||
|
})
|
||||||
|
require('onedark').load()
|
||||||
|
vim.cmd('colorscheme onedark')
|
||||||
|
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
||||||
|
-- or , branch = '0.1.x',
|
||||||
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
|
}
|
||||||
|
-- use({
|
||||||
|
-- 'rose-pine/neovim',
|
||||||
|
-- as = 'rose-pine',
|
||||||
|
-- config = function()
|
||||||
|
-- vim.cmd('colorscheme rose-pine')
|
||||||
|
-- end
|
||||||
|
-- })
|
||||||
|
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||||
|
use {
|
||||||
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
|
branch = 'v2.x',
|
||||||
|
requires = {
|
||||||
|
-- LSP Support
|
||||||
|
{'neovim/nvim-lspconfig'},
|
||||||
|
{'williamboman/mason.nvim', run = function()
|
||||||
|
pcall(vim.cmd, 'MasonUpdate')
|
||||||
|
end,},
|
||||||
|
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||||
|
|
||||||
|
-- Autocompletion
|
||||||
|
{'hrsh7th/nvim-cmp'}, -- Required
|
||||||
|
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||||
|
{'L3MON4D3/LuaSnip'}, -- Required
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Auto pairs
|
||||||
|
use {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function() require("nvim-autopairs").setup {} end
|
||||||
|
}
|
||||||
|
|
||||||
|
--harpoon
|
||||||
|
use("theprimeagen/harpoon")
|
||||||
|
end)
|
184
.config/nvim/plugin/coc.lua
Normal file
184
.config/nvim/plugin/coc.lua
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
-- Some servers have issues with backup files, see #649
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.writebackup = false
|
||||||
|
|
||||||
|
-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
|
||||||
|
-- delays and poor user experience
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
-- diagnostics appeared/became resolved
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
local keyset = vim.keymap.set
|
||||||
|
-- Autocomplete
|
||||||
|
function _G.check_back_space()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use Tab for trigger completion with characters ahead and navigate
|
||||||
|
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||||
|
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||||
|
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||||
|
-- other plugins before putting this into your config
|
||||||
|
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||||
|
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||||
|
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||||
|
|
||||||
|
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||||
|
-- <C-g>u breaks current undo, please make your own choice
|
||||||
|
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||||
|
|
||||||
|
-- Use <c-j> to trigger snippets
|
||||||
|
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
|
||||||
|
-- Use <c-space> to trigger completion
|
||||||
|
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
|
||||||
|
|
||||||
|
-- Use `[g` and `]g` to navigate diagnostics
|
||||||
|
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||||
|
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||||
|
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||||
|
|
||||||
|
-- GoTo code navigation
|
||||||
|
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||||
|
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||||
|
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||||
|
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Use K to show documentation in preview window
|
||||||
|
function _G.show_docs()
|
||||||
|
local cw = vim.fn.expand('<cword>')
|
||||||
|
if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
|
||||||
|
vim.api.nvim_command('h ' .. cw)
|
||||||
|
elseif vim.api.nvim_eval('coc#rpc#ready()') then
|
||||||
|
vim.fn.CocActionAsync('doHover')
|
||||||
|
else
|
||||||
|
vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
|
||||||
|
vim.api.nvim_create_augroup("CocGroup", {})
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
group = "CocGroup",
|
||||||
|
command = "silent call CocActionAsync('highlight')",
|
||||||
|
desc = "Highlight symbol under cursor on CursorHold"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Symbol renaming
|
||||||
|
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Formatting selected code
|
||||||
|
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Setup formatexpr specified filetype(s)
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "typescript,json",
|
||||||
|
command = "setl formatexpr=CocAction('formatSelected')",
|
||||||
|
desc = "Setup formatexpr specified filetype(s)."
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Update signature help on jump placeholder
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "CocJumpPlaceholder",
|
||||||
|
command = "call CocActionAsync('showSignatureHelp')",
|
||||||
|
desc = "Update signature help on jump placeholder"
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Apply codeAction to the selected region
|
||||||
|
-- Example: `<leader>aap` for current paragraph
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply code actions at the cursor position.
|
||||||
|
keyset("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", opts)
|
||||||
|
-- Remap keys for apply source code actions for current file.
|
||||||
|
keyset("n", "<leader>as", "<Plug>(coc-codeaction-source)", opts)
|
||||||
|
-- Apply the most preferred quickfix action on the current line.
|
||||||
|
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply refactor code actions.
|
||||||
|
keyset("n", "<leader>re", "<Plug>(coc-codeaction-refactor)", { silent = true })
|
||||||
|
keyset("x", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
keyset("n", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
|
||||||
|
-- Run the Code Lens actions on the current line
|
||||||
|
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Map function and class text objects
|
||||||
|
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||||
|
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Remap <C-f> and <C-b> to scroll float windows/popups
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true, expr = true}
|
||||||
|
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
keyset("i", "<C-f>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
|
||||||
|
keyset("i", "<C-b>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
|
||||||
|
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Use CTRL-S for selections ranges
|
||||||
|
-- Requires 'textDocument/selectionRange' support of language server
|
||||||
|
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Add `:Format` command to format current buffer
|
||||||
|
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
||||||
|
|
||||||
|
-- " Add `:Fold` command to fold current buffer
|
||||||
|
vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
|
||||||
|
|
||||||
|
-- Add `:OR` command for organize imports of the current buffer
|
||||||
|
vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
|
||||||
|
|
||||||
|
-- Add (Neo)Vim's native statusline support
|
||||||
|
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||||
|
-- provide custom statusline: lightline.vim, vim-airline
|
||||||
|
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
|
||||||
|
|
||||||
|
-- Mappings for CoCList
|
||||||
|
-- code actions and coc stuff
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
-- Show all diagnostics
|
||||||
|
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
|
||||||
|
-- Manage extensions
|
||||||
|
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
|
||||||
|
-- Show commands
|
||||||
|
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
|
||||||
|
-- Find symbol of current document
|
||||||
|
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
|
||||||
|
-- Search workspace symbols
|
||||||
|
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
|
||||||
|
-- Do default action for next item
|
||||||
|
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
|
||||||
|
-- Do default action for previous item
|
||||||
|
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
|
||||||
|
-- Resume latest coc list
|
||||||
|
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)
|
@ -1,11 +1,11 @@
|
|||||||
local mark = require("harpoon.mark")
|
local harpoon = require("harpoon")
|
||||||
local ui = require("harpoon.ui")
|
harpoon:setup()
|
||||||
|
--
|
||||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
-- vim.keymap.set("n", "<leader>q", function() harpoon:list().append() end)
|
||||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
-- vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||||
|
--
|
||||||
vim.keymap.set("n", "<M-a>", function() ui.nav_file(1) end)
|
-- vim.keymap.set("n", "<M-q>", function() harpoon:list():select(1) end)
|
||||||
vim.keymap.set("n", "<M-z>", function() ui.nav_file(2) end)
|
-- vim.keymap.set("n", "<M-w>", function() harpoon:list():select(2) end)
|
||||||
vim.keymap.set("n", "<M-e>", function() ui.nav_file(3) end)
|
-- vim.keymap.set("n", "<M-e>", function() harpoon:list():select(3) end)
|
||||||
vim.keymap.set("n", "<M-r>", function() ui.nav_file(4) end)
|
-- vim.keymap.set("n", "<M-r>", function() harpoon:list():select(4) end)
|
||||||
vim.keymap.set("n", "<M-t>", function() ui.nav_file(5) end)
|
-- vim.keymap.set("n", "<M-t>", function() harpoon:list():select(5) end)
|
||||||
|
@ -1,13 +1,117 @@
|
|||||||
local lsp = require('lsp-zero').preset({})
|
-- Initialize Mason and specify which language servers to install
|
||||||
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensured_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Define lspconfig settings for rust_analyzer
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = { buffer = bufnr, remap = false }
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--
|
||||||
|
---- Configure autocomplete using nvim-cmp
|
||||||
|
--local cmp = require("cmp")
|
||||||
|
--cmp.setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- --completion = cmp.config.window.bordered(),
|
||||||
|
-- --documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Set up Rust Analyzer
|
||||||
|
--local lspconfig = require('lspconfig')
|
||||||
|
--lspconfig.rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
--vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
|
--vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
|
--vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
|
---- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
lsp.on_attach(function(client, bufnr)
|
|
||||||
local opts = {buffer = bufnr, remap = false}
|
|
||||||
|
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
-- old
|
||||||
end)
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensure_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--require("configs.nvim-cmp")
|
||||||
|
--require('nvim-cmp').setup{}
|
||||||
|
--require('cmp').setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
-- ['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--require("lspconfig").rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
|
||||||
lsp.ensure_installed({
|
--local lsp = require('lsp-zero').preset({})
|
||||||
'tsserver',
|
--
|
||||||
'eslint',
|
-- lsp.on_attach(function(client, bufnr)
|
||||||
})
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
lsp.setup()
|
--
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
----lsp['rust_analyzer'].setup({
|
||||||
|
---- capabilities = capabilities,
|
||||||
|
---- on_attach = on_attach
|
||||||
|
----})
|
||||||
|
--
|
||||||
|
--lsp.ensure_installed({
|
||||||
|
-- 'tsserver',
|
||||||
|
-- 'eslint',
|
||||||
|
-- 'rust_analyzer'
|
||||||
|
--})
|
||||||
|
--lsp.setup()
|
||||||
|
----lsp.rust_analyzer.setup()
|
||||||
|
52
.config/nvim/plugin/minifiles.lua
Normal file
52
.config/nvim/plugin/minifiles.lua
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
require('mini.files').setup({
|
||||||
|
-- Customization of shown content
|
||||||
|
content = {
|
||||||
|
-- Predicate for which file system entries to show
|
||||||
|
filter = nil,
|
||||||
|
-- What prefix to show to the left of file system entry
|
||||||
|
prefix = nil,
|
||||||
|
-- In which order to show file system entries
|
||||||
|
sort = nil,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Module mappings created only inside explorer.
|
||||||
|
-- Use `''` (empty string) to not create one.
|
||||||
|
mappings = {
|
||||||
|
close = 'q',
|
||||||
|
go_in = 'l',
|
||||||
|
go_in_plus = 'L',
|
||||||
|
go_out = 'h',
|
||||||
|
go_out_plus = 'H',
|
||||||
|
reset = '<BS>',
|
||||||
|
reveal_cwd = '@',
|
||||||
|
show_help = 'g?',
|
||||||
|
synchronize = '=',
|
||||||
|
trim_left = '<',
|
||||||
|
trim_right = '>',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- General options
|
||||||
|
options = {
|
||||||
|
-- Whether to delete permanently or move into module-specific trash
|
||||||
|
permanent_delete = true,
|
||||||
|
-- Whether to use for editing directories
|
||||||
|
use_as_default_explorer = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Customization of explorer windows
|
||||||
|
windows = {
|
||||||
|
-- Maximum number of windows to show side by side
|
||||||
|
max_number = math.huge,
|
||||||
|
-- Whether to show preview of file/directory under cursor
|
||||||
|
preview = false,
|
||||||
|
-- Width of focused window
|
||||||
|
width_focus = 50,
|
||||||
|
-- Width of non-focused window
|
||||||
|
width_nofocus = 15,
|
||||||
|
-- Width of preview window
|
||||||
|
width_preview = 25,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "-", '<CMD>lua MiniFiles.open(vim.api.nvim_buf_get_name(0)); MiniFiles.reveal_cwd()<CR>', { desc = 'Open MiniFiles' })
|
||||||
|
vim.keymap.set("n", "<ESC>", '<CMD>lua MiniFiles.close()<CR>', { desc = 'Close MiniFiles' })
|
5
.config/nvim/plugin/neogen.lua
Executable file
5
.config/nvim/plugin/neogen.lua
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
--require('neogen').generate()
|
||||||
|
--local opts = { noremap = true, silent = true }
|
||||||
|
--
|
||||||
|
--vim.api.nvim_set_keymap("n", "<Leader>nf", ":lua require('neogen').generate()<CR>", opts)
|
||||||
|
|
@ -49,8 +49,8 @@ local function save_profiles(threshold)
|
|||||||
end
|
end
|
||||||
|
|
||||||
time([[Luarocks path setup]], true)
|
time([[Luarocks path setup]], true)
|
||||||
local package_path_str = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
local package_path_str = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?/init.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
local install_cpath_pattern = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
local install_cpath_pattern = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/lua/5.1/?.so"
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
package.path = package.path .. ';' .. package_path_str
|
package.path = package.path .. ';' .. package_path_str
|
||||||
end
|
end
|
||||||
@ -74,26 +74,31 @@ end
|
|||||||
time([[try_loadstring definition]], false)
|
time([[try_loadstring definition]], false)
|
||||||
time([[Defining packer_plugins]], true)
|
time([[Defining packer_plugins]], true)
|
||||||
_G.packer_plugins = {
|
_G.packer_plugins = {
|
||||||
LuaSnip = {
|
["cmp-buffer"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
},
|
},
|
||||||
["cmp-nvim-lsp"] = {
|
["cmp-nvim-lsp"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
},
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
["coc.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/coc.nvim",
|
||||||
|
url = "https://github.com/neoclide/coc.nvim"
|
||||||
|
},
|
||||||
harpoon = {
|
harpoon = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/harpoon",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
url = "https://github.com/theprimeagen/harpoon"
|
url = "https://github.com/theprimeagen/harpoon"
|
||||||
},
|
},
|
||||||
["lsp-zero.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
|
||||||
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
|
|
||||||
},
|
|
||||||
["mason-lspconfig.nvim"] = {
|
["mason-lspconfig.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
@ -125,6 +130,11 @@ _G.packer_plugins = {
|
|||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
},
|
},
|
||||||
|
["onedark.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onedark.nvim",
|
||||||
|
url = "https://github.com/navarasu/onedark.nvim"
|
||||||
|
},
|
||||||
onehalf = {
|
onehalf = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onehalf",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onehalf",
|
||||||
@ -140,12 +150,6 @@ _G.packer_plugins = {
|
|||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
},
|
},
|
||||||
["rose-pine"] = {
|
|
||||||
config = { "\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/rose-pine",
|
|
||||||
url = "https://github.com/rose-pine/neovim"
|
|
||||||
},
|
|
||||||
["telescope.nvim"] = {
|
["telescope.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
@ -158,10 +162,6 @@ time([[Defining packer_plugins]], false)
|
|||||||
time([[Config for nvim-autopairs]], true)
|
time([[Config for nvim-autopairs]], true)
|
||||||
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
|
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
|
||||||
time([[Config for nvim-autopairs]], false)
|
time([[Config for nvim-autopairs]], false)
|
||||||
-- Config for: rose-pine
|
|
||||||
time([[Config for rose-pine]], true)
|
|
||||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0", "config", "rose-pine")
|
|
||||||
time([[Config for rose-pine]], false)
|
|
||||||
|
|
||||||
_G._packer.inside_compile = false
|
_G._packer.inside_compile = false
|
||||||
if _G._packer.needs_bufread == true then
|
if _G._packer.needs_bufread == true then
|
||||||
|
50
.config/nvim/plugin/rustaceanvim.lua
Normal file
50
.config/nvim/plugin/rustaceanvim.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
-- vim.g.auto_ra_attach = true
|
||||||
|
--
|
||||||
|
-- vim.g.rustaceanvim = {
|
||||||
|
-- -- Plugin configuration
|
||||||
|
-- tools = {},
|
||||||
|
-- -- LSP configuration
|
||||||
|
-- ---@type RustaceanLspClientOpts
|
||||||
|
-- server = {
|
||||||
|
-- load_vscode_settings = true,
|
||||||
|
-- auto_attach = function(bufnr)
|
||||||
|
-- return vim.g.auto_ra_attach
|
||||||
|
-- end,
|
||||||
|
-- on_attach = function(client, _)
|
||||||
|
-- client.server_capabilities.workspace.didChangeWatchedFiles = {
|
||||||
|
-- dynamicRegistration = false,
|
||||||
|
-- relativePatternSupport = false,
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||||
|
-- desc = 'Resize splits when resizing the window',
|
||||||
|
-- pattern = { '*.rs' },
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.cmd('RustAnalyzer reloadSettings')
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- default_settings = {
|
||||||
|
-- ['rust-analyzer'] = {
|
||||||
|
-- cachePriming = false,
|
||||||
|
-- rustfmt = {
|
||||||
|
-- extraArgs = {
|
||||||
|
-- '--config',
|
||||||
|
-- 'comment_width=120,condense_wildcard_suffixes=false,format_code_in_doc_comments=true,format_macro_bodies=true,hex_literal_case=Upper,imports_granularity=One,normalize_doc_attributes=true,wrap_comments=true',
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- -- DAP configuration
|
||||||
|
-- dap = {},
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- return {
|
||||||
|
-- {
|
||||||
|
-- 'mrcjkb/rustaceanvim',
|
||||||
|
-- version = '^4', -- Recommended
|
||||||
|
-- ft = { 'rust' },
|
||||||
|
-- dev = true,
|
||||||
|
-- },
|
||||||
|
-- }
|
@ -1,5 +1,18 @@
|
|||||||
|
-- [[ Configure Telescope ]]
|
||||||
|
-- See `:help telescope` and `:help telescope.setup()`
|
||||||
|
require('telescope').setup {
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
['<C-u>'] = false,
|
||||||
|
['<C-d>'] = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
||||||
|
vim.keymap.set('n', '<leader>pg', builtin.live_grep, {noremap = true})
|
||||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {noremap = true})
|
vim.keymap.set('n', '<C-p>', builtin.git_files, {noremap = true})
|
||||||
|
|
||||||
|
184
.config/nvim/plugin_back/coc.lua
Normal file
184
.config/nvim/plugin_back/coc.lua
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
-- Some servers have issues with backup files, see #649
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.writebackup = false
|
||||||
|
|
||||||
|
-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
|
||||||
|
-- delays and poor user experience
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
-- diagnostics appeared/became resolved
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
local keyset = vim.keymap.set
|
||||||
|
-- Autocomplete
|
||||||
|
function _G.check_back_space()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use Tab for trigger completion with characters ahead and navigate
|
||||||
|
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||||
|
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||||
|
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||||
|
-- other plugins before putting this into your config
|
||||||
|
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||||
|
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||||
|
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||||
|
|
||||||
|
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||||
|
-- <C-g>u breaks current undo, please make your own choice
|
||||||
|
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||||
|
|
||||||
|
-- Use <c-j> to trigger snippets
|
||||||
|
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
|
||||||
|
-- Use <c-space> to trigger completion
|
||||||
|
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
|
||||||
|
|
||||||
|
-- Use `[g` and `]g` to navigate diagnostics
|
||||||
|
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||||
|
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||||
|
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||||
|
|
||||||
|
-- GoTo code navigation
|
||||||
|
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||||
|
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||||
|
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||||
|
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Use K to show documentation in preview window
|
||||||
|
function _G.show_docs()
|
||||||
|
local cw = vim.fn.expand('<cword>')
|
||||||
|
if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
|
||||||
|
vim.api.nvim_command('h ' .. cw)
|
||||||
|
elseif vim.api.nvim_eval('coc#rpc#ready()') then
|
||||||
|
vim.fn.CocActionAsync('doHover')
|
||||||
|
else
|
||||||
|
vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
|
||||||
|
vim.api.nvim_create_augroup("CocGroup", {})
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
group = "CocGroup",
|
||||||
|
command = "silent call CocActionAsync('highlight')",
|
||||||
|
desc = "Highlight symbol under cursor on CursorHold"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Symbol renaming
|
||||||
|
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Formatting selected code
|
||||||
|
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Setup formatexpr specified filetype(s)
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "typescript,json",
|
||||||
|
command = "setl formatexpr=CocAction('formatSelected')",
|
||||||
|
desc = "Setup formatexpr specified filetype(s)."
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Update signature help on jump placeholder
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "CocJumpPlaceholder",
|
||||||
|
command = "call CocActionAsync('showSignatureHelp')",
|
||||||
|
desc = "Update signature help on jump placeholder"
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Apply codeAction to the selected region
|
||||||
|
-- Example: `<leader>aap` for current paragraph
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply code actions at the cursor position.
|
||||||
|
keyset("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", opts)
|
||||||
|
-- Remap keys for apply source code actions for current file.
|
||||||
|
keyset("n", "<leader>as", "<Plug>(coc-codeaction-source)", opts)
|
||||||
|
-- Apply the most preferred quickfix action on the current line.
|
||||||
|
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply refactor code actions.
|
||||||
|
keyset("n", "<leader>re", "<Plug>(coc-codeaction-refactor)", { silent = true })
|
||||||
|
keyset("x", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
keyset("n", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
|
||||||
|
-- Run the Code Lens actions on the current line
|
||||||
|
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Map function and class text objects
|
||||||
|
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||||
|
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Remap <C-f> and <C-b> to scroll float windows/popups
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true, expr = true}
|
||||||
|
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
keyset("i", "<C-f>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
|
||||||
|
keyset("i", "<C-b>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
|
||||||
|
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Use CTRL-S for selections ranges
|
||||||
|
-- Requires 'textDocument/selectionRange' support of language server
|
||||||
|
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Add `:Format` command to format current buffer
|
||||||
|
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
||||||
|
|
||||||
|
-- " Add `:Fold` command to fold current buffer
|
||||||
|
vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
|
||||||
|
|
||||||
|
-- Add `:OR` command for organize imports of the current buffer
|
||||||
|
vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
|
||||||
|
|
||||||
|
-- Add (Neo)Vim's native statusline support
|
||||||
|
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||||
|
-- provide custom statusline: lightline.vim, vim-airline
|
||||||
|
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
|
||||||
|
|
||||||
|
-- Mappings for CoCList
|
||||||
|
-- code actions and coc stuff
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
-- Show all diagnostics
|
||||||
|
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
|
||||||
|
-- Manage extensions
|
||||||
|
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
|
||||||
|
-- Show commands
|
||||||
|
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
|
||||||
|
-- Find symbol of current document
|
||||||
|
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
|
||||||
|
-- Search workspace symbols
|
||||||
|
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
|
||||||
|
-- Do default action for next item
|
||||||
|
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
|
||||||
|
-- Do default action for previous item
|
||||||
|
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
|
||||||
|
-- Resume latest coc list
|
||||||
|
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)
|
11
.config/nvim/plugin_back/harpoon.lua
Normal file
11
.config/nvim/plugin_back/harpoon.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local mark = require("harpoon.mark")
|
||||||
|
local ui = require("harpoon.ui")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>q", mark.add_file)
|
||||||
|
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<M-q>", function() ui.nav_file(1) end)
|
||||||
|
vim.keymap.set("n", "<M-w>", function() ui.nav_file(2) end)
|
||||||
|
vim.keymap.set("n", "<M-e>", function() ui.nav_file(3) end)
|
||||||
|
vim.keymap.set("n", "<M-r>", function() ui.nav_file(4) end)
|
||||||
|
vim.keymap.set("n", "<M-t>", function() ui.nav_file(5) end)
|
117
.config/nvim/plugin_back/lsp.lua
Normal file
117
.config/nvim/plugin_back/lsp.lua
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
-- Initialize Mason and specify which language servers to install
|
||||||
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensured_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Define lspconfig settings for rust_analyzer
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = { buffer = bufnr, remap = false }
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--
|
||||||
|
---- Configure autocomplete using nvim-cmp
|
||||||
|
--local cmp = require("cmp")
|
||||||
|
--cmp.setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- --completion = cmp.config.window.bordered(),
|
||||||
|
-- --documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Set up Rust Analyzer
|
||||||
|
--local lspconfig = require('lspconfig')
|
||||||
|
--lspconfig.rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
--vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
|
--vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
|
--vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
|
---- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
|
||||||
|
-- old
|
||||||
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensure_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--require("configs.nvim-cmp")
|
||||||
|
--require('nvim-cmp').setup{}
|
||||||
|
--require('cmp').setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
-- ['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--require("lspconfig").rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
|
||||||
|
--local lsp = require('lsp-zero').preset({})
|
||||||
|
--
|
||||||
|
-- lsp.on_attach(function(client, bufnr)
|
||||||
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
----lsp['rust_analyzer'].setup({
|
||||||
|
---- capabilities = capabilities,
|
||||||
|
---- on_attach = on_attach
|
||||||
|
----})
|
||||||
|
--
|
||||||
|
--lsp.ensure_installed({
|
||||||
|
-- 'tsserver',
|
||||||
|
-- 'eslint',
|
||||||
|
-- 'rust_analyzer'
|
||||||
|
--})
|
||||||
|
--lsp.setup()
|
||||||
|
----lsp.rust_analyzer.setup()
|
5
.config/nvim/plugin_back/neogen.lua
Executable file
5
.config/nvim/plugin_back/neogen.lua
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
--require('neogen').generate()
|
||||||
|
--local opts = { noremap = true, silent = true }
|
||||||
|
--
|
||||||
|
--vim.api.nvim_set_keymap("n", "<Leader>nf", ":lua require('neogen').generate()<CR>", opts)
|
||||||
|
|
179
.config/nvim/plugin_back/packer_compiled.lua
Normal file
179
.config/nvim/plugin_back/packer_compiled.lua
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
-- Automatically generated packer.nvim plugin loader code
|
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.inside_compile = true
|
||||||
|
|
||||||
|
local time
|
||||||
|
local profile_info
|
||||||
|
local should_profile = false
|
||||||
|
if should_profile then
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
profile_info = {}
|
||||||
|
time = function(chunk, start)
|
||||||
|
if start then
|
||||||
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_profiles(threshold)
|
||||||
|
local sorted_times = {}
|
||||||
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||||
|
end
|
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||||
|
local results = {}
|
||||||
|
for i, elem in ipairs(sorted_times) do
|
||||||
|
if not threshold or threshold and elem[2] > threshold then
|
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if threshold then
|
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||||
|
end
|
||||||
|
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?/init.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/lua/5.1/?.so"
|
||||||
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
|
package.path = package.path .. ';' .. package_path_str
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], false)
|
||||||
|
time([[try_loadstring definition]], true)
|
||||||
|
local function try_loadstring(s, component, name)
|
||||||
|
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||||
|
if not success then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[try_loadstring definition]], false)
|
||||||
|
time([[Defining packer_plugins]], true)
|
||||||
|
_G.packer_plugins = {
|
||||||
|
["cmp-buffer"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
["coc.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/coc.nvim",
|
||||||
|
url = "https://github.com/neoclide/coc.nvim"
|
||||||
|
},
|
||||||
|
harpoon = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
|
url = "https://github.com/theprimeagen/harpoon"
|
||||||
|
},
|
||||||
|
["mason-lspconfig.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
["mason.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
["nvim-autopairs"] = {
|
||||||
|
config = { "\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0" },
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||||
|
url = "https://github.com/windwp/nvim-autopairs"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["onedark.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onedark.nvim",
|
||||||
|
url = "https://github.com/navarasu/onedark.nvim"
|
||||||
|
},
|
||||||
|
onehalf = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onehalf",
|
||||||
|
url = "https://github.com/sonph/onehalf"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||||
|
url = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false)
|
||||||
|
-- Config for: nvim-autopairs
|
||||||
|
time([[Config for nvim-autopairs]], true)
|
||||||
|
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
|
||||||
|
time([[Config for nvim-autopairs]], false)
|
||||||
|
|
||||||
|
_G._packer.inside_compile = false
|
||||||
|
if _G._packer.needs_bufread == true then
|
||||||
|
vim.cmd("doautocmd BufRead")
|
||||||
|
end
|
||||||
|
_G._packer.needs_bufread = false
|
||||||
|
|
||||||
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not no_errors then
|
||||||
|
error_msg = error_msg:gsub('"', '\\"')
|
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||||
|
end
|
4
.config/nvim/plugin_back/telescope.lua
Normal file
4
.config/nvim/plugin_back/telescope.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.git_files, {noremap = true})
|
35
.config/nvim/plugin_back/treesitter.lua
Normal file
35
.config/nvim/plugin_back/treesitter.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
|
ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||||
|
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||||
|
-- the name of the parser)
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = { },
|
||||||
|
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- 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).
|
||||||
|
-- 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
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
}
|
11
.config/nvim/plugin_old/harpoon.lua
Normal file
11
.config/nvim/plugin_old/harpoon.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local mark = require("harpoon.mark")
|
||||||
|
local ui = require("harpoon.ui")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>q", mark.add_file)
|
||||||
|
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<M-q>", function() ui.nav_file(1) end)
|
||||||
|
vim.keymap.set("n", "<M-w>", function() ui.nav_file(2) end)
|
||||||
|
vim.keymap.set("n", "<M-e>", function() ui.nav_file(3) end)
|
||||||
|
vim.keymap.set("n", "<M-r>", function() ui.nav_file(4) end)
|
||||||
|
vim.keymap.set("n", "<M-t>", function() ui.nav_file(5) end)
|
13
.config/nvim/plugin_old/lsp.lua
Normal file
13
.config/nvim/plugin_old/lsp.lua
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
local lsp = require('lsp-zero').preset({})
|
||||||
|
|
||||||
|
lsp.on_attach(function(client, bufnr)
|
||||||
|
local opts = {buffer = bufnr, remap = false}
|
||||||
|
|
||||||
|
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
end)
|
||||||
|
|
||||||
|
lsp.ensure_installed({
|
||||||
|
'tsserver',
|
||||||
|
'eslint'
|
||||||
|
})
|
||||||
|
lsp.setup()
|
169
.config/nvim/plugin_old/packer_compiled.lua
Normal file
169
.config/nvim/plugin_old/packer_compiled.lua
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
-- Automatically generated packer.nvim plugin loader code
|
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.inside_compile = true
|
||||||
|
|
||||||
|
local time
|
||||||
|
local profile_info
|
||||||
|
local should_profile = false
|
||||||
|
if should_profile then
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
profile_info = {}
|
||||||
|
time = function(chunk, start)
|
||||||
|
if start then
|
||||||
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_profiles(threshold)
|
||||||
|
local sorted_times = {}
|
||||||
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||||
|
end
|
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||||
|
local results = {}
|
||||||
|
for i, elem in ipairs(sorted_times) do
|
||||||
|
if not threshold or threshold and elem[2] > threshold then
|
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if threshold then
|
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||||
|
end
|
||||||
|
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/hugo.meens/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/hugo.meens/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/hugo.meens/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/hugo.meens/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/hugo.meens/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||||
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
|
package.path = package.path .. ';' .. package_path_str
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], false)
|
||||||
|
time([[try_loadstring definition]], true)
|
||||||
|
local function try_loadstring(s, component, name)
|
||||||
|
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||||
|
if not success then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[try_loadstring definition]], false)
|
||||||
|
time([[Defining packer_plugins]], true)
|
||||||
|
_G.packer_plugins = {
|
||||||
|
LuaSnip = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||||
|
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
harpoon = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
|
url = "https://github.com/theprimeagen/harpoon"
|
||||||
|
},
|
||||||
|
["lsp-zero.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
||||||
|
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
|
||||||
|
},
|
||||||
|
["mason-lspconfig.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
["mason.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
["nvim-autopairs"] = {
|
||||||
|
config = { "\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0" },
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||||
|
url = "https://github.com/windwp/nvim-autopairs"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["onedark.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/onedark.nvim",
|
||||||
|
url = "https://github.com/navarasu/onedark.nvim"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||||
|
url = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/hugo.meens/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false)
|
||||||
|
-- Config for: nvim-autopairs
|
||||||
|
time([[Config for nvim-autopairs]], true)
|
||||||
|
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
|
||||||
|
time([[Config for nvim-autopairs]], false)
|
||||||
|
|
||||||
|
_G._packer.inside_compile = false
|
||||||
|
if _G._packer.needs_bufread == true then
|
||||||
|
vim.cmd("doautocmd BufRead")
|
||||||
|
end
|
||||||
|
_G._packer.needs_bufread = false
|
||||||
|
|
||||||
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not no_errors then
|
||||||
|
error_msg = error_msg:gsub('"', '\\"')
|
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||||
|
end
|
5
.config/nvim/plugin_old/telescope.lua
Normal file
5
.config/nvim/plugin_old/telescope.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.git_files, {noremap = true})
|
||||||
|
|
35
.config/nvim/plugin_old/treesitter.lua
Normal file
35
.config/nvim/plugin_old/treesitter.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
|
ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||||
|
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||||
|
-- the name of the parser)
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = { },
|
||||||
|
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- 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).
|
||||||
|
-- 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
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
}
|
@ -27,7 +27,7 @@ font-1 = FontAwesome6FreeSolid:size=12;3
|
|||||||
|
|
||||||
modules-left = bspwm-desktops window-title
|
modules-left = bspwm-desktops window-title
|
||||||
modules-center = cpu memory disk
|
modules-center = cpu memory disk
|
||||||
modules-right = battery wired-network wireless-network pulseaudio-volume date-and-time
|
modules-right = keyboard-layout battery wired-network wireless-network pulseaudio-volume date-and-time
|
||||||
|
|
||||||
locale = en_US.UTF-8
|
locale = en_US.UTF-8
|
||||||
|
|
||||||
|
11
.config/sxhkd/switch_layout.sh
Executable file
11
.config/sxhkd/switch_layout.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
# !/bin/bash
|
||||||
|
|
||||||
|
# Switching between keyboard layouts
|
||||||
|
CURRENT_LAYOUT=$(setxkbmap -query | awk 'NR==3{print $2}')
|
||||||
|
|
||||||
|
if [ "$CURRENT_LAYOUT" = "us" ]; then
|
||||||
|
setxkbmap "fr"
|
||||||
|
else
|
||||||
|
setxkbmap "us"
|
||||||
|
fi
|
||||||
|
|
@ -2,6 +2,9 @@
|
|||||||
# WM-independent hotkeys
|
# WM-independent hotkeys
|
||||||
#
|
#
|
||||||
|
|
||||||
|
ctrl + q
|
||||||
|
echo ""
|
||||||
|
|
||||||
# Terminal emulator
|
# Terminal emulator
|
||||||
super + Return
|
super + Return
|
||||||
alacritty
|
alacritty
|
||||||
@ -24,6 +27,9 @@ Print
|
|||||||
shift + Print
|
shift + Print
|
||||||
flameshot gui
|
flameshot gui
|
||||||
|
|
||||||
|
super + space
|
||||||
|
~/.config/sxhkd/switch_layout.sh
|
||||||
|
|
||||||
# Lock screen
|
# Lock screen
|
||||||
ctrl + alt + l
|
ctrl + alt + l
|
||||||
~/.config/i3lock/lock.sh
|
~/.config/i3lock/lock.sh
|
||||||
@ -110,7 +116,7 @@ super + shift + {h, j, k, l}
|
|||||||
|
|
||||||
# Focus/Send to the given desktop
|
# Focus/Send to the given desktop
|
||||||
#super + {_,shift + }{ampersand,eacute,quotedbl,apostrophe,parenleft,minus,egrave,underscore,ccedilla,agrave}
|
#super + {_,shift + }{ampersand,eacute,quotedbl,apostrophe,parenleft,minus,egrave,underscore,ccedilla,agrave}
|
||||||
super + {_,shift + }{ampersand,eacute,quotedbl,apostrophe,parenleft,a,z,e,r,t,y}
|
super + {_,shift + }{ampersand,eacute,quotedbl,apostrophe,parenleft,a,z,e,r}
|
||||||
bspc {desktop -f,node -d} '^{1-9,10,11}'
|
bspc {desktop -f,node -d} '^{1-9,10,11}'
|
||||||
|
|
||||||
# Focus the node for the given path jump
|
# Focus the node for the given path jump
|
||||||
|
8
nvim/README.md
Normal file
8
nvim/README.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
nodejs
|
||||||
|
|
||||||
|
clang
|
||||||
|
|
||||||
|
|
||||||
|
:CocInstall coc-clangd
|
||||||
|
|
||||||
|
:CocCommand clangd.install
|
830
nvim/init.lua
Executable file
830
nvim/init.lua
Executable file
@ -0,0 +1,830 @@
|
|||||||
|
vim.g.mapleader = ' '
|
||||||
|
vim.g.maplocalleader = ' '
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.o.colorcolumn = "80"
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.tabstop = 4
|
||||||
|
vim.o.softtabstop = 4
|
||||||
|
vim.o.shiftwidth = 4
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.smartindent = true
|
||||||
|
-- [[ Setting options ]]
|
||||||
|
-- See `:help vim.o`
|
||||||
|
-- NOTE: You can change these options as you wish!
|
||||||
|
|
||||||
|
-- Make line numbers default
|
||||||
|
vim.wo.number = true
|
||||||
|
|
||||||
|
-- Enable mouse mode
|
||||||
|
vim.o.mouse = 'a'
|
||||||
|
|
||||||
|
-- Sync clipboard between OS and Neovim.
|
||||||
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
|
-- See `:help 'clipboard'`
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
end)
|
||||||
|
vim.o.clipboard = 'unnamedplus'
|
||||||
|
vim.opt.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
-- Enable break indent
|
||||||
|
vim.o.breakindent = true
|
||||||
|
|
||||||
|
-- Save undo history
|
||||||
|
vim.o.undofile = true
|
||||||
|
|
||||||
|
-- Keep signcolumn on by default
|
||||||
|
vim.wo.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- Decrease update time
|
||||||
|
vim.o.updatetime = 250
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
|
-- Set completeopt to have a better completion experience
|
||||||
|
vim.o.completeopt = 'menuone,noselect'
|
||||||
|
|
||||||
|
-- NOTE: You should make sure your terminal supports this
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
|
||||||
|
-- [[ Basic Keymaps ]]
|
||||||
|
|
||||||
|
--vim.o.listchars="eol:$"
|
||||||
|
|
||||||
|
--vim.keymap.set({"n", "v", "i"}, "<leader><leader>", "<Esc>", {noremap = true})
|
||||||
|
|
||||||
|
--ignore case if pattern doesn't contain upper case
|
||||||
|
vim.o.ignorecase = true
|
||||||
|
vim.o.smartcase = true
|
||||||
|
|
||||||
|
--number of line to show around the cursor
|
||||||
|
vim.o.scrolloff = 8
|
||||||
|
vim.g.rustfmt_autosave = 1
|
||||||
|
|
||||||
|
--
|
||||||
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||||
|
vim.keymap.set("n", "<leader>h", ":noh<CR>")
|
||||||
|
|
||||||
|
--move line shortcut
|
||||||
|
vim.keymap.set("n", "<M-j>", ":m +1<CR>==", {noremap = true})
|
||||||
|
vim.keymap.set("n", "<M-k>", ":m -2<CR>==", {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("v", "<M-j>", ":m '>+1<CR>gv=gv", {noremap = true})
|
||||||
|
vim.keymap.set("v", "<M-k>", ":m '<-2<CR>gv=gv", {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-d>", "<C-d>zz", {noremap = true})
|
||||||
|
vim.keymap.set("n", "<C-u>", "<C-u>zz", {noremap = true})
|
||||||
|
|
||||||
|
vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>y", "\"+y")
|
||||||
|
vim.keymap.set("v", "<leader>y", "\"+y")
|
||||||
|
|
||||||
|
--surrounding
|
||||||
|
vim.keymap.set("v", '<leader>s(', "xi()<Esc>P", {noremap = true})
|
||||||
|
vim.keymap.set("v", '<leader>s)', "xi()<Esc>P", {noremap = true})
|
||||||
|
vim.keymap.set("v", '<leader>s{', "xi{}<Esc>P", {noremap = true})
|
||||||
|
vim.keymap.set("v", '<leader>s}', "xi{}<Esc>P", {noremap = true})
|
||||||
|
vim.keymap.set("v", '<leader>s[', "xi[]<Esc>P", {noremap = true})
|
||||||
|
vim.keymap.set("v", '<leader>s]', "xi[]<Esc>P", {noremap = true})
|
||||||
|
vim.keymap.set("v", '<leader>s"', 'xi""<Esc>P', {noremap = true})
|
||||||
|
vim.keymap.set("v", "<leader>s'", "xi''<Esc>P", {noremap = true})
|
||||||
|
|
||||||
|
--tab buffer
|
||||||
|
vim.keymap.set("n", "<leader>fn", ":bnext<CR>", {noremap = true})
|
||||||
|
vim.keymap.set("n", "<leader>fp", ":bprev<CR>", {noremap = true})
|
||||||
|
|
||||||
|
-- wrap toggle
|
||||||
|
vim.keymap.set("n", "<leader>w", function() vim.o.wrap = not vim.o.wrap end, {noremap = true})
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
|
||||||
|
- https://learnxinyminutes.com/docs/lua/
|
||||||
|
|
||||||
|
And then you can explore or search through `:help lua-guide`
|
||||||
|
- https://neovim.io/doc/user/lua-guide.html
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
|
-- https://github.com/folke/lazy.nvim
|
||||||
|
-- `:help lazy.nvim.txt` for more info
|
||||||
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system {
|
||||||
|
'git',
|
||||||
|
'clone',
|
||||||
|
'--filter=blob:none',
|
||||||
|
'https://github.com/folke/lazy.nvim.git',
|
||||||
|
'--branch=stable', -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- [[ Configure plugins ]]
|
||||||
|
-- NOTE: Here is where you install your plugins.
|
||||||
|
-- You can configure plugins using the `config` key.
|
||||||
|
--
|
||||||
|
-- You can also configure plugins after the setup call,
|
||||||
|
-- as they will be available in your neovim runtime.
|
||||||
|
require('lazy').setup({
|
||||||
|
-- NOTE: First, some plugins that don't require any configuration
|
||||||
|
|
||||||
|
-- Git related plugins
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
'tpope/vim-rhubarb',
|
||||||
|
|
||||||
|
-- harpoon
|
||||||
|
-- {
|
||||||
|
-- 'ThePrimeagen/harpoon',
|
||||||
|
-- branch = "harpoon2",
|
||||||
|
-- dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
|
-- },
|
||||||
|
{
|
||||||
|
'ThePrimeagen/harpoon',
|
||||||
|
branch = 'harpoon2',
|
||||||
|
opts = {
|
||||||
|
menu = {
|
||||||
|
width = vim.api.nvim_win_get_width(0) - 4,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>q',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():add()
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon File',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<C-e>',
|
||||||
|
function()
|
||||||
|
local harpoon = require('harpoon')
|
||||||
|
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon Quick Menu',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-q>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(1)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 1',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-w>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(2)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-e>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(3)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-r>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(4)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 4',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<M-t>',
|
||||||
|
function()
|
||||||
|
require('harpoon'):list():select(5)
|
||||||
|
end,
|
||||||
|
desc = 'Harpoon to File 5',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Mini
|
||||||
|
{ 'echasnovski/mini.files', version = false },
|
||||||
|
|
||||||
|
-- Detect tabstop and shiftwidth automatically
|
||||||
|
-- 'tpope/vim-sleuth',
|
||||||
|
|
||||||
|
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||||
|
-- The configuration is done below. Search for lspconfig to find it below.
|
||||||
|
{
|
||||||
|
-- LSP Configuration & Plugins
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = {
|
||||||
|
-- Automatically install LSPs to stdpath for neovim
|
||||||
|
{ 'williamboman/mason.nvim', config = true },
|
||||||
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
|
-- Useful status updates for LSP
|
||||||
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||||
|
{ 'j-hui/fidget.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
|
'folke/neodev.nvim',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Autocompletion
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
dependencies = {
|
||||||
|
-- Snippet Engine & its associated nvim-cmp source
|
||||||
|
{
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
build = (function()
|
||||||
|
-- Build Step is needed for regex support in snippets
|
||||||
|
-- This step is not supported in many windows environments
|
||||||
|
-- Remove the below condition to re-enable on windows
|
||||||
|
if vim.fn.has 'win32' == 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
return 'make install_jsregexp'
|
||||||
|
end)(),
|
||||||
|
},
|
||||||
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
|
||||||
|
-- Adds LSP completion capabilities
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
|
||||||
|
-- Adds a number of user-friendly snippets
|
||||||
|
'rafamadriz/friendly-snippets',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- auto pair
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function() require("nvim-autopairs").setup {} end
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Rust
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
|
||||||
|
-- Useful plugin to show you pending keybinds.
|
||||||
|
-- { 'folke/which-key.nvim', opts = {} },
|
||||||
|
--{
|
||||||
|
-- -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
-- 'lewis6991/gitsigns.nvim',
|
||||||
|
-- opts = {
|
||||||
|
-- -- See `:help gitsigns.txt`
|
||||||
|
-- signs = {
|
||||||
|
-- add = { text = '+' },
|
||||||
|
-- change = { text = '~' },
|
||||||
|
-- delete = { text = '_' },
|
||||||
|
-- topdelete = { text = '‾' },
|
||||||
|
-- changedelete = { text = '~' },
|
||||||
|
-- },
|
||||||
|
-- on_attach = function(bufnr)
|
||||||
|
-- local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
-- local function map(mode, l, r, opts)
|
||||||
|
-- opts = opts or {}
|
||||||
|
-- opts.buffer = bufnr
|
||||||
|
-- vim.keymap.set(mode, l, r, opts)
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- -- Navigation
|
||||||
|
-- map({ 'n', 'v' }, ']c', function()
|
||||||
|
-- if vim.wo.diff then
|
||||||
|
-- return ']c'
|
||||||
|
-- end
|
||||||
|
-- vim.schedule(function()
|
||||||
|
-- gs.next_hunk()
|
||||||
|
-- end)
|
||||||
|
-- return '<Ignore>'
|
||||||
|
-- end, { expr = true, desc = 'Jump to next hunk' })
|
||||||
|
|
||||||
|
-- map({ 'n', 'v' }, '[c', function()
|
||||||
|
-- if vim.wo.diff then
|
||||||
|
-- return '[c'
|
||||||
|
-- end
|
||||||
|
-- vim.schedule(function()
|
||||||
|
-- gs.prev_hunk()
|
||||||
|
-- end)
|
||||||
|
-- return '<Ignore>'
|
||||||
|
-- end, { expr = true, desc = 'Jump to previous hunk' })
|
||||||
|
|
||||||
|
-- -- Actions
|
||||||
|
-- -- visual mode
|
||||||
|
-- map('v', '<leader>hs', function()
|
||||||
|
-- gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
-- end, { desc = 'stage git hunk' })
|
||||||
|
-- map('v', '<leader>hr', function()
|
||||||
|
-- gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||||
|
-- end, { desc = 'reset git hunk' })
|
||||||
|
-- -- normal mode
|
||||||
|
-- map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
|
||||||
|
-- map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
|
||||||
|
-- map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
|
||||||
|
-- map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
|
||||||
|
-- map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
|
||||||
|
-- map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
|
||||||
|
-- map('n', '<leader>hb', function()
|
||||||
|
-- gs.blame_line { full = false }
|
||||||
|
-- end, { desc = 'git blame line' })
|
||||||
|
-- map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
|
||||||
|
-- map('n', '<leader>hD', function()
|
||||||
|
-- gs.diffthis '~'
|
||||||
|
-- end, { desc = 'git diff against last commit' })
|
||||||
|
|
||||||
|
-- -- Toggles
|
||||||
|
-- map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
|
||||||
|
-- map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
|
||||||
|
|
||||||
|
-- -- Text object
|
||||||
|
-- map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
--},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Theme inspired by Atom
|
||||||
|
'navarasu/onedark.nvim',
|
||||||
|
priority = 1000,
|
||||||
|
lazy = false,
|
||||||
|
config = function()
|
||||||
|
require('onedark').setup {
|
||||||
|
-- Set a style preset. 'dark' is default.
|
||||||
|
style = 'dark', -- dark, darker, cool, deep, warm, warmer, light
|
||||||
|
}
|
||||||
|
require('onedark').load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- bar
|
||||||
|
--{
|
||||||
|
-- -- Set lualine as statusline
|
||||||
|
-- 'nvim-lualine/lualine.nvim',
|
||||||
|
-- -- See `:help lualine.txt`
|
||||||
|
-- opts = {
|
||||||
|
-- options = {
|
||||||
|
-- icons_enabled = false,
|
||||||
|
-- theme = 'auto',
|
||||||
|
-- component_separators = '|',
|
||||||
|
-- section_separators = '',
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
--},
|
||||||
|
|
||||||
|
-- coloration and indentation
|
||||||
|
--{
|
||||||
|
-- -- Add indentation guides even on blank lines
|
||||||
|
-- 'lukas-reineke/indent-blankline.nvim',
|
||||||
|
-- -- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
|
-- -- See `:help ibl`
|
||||||
|
-- main = 'ibl',
|
||||||
|
-- opts = {},
|
||||||
|
--},
|
||||||
|
|
||||||
|
-- `gcc` - Toggles the current line using linewise comment
|
||||||
|
-- `gbc` - Toggles the current line using blockwise comment
|
||||||
|
-- `[count]gcc` - Toggles the number of line given as a prefix-count using linewise
|
||||||
|
-- `[count]gbc` - Toggles the number of line given as a prefix-count using blockwise
|
||||||
|
-- `gc[count]{motion}` - (Op-pending) Toggles the region using linewise comment
|
||||||
|
-- `gb[count]{motion}` - (Op-pending) Toggles the region using blockwise comment
|
||||||
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
|
|
||||||
|
-- Fuzzy Finder (files, lsp, etc)
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
branch = '0.1.x',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||||
|
-- Only load if `make` is available. Make sure you have the system
|
||||||
|
-- requirements installed.
|
||||||
|
{
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
-- NOTE: If you are having trouble with this installation,
|
||||||
|
-- refer to the README for telescope-fzf-native for more instructions.
|
||||||
|
build = 'make',
|
||||||
|
cond = function()
|
||||||
|
return vim.fn.executable 'make' == 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
},
|
||||||
|
build = ':TSUpdate',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
|
||||||
|
-- These are some example plugins that I've included in the kickstart repository.
|
||||||
|
-- Uncomment any of the lines below to enable them.
|
||||||
|
-- require 'kickstart.plugins.autoformat',
|
||||||
|
-- require 'kickstart.plugins.debug',
|
||||||
|
|
||||||
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
|
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
|
||||||
|
-- up-to-date with whatever is in the kickstart repo.
|
||||||
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
|
--
|
||||||
|
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||||
|
-- { import = 'custom.plugins' },
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
-- Keymaps for better default experience
|
||||||
|
-- See `:help vim.keymap.set()`
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
||||||
|
|
||||||
|
-- Remap for dealing with word wrap
|
||||||
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
|
||||||
|
vim.keymap.set('n', '<leader>d', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||||
|
|
||||||
|
-- [[ Highlight on yank ]]
|
||||||
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
--local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||||
|
--vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.highlight.on_yank()
|
||||||
|
-- end,
|
||||||
|
-- group = highlight_group,
|
||||||
|
-- pattern = '*',
|
||||||
|
--})
|
||||||
|
|
||||||
|
-- Enable telescope fzf native, if installed
|
||||||
|
pcall(require('telescope').load_extension, 'fzf')
|
||||||
|
|
||||||
|
-- Telescope live_grep in git root
|
||||||
|
-- Function to find the git root directory based on the current buffer's path
|
||||||
|
local function find_git_root()
|
||||||
|
-- Use the current buffer's path as the starting point for the git search
|
||||||
|
local current_file = vim.api.nvim_buf_get_name(0)
|
||||||
|
local current_dir
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
-- If the buffer is not associated with a file, return nil
|
||||||
|
if current_file == '' then
|
||||||
|
current_dir = cwd
|
||||||
|
else
|
||||||
|
-- Extract the directory from the current file's path
|
||||||
|
current_dir = vim.fn.fnamemodify(current_file, ':h')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find the Git root directory from the current file's path
|
||||||
|
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
print 'Not a git repository. Searching on current working directory'
|
||||||
|
return cwd
|
||||||
|
end
|
||||||
|
return git_root
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Custom live_grep function to search in git root
|
||||||
|
local function live_grep_git_root()
|
||||||
|
local git_root = find_git_root()
|
||||||
|
if git_root then
|
||||||
|
require('telescope.builtin').live_grep {
|
||||||
|
search_dirs = { git_root },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
||||||
|
|
||||||
|
-- See `:help telescope.builtin`
|
||||||
|
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||||
|
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
vim.keymap.set('n', '<leader>/', function()
|
||||||
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||||
|
require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||||
|
winblend = 10,
|
||||||
|
previewer = false,
|
||||||
|
})
|
||||||
|
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||||
|
|
||||||
|
local function telescope_live_grep_open_files()
|
||||||
|
require('telescope.builtin').live_grep {
|
||||||
|
grep_open_files = true,
|
||||||
|
prompt_title = 'Live Grep in Open Files',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
vim.keymap.set('n', '<leader>s/', telescope_live_grep_open_files, { desc = '[S]earch [/] in Open Files' })
|
||||||
|
vim.keymap.set('n', '<leader>ss', require('telescope.builtin').builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||||
|
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||||
|
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||||
|
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
|
vim.keymap.set('n', '<leader>sG', ':LiveGrepGitRoot<cr>', { desc = '[S]earch by [G]rep on Git Root' })
|
||||||
|
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
|
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||||
|
|
||||||
|
-- [[ Configure Treesitter ]]
|
||||||
|
-- See `:help nvim-treesitter`
|
||||||
|
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
|
||||||
|
vim.defer_fn(function()
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
|
ensure_installed = { 'rust', 'vimdoc', 'vim', 'bash' },
|
||||||
|
|
||||||
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
|
auto_install = false,
|
||||||
|
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
-- List of parsers to ignore installing
|
||||||
|
ignore_install = {},
|
||||||
|
-- You can specify additional Treesitter modules here: -- For example: -- playground = {--enable = true,-- },
|
||||||
|
modules = {},
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = '<c-space>',
|
||||||
|
node_incremental = '<c-space>',
|
||||||
|
scope_incremental = '<c-s>',
|
||||||
|
node_decremental = '<M-space>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
['aa'] = '@parameter.outer',
|
||||||
|
['ia'] = '@parameter.inner',
|
||||||
|
['af'] = '@function.outer',
|
||||||
|
['if'] = '@function.inner',
|
||||||
|
['ac'] = '@class.outer',
|
||||||
|
['ic'] = '@class.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true, -- whether to set jumps in the jumplist
|
||||||
|
goto_next_start = {
|
||||||
|
[']m'] = '@function.outer',
|
||||||
|
[']]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
[']M'] = '@function.outer',
|
||||||
|
[']['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
['[m'] = '@function.outer',
|
||||||
|
['[['] = '@class.outer',
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
['[M'] = '@function.outer',
|
||||||
|
['[]'] = '@class.outer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
['<leader>a'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
['<leader>A'] = '@parameter.inner',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end, 0)
|
||||||
|
|
||||||
|
-- [[ Configure LSP ]]
|
||||||
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
|
local on_attach = function(_, bufnr)
|
||||||
|
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||||
|
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||||
|
-- many times.
|
||||||
|
--
|
||||||
|
-- In this case, we create a function that lets us more easily define mappings specific
|
||||||
|
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||||
|
local nmap = function(keys, func, desc)
|
||||||
|
if desc then
|
||||||
|
desc = 'LSP: ' .. desc
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
|
nmap('<leader>ca', function()
|
||||||
|
vim.lsp.buf.code_action { context = { only = { 'quickfix', 'refactor', 'source' } } }
|
||||||
|
end, '[C]ode [A]ction')
|
||||||
|
|
||||||
|
nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||||
|
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
|
nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||||
|
nmap('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||||
|
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
|
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
|
-- See `:help K` for why this keymap
|
||||||
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
|
-- Lesser used LSP functionality
|
||||||
|
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>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||||
|
nmap('<leader>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, '[W]orkspace [L]ist Folders')
|
||||||
|
|
||||||
|
-- Create a command `:Format` local to the LSP buffer
|
||||||
|
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- document existing key chains
|
||||||
|
-- require('which-key').register {
|
||||||
|
-- ['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
|
||||||
|
-- ['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
|
||||||
|
-- }
|
||||||
|
-- -- register which-key VISUAL mode
|
||||||
|
-- -- required for visual <leader>hs (hunk stage) to work
|
||||||
|
-- require('which-key').register({
|
||||||
|
-- ['<leader>'] = { name = 'VISUAL <leader>' },
|
||||||
|
-- ['<leader>h'] = { 'Git [H]unk' },
|
||||||
|
-- }, { mode = 'v' })
|
||||||
|
|
||||||
|
-- mason-lspconfig requires that these setup functions are called in this order
|
||||||
|
-- before setting up the servers.
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
|
-- vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
|
||||||
|
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
-- group = "LspAttach_inlayhints",
|
||||||
|
-- callback = function(args)
|
||||||
|
-- if not (args.data and args.data.client_id) then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
-- local bufnr = args.buf
|
||||||
|
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
-- require("lsp-inlayhints").on_attach(client, bufnr)
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- rust
|
||||||
|
require("rust-tools").setup({
|
||||||
|
tools = {
|
||||||
|
inlay_hints = {
|
||||||
|
auto = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||||
|
callback = function(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
if client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.inlay_hint.enable(true, { 0 })
|
||||||
|
end
|
||||||
|
-- whatever other lsp config you want
|
||||||
|
end
|
||||||
|
})
|
||||||
|
-- toggle inlay hint
|
||||||
|
vim.keymap.set("n", "<leader>ri", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({0}), {0}) end)
|
||||||
|
|
||||||
|
-- Enable the following language servers
|
||||||
|
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||||
|
--
|
||||||
|
-- Add any additional override configuration in the following tables. They will be passed to
|
||||||
|
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||||
|
--
|
||||||
|
-- If you want to override the default filetypes that your language server will attach to you can
|
||||||
|
-- define the property 'filetypes' to the map in question.
|
||||||
|
local servers = {
|
||||||
|
-- clangd = {},
|
||||||
|
-- gopls = {},
|
||||||
|
-- pyright = {},
|
||||||
|
rust_analyzer = {
|
||||||
|
imports = {
|
||||||
|
granularity = {
|
||||||
|
group = "module",
|
||||||
|
},
|
||||||
|
prefix = "self",
|
||||||
|
},
|
||||||
|
cargo = {
|
||||||
|
buildScripts = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
experimental = {
|
||||||
|
enable = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- tsserver = {},
|
||||||
|
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
|
||||||
|
|
||||||
|
lua_ls = {
|
||||||
|
Lua = {
|
||||||
|
workspace = { checkThirdParty = false },
|
||||||
|
telemetry = { enable = false },
|
||||||
|
-- NOTE: toggle below to ignore Lua_LS's noisy `missing-fields` warnings
|
||||||
|
-- diagnostics = { disable = { 'missing-fields' } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Setup neovim lua configuration
|
||||||
|
require('neodev').setup()
|
||||||
|
|
||||||
|
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
|
|
||||||
|
-- Ensure the servers above are installed
|
||||||
|
local mason_lspconfig = require 'mason-lspconfig'
|
||||||
|
|
||||||
|
mason_lspconfig.setup {
|
||||||
|
ensure_installed = vim.tbl_keys(servers),
|
||||||
|
-- ensure_installed = { "rust-analyzer" }
|
||||||
|
}
|
||||||
|
|
||||||
|
mason_lspconfig.setup_handlers {
|
||||||
|
function(server_name)
|
||||||
|
require('lspconfig')[server_name].setup {
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = servers[server_name],
|
||||||
|
filetypes = (servers[server_name] or {}).filetypes,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- [[ Configure nvim-cmp ]]
|
||||||
|
-- See `:help cmp`
|
||||||
|
local cmp = require 'cmp'
|
||||||
|
local luasnip = require 'luasnip'
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
luasnip.config.setup {}
|
||||||
|
|
||||||
|
cmp.setup {
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
completeopt = 'menu,menuone,noinsert',
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert {
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete {},
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_locally_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' }),
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
},
|
||||||
|
}
|
28
nvim/lazy-lock.json
Normal file
28
nvim/lazy-lock.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
|
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
|
||||||
|
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "482350b050bd413931c2cdd4857443c3da7d57cb" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||||
|
"mini.files": { "branch": "main", "commit": "2e262838a773c0bc3ccbc9c4bcf4a1a012497ea2" },
|
||||||
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
|
"nvim-autopairs": { "branch": "master", "commit": "19606af7c039271d5aa96bceff101e7523af3136" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "6bfd9210e312af6cfedba05d272e85618c93ab0d" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "585860a1865853d2c287c8ef534297da8115818e" },
|
||||||
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "41e3abf6bfd9a9a681eb1f788bdeba91c9004b2b" },
|
||||||
|
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "ec289423a1693aeae6cd0d503bac2856af74edaa" },
|
||||||
|
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||||
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "0444df68cd1cdabc7453d6bd84099458327e5513" },
|
||||||
|
"vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }
|
||||||
|
}
|
93
nvim/lua/packer-plugins.lua
Normal file
93
nvim/lua/packer-plugins.lua
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
return require('packer').startup(function()
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
use 'sonph/onehalf'
|
||||||
|
use 'navarasu/onedark.nvim'
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim', tag = '0.1.4',
|
||||||
|
-- or , branch = '0.1.x',
|
||||||
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
|
}
|
||||||
|
|
||||||
|
require('onedark').setup {
|
||||||
|
style = 'darker'
|
||||||
|
}
|
||||||
|
require('onedark').load()
|
||||||
|
-- use({
|
||||||
|
-- 'rose-pine/neovim',
|
||||||
|
-- as = 'rose-pine',
|
||||||
|
-- config = function()
|
||||||
|
-- vim.cmd('colorscheme rose-pine')
|
||||||
|
-- end
|
||||||
|
-- })
|
||||||
|
|
||||||
|
use {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
'neovim/nvim-lspconfig'
|
||||||
|
}
|
||||||
|
use 'hrsh7th/nvim-cmp' -- Autocompletion plugin
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp' -- Autocompletion with LSPs
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
|
||||||
|
use {'neoclide/coc.nvim', branch = 'release'}
|
||||||
|
|
||||||
|
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||||
|
|
||||||
|
--use {
|
||||||
|
-- 'VonHeikemen/lsp-zero.nvim',
|
||||||
|
-- branch = 'v2.x',
|
||||||
|
-- requires = {
|
||||||
|
-- -- LSP Support
|
||||||
|
-- {'neovim/nvim-lspconfig'},
|
||||||
|
-- {'williamboman/mason.nvim', run = function()
|
||||||
|
-- pcall(vim.cmd, 'MasonUpdate')
|
||||||
|
-- end,},
|
||||||
|
-- {'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||||
|
|
||||||
|
-- -- Autocompletion
|
||||||
|
-- {'hrsh7th/nvim-cmp'}, -- Required
|
||||||
|
-- {'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||||
|
-- {'L3MON4D3/LuaSnip'}, -- Required
|
||||||
|
-- }
|
||||||
|
--}
|
||||||
|
|
||||||
|
-- Auto pairs
|
||||||
|
use {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function() require("nvim-autopairs").setup {} end
|
||||||
|
}
|
||||||
|
|
||||||
|
--harpoon
|
||||||
|
use("theprimeagen/harpoon")
|
||||||
|
|
||||||
|
---- neogen
|
||||||
|
--local i = require("neogen.types.template").item
|
||||||
|
--local annotation = {
|
||||||
|
-- { nil, "/**", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "** \\file", { no_results = true, type = { "file" } } },
|
||||||
|
-- { nil, "** \\brief $1", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "*/", { no_results = true, type = { "func", "file", "class" } } },
|
||||||
|
-- { nil, "", { no_results = true, type = { "file" } } },
|
||||||
|
|
||||||
|
-- { nil, "/**", { type = { "func", "class", "type" } } },
|
||||||
|
-- { i.ClassName, "** @class %s", { type = { "class" } } },
|
||||||
|
-- { i.Type, "** @typedef %s", { type = { "type" } } },
|
||||||
|
-- { nil, "** \\brief $1", { type = { "func", "class", "type" } } },
|
||||||
|
-- { nil, "**", { type = { "func", "class", "type" } } },
|
||||||
|
-- { i.Tparam, "** \\tparam %s $1" },
|
||||||
|
-- { i.Parameter, "** \\param %s $1" },
|
||||||
|
-- { i.Return, "** \\return $1" },
|
||||||
|
-- { nil, "*/", { type = { "func", "class", "type" } } },
|
||||||
|
--}
|
||||||
|
--require("neogen").setup({
|
||||||
|
-- languages = {
|
||||||
|
-- c = {
|
||||||
|
-- template = {
|
||||||
|
-- annotation_convention = "my_annotation",
|
||||||
|
-- my_annotation = annotation
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
--})
|
||||||
|
end)
|
11
nvim/plugin/harpoon.lua
Normal file
11
nvim/plugin/harpoon.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local harpoon = require("harpoon")
|
||||||
|
harpoon:setup()
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<leader>q", function() harpoon:list().append() end)
|
||||||
|
-- vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "<M-q>", function() harpoon:list():select(1) end)
|
||||||
|
-- vim.keymap.set("n", "<M-w>", function() harpoon:list():select(2) end)
|
||||||
|
-- vim.keymap.set("n", "<M-e>", function() harpoon:list():select(3) end)
|
||||||
|
-- vim.keymap.set("n", "<M-r>", function() harpoon:list():select(4) end)
|
||||||
|
-- vim.keymap.set("n", "<M-t>", function() harpoon:list():select(5) end)
|
52
nvim/plugin/minifiles.lua
Normal file
52
nvim/plugin/minifiles.lua
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
require('mini.files').setup({
|
||||||
|
-- Customization of shown content
|
||||||
|
content = {
|
||||||
|
-- Predicate for which file system entries to show
|
||||||
|
filter = nil,
|
||||||
|
-- What prefix to show to the left of file system entry
|
||||||
|
prefix = nil,
|
||||||
|
-- In which order to show file system entries
|
||||||
|
sort = nil,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Module mappings created only inside explorer.
|
||||||
|
-- Use `''` (empty string) to not create one.
|
||||||
|
mappings = {
|
||||||
|
close = 'q',
|
||||||
|
go_in = 'l',
|
||||||
|
go_in_plus = 'L',
|
||||||
|
go_out = 'h',
|
||||||
|
go_out_plus = 'H',
|
||||||
|
reset = '<BS>',
|
||||||
|
reveal_cwd = '@',
|
||||||
|
show_help = 'g?',
|
||||||
|
synchronize = '=',
|
||||||
|
trim_left = '<',
|
||||||
|
trim_right = '>',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- General options
|
||||||
|
options = {
|
||||||
|
-- Whether to delete permanently or move into module-specific trash
|
||||||
|
permanent_delete = true,
|
||||||
|
-- Whether to use for editing directories
|
||||||
|
use_as_default_explorer = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Customization of explorer windows
|
||||||
|
windows = {
|
||||||
|
-- Maximum number of windows to show side by side
|
||||||
|
max_number = math.huge,
|
||||||
|
-- Whether to show preview of file/directory under cursor
|
||||||
|
preview = false,
|
||||||
|
-- Width of focused window
|
||||||
|
width_focus = 50,
|
||||||
|
-- Width of non-focused window
|
||||||
|
width_nofocus = 15,
|
||||||
|
-- Width of preview window
|
||||||
|
width_preview = 25,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "-", '<CMD>lua MiniFiles.open(vim.api.nvim_buf_get_name(0)); MiniFiles.reveal_cwd()<CR>', { desc = 'Open MiniFiles' })
|
||||||
|
vim.keymap.set("n", "<ESC>", '<CMD>lua MiniFiles.close()<CR>', { desc = 'Close MiniFiles' })
|
50
nvim/plugin/rustaceanvim.lua
Normal file
50
nvim/plugin/rustaceanvim.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
-- vim.g.auto_ra_attach = true
|
||||||
|
--
|
||||||
|
-- vim.g.rustaceanvim = {
|
||||||
|
-- -- Plugin configuration
|
||||||
|
-- tools = {},
|
||||||
|
-- -- LSP configuration
|
||||||
|
-- ---@type RustaceanLspClientOpts
|
||||||
|
-- server = {
|
||||||
|
-- load_vscode_settings = true,
|
||||||
|
-- auto_attach = function(bufnr)
|
||||||
|
-- return vim.g.auto_ra_attach
|
||||||
|
-- end,
|
||||||
|
-- on_attach = function(client, _)
|
||||||
|
-- client.server_capabilities.workspace.didChangeWatchedFiles = {
|
||||||
|
-- dynamicRegistration = false,
|
||||||
|
-- relativePatternSupport = false,
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||||
|
-- desc = 'Resize splits when resizing the window',
|
||||||
|
-- pattern = { '*.rs' },
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.cmd('RustAnalyzer reloadSettings')
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- default_settings = {
|
||||||
|
-- ['rust-analyzer'] = {
|
||||||
|
-- cachePriming = false,
|
||||||
|
-- rustfmt = {
|
||||||
|
-- extraArgs = {
|
||||||
|
-- '--config',
|
||||||
|
-- 'comment_width=120,condense_wildcard_suffixes=false,format_code_in_doc_comments=true,format_macro_bodies=true,hex_literal_case=Upper,imports_granularity=One,normalize_doc_attributes=true,wrap_comments=true',
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- -- DAP configuration
|
||||||
|
-- dap = {},
|
||||||
|
-- }
|
||||||
|
--
|
||||||
|
-- return {
|
||||||
|
-- {
|
||||||
|
-- 'mrcjkb/rustaceanvim',
|
||||||
|
-- version = '^4', -- Recommended
|
||||||
|
-- ft = { 'rust' },
|
||||||
|
-- dev = true,
|
||||||
|
-- },
|
||||||
|
-- }
|
18
nvim/plugin/telescope.lua
Normal file
18
nvim/plugin/telescope.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
-- [[ Configure Telescope ]]
|
||||||
|
-- See `:help telescope` and `:help telescope.setup()`
|
||||||
|
require('telescope').setup {
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
['<C-u>'] = false,
|
||||||
|
['<C-d>'] = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
||||||
|
vim.keymap.set('n', '<leader>pg', builtin.live_grep, {noremap = true})
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.git_files, {noremap = true})
|
184
nvim/plugin_back/coc.lua
Normal file
184
nvim/plugin_back/coc.lua
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
-- Some servers have issues with backup files, see #649
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.writebackup = false
|
||||||
|
|
||||||
|
-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
|
||||||
|
-- delays and poor user experience
|
||||||
|
vim.opt.updatetime = 300
|
||||||
|
|
||||||
|
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
-- diagnostics appeared/became resolved
|
||||||
|
vim.opt.signcolumn = "yes"
|
||||||
|
|
||||||
|
local keyset = vim.keymap.set
|
||||||
|
-- Autocomplete
|
||||||
|
function _G.check_back_space()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use Tab for trigger completion with characters ahead and navigate
|
||||||
|
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||||
|
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||||
|
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||||
|
-- other plugins before putting this into your config
|
||||||
|
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||||
|
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||||
|
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||||
|
|
||||||
|
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||||
|
-- <C-g>u breaks current undo, please make your own choice
|
||||||
|
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||||
|
|
||||||
|
-- Use <c-j> to trigger snippets
|
||||||
|
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
|
||||||
|
-- Use <c-space> to trigger completion
|
||||||
|
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
|
||||||
|
|
||||||
|
-- Use `[g` and `]g` to navigate diagnostics
|
||||||
|
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||||
|
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||||
|
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||||
|
|
||||||
|
-- GoTo code navigation
|
||||||
|
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||||
|
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||||
|
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||||
|
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Use K to show documentation in preview window
|
||||||
|
function _G.show_docs()
|
||||||
|
local cw = vim.fn.expand('<cword>')
|
||||||
|
if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
|
||||||
|
vim.api.nvim_command('h ' .. cw)
|
||||||
|
elseif vim.api.nvim_eval('coc#rpc#ready()') then
|
||||||
|
vim.fn.CocActionAsync('doHover')
|
||||||
|
else
|
||||||
|
vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
|
||||||
|
vim.api.nvim_create_augroup("CocGroup", {})
|
||||||
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
|
group = "CocGroup",
|
||||||
|
command = "silent call CocActionAsync('highlight')",
|
||||||
|
desc = "Highlight symbol under cursor on CursorHold"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Symbol renaming
|
||||||
|
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Formatting selected code
|
||||||
|
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Setup formatexpr specified filetype(s)
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "typescript,json",
|
||||||
|
command = "setl formatexpr=CocAction('formatSelected')",
|
||||||
|
desc = "Setup formatexpr specified filetype(s)."
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Update signature help on jump placeholder
|
||||||
|
vim.api.nvim_create_autocmd("User", {
|
||||||
|
group = "CocGroup",
|
||||||
|
pattern = "CocJumpPlaceholder",
|
||||||
|
command = "call CocActionAsync('showSignatureHelp')",
|
||||||
|
desc = "Update signature help on jump placeholder"
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Apply codeAction to the selected region
|
||||||
|
-- Example: `<leader>aap` for current paragraph
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply code actions at the cursor position.
|
||||||
|
keyset("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", opts)
|
||||||
|
-- Remap keys for apply source code actions for current file.
|
||||||
|
keyset("n", "<leader>as", "<Plug>(coc-codeaction-source)", opts)
|
||||||
|
-- Apply the most preferred quickfix action on the current line.
|
||||||
|
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)
|
||||||
|
|
||||||
|
-- Remap keys for apply refactor code actions.
|
||||||
|
keyset("n", "<leader>re", "<Plug>(coc-codeaction-refactor)", { silent = true })
|
||||||
|
keyset("x", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
keyset("n", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
|
||||||
|
|
||||||
|
-- Run the Code Lens actions on the current line
|
||||||
|
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Map function and class text objects
|
||||||
|
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||||
|
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||||
|
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||||
|
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||||
|
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Remap <C-f> and <C-b> to scroll float windows/popups
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true, expr = true}
|
||||||
|
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
keyset("i", "<C-f>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
|
||||||
|
keyset("i", "<C-b>",
|
||||||
|
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
|
||||||
|
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||||
|
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||||
|
|
||||||
|
|
||||||
|
-- Use CTRL-S for selections ranges
|
||||||
|
-- Requires 'textDocument/selectionRange' support of language server
|
||||||
|
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||||
|
|
||||||
|
|
||||||
|
-- Add `:Format` command to format current buffer
|
||||||
|
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
||||||
|
|
||||||
|
-- " Add `:Fold` command to fold current buffer
|
||||||
|
vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
|
||||||
|
|
||||||
|
-- Add `:OR` command for organize imports of the current buffer
|
||||||
|
vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
|
||||||
|
|
||||||
|
-- Add (Neo)Vim's native statusline support
|
||||||
|
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||||
|
-- provide custom statusline: lightline.vim, vim-airline
|
||||||
|
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
|
||||||
|
|
||||||
|
-- Mappings for CoCList
|
||||||
|
-- code actions and coc stuff
|
||||||
|
---@diagnostic disable-next-line: redefined-local
|
||||||
|
local opts = {silent = true, nowait = true}
|
||||||
|
-- Show all diagnostics
|
||||||
|
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
|
||||||
|
-- Manage extensions
|
||||||
|
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
|
||||||
|
-- Show commands
|
||||||
|
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
|
||||||
|
-- Find symbol of current document
|
||||||
|
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
|
||||||
|
-- Search workspace symbols
|
||||||
|
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
|
||||||
|
-- Do default action for next item
|
||||||
|
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
|
||||||
|
-- Do default action for previous item
|
||||||
|
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
|
||||||
|
-- Resume latest coc list
|
||||||
|
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)
|
11
nvim/plugin_back/harpoon.lua
Normal file
11
nvim/plugin_back/harpoon.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local mark = require("harpoon.mark")
|
||||||
|
local ui = require("harpoon.ui")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>q", mark.add_file)
|
||||||
|
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<M-q>", function() ui.nav_file(1) end)
|
||||||
|
vim.keymap.set("n", "<M-w>", function() ui.nav_file(2) end)
|
||||||
|
vim.keymap.set("n", "<M-e>", function() ui.nav_file(3) end)
|
||||||
|
vim.keymap.set("n", "<M-r>", function() ui.nav_file(4) end)
|
||||||
|
vim.keymap.set("n", "<M-t>", function() ui.nav_file(5) end)
|
117
nvim/plugin_back/lsp.lua
Normal file
117
nvim/plugin_back/lsp.lua
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
-- Initialize Mason and specify which language servers to install
|
||||||
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensured_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Define lspconfig settings for rust_analyzer
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = { buffer = bufnr, remap = false }
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--
|
||||||
|
---- Configure autocomplete using nvim-cmp
|
||||||
|
--local cmp = require("cmp")
|
||||||
|
--cmp.setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
-- ["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- --completion = cmp.config.window.bordered(),
|
||||||
|
-- --documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
---- Set up Rust Analyzer
|
||||||
|
--local lspconfig = require('lspconfig')
|
||||||
|
--lspconfig.rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
--vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||||
|
--vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
|
--vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||||
|
---- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
|
|
||||||
|
-- old
|
||||||
|
--require("mason").setup()
|
||||||
|
--require("mason-lspconfig").setup({
|
||||||
|
-- ensure_installed = { "rust_analyzer" }
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--local on_attach = function(_, _)
|
||||||
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
--end
|
||||||
|
--
|
||||||
|
--local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
--require("configs.nvim-cmp")
|
||||||
|
--require('nvim-cmp').setup{}
|
||||||
|
--require('cmp').setup({
|
||||||
|
-- mapping = {
|
||||||
|
-- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
-- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
-- ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
-- ['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
-- },
|
||||||
|
-- sources = {
|
||||||
|
-- { name = 'nvim_lsp' },
|
||||||
|
-- { name = 'buffer' },
|
||||||
|
-- { name = 'path' },
|
||||||
|
-- },
|
||||||
|
-- experimental = { ghost_text = false },
|
||||||
|
-- formatting = { fields = { 'menu', 'abbr', 'kind' } },
|
||||||
|
-- confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, select = false },
|
||||||
|
-- window = {
|
||||||
|
-- completion = cmp.config.window.bordered(),
|
||||||
|
-- documentation = cmp.config.window.bordered(),
|
||||||
|
-- },
|
||||||
|
-- capabilities = capabilities,
|
||||||
|
--})
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--require("lspconfig").rust_analyzer.setup {
|
||||||
|
-- capabilities = capabilities
|
||||||
|
-- on_attach = on_attach
|
||||||
|
--}
|
||||||
|
|
||||||
|
--local lsp = require('lsp-zero').preset({})
|
||||||
|
--
|
||||||
|
-- lsp.on_attach(function(client, bufnr)
|
||||||
|
-- local opts = {buffer = bufnr, remap = false}
|
||||||
|
--
|
||||||
|
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
|
-- end)
|
||||||
|
--
|
||||||
|
----lsp['rust_analyzer'].setup({
|
||||||
|
---- capabilities = capabilities,
|
||||||
|
---- on_attach = on_attach
|
||||||
|
----})
|
||||||
|
--
|
||||||
|
--lsp.ensure_installed({
|
||||||
|
-- 'tsserver',
|
||||||
|
-- 'eslint',
|
||||||
|
-- 'rust_analyzer'
|
||||||
|
--})
|
||||||
|
--lsp.setup()
|
||||||
|
----lsp.rust_analyzer.setup()
|
5
nvim/plugin_back/neogen.lua
Executable file
5
nvim/plugin_back/neogen.lua
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
--require('neogen').generate()
|
||||||
|
--local opts = { noremap = true, silent = true }
|
||||||
|
--
|
||||||
|
--vim.api.nvim_set_keymap("n", "<Leader>nf", ":lua require('neogen').generate()<CR>", opts)
|
||||||
|
|
179
nvim/plugin_back/packer_compiled.lua
Normal file
179
nvim/plugin_back/packer_compiled.lua
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
-- Automatically generated packer.nvim plugin loader code
|
||||||
|
|
||||||
|
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||||
|
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_command('packadd packer.nvim')
|
||||||
|
|
||||||
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.inside_compile = true
|
||||||
|
|
||||||
|
local time
|
||||||
|
local profile_info
|
||||||
|
local should_profile = false
|
||||||
|
if should_profile then
|
||||||
|
local hrtime = vim.loop.hrtime
|
||||||
|
profile_info = {}
|
||||||
|
time = function(chunk, start)
|
||||||
|
if start then
|
||||||
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function save_profiles(threshold)
|
||||||
|
local sorted_times = {}
|
||||||
|
for chunk_name, time_taken in pairs(profile_info) do
|
||||||
|
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||||
|
end
|
||||||
|
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||||
|
local results = {}
|
||||||
|
for i, elem in ipairs(sorted_times) do
|
||||||
|
if not threshold or threshold and elem[2] > threshold then
|
||||||
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if threshold then
|
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||||
|
end
|
||||||
|
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/share/lua/5.1/?/init.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?.lua;/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/grimhilt/.cache/nvim/packer_hererocks/2.1.1693350652/lib/lua/5.1/?.so"
|
||||||
|
if not string.find(package.path, package_path_str, 1, true) then
|
||||||
|
package.path = package.path .. ';' .. package_path_str
|
||||||
|
end
|
||||||
|
|
||||||
|
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||||
|
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], false)
|
||||||
|
time([[try_loadstring definition]], true)
|
||||||
|
local function try_loadstring(s, component, name)
|
||||||
|
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||||
|
if not success then
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[try_loadstring definition]], false)
|
||||||
|
time([[Defining packer_plugins]], true)
|
||||||
|
_G.packer_plugins = {
|
||||||
|
["cmp-buffer"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
["coc.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/coc.nvim",
|
||||||
|
url = "https://github.com/neoclide/coc.nvim"
|
||||||
|
},
|
||||||
|
harpoon = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||||
|
url = "https://github.com/theprimeagen/harpoon"
|
||||||
|
},
|
||||||
|
["mason-lspconfig.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
["mason.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
["nvim-autopairs"] = {
|
||||||
|
config = { "\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0" },
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||||
|
url = "https://github.com/windwp/nvim-autopairs"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-treesitter"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
["onedark.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onedark.nvim",
|
||||||
|
url = "https://github.com/navarasu/onedark.nvim"
|
||||||
|
},
|
||||||
|
onehalf = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/onehalf",
|
||||||
|
url = "https://github.com/sonph/onehalf"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||||
|
url = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/grimhilt/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], false)
|
||||||
|
-- Config for: nvim-autopairs
|
||||||
|
time([[Config for nvim-autopairs]], true)
|
||||||
|
try_loadstring("\27LJ\2\n@\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\19nvim-autopairs\frequire\0", "config", "nvim-autopairs")
|
||||||
|
time([[Config for nvim-autopairs]], false)
|
||||||
|
|
||||||
|
_G._packer.inside_compile = false
|
||||||
|
if _G._packer.needs_bufread == true then
|
||||||
|
vim.cmd("doautocmd BufRead")
|
||||||
|
end
|
||||||
|
_G._packer.needs_bufread = false
|
||||||
|
|
||||||
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not no_errors then
|
||||||
|
error_msg = error_msg:gsub('"', '\\"')
|
||||||
|
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||||
|
end
|
4
nvim/plugin_back/telescope.lua
Normal file
4
nvim/plugin_back/telescope.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {noremap = true})
|
||||||
|
vim.keymap.set('n', '<C-p>', builtin.git_files, {noremap = true})
|
35
nvim/plugin_back/treesitter.lua
Normal file
35
nvim/plugin_back/treesitter.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
|
ensure_installed = { "javascript", "typescript", "rust", "c", "lua", "vim", "vimdoc", "query" },
|
||||||
|
|
||||||
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
|
sync_install = false,
|
||||||
|
|
||||||
|
-- Automatically install missing parsers when entering buffer
|
||||||
|
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
|
||||||
|
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||||
|
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||||
|
-- the name of the parser)
|
||||||
|
-- list of language that will be disabled
|
||||||
|
disable = { },
|
||||||
|
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||||
|
disable = function(lang, buf)
|
||||||
|
local max_filesize = 100 * 1024 -- 100 KB
|
||||||
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||||
|
if ok and stats and stats.size > max_filesize then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- 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).
|
||||||
|
-- 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
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user