Switch to lua config
This commit is contained in:
parent
95988b96a7
commit
2c600d25a9
15 changed files with 645 additions and 93 deletions
21
dotfiles/fish/completions/nvm.fish
Normal file
21
dotfiles/fish/completions/nvm.fish
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
complete --command nvm --exclusive
|
||||||
|
complete --command nvm --exclusive --long version --description "Print version"
|
||||||
|
complete --command nvm --exclusive --long help --description "Print help"
|
||||||
|
complete --command nvm --long silent --description "Suppress standard output"
|
||||||
|
|
||||||
|
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version"
|
||||||
|
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate a version in the current shell"
|
||||||
|
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed versions"
|
||||||
|
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List versions available to install matching optional regex"
|
||||||
|
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active version"
|
||||||
|
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "(
|
||||||
|
test -e $nvm_data && string split ' ' <$nvm_data/.index
|
||||||
|
)"
|
||||||
|
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')"
|
||||||
|
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall a version"
|
||||||
|
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "(
|
||||||
|
_nvm_list | string split ' ' | string replace system ''
|
||||||
|
)"
|
||||||
|
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use uninstall" --arguments "(
|
||||||
|
set --query nvm_default_version && echo default
|
||||||
|
)"
|
7
dotfiles/fish/conf.d/fish-ssh-agent.fish
Normal file
7
dotfiles/fish/conf.d/fish-ssh-agent.fish
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
if test -z "$SSH_ENV"
|
||||||
|
set -xg SSH_ENV $HOME/.ssh/environment
|
||||||
|
end
|
||||||
|
|
||||||
|
if not __ssh_agent_is_started
|
||||||
|
__ssh_agent_start
|
||||||
|
end
|
28
dotfiles/fish/conf.d/nvm.fish
Normal file
28
dotfiles/fish/conf.d/nvm.fish
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
function _nvm_install --on-event nvm_install
|
||||||
|
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
|
||||||
|
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
|
||||||
|
set --universal nvm_data $XDG_DATA_HOME/nvm
|
||||||
|
|
||||||
|
test ! -d $nvm_data && command mkdir -p $nvm_data
|
||||||
|
echo "Downloading the Node distribution index..." 2>/dev/null
|
||||||
|
_nvm_index_update
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_update --on-event nvm_update
|
||||||
|
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
|
||||||
|
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
|
||||||
|
set --universal nvm_data $XDG_DATA_HOME/nvm
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_uninstall --on-event nvm_uninstall
|
||||||
|
command rm -rf $nvm_data
|
||||||
|
|
||||||
|
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
|
||||||
|
|
||||||
|
set --names | string replace --filter --regex -- "^nvm" "set --erase nvm" | source
|
||||||
|
functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
|
||||||
|
end
|
||||||
|
|
||||||
|
if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
|
||||||
|
nvm use --silent $nvm_default_version
|
||||||
|
end
|
2
dotfiles/fish/fish_plugins
Normal file
2
dotfiles/fish/fish_plugins
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
danhper/fish-ssh-agent
|
||||||
|
jorgebucaran/nvm.fish
|
|
@ -1,8 +1,10 @@
|
||||||
# This file contains fish universal variable definitions.
|
# This file contains fish universal variable definitions.
|
||||||
# VERSION: 3.0
|
# VERSION: 3.0
|
||||||
SETUVAR __fish_initialized:3400
|
SETUVAR __fish_initialized:3400
|
||||||
SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:/home/digyx/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e/home/digyx/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e/home/digyx/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish
|
SETUVAR _fisher_danhper_2F_fish_2D_ssh_2D_agent_files:\x7e/\x2econfig/fish/functions/__ssh_agent_is_started\x2efish\x1e\x7e/\x2econfig/fish/functions/__ssh_agent_start\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fish\x2dssh\x2dagent\x2efish
|
||||||
SETUVAR _fisher_plugins:danhper/fish\x2dssh\x2dagent
|
SETUVAR _fisher_jorgebucaran_2F_nvm_2E_fish_files:\x7e/\x2econfig/fish/functions/_nvm_index_update\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_list\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_activate\x2efish\x1e\x7e/\x2econfig/fish/functions/_nvm_version_deactivate\x2efish\x1e\x7e/\x2econfig/fish/functions/nvm\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/nvm\x2efish\x1e\x7e/\x2econfig/fish/completions/nvm\x2efish
|
||||||
|
SETUVAR _fisher_plugins:danhper/fish\x2dssh\x2dagent\x1ejorgebucaran/nvm\x2efish
|
||||||
|
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||||
SETUVAR fish_color_autosuggestion:585858
|
SETUVAR fish_color_autosuggestion:585858
|
||||||
SETUVAR fish_color_cancel:\x2dr
|
SETUVAR fish_color_cancel:\x2dr
|
||||||
SETUVAR fish_color_command:a1b56c
|
SETUVAR fish_color_command:a1b56c
|
||||||
|
@ -33,3 +35,5 @@ SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||||
SETUVAR fish_pager_color_selected_background:\x2dr
|
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||||
SETUVAR fish_user_paths:/home/digyx/\x2eyarn/bin\x1e/home/digyx/\x2ecargo/bin
|
SETUVAR fish_user_paths:/home/digyx/\x2eyarn/bin\x1e/home/digyx/\x2ecargo/bin
|
||||||
|
SETUVAR nvm_data:/home/digyx/\x2elocal/share/nvm
|
||||||
|
SETUVAR nvm_mirror:https\x3a//nodejs\x2eorg/dist
|
||||||
|
|
14
dotfiles/fish/functions/__ssh_agent_is_started.fish
Normal file
14
dotfiles/fish/functions/__ssh_agent_is_started.fish
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
function __ssh_agent_is_started -d "check if ssh agent is already started"
|
||||||
|
if begin; test -f $SSH_ENV; and test -z "$SSH_AGENT_PID"; end
|
||||||
|
source $SSH_ENV > /dev/null
|
||||||
|
end
|
||||||
|
|
||||||
|
if begin; test -z "$SSH_AGENT_PID"; and test -z "$SSH_CONNECTION"; end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
ssh-add -l > /dev/null 2>&1
|
||||||
|
if test $status -eq 2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
5
dotfiles/fish/functions/__ssh_agent_start.fish
Normal file
5
dotfiles/fish/functions/__ssh_agent_start.fish
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
function __ssh_agent_start -d "start a new ssh agent"
|
||||||
|
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
|
||||||
|
chmod 600 $SSH_ENV
|
||||||
|
source $SSH_ENV > /dev/null
|
||||||
|
end
|
20
dotfiles/fish/functions/_nvm_index_update.fish
Normal file
20
dotfiles/fish/functions/_nvm_index_update.fish
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
function _nvm_index_update
|
||||||
|
test ! -d $nvm_data && command mkdir -p $nvm_data
|
||||||
|
|
||||||
|
set --local index $nvm_data/.index
|
||||||
|
|
||||||
|
if not command curl --location --silent $nvm_mirror/index.tab >$index.temp
|
||||||
|
command rm -f $index.temp
|
||||||
|
echo "nvm: Can't update index, host unavailable: \"$nvm_mirror\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
command awk -v OFS=\t '
|
||||||
|
/v0.9.12/ { exit } # Unsupported
|
||||||
|
NR > 1 {
|
||||||
|
print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
|
||||||
|
}
|
||||||
|
' $index.temp >$index
|
||||||
|
|
||||||
|
command rm -f $index.temp
|
||||||
|
end
|
11
dotfiles/fish/functions/_nvm_list.fish
Normal file
11
dotfiles/fish/functions/_nvm_list.fish
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
function _nvm_list
|
||||||
|
set --local versions $nvm_data/*
|
||||||
|
set --query versions[1] &&
|
||||||
|
string match --entire --regex -- (string match --regex -- "v\d.+" $versions |
|
||||||
|
string escape --style=regex |
|
||||||
|
string join "|"
|
||||||
|
) <$nvm_data/.index
|
||||||
|
|
||||||
|
command --all node |
|
||||||
|
string match --quiet --invert --regex -- "^$nvm_data" && echo system
|
||||||
|
end
|
4
dotfiles/fish/functions/_nvm_version_activate.fish
Normal file
4
dotfiles/fish/functions/_nvm_version_activate.fish
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
function _nvm_version_activate --argument-names ver
|
||||||
|
set --global --export nvm_current_version $ver
|
||||||
|
set --prepend PATH $nvm_data/$ver/bin
|
||||||
|
end
|
5
dotfiles/fish/functions/_nvm_version_deactivate.fish
Normal file
5
dotfiles/fish/functions/_nvm_version_deactivate.fish
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
function _nvm_version_deactivate --argument-names ver
|
||||||
|
test "$nvm_current_version" = "$ver" && set --erase nvm_current_version
|
||||||
|
set --local index (contains --index -- $nvm_data/$ver/bin $PATH) &&
|
||||||
|
set --erase PATH[$index]
|
||||||
|
end
|
230
dotfiles/fish/functions/nvm.fish
Normal file
230
dotfiles/fish/functions/nvm.fish
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
function nvm --description "Node version manager"
|
||||||
|
for silent in --silent -s
|
||||||
|
if set --local index (contains --index -- $silent $argv)
|
||||||
|
set --erase argv[$index] && break
|
||||||
|
end
|
||||||
|
set --erase silent
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local cmd $argv[1]
|
||||||
|
set --local ver $argv[2]
|
||||||
|
|
||||||
|
if set --query silent && ! set --query cmd[1]
|
||||||
|
echo "nvm: Version number not specified (see nvm -h for usage)" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if ! set --query ver[1] && contains -- "$cmd" install use
|
||||||
|
for file in .nvmrc .node-version
|
||||||
|
set file (_nvm_find_up $PWD $file) && read ver <$file && break
|
||||||
|
end
|
||||||
|
|
||||||
|
if ! set --query ver[1]
|
||||||
|
echo "nvm: Invalid version or missing \".nvmrc\" file" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local their_version $ver
|
||||||
|
|
||||||
|
switch "$cmd"
|
||||||
|
case -v --version
|
||||||
|
echo "nvm, version 2.2.11"
|
||||||
|
case "" -h --help
|
||||||
|
echo "Usage: nvm install <version> Download and activate the specified Node version"
|
||||||
|
echo " nvm install Install version from nearest .nvmrc file"
|
||||||
|
echo " nvm use <version> Activate a version in the current shell"
|
||||||
|
echo " nvm use Activate version from nearest .nvmrc file"
|
||||||
|
echo " nvm list List installed versions"
|
||||||
|
echo " nvm list-remote List versions available to install"
|
||||||
|
echo " nvm list-remote <regex> List versions matching a given regular expression"
|
||||||
|
echo " nvm current Print the currently-active version"
|
||||||
|
echo " nvm uninstall <version> Uninstall a version"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -s or --silent Suppress standard output"
|
||||||
|
echo " -v or --version Print version"
|
||||||
|
echo " -h or --help Print this help message"
|
||||||
|
echo "Variables:"
|
||||||
|
echo " nvm_arch Override architecture, e.g. x64-musl"
|
||||||
|
echo " nvm_mirror Use a mirror of the Node binaries"
|
||||||
|
echo " nvm_default_version Set the default version for new shells"
|
||||||
|
echo " nvm_default_packages Install a list of packages every time you install a Node version"
|
||||||
|
case install
|
||||||
|
_nvm_index_update
|
||||||
|
|
||||||
|
string match --entire --regex -- (_nvm_version_match $ver) <$nvm_data/.index | read ver alias
|
||||||
|
|
||||||
|
if ! set --query ver[1]
|
||||||
|
echo "nvm: Invalid version number or alias: \"$their_version\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if test ! -e $nvm_data/$ver
|
||||||
|
set --local os (command uname -s | string lower)
|
||||||
|
set --local ext tar.gz
|
||||||
|
set --local arch (command uname -m)
|
||||||
|
|
||||||
|
switch $os
|
||||||
|
case aix
|
||||||
|
set arch ppc64
|
||||||
|
case sunos
|
||||||
|
case linux
|
||||||
|
case darwin
|
||||||
|
case {MSYS_NT,MINGW\*_NT}\*
|
||||||
|
set os win
|
||||||
|
set ext zip
|
||||||
|
case \*
|
||||||
|
echo "nvm: Unsupported operating system: \"$os\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
switch $arch
|
||||||
|
case i\*86
|
||||||
|
set arch x86
|
||||||
|
case x86_64
|
||||||
|
set arch x64
|
||||||
|
case arm64
|
||||||
|
string match --regex --quiet "v(?<major>\d+)" $ver
|
||||||
|
if test "$os" = darwin -a $major -lt 16
|
||||||
|
set arch x64
|
||||||
|
end
|
||||||
|
case armv6 armv6l
|
||||||
|
set arch armv6l
|
||||||
|
case armv7 armv7l
|
||||||
|
set arch armv7l
|
||||||
|
case armv8 armv8l aarch64
|
||||||
|
set arch arm64
|
||||||
|
end
|
||||||
|
|
||||||
|
set --query nvm_arch && set arch $nvm_arch
|
||||||
|
|
||||||
|
set --local dir "node-$ver-$os-$arch"
|
||||||
|
set --local url $nvm_mirror/$ver/$dir.$ext
|
||||||
|
|
||||||
|
command mkdir -p $nvm_data/$ver
|
||||||
|
|
||||||
|
if ! set --query silent
|
||||||
|
echo -e "Installing Node \x1b[1m$ver\x1b[22m $alias"
|
||||||
|
echo -e "Fetching \x1b[4m$url\x1b[24m\x1b[7m"
|
||||||
|
end
|
||||||
|
|
||||||
|
if ! command curl $silent --progress-bar --location $url |
|
||||||
|
command tar --extract --gzip --directory $nvm_data/$ver 2>/dev/null
|
||||||
|
command rm -rf $nvm_data/$ver
|
||||||
|
echo -e "\033[F\33[2K\x1b[0mnvm: Invalid mirror or host unavailable: \"$url\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set --query silent || echo -en "\033[F\33[2K\x1b[0m"
|
||||||
|
|
||||||
|
if test "$os" = win
|
||||||
|
command mv $nvm_data/$ver/$dir $nvm_data/$ver/bin
|
||||||
|
else
|
||||||
|
command mv $nvm_data/$ver/$dir/* $nvm_data/$ver
|
||||||
|
command rm -rf $nvm_data/$ver/$dir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if test $ver != "$nvm_current_version"
|
||||||
|
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
|
||||||
|
_nvm_version_activate $ver
|
||||||
|
|
||||||
|
set --query nvm_default_packages[1] && npm install --global $silent $nvm_default_packages
|
||||||
|
end
|
||||||
|
|
||||||
|
set --query silent || printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
|
||||||
|
case use
|
||||||
|
test $ver = default && set ver $nvm_default_version
|
||||||
|
_nvm_list | string match --entire --regex -- (_nvm_version_match $ver) | read ver __
|
||||||
|
|
||||||
|
if ! set --query ver[1]
|
||||||
|
echo "nvm: Can't use Node \"$their_version\", version must be installed first" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if test $ver != "$nvm_current_version"
|
||||||
|
set --query nvm_current_version && _nvm_version_deactivate $nvm_current_version
|
||||||
|
test $ver != system && _nvm_version_activate $ver
|
||||||
|
end
|
||||||
|
|
||||||
|
set --query silent || printf "Now using Node %s (npm %s) %s\n" (_nvm_node_info)
|
||||||
|
case uninstall
|
||||||
|
if test -z "$ver"
|
||||||
|
echo "nvm: Not enough arguments for command: \"$cmd\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
test $ver = default && test ! -z "$nvm_default_version" && set ver $nvm_default_version
|
||||||
|
|
||||||
|
_nvm_list | string match --entire --regex -- (_nvm_version_match $ver) | read ver __
|
||||||
|
|
||||||
|
if ! set -q ver[1]
|
||||||
|
echo "nvm: Node version not installed or invalid: \"$their_version\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set --query silent || printf "Uninstalling Node %s %s\n" $ver (string replace ~ \~ "$nvm_data/$ver/bin/node")
|
||||||
|
|
||||||
|
_nvm_version_deactivate $ver
|
||||||
|
|
||||||
|
command rm -rf $nvm_data/$ver
|
||||||
|
case current
|
||||||
|
_nvm_current
|
||||||
|
case ls list
|
||||||
|
_nvm_list | _nvm_list_format (_nvm_current) $argv[2]
|
||||||
|
case lsr {ls,list}-remote
|
||||||
|
_nvm_index_update || return
|
||||||
|
_nvm_list | command awk '
|
||||||
|
FILENAME == "-" && (is_local[$1] = FNR == NR) { next } {
|
||||||
|
print $0 (is_local[$1] ? " ✓" : "")
|
||||||
|
}
|
||||||
|
' - $nvm_data/.index | _nvm_list_format (_nvm_current) $argv[2]
|
||||||
|
case \*
|
||||||
|
echo "nvm: Unknown command or option: \"$cmd\" (see nvm -h for usage)" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_find_up --argument-names path file
|
||||||
|
test -e "$path/$file" && echo $path/$file || begin
|
||||||
|
test ! -z "$path" || return
|
||||||
|
_nvm_find_up (string replace --regex -- '/[^/]*$' "" $path) $file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_version_match --argument-names ver
|
||||||
|
string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $ver |
|
||||||
|
string replace --filter --regex -- '^v?(\d+)' 'v$1' |
|
||||||
|
string escape --style=regex ||
|
||||||
|
string lower '\b'$ver'(?:/\w+)?$'
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_list_format --argument-names current regex
|
||||||
|
command awk -v current="$current" -v regex="$regex" '
|
||||||
|
$0 ~ regex {
|
||||||
|
aliases[versions[i++] = $1] = $2 " " $3
|
||||||
|
pad = (n = length($1)) > pad ? n : pad
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (!i) exit 1
|
||||||
|
while (i--)
|
||||||
|
printf((current == versions[i] ? " ▶ " : " ") "%"pad"s %s\n",
|
||||||
|
versions[i], aliases[versions[i]])
|
||||||
|
}
|
||||||
|
'
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_current
|
||||||
|
command --search --quiet node || return
|
||||||
|
set --query nvm_current_version && echo $nvm_current_version || echo system
|
||||||
|
end
|
||||||
|
|
||||||
|
function _nvm_node_info
|
||||||
|
set --local npm_path (string replace bin/npm-cli.js "" (realpath (command --search npm)))
|
||||||
|
test -f $npm_path/package.json || set --local npm_version_default (command npm --version)
|
||||||
|
command node --eval "
|
||||||
|
console.log(process.version)
|
||||||
|
console.log('$npm_version_default' ? '$npm_version_default': require('$npm_path/package.json').version)
|
||||||
|
console.log(process.execPath.replace(require('os').homedir(), '~'))
|
||||||
|
"
|
||||||
|
end
|
115
dotfiles/nvim/init.lua
Normal file
115
dotfiles/nvim/init.lua
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
require('packer').startup(function(use)
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
use 'williamboman/mason.nvim'
|
||||||
|
use 'williamboman/mason-lspconfig.nvim'
|
||||||
|
use 'neovim/nvim-lspconfig'
|
||||||
|
|
||||||
|
use 'nvim-lualine/lualine.nvim'
|
||||||
|
use 'morhetz/gruvbox'
|
||||||
|
use 'vim-test/vim-test'
|
||||||
|
use 'lewis6991/gitsigns.nvim'
|
||||||
|
use 'windwp/nvim-autopairs'
|
||||||
|
|
||||||
|
-- nvim-cmp plugins
|
||||||
|
use 'hrsh7th/nvim-cmp'
|
||||||
|
use 'hrsh7th/cmp-buffer'
|
||||||
|
use 'hrsh7th/cmp-path'
|
||||||
|
use 'hrsh7th/cmp-nvim-lua'
|
||||||
|
use 'hrsh7th/cmp-nvim-lsp'
|
||||||
|
use 'L3MON4D3/LuaSnip'
|
||||||
|
use 'saadparwaiz1/cmp_luasnip'
|
||||||
|
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
requires = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'kyazdani42/nvim-web-devicons'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Automatic LSP Setup
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
require('mason').setup()
|
||||||
|
require('mason-lspconfig').setup_handlers({
|
||||||
|
function(server_name)
|
||||||
|
lspconfig[server_name].setup{}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Autocomplete Setup
|
||||||
|
local cmp = require('cmp')
|
||||||
|
cmp.setup {
|
||||||
|
mapping = {
|
||||||
|
["<CR>"] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
["<Up>"] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
["<Down>"] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
sources = {
|
||||||
|
{ name = "nvim_lua" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "path" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
},
|
||||||
|
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Misc Plugin Setup
|
||||||
|
require('lualine').setup()
|
||||||
|
require('nvim-autopairs').setup()
|
||||||
|
require('gitsigns').setup()
|
||||||
|
|
||||||
|
-- General Options
|
||||||
|
vim.cmd[[colorscheme gruvbox]]
|
||||||
|
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.o.splitright = true
|
||||||
|
vim.o.splitbelow = true
|
||||||
|
vim.o.scrolloff = 10
|
||||||
|
|
||||||
|
-- General Keymaps
|
||||||
|
vim.keymap.set('t', '<ESC>', '<C-\\><C-n>')
|
||||||
|
vim.keymap.set('n', '<leader>t', ':TestNearest<CR>')
|
||||||
|
vim.keymap.set('n', '<leader>T', ':TestFile<CR>')
|
||||||
|
|
||||||
|
local telescope = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', telescope.find_files)
|
||||||
|
vim.keymap.set('n', '<leader>fg', telescope.live_grep)
|
||||||
|
|
||||||
|
-- LSP Keymaps
|
||||||
|
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover)
|
||||||
|
vim.keymap.set('n', '<leader>r', vim.lsp.buf.rename)
|
||||||
|
vim.keymap.set('n', '<leader><space>', vim.lsp.buf.code_action)
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition)
|
||||||
|
vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation)
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references)
|
||||||
|
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
|
@ -1,91 +0,0 @@
|
||||||
set nocompatible
|
|
||||||
|
|
||||||
call plug#begin('~/.local/share/nvim/plugged')
|
|
||||||
Plug 'vim-airline/vim-airline'
|
|
||||||
Plug 'morhetz/gruvbox'
|
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
|
||||||
Plug 'mattn/emmet-vim'
|
|
||||||
Plug 'sheerun/vim-polyglot'
|
|
||||||
Plug 'preservim/nerdtree'
|
|
||||||
Plug 'nvim-lua/plenary.nvim'
|
|
||||||
Plug 'nvim-telescope/telescope.nvim'
|
|
||||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
|
||||||
Plug 'kyazdani42/nvim-web-devicons'
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
"Theme
|
|
||||||
colorscheme gruvbox
|
|
||||||
|
|
||||||
"General Options
|
|
||||||
set number relativenumber
|
|
||||||
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
|
|
||||||
set splitright splitbelow
|
|
||||||
set scrolloff=10
|
|
||||||
|
|
||||||
tnoremap <Esc> <C-\><C-n>
|
|
||||||
nmap <C-f> :NERDTree<CR>
|
|
||||||
let NERDTreeQuitOnOpen=3
|
|
||||||
|
|
||||||
command TMK w | call system("latexmk -pdf " . expand("%")) | call system("latexmk -c")
|
|
||||||
command Shh set nonu norelativenumber scl=no
|
|
||||||
command NoShh set nu relativenumber scl=auto
|
|
||||||
|
|
||||||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
|
||||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
|
||||||
|
|
||||||
" coc.nvim Plugins
|
|
||||||
let g:coc_global_extensions = [
|
|
||||||
\'coc-pairs',
|
|
||||||
\'coc-json',
|
|
||||||
\'coc-git',
|
|
||||||
\'coc-pyright',
|
|
||||||
\'coc-go',
|
|
||||||
\'coc-rust-analyzer',
|
|
||||||
\'coc-clangd',
|
|
||||||
\'coc-html',
|
|
||||||
\'coc-css',
|
|
||||||
\'coc-tsserver',
|
|
||||||
\'coc-flutter',
|
|
||||||
\'coc-sumneko-lua'
|
|
||||||
\]
|
|
||||||
|
|
||||||
" GoTo code navigation.
|
|
||||||
nmap gd <Plug>(coc-definition)
|
|
||||||
nmap gt <Plug>(coc-type-definition)
|
|
||||||
nmap gi <Plug>(coc-implementation)
|
|
||||||
nmap gr <Plug>(coc-references)
|
|
||||||
|
|
||||||
" Telescope
|
|
||||||
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
|
||||||
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
|
||||||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
|
||||||
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
|
||||||
|
|
||||||
" Diagnostic navigation
|
|
||||||
nmap <silent> [d <Plug>(coc-diagnostic-prev)
|
|
||||||
nmap <silent> ]d <Plug>(coc-diagnostic-next)
|
|
||||||
|
|
||||||
" Misc coc-commands
|
|
||||||
nmap <leader>r <Plug>(coc-rename)
|
|
||||||
nmap <leader>R <Plug>(coc-refactor)
|
|
||||||
nmap <leader>h :call CocActionAsync('doHover')<CR>
|
|
||||||
|
|
||||||
command Imports call CocActionAsync('organizeImport')
|
|
||||||
command GitDiff call CocActionAsync('runCommand', 'git.chunkInfo')
|
|
||||||
command GitUndo call CocActionAsync('runCommand', 'git.chunkUndo')
|
|
||||||
command GitShow call CocActionAsync('runCommand', 'git.showCommit')
|
|
||||||
|
|
||||||
" Language Specific Settings
|
|
||||||
autocmd FileType go call Golang_settings()
|
|
||||||
function! Golang_settings()
|
|
||||||
setlocal tabstop=4
|
|
||||||
setlocal noexpandtab
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Terraform Format on Save
|
|
||||||
autocmd BufWritePost *.tf call TerraformFormat()
|
|
||||||
function TerraformFormat()
|
|
||||||
call system("terraform fmt " . expand("%"))"
|
|
||||||
edit
|
|
||||||
endfunction
|
|
||||||
|
|
177
dotfiles/nvim/plugin/packer_compiled.lua
Normal file
177
dotfiles/nvim/plugin/packer_compiled.lua
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
-- 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()
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
_G._packer = _G._packer or {}
|
||||||
|
_G._packer.profile_output = results
|
||||||
|
end
|
||||||
|
|
||||||
|
time([[Luarocks path setup]], true)
|
||||||
|
local package_path_str = "/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/digyx/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||||
|
local install_cpath_pattern = "/home/digyx/.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/digyx/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||||
|
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||||
|
},
|
||||||
|
["cmp-buffer"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lua"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lua"
|
||||||
|
},
|
||||||
|
["cmp-path"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-path"
|
||||||
|
},
|
||||||
|
cmp_luasnip = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||||
|
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||||
|
},
|
||||||
|
["gitsigns.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||||
|
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||||
|
},
|
||||||
|
gruvbox = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/gruvbox",
|
||||||
|
url = "https://github.com/morhetz/gruvbox"
|
||||||
|
},
|
||||||
|
["lualine.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||||
|
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||||
|
},
|
||||||
|
["mason-lspconfig.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
["mason.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
["nvim-autopairs"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||||
|
url = "https://github.com/windwp/nvim-autopairs"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
["nvim-web-devicons"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||||
|
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
["packer.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||||
|
url = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
},
|
||||||
|
["plenary.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||||
|
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||||
|
},
|
||||||
|
["telescope.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
["vim-test"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/digyx/.local/share/nvim/site/pack/packer/start/vim-test",
|
||||||
|
url = "https://github.com/vim-test/vim-test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time([[Defining packer_plugins]], 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
|
Loading…
Reference in a new issue