From 2c600d25a9899a09f3a09b680374dcc513e0df39 Mon Sep 17 00:00:00 2001 From: Devon Tingley Date: Mon, 25 Jul 2022 18:15:23 -0400 Subject: [PATCH] Switch to lua config --- dotfiles/fish/completions/nvm.fish | 21 ++ dotfiles/fish/conf.d/fish-ssh-agent.fish | 7 + dotfiles/fish/conf.d/nvm.fish | 28 +++ dotfiles/fish/fish_plugins | 2 + dotfiles/fish/fish_variables | 8 +- .../functions/__ssh_agent_is_started.fish | 14 ++ .../fish/functions/__ssh_agent_start.fish | 5 + .../fish/functions/_nvm_index_update.fish | 20 ++ dotfiles/fish/functions/_nvm_list.fish | 11 + .../fish/functions/_nvm_version_activate.fish | 4 + .../functions/_nvm_version_deactivate.fish | 5 + dotfiles/fish/functions/nvm.fish | 230 ++++++++++++++++++ dotfiles/nvim/init.lua | 115 +++++++++ dotfiles/nvim/init.vim | 91 ------- dotfiles/nvim/plugin/packer_compiled.lua | 177 ++++++++++++++ 15 files changed, 645 insertions(+), 93 deletions(-) create mode 100644 dotfiles/fish/completions/nvm.fish create mode 100644 dotfiles/fish/conf.d/fish-ssh-agent.fish create mode 100644 dotfiles/fish/conf.d/nvm.fish create mode 100644 dotfiles/fish/fish_plugins create mode 100644 dotfiles/fish/functions/__ssh_agent_is_started.fish create mode 100644 dotfiles/fish/functions/__ssh_agent_start.fish create mode 100644 dotfiles/fish/functions/_nvm_index_update.fish create mode 100644 dotfiles/fish/functions/_nvm_list.fish create mode 100644 dotfiles/fish/functions/_nvm_version_activate.fish create mode 100644 dotfiles/fish/functions/_nvm_version_deactivate.fish create mode 100644 dotfiles/fish/functions/nvm.fish create mode 100644 dotfiles/nvim/init.lua delete mode 100644 dotfiles/nvim/init.vim create mode 100644 dotfiles/nvim/plugin/packer_compiled.lua diff --git a/dotfiles/fish/completions/nvm.fish b/dotfiles/fish/completions/nvm.fish new file mode 100644 index 0000000..c0ab183 --- /dev/null +++ b/dotfiles/fish/completions/nvm.fish @@ -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 +)" diff --git a/dotfiles/fish/conf.d/fish-ssh-agent.fish b/dotfiles/fish/conf.d/fish-ssh-agent.fish new file mode 100644 index 0000000..719087a --- /dev/null +++ b/dotfiles/fish/conf.d/fish-ssh-agent.fish @@ -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 diff --git a/dotfiles/fish/conf.d/nvm.fish b/dotfiles/fish/conf.d/nvm.fish new file mode 100644 index 0000000..8aab50a --- /dev/null +++ b/dotfiles/fish/conf.d/nvm.fish @@ -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 diff --git a/dotfiles/fish/fish_plugins b/dotfiles/fish/fish_plugins new file mode 100644 index 0000000..909e665 --- /dev/null +++ b/dotfiles/fish/fish_plugins @@ -0,0 +1,2 @@ +danhper/fish-ssh-agent +jorgebucaran/nvm.fish diff --git a/dotfiles/fish/fish_variables b/dotfiles/fish/fish_variables index 8bd68ff..4d330dd 100644 --- a/dotfiles/fish/fish_variables +++ b/dotfiles/fish/fish_variables @@ -1,8 +1,10 @@ # This file contains fish universal variable definitions. # VERSION: 3.0 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_plugins:danhper/fish\x2dssh\x2dagent +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_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_cancel:\x2dr 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_selected_background:\x2dr 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 diff --git a/dotfiles/fish/functions/__ssh_agent_is_started.fish b/dotfiles/fish/functions/__ssh_agent_is_started.fish new file mode 100644 index 0000000..7d481ee --- /dev/null +++ b/dotfiles/fish/functions/__ssh_agent_is_started.fish @@ -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 diff --git a/dotfiles/fish/functions/__ssh_agent_start.fish b/dotfiles/fish/functions/__ssh_agent_start.fish new file mode 100644 index 0000000..3766fe4 --- /dev/null +++ b/dotfiles/fish/functions/__ssh_agent_start.fish @@ -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 diff --git a/dotfiles/fish/functions/_nvm_index_update.fish b/dotfiles/fish/functions/_nvm_index_update.fish new file mode 100644 index 0000000..c1bbe28 --- /dev/null +++ b/dotfiles/fish/functions/_nvm_index_update.fish @@ -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 diff --git a/dotfiles/fish/functions/_nvm_list.fish b/dotfiles/fish/functions/_nvm_list.fish new file mode 100644 index 0000000..fb5ab0e --- /dev/null +++ b/dotfiles/fish/functions/_nvm_list.fish @@ -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 diff --git a/dotfiles/fish/functions/_nvm_version_activate.fish b/dotfiles/fish/functions/_nvm_version_activate.fish new file mode 100644 index 0000000..f7dfef7 --- /dev/null +++ b/dotfiles/fish/functions/_nvm_version_activate.fish @@ -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 diff --git a/dotfiles/fish/functions/_nvm_version_deactivate.fish b/dotfiles/fish/functions/_nvm_version_deactivate.fish new file mode 100644 index 0000000..24dd36e --- /dev/null +++ b/dotfiles/fish/functions/_nvm_version_deactivate.fish @@ -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 diff --git a/dotfiles/fish/functions/nvm.fish b/dotfiles/fish/functions/nvm.fish new file mode 100644 index 0000000..131a030 --- /dev/null +++ b/dotfiles/fish/functions/nvm.fish @@ -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 Download and activate the specified Node version" + echo " nvm install Install version from nearest .nvmrc file" + echo " nvm use 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 List versions matching a given regular expression" + echo " nvm current Print the currently-active version" + echo " nvm uninstall 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(?\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 diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua new file mode 100644 index 0000000..11e8fb9 --- /dev/null +++ b/dotfiles/nvim/init.lua @@ -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 = { + [""] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Insert, + select = true, + }, + + [""] = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, + + [""] = 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', '', '') +vim.keymap.set('n', 't', ':TestNearest') +vim.keymap.set('n', 'T', ':TestFile') + +local telescope = require('telescope.builtin') +vim.keymap.set('n', 'ff', telescope.find_files) +vim.keymap.set('n', 'fg', telescope.live_grep) + +-- LSP Keymaps +vim.keymap.set('n', 'h', vim.lsp.buf.hover) +vim.keymap.set('n', 'r', vim.lsp.buf.rename) +vim.keymap.set('n', '', 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) diff --git a/dotfiles/nvim/init.vim b/dotfiles/nvim/init.vim deleted file mode 100644 index 61ee1d9..0000000 --- a/dotfiles/nvim/init.vim +++ /dev/null @@ -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 -nmap :NERDTree -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 pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - -" 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 (coc-definition) -nmap gt (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Telescope -nnoremap ff Telescope find_files -nnoremap fg Telescope live_grep -nnoremap fb Telescope buffers -nnoremap fh Telescope help_tags - -" Diagnostic navigation -nmap [d (coc-diagnostic-prev) -nmap ]d (coc-diagnostic-next) - -" Misc coc-commands -nmap r (coc-rename) -nmap R (coc-refactor) -nmap h :call CocActionAsync('doHover') - -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 - diff --git a/dotfiles/nvim/plugin/packer_compiled.lua b/dotfiles/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..e58a216 --- /dev/null +++ b/dotfiles/nvim/plugin/packer_compiled.lua @@ -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