diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2022-01-10 21:57:57 +0100 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2023-12-12 23:29:57 +0100 |
| commit | 6aee281615ae489346b398c68bb00b0a1dfd1476 (patch) | |
| tree | 19835d9c25d5775e3a1bb86ad42a15cca9791952 | |
| parent | 07fce1556195e713c7dcdd20e983f39b50dc4944 (diff) | |
Refactor Neovim configuration
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | LICENSE | 2 | ||||
| -rw-r--r-- | config/emacs/init.el | 43 | ||||
| -rw-r--r-- | config/kak/fzf.kak | 14 | ||||
| -rw-r--r-- | config/kak/kakrc | 20 | ||||
| -rw-r--r-- | config/kak/plugins/plug.kak | 622 | ||||
| -rw-r--r-- | config/kak/plugins/plugrc.kak | 15 | ||||
| -rw-r--r-- | config/nvim/colors/pico8.vim | 1 | ||||
| l--------- | config/nvim/ftplugin/javascript.vim | 1 | ||||
| -rw-r--r-- | config/nvim/ftplugin/typescript.vim | 2 | ||||
| l---------[-rw-r--r--] | config/nvim/ftplugin/typescriptreact.vim | 2 | ||||
| -rw-r--r-- | config/nvim/init.lua | 106 | ||||
| -rw-r--r-- | config/nvim/lua/colors/pico8.lua | 53 | ||||
| -rw-r--r-- | config/nvim/lua/config/keys.lua | 24 | ||||
| -rw-r--r-- | config/nvim/lua/config/lsp.lua | 80 | ||||
| -rw-r--r-- | config/nvim/lua/ft/ecmascript.lua | 7 | ||||
| -rw-r--r-- | config/nvim/lua/ft/rust.lua | 13 | ||||
| -rw-r--r-- | config/nvim/lua/ft/typescript.lua | 18 | ||||
| -rw-r--r-- | config/nvim/lua/utils.lua | 27 | ||||
| -rw-r--r-- | config/nvim/lua/utils/packer.lua | 13 | ||||
| -rw-r--r-- | config/nvim/lua/utils/set.lua | 14 | ||||
| -rw-r--r-- | config/nvim/old.vim | 34 | ||||
| -rw-r--r-- | config/tmux/tmux.conf | 2 | ||||
| -rwxr-xr-x | install.sh | 12 |
24 files changed, 160 insertions, 966 deletions
@@ -1,2 +1,3 @@ .netrwhist +custom.el packer_compiled.* @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Nicholas Lordello +Copyright (c) 2022 Nicholas Lordello Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/config/emacs/init.el b/config/emacs/init.el new file mode 100644 index 0000000..1ca91dc --- /dev/null +++ b/config/emacs/init.el @@ -0,0 +1,43 @@ +;;; Customize Emacs +(if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) +(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) +(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) +(column-number-mode) +(fset 'yes-or-no-p 'y-or-n-p) +(setq + inhibit-startup-screen t + initial-scratch-message "" + sentence-end-double-space nil) +(setq-default + cursor-type 'bar + show-trailing-whitespace t + tab-width 4) + +;;; Write auto-saves and backups to `.cache` directory +(setq + auto-save-list-file-prefix "~/.cache/emacs/auto-save/" + auto-save-file-name-transforms '((".*" "~/.cache/emacs/auto-save/" t)) + backup-by-copying t + backup-directory-alist '((".*" . "~/.cache/emacs/backup/")) + create-lockfiles nil) + +;;; Setup `package.el` +(require 'package) +(setq + package-enable-at-startup nil + package-user-dir "~/.cache/emacs/elpa/") +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) +(unless package--initialized (package-initialize)) + +;;; Setup `use-package` +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) +(eval-when-compile (require 'use-package)) +(setq use-package-always-ensure t) + +;;; Use separate file for custom variables +(setq custom-file "~/.config/emacs/custom.el") +(if (file-exists-p custom-file) + (load custom-file nil t)) diff --git a/config/kak/fzf.kak b/config/kak/fzf.kak deleted file mode 100644 index f3506fe..0000000 --- a/config/kak/fzf.kak +++ /dev/null @@ -1,14 +0,0 @@ -define-command -docstring "Open a FZF Tmux pane to select file to edit" \ -fzf-edit %{ evaluate-commands %sh{ - if [ "$(echo 3.2 $(tmux -V | sed 's/tmux //') | tr ' ' '\n' | sort -V | head -1)" = "3.2" ]; then - view="-p 80%,50%" - else - view="-d 50%" - fi - file=$(find . -type f | fzf-tmux $view --preview='bat {}') - if [ -n "$file" ]; then - echo "edit '$file'" - else - echo "echo no file selected" - fi -}} diff --git a/config/kak/kakrc b/config/kak/kakrc deleted file mode 100644 index d4f3a59..0000000 --- a/config/kak/kakrc +++ /dev/null @@ -1,20 +0,0 @@ -source "%val{config}/plugins/plugrc.kak" -source "%val{config}/fzf.kak" - -set global ui_options ncurses_set_title=false - -declare-user-mode clip -map global -docstring 'clipboard' user 'y' ':enter-user-mode clip<ret>' -map global -docstring 'yank' clip 'y' '<a-|>xsel -bi<ret>' -map global -docstring 'paste' clip 'p' '<a-!>xsel -b<ret>' -map global -docstring 'paste before' clip 'P' '!xsel -b<ret>' -map global -docstring 'replace' clip 'R' '|xsel -b<ret>' - -declare-user-mode find -map global -docstring 'find' user 'f' ':enter-user-mode find<ret>' -map global -docstring 'file' find 'f' ':fzf-edit<ret>' - -declare-user-mode tmux -map global -docstring 'tmux' user 't' ':enter-user-mode tmux<ret>' -map global -docstring 'split' tmux 's' ':tmux-terminal-vertical kak -c %val{session}<ret>' -map global -docstring 'vsplit' tmux 'v' ':tmux-terminal-horizontal kak -c %val{session}<ret>' diff --git a/config/kak/plugins/plug.kak b/config/kak/plugins/plug.kak deleted file mode 100644 index 3a8ffc6..0000000 --- a/config/kak/plugins/plug.kak +++ /dev/null @@ -1,622 +0,0 @@ -# ╭─────────────╥────────────────────╮ -# │ Author: ║ File: │ -# │ Andrey Orst ║ plug.kak │ -# ╞═════════════╩════════════════════╡ -# │ plug.kak is a plugin manager for │ -# │ Kakoune. It can install plugins │ -# │ keep them updated and uninstall │ -# ╞══════════════════════════════════╡ -# │ GitHub repo: │ -# │ GitHub.com/andreyorst/plug.kak │ -# ╰──────────────────────────────────╯ - -# Public options -declare-option -docstring \ -"Path where plugins should be installed. - - Defaults to the plug.kak installation directory" \ -str plug_install_dir %sh{ echo "${kak_source%%/rc*}/../" } - -declare-option -docstring \ -"Default domain to access git repositories. Can be changed to any preferred domain, like gitlab, bitbucket, gitea, etc. - - Default value: 'https://github.com'" \ -str plug_git_domain 'https://github.com' - -declare-option -docstring \ -"Sort sourced files by depth" \ -bool plug_depth_sort false - -declare-option -docstring \ -"Sort sourced files by depth" \ -bool plug_profile false - -declare-option -docstring \ -"Maximum amount of simultaneously active downloads when installing or updating all plugins - Default value: 10 -" \ -int plug_max_active_downloads 10 - -declare-option -docstring \ -"Always ensure that all plugins are installed. If this option specified, all uninstalled plugins are being installed when Kakoune starts." \ -bool plug_always_ensure false - -declare-option -docstring "name of the client in which utilities display information" \ -str toolsclient - -# Private options -declare-option -hidden -docstring \ -"Array of all plugins, mentioned in any configuration file. -Empty by default, and erased on reload of main Kakoune configuration, to track if some plugins were disabled -Should not be modified by user." \ -str plug_plugins '' - -declare-option -hidden -docstring \ -"List of loaded plugins. Has no default value. -Should not be cleared during update of configuration files. Should not be modified by user." \ -str plug_loaded_plugins - -declare-option -hidden -docstring \ -"List of post update/install hooks to be executed" \ -str-list plug_post_hooks - -declare-option -hidden -docstring \ -"List of post update/install hooks to be executed" \ -str-list plug_domains - -# since we want to add highlighters to kak filetype we need to require kak module -# using `try' here since kakrc module may not be available in rare cases -try %@ - require-module kak - - try %$ - add-highlighter shared/kakrc/code/plug_keywords regex \b(plug|do|config|subset|domain|defer|demand|load-path|branch|tag|commit)\b 0:keyword - add-highlighter shared/kakrc/code/plug_attributes regex \b(noload|ensure|theme|(no-)?depth-sort)\b 0:attribute - add-highlighter shared/kakrc/plug_post_hooks1 region -recurse '\{' '\bdo\K\h+%\{' '\}' ref sh - add-highlighter shared/kakrc/plug_post_hooks2 region -recurse '\[' '\bdo\K\h+%\[' '\]' ref sh - add-highlighter shared/kakrc/plug_post_hooks3 region -recurse '\(' '\bdo\K\h+%\(' '\)' ref sh - add-highlighter shared/kakrc/plug_post_hooks4 region -recurse '<' '\bdo\K\h+%<' '>' ref sh - $ catch %$ - echo -debug "plug.kak: Can't declare highlighters for 'kak' filetype." - echo -debug " Detailed error: %val{error}" - $ -@ catch %{ - echo -debug "Can't require 'kak' module to declare highlighters for plug.kak." - echo -debug "Check if kakrc.kak is available in your autoload." -} - -# *plug* highlighters -try %{ - add-highlighter shared/plug_buffer group - add-highlighter shared/plug_buffer/done regex [^:]+:\h+(Up\h+to\h+date|Done|Installed)$ 1:string - add-highlighter shared/plug_buffer/update regex [^:]+:\h+(Update\h+available|Deleted)$ 1:keyword - add-highlighter shared/plug_buffer/not_installed regex [^:]+:\h+(Not\h+(installed|loaded)|(\w+\h+)?Error([^\n]+)?)$ 1:red+b - add-highlighter shared/plug_buffer/updating regex [^:]+:\h+(Installing|Updating|Local\h+changes)$ 1:type - add-highlighter shared/plug_buffer/working regex [^:]+:\h+(Running\h+post-update\h+hooks|Waiting[^\n]+)$ 1:attribute -} catch %{ - echo -debug "plug.kak: Can't declare highlighters for *plug* buffer." - echo -debug " Detailed error: %val{error}" -} - -hook -group plug-syntax global WinSetOption filetype=plug %{ - add-highlighter buffer/plug_buffer ref plug_buffer - hook -always -once window WinSetOption filetype=.* %{ - remove-highlighter buffer/plug_buffer - } -} - -define-command -override -docstring \ -"plug <plugin> [<switches>]: manage <plugin> from ""%opt{plug_install_dir}"" -Switches: - branch (tag, commit) <str> checkout to <str> before loading plugin - noload do not source plugin files - subset <subset> source only <subset> of plugin files - load-path <path> path for loading plugin from foreign location - defer <module> <configurations> load plugin <configurations> only when <module> is loaded - config <configurations> plugin <configurations>" \ -plug -params 1.. -shell-script-candidates %{ ls -1 ${kak_opt_plug_install_dir} } %{ try %{ - evaluate-commands %sh{ - [ "${kak_opt_plug_profile}" = "true" ] && start=$(date +%s%N) - plugin="${1%%.git}" - shift - plugin_name="${plugin##*/}" - plugin_opt_name=$(printf "%s\n" "${plugin_name}" | sed 's/[^a-zA-Z0-9_]/_/g') - load_files='*.kak' - path_to_plugin="${kak_opt_plug_install_dir}/${plugin_name}" - - if [ $(expr "${kak_opt_plug_loaded_plugins}" : ".*${plugin}.*") -ne 0 ]; then - printf "%s\n" "echo -markup %{{Information}${plugin_name} already loaded}" - exit - fi - - [ $(expr "${kak_opt_plug_plugins}" : ".*${plugin}.*") -eq 0 ] && printf "%s\n" "set-option -add global plug_plugins %{${plugin} }" - [ "${kak_opt_plug_depth_sort}" = "true" ] && depth_sort="true" || depth_sort="false" - - while [ $# -gt 0 ]; do - case $1 in - (branch|tag|commit) - checkout_type=$1 - shift - checkout="$1" ;; - (noload) - noload=1 ;; - (subset) - shift - subset=1 - load_files="$1" ;; - (load-path) - shift - path_to_plugin=$(printf "%s\n" "$1" | sed "s:^\s*~/:${HOME}/:") ;; - (defer) - shift - module="$1" - shift - [ -z "${1##*@*}" ] && deferred_conf=$(printf "%s\n" "$1" | sed "s/@/@@/g") || deferred_conf="$1" - deferred_conf=$(printf "%s\n" "hook global ModuleLoaded ${module} %@ ${deferred_conf} @") - configurations="${configurations} - ${deferred_conf}" ;; - (demand) - demand=1 ;; - (do) - shift - hooks="${hooks} %{${plugin_name}} %{$1}" ;; - (ensure) - ensure=1 ;; - (theme) - noload=1 - theme_hooks="mkdir -p ${kak_config}/colors - find . -type f -name '*.kak' -exec cp {} ${kak_config}/colors/ \;" - hooks="${hooks} %{${plugin_name}} %{${theme_hooks}}" ;; - (depth-sort) - depth_sort="true" ;; - (no-depth-sort) - depth_sort="false" ;; - (domain) - shift - domains="${domains} %{${plugin_name}} %{$1}" ;; - (config) - shift - configurations="${configurations} $1" ;; - (*) - configurations="${configurations} $1" ;; - esac - shift - done - - if [ -n "${demand}" ] && [ -n "${module}" ]; then - configurations="${configurations} - require-module ${module}" - fi - - # bake configuration options. We need this in case plugins are not installed, but - # their configurations are known to `plug.kak', so it can load those after installation - # automatically. - [ -z "${configurations##*&*}" ] && configurations=$(printf "%s\n" "${configurations}" | sed "s/&/&&/g") - printf "%s\n" "declare-option -hidden str plug_${plugin_opt_name}_conf %&${configurations}&" - [ -n "${hooks}" ] && printf "%s\n" "set-option -add global plug_post_hooks ${hooks}" - [ -n "${domains}" ] && printf "%s\n" "set-option -add global plug_domains ${domains}" - - if [ -n "${noload}" ] && [ -n "${subset}" ]; then - printf "%s\n" "echo -debug %{Warning: plug.kak: ${plugin_name}: 'load' has higer priority than 'noload'}" - noload= - fi - - if [ -d "${path_to_plugin}" ]; then - if [ -n "${checkout}" ]; then - ( - cd "${path_to_plugin}" - [ -z "${GIT_TERMINAL_PROMPT}" ] && export GIT_TERMINAL_PROMPT=0 - if [ "${checkout_type}" = "branch" ]; then - current_branch=$(git branch | awk '/^\*/ { print $2 }') - [ "${current_branch}" != "${checkout}" ] && git fetch >/dev/null 2>&1 - fi - git checkout ${checkout} >/dev/null 2>&1 - ) - fi - if [ -z "${noload}" ]; then { - IFS=' -' - set -f # set noglob - for file in ${load_files}; do - # trim leading and trailing whitespaces. Looks ugly, but faster than `sed' - file="${file#"${file%%[![:space:]]*}"}" - file="${file%"${file##*[![:space:]]}"}" - if [ "${depth_sort}" = "true" ]; then - # performance hungry place. - find -L "${path_to_plugin}" -path '*/.git' -prune -o -type f -name "${file}" -print | perl -e ' - print map { $_->[0] } - sort { $a->[1] <=> $b->[1] } - map { [$_, ($_ =~ s/^/source "/ && $_ =~ s/$/"/ && $_ =~ s/\//\//g)] } - <>;' - else - # source files in order that `find' is returning - # may break some plugins - find -L "${path_to_plugin}" -path '*/.git' -prune -o -type f -name "${file}" -exec printf 'source "%s"\n' {} \; - fi - done - } fi - printf "%s\n" "evaluate-commands %opt{plug_${plugin_opt_name}_conf}" - printf "%s\n" "set-option -add global plug_loaded_plugins %{${plugin} }" - else - if [ -n "${ensure}" ] || [ "${kak_opt_plug_always_ensure}" = "true" ]; then - printf "%s\n" "evaluate-commands plug-install ${plugin}" - fi - fi - [ "${kak_opt_plug_profile}" = "true" ] && printf "%s\n" "echo -debug %{'$plugin' loaded in $(echo "($(date +%s%N)-${start})/1000000" | bc) ms}" - } -} catch %{ - echo -debug "plug.kak: Error occured while loading '%arg{1}' plugin:" - echo -debug " %val{error}" -}} - -define-command -override -docstring \ -"plug-install [<plugin>]: install <plugin>. -If <plugin> omitted installs all plugins mentioned in configuration files" \ -plug-install -params ..1 %{ nop %sh{ ( - plugin=$1 - plugin_name="${plugin##*/}" - jobs=$(mktemp ${TMPDIR:-/tmp}/plug.kak.jobs.XXXXXX) - - [ -z "${GIT_TERMINAL_PROMPT}" ] && export GIT_TERMINAL_PROMPT=0 - - if [ ! -d ${kak_opt_plug_install_dir} ]; then - if ! mkdir -p ${kak_opt_plug_install_dir} >/dev/null 2>&1; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} echo -debug 'plug.kak: Error: unable to create directory for plugins'" | kak -p ${kak_session} - exit - fi - fi - - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ try %{ buffer *plug* } catch %{ plug-list noupdate } }" | kak -p ${kak_session} - sleep 0.3 - - lockfile="${kak_opt_plug_install_dir}/.${plugin_name:-global}.plug.kak.lock" - if [ -d "${lockfile}" ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Waiting for .plug.kak.lock} }" | kak -p ${kak_session} - fi - - # this creates the lockfile for a plugin, if specified to prevent several processes of installation - # of the same plugin, but will allow install different plugins without waiting for eachother. - # Should be fine, since different plugins doesn't interfere with eachother. - while ! mkdir "${lockfile}" 2>/dev/null; do sleep 1; done - trap "rmdir '${lockfile}'" EXIT - - # if plugin specified as an argument add it to the *plug* buffer, if it isn't there already - # otherwise update all plugins - if [ -n "${plugin}" ]; then - plugin_list=${plugin} - printf "%s\n" "evaluate-commands -buffer *plug* %{ - try %{ - execute-keys /${plugin}<ret> - } catch %{ - execute-keys gjO${plugin}:<space>Not<space>installed<esc> - } - }" | kak -p ${kak_session} - sleep 0.2 - else - plugin_list=${kak_opt_plug_plugins} - fi - - for plugin in ${plugin_list}; do - plugin_name="${plugin##*/}" - git_domain=${kak_opt_plug_git_domain} - - eval "set -- ${kak_quoted_opt_plug_domains}" - while [ $# -ne 0 ]; do - if [ "$1" = "${plugin_name}" ]; then - git_domain="https://$2" - break - fi - shift - done - - if [ ! -d "${kak_opt_plug_install_dir}/${plugin_name}" ]; then - case ${plugin} in - (http*|git*) - git="git clone ${plugin}" ;; - (*) - git="git clone ${git_domain}/${plugin}" ;; - esac - - ( - plugin_log="${TMPDIR:-/tmp}/${plugin_name}-log" - printf "%s\n" "hook global -always KakEnd .* %{ nop %sh{rm -rf ${plugin_log}}} - evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Installing} }" | kak -p ${kak_session} - cd ${kak_opt_plug_install_dir} && ${git} >>${plugin_log} 2>&1 - status=$? - if [ ${status} -ne 0 ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Download Error (${status})} }" | kak -p ${kak_session} - else - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} plug-eval-hooks ${plugin_name} - evaluate-commands -client ${kak_client:-client0} plug ${plugin}" | kak -p ${kak_session} - fi - ) > /dev/null 2>&1 < /dev/null & - fi - # this is a hacky way to measure amount of active processes. We need this - # because dash shell has this long term bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482999 - jobs > ${jobs}; active=$(wc -l < ${jobs}) - while [ ${active} -ge ${kak_opt_plug_max_active_downloads} ]; do - sleep 1 - jobs > ${jobs}; active=$(wc -l < ${jobs}) - done - done - wait - rm -rf ${jobs} -) > /dev/null 2>&1 < /dev/null & }} - -define-command -override -docstring \ -"plug-update [<plugin>]: Update plugin. -If <plugin> omitted all installed plugins are updated" \ -plug-update -params ..1 -shell-script-candidates %{ printf "%s\n" ${kak_opt_plug_plugins} | tr ' ' '\n' } %{ - evaluate-commands %sh{ ( - plugin=$1 - plugin_name="${plugin##*/}" - jobs=$(mktemp ${TMPDIR:-/tmp}/jobs.XXXXXX) - - [ -z "${GIT_TERMINAL_PROMPT}" ] && export GIT_TERMINAL_PROMPT=0 - - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ try %{ buffer *plug* } catch %{ plug-list noupdate } }" | kak -p ${kak_session} - - lockfile="${kak_opt_plug_install_dir}/.${plugin_name:-global}.plug.kak.lock" - if [ -d "${lockfile}" ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin##*/}} %{Waiting for .plug.kak.lock} }" | kak -p ${kak_session} - fi - - while ! mkdir "${lockfile}" 2>/dev/null; do sleep 1; done - trap "rmdir '${lockfile}'" EXIT - - [ -n "${plugin}" ] && plugin_list=${plugin} || plugin_list=${kak_opt_plug_plugins} - for plugin in ${plugin_list}; do - plugin_name="${plugin##*/}" - if [ -d "${kak_opt_plug_install_dir}/${plugin_name}" ]; then - ( - plugin_log="${TMPDIR:-/tmp}/${plugin_name}-log" - printf "%s\n" "hook global -always KakEnd .* %{ nop %sh{rm -rf ${plugin_log}}} - evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Updating} }" | kak -p ${kak_session} - cd "${kak_opt_plug_install_dir}/${plugin_name}" && rev=$(git rev-parse HEAD) && git pull >> ${plugin_log} 2>&1 - status=$? - if [ ${status} -ne 0 ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Update Error (${status})} }" | kak -p ${kak_session} - else - if [ ${rev} != $(git rev-parse HEAD) ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} plug-eval-hooks ${plugin_name}" | kak -p ${kak_session} - else - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Done} }" | kak -p ${kak_session} - fi - fi - ) > /dev/null 2>&1 < /dev/null & - fi - jobs > ${jobs}; active=$(wc -l < ${jobs}) - # TODO: re-check this - # for some reason I need to multiply the amount of jobs by five here. - while [ ${active} -ge $(expr ${kak_opt_plug_max_active_downloads} \* 5) ]; do - sleep 1 - jobs > ${jobs}; active=$(wc -l < ${jobs}) - done - done - rm -rf ${jobs} - wait - ) > /dev/null 2>&1 < /dev/null & } -} - -define-command -override -docstring \ -"plug-clean [<plugin>]: delete <plugin>. -If <plugin> omitted deletes all plugins that are installed but not presented in configuration files" \ -plug-clean -params ..1 -shell-script-candidates %{ ls -1 ${kak_opt_plug_install_dir} } %{ nop %sh{ ( - plugin=$1 - plugin_name="${plugin##*/}" - - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ try %{ buffer *plug* } catch %{ plug-list noupdate } }" | kak -p ${kak_session} - - lockfile="${kak_opt_plug_install_dir}/.${plugin_name:-global}.plug.kak.lock" - if [ -d "${lockfile}" ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Waiting for .plug.kak.lock} }" | kak -p ${kak_session} - fi - - while ! mkdir "${lockfile}" 2>/dev/null; do sleep 1; done - trap "rmdir '${lockfile}'" EXIT - - if [ -n "${plugin}" ]; then - if [ -d "${kak_opt_plug_install_dir}/${plugin_name}" ]; then - ( - cd "${kak_opt_plug_install_dir}" && rm -rf "${plugin_name}" - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Deleted} }" | kak -p ${kak_session} - ) - else - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} echo -markup %{{Error}No such plugin '${plugin}'}" | kak -p ${kak_session} - exit - fi - else - for installed_plugin in $(printf "%s\n" ${kak_opt_plug_install_dir}/*); do - skip= - for enabled_plugin in ${kak_opt_plug_plugins}; do - [ "${installed_plugin##*/}" = "${enabled_plugin##*/}" ] && { skip=1; break; } - done - [ "${skip}" = "1" ] || plugins_to_remove=${plugins_to_remove}" ${installed_plugin}" - done - for plugin in ${plugins_to_remove}; do - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin##*/}} %{Deleted} }" | kak -p ${kak_session} - rm -rf ${plugin} - done - fi -) > /dev/null 2>&1 < /dev/null & }} - -define-command -override -hidden \ --docstring "plug-eval-hooks: wrapper for post update/install hooks" \ -plug-eval-hooks -params 1 %{ nop %sh{ ( - status=0 - plugin_name="$1" - eval "set -- ${kak_quoted_opt_plug_post_hooks}" - while [ $# -gt 0 ]; do - if [ "$1" = "${plugin_name}" ]; then - plugin_name="${1##*/}" - plugin_log="${TMPDIR:-/tmp}/${plugin_name}-log" - cd "${kak_opt_plug_install_dir}/${plugin_name}" - printf "%s\n" "hook global -always KakEnd .* %{ nop %sh{rm -rf ${plugin_log}}} - evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{Running post-update hooks} }" | kak -p ${kak_session} - IFS=' -' - for cmd in $2; do - eval "${cmd}" >> ${plugin_log} 2>&1 - status=$? - if [ ! ${status} -eq 0 ]; then - break - fi - done - - if [ ${status} -ne 0 ]; then - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ echo -debug %{plug.kak: error occured while evaluation of post-update hooks for ${plugin_name}. Aborting with error code ${status}} }" | kak -p ${kak_session} - fi - break - fi - shift - done - - if [ ${status} -ne 0 ]; then - message="Error (${status})" - else - message="Done" - fi - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{${plugin_name}} %{${message}} }" | kak -p ${kak_session} -) > /dev/null 2>&1 < /dev/null & }} - -define-command -override \ --docstring "plug-list [<noupdate>]: list all installed plugins in *plug* buffer. Checks updates by default unless <noupdate> is specified." \ -plug-list -params ..1 %{ evaluate-commands -try-client %opt{toolsclient} %sh{ - noupdate=$1 - tmp=$(mktemp -d "${TMPDIR:-/tmp}/plug-kak.XXXXXXXX") - fifo="${tmp}/fifo" - plug_buffer="${tmp}/plug-buffer" - mkfifo ${fifo} - - printf "%s\n" "edit! -fifo ${fifo} *plug* - set-option buffer filetype plug - plug-show-help - hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -rf ${tmp} } } - map buffer normal '<ret>' ':<space>plug-fifo-operate install-update<ret>' - map buffer normal 'H' ':<space>plug-show-help<ret>' - map buffer normal 'U' ':<space>plug-fifo-operate update<ret>' - map buffer normal 'I' ':<space>plug-fifo-operate install<ret>' - map buffer normal 'L' ':<space>plug-fifo-operate log<ret>' - map buffer normal 'D' ':<space>plug-fifo-operate clean<ret>' - map buffer normal 'R' ':<space>plug-fifo-operate hooks<ret>'" - - # get those plugins which were loaded by plug.kak - eval "set -- ${kak_opt_plug_plugins}" - while [ $# -gt 0 ]; do - if [ -d "${kak_opt_plug_install_dir}/${1##*/}" ]; then - printf "%s: Installed\n" "$1" >> ${plug_buffer} - else - printf "%s: Not installed\n" "$1" >> ${plug_buffer} - fi - shift - done - - # get those plugins which have a directory at installation path, but wasn't mentioned in any config file - for exitsting_plugin in $(printf "%s\n" ${kak_opt_plug_install_dir}/*); do - if [ $(expr "${kak_opt_plug_plugins}" : ".*${exitsting_plugin##*/}.*") -eq 0 ]; then - printf "%s: Not loaded\n" "${exitsting_plugin##*/}" >> ${plug_buffer} - fi - done - - ( sort ${plug_buffer} > ${fifo} ) > /dev/null 2>&1 < /dev/null & - - if [ -z "${noupdate}" ]; then - ( - [ -z "${GIT_TERMINAL_PROMPT}" ] && export GIT_TERMINAL_PROMPT=0 - eval "set -- ${kak_opt_plug_plugins}" - while [ $# -gt 0 ]; do - plugin_dir="${1##*/}" - if [ -d "${kak_opt_plug_install_dir}/${plugin_dir}" ]; then ( - cd ${kak_opt_plug_install_dir}/${plugin_dir} - git fetch > /dev/null 2>&1 - status=$? - if [ ${status} -eq 0 ]; then - LOCAL=$(git rev-parse @{0}) - REMOTE=$(git rev-parse @{u}) - BASE=$(git merge-base @{0} @{u}) - - if [ ${LOCAL} = ${REMOTE} ]; then - message="Up to date" - elif [ ${LOCAL} = ${BASE} ]; then - message="Update available" - elif [ ${REMOTE} = ${BASE} ]; then - message="Local changes" - else - message="Installed" - fi - else - message="Fetch Error (${status})" - fi - printf "%s\n" "evaluate-commands -client ${kak_client:-client0} %{ plug-update-fifo %{$1} %{${message}} }" | kak -p ${kak_session} - ) > /dev/null 2>&1 < /dev/null & fi - shift - done - ) > /dev/null 2>&1 < /dev/null & - fi - -}} - -define-command -hidden -override \ --docstring "operate on *plug* buffer contents based on current cursor position" \ -plug-fifo-operate -params 1 %{ evaluate-commands -save-regs t %{ - execute-keys -save-regs '' "<a-h><a-l>" - set-register t %val{selection} - evaluate-commands %sh{ - plugin="${kak_reg_t%:*}" - case $1 in - (install-update) - if [ -d "${kak_opt_plug_install_dir}/${plugin##*/}" ]; then - printf "%s\n" "plug-update ${plugin}" - else - printf "%s\n" "plug-install ${plugin}" - fi ;; - (update) - if [ -d "${kak_opt_plug_install_dir}/${plugin##*/}" ]; then - printf "%s\n" "plug-update ${plugin}" - else - printf "%s\n" "echo -markup %{{Information}'${plugin}' is not installed}" - fi ;; - (install) - if [ ! -d "${kak_opt_plug_install_dir}/${plugin##*/}" ]; then - printf "%s\n" "plug-install ${plugin}" - else - printf "%s\n" "echo -markup %{{Information}'${plugin}' already installed}" - fi ;; - (clean) - printf "%s\n" "plug-clean ${plugin}" ;; - (log) - printf "%s\n" "plug-display-log ${plugin}" ;; - (hooks) - printf "%s\n" "plug-eval-hooks ${plugin##*/}" ;; - (*) - ;; - esac - } -}} - -define-command -hidden -override \ --docstring "plug-update-fifo <plugin> <message>" \ -plug-update-fifo -params 2 %{ evaluate-commands -buffer *plug* -save-regs "/""" %{ try %{ - set-register / "%arg{1}: " - set-register dquote %arg{2} - execute-keys /<ret>lGlR -}}} - -define-command -hidden -override \ -plug-display-log -params 1 %{ evaluate-commands %sh{ - plugin_log="${TMPDIR:-/tmp}/${1##*/}-log" - [ -s "${plugin_log}" ] && printf "%s\n" "edit! -existing -debug -readonly -scroll %{${plugin_log}}" -}} - -define-command -override \ --docstring "displays help message" \ -plug-show-help %{ - info -title "plug.kak Help" "h,j,k,l: Move -<ret>: Update or Install plugin -I: Install plugin -U: Update plugin -D: clean (Delete) plugin -L: show Log, if any -R: Run post-update hooks manually -H show Help message" -} diff --git a/config/kak/plugins/plugrc.kak b/config/kak/plugins/plugrc.kak deleted file mode 100644 index 6ac3fea..0000000 --- a/config/kak/plugins/plugrc.kak +++ /dev/null @@ -1,15 +0,0 @@ -# `plug.kak` Configuration -# -# This script configures plugins to install to `$XDG_CACHE_HOME` by default -# instead of the Kakoune configuration directory and adds code to upgrade -# the checked-in `plug.kak`. - -source "%val{config}/plugins/plug.kak" -set-option global plug_install_dir %sh{ - echo "${XDG_CACHE_HOME:-$HOME/.cache}/kak/plugins" -} - -plug "robertmeta/plug.kak" noload do %{ - kak_config="${XDG_CONFIG_HOME:-$HOME/.config}/kak" - cp rc/plug.kak "$kak_config/plugins/plug.kak" -} diff --git a/config/nvim/colors/pico8.vim b/config/nvim/colors/pico8.vim deleted file mode 100644 index 3d33b08..0000000 --- a/config/nvim/colors/pico8.vim +++ /dev/null @@ -1 +0,0 @@ -lua require('colors.pico8').colorscheme() diff --git a/config/nvim/ftplugin/javascript.vim b/config/nvim/ftplugin/javascript.vim new file mode 120000 index 0000000..8653162 --- /dev/null +++ b/config/nvim/ftplugin/javascript.vim @@ -0,0 +1 @@ +typescript.vim
\ No newline at end of file diff --git a/config/nvim/ftplugin/typescript.vim b/config/nvim/ftplugin/typescript.vim index ca27e7f..7155518 100644 --- a/config/nvim/ftplugin/typescript.vim +++ b/config/nvim/ftplugin/typescript.vim @@ -1 +1 @@ -lua require('ft.typescript') +lua require('ft.ecmascript') diff --git a/config/nvim/ftplugin/typescriptreact.vim b/config/nvim/ftplugin/typescriptreact.vim index ca27e7f..8653162 100644..120000 --- a/config/nvim/ftplugin/typescriptreact.vim +++ b/config/nvim/ftplugin/typescriptreact.vim @@ -1 +1 @@ -lua require('ft.typescript') +typescript.vim
\ No newline at end of file diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 318b024..8b5610b 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,6 +1,7 @@ -local utils = require("utils") +local packer = require("utils.packer") +local set = require("utils.set") -utils.vars { +set.vars { loaded_python_provider = 0, loaded_python3_provider = 0, loaded_perl_provider = 0, @@ -8,52 +9,27 @@ utils.vars { loaded_node_provider = 0, } -require("packer").startup(function (use) +packer.startup(function (use) use "wbthomason/packer.nvim" use "andymass/vim-matchup" use { - "folke/todo-comments.nvim", - requires = "nvim-lua/plenary.nvim", - } - use "folke/lsp-colors.nvim" - use { - "folke/tokyonight.nvim", - config = function () - vim.g.tokyonight_colors = { - bg_dark = "#121212", - bg = "#1e1e1e", - bg_highlight = "#242424", - } - vim.cmd [[colorscheme tokyonight]] - end, - } - use { "folke/which-key.nvim", - config = [[require("which-key").setup()]], - } - use { - "hoob3rt/lualine.nvim", - requires = "kyazdani42/nvim-web-devicons", config = function () - require("lualine").setup { - options = { - theme = "tokyonight", - section_separators = "", - component_separators = "", - }, - } - end + require("which-key").setup() + require("config.keys").setup() + end, } use { "neovim/nvim-lspconfig", - config = [[require("config.lsp").setup()]], + config = function () + require("config.lsp").setup() + end, } use { "nvim-telescope/telescope.nvim", requires = { "kyazdani42/nvim-web-devicons", - "nvim-lua/popup.nvim", "nvim-lua/plenary.nvim", }, } @@ -63,74 +39,44 @@ require("packer").startup(function (use) require("nvim-treesitter.configs").setup { ensure_installed = "maintained", highlight = {enable = true}, + matchup = {enable = true}, } end, } - use "sheerun/vim-polyglot" use "tpope/vim-commentary" - use "tpope/vim-surround" + use { + "tpope/vim-surround", + requires = "tpope/vim-repeat", + } -- TODO: some other plugins to try out --[=[ - use "dense-analysis/ale" - use "folke/trouble.nvim" - use "glepnir/lspsaga.nvim" - use "junegunn/vim-peekaboo" - use "lukas-reineke/indent-blankline.nvim", - use "neovim/nvim-lspconfig" + use "ggandor/lightspeed.nvim" + use "hrsh7th/nvim-cmp" + use "jose-elias-alvarez/null-ls.nvim" + use "lewis6991/gitsigns.nvim" use "nvim-lua/lsp-status.nvim" - use "nvim-lua/completion-nvim" + use "nvim-lualine/lualine.nvim" + use "nvim-neorg/neorg" use "onsails/lspkind-nvim" + use "phaazon/hop.nvim" ]=]-- end) -- customization -utils.vars { +set.vars { mapleader = ",", maplocalleader = ",", } -utils.opts { - inccommand = "nosplit", - showmode = false, - smarttab = true, -} -utils.wopts { + +set.opts { number = true, relativenumber = true, list = true, - listchars = "tab:» ,nbsp:␣,trail:·", -} -utils.bopts { - autoindent = true, - copyindent = true, - expandtab = false, + listchars = {tab = "» ", nbsp = "␣", trail = "·"}, tabstop = 4, shiftwidth = 4, } -- TODO: make this prettier. vim.cmd [[call matchadd('ColorColumn', '\%81v.')]] - -require("which-key").register({ - f = { - name = "find", - b = {"<cmd>Telescope buffers<cr>", "Buffer"}, - c = {"<cmd>Telescope commands<cr>", "Command"}, - f = {"<cmd>Telescope find_files<cr>", "File"}, - g = {"<cmd>Telescope git_files<cr>", "Git File"}, - m = {"<cmd>Telescope git_status<cr>", "Git Modified File"}, - s = {"<cmd>Telescope treesitter<cr>", "Symbol"}, - w = {"<cmd>Telescope grep_string<cr>", "Word"}, - p = {"<cmd>Telescope planets<cr>", "Planet"}, - ["/"] = {"<cmd>Telescope live_grep<cr>", "Search"}, - }, -}, {prefix = "<leader>"}) - --- TODO(nlordell): final touches ---[[ - * configure LSP signs and tweak keymaps: - <https://github.com/wbthomason/dotfiles/blob/linux/neovim/.config/nvim/lua/config/lsp.lua> - * configure colours: - <https://github.com/wbthomason/dotfiles/blob/linux/neovim/.config/nvim/plugin/colors.vim> - * configure a colour scheme. -]]-- diff --git a/config/nvim/lua/colors/pico8.lua b/config/nvim/lua/colors/pico8.lua deleted file mode 100644 index 5fabab6..0000000 --- a/config/nvim/lua/colors/pico8.lua +++ /dev/null @@ -1,53 +0,0 @@ -local palette = { - black = "#000000", - dark_blue = "#1d2b53", - dark_purple = "#7e2553", - dark_green = "#008751", - brown = "#ab5236", - dark_grey = "#5f574f", - light_grey = "#c2c3c7", - white = "#fff1e8", - red = "#ff004d", - orange = "#ffa300", - yellow = "#ffec27", - green = "#00e436", - blue = "#29adff", - indigo = "#83769c", - pink = "#ff77a8", - peach = "#ffccaa", -} - -function colorscheme() - -end - -function terminal() - vim.g.terminal_color_0 = palette.black - vim.g.terminal_color_8 = palette.dark_grey - - vim.g.terminal_color_1 = palette.red - vim.g.terminal_color_9 = palette.red - - vim.g.terminal_color_2 = palette.green - vim.g.terminal_color_10 = palette.green - - vim.g.terminal_color_3 = palette.orange - vim.g.terminal_color_11 = palette.orange - - vim.g.terminal_color_4 = palette.blue - vim.g.terminal_color_12 = palette.blue - - vim.g.terminal_color_5 = palette.pink - vim.g.terminal_color_13 = palette.pink - - vim.g.terminal_color_6 = palette.indigo - vim.g.terminal_color_14 = palette.indigo - - vim.g.terminal_color_7 = palette.white - vim.g.terminal_color_15 = palette.white -end - -return { - palette = palette, - colorscheme = colorscheme, -} diff --git a/config/nvim/lua/config/keys.lua b/config/nvim/lua/config/keys.lua new file mode 100644 index 0000000..176a6fb --- /dev/null +++ b/config/nvim/lua/config/keys.lua @@ -0,0 +1,24 @@ +local keys = require("which-key") + +local function setup() + keys.register({ + f = { + name = "find", + b = {"<cmd>Telescope buffers<cr>", "Buffer"}, + c = {"<cmd>Telescope commands<cr>", "Command"}, + f = {"<cmd>Telescope find_files<cr>", "File"}, + F = {"<cmd>Telescope git_files<cr>", "Git File"}, + g = {"<cmd>Telescope live_grep<cr>", "Live Grep"}, + m = {"<cmd>Telescope git_status<cr>", "Git Modified File"}, + s = {"<cmd>Telescope treesitter<cr>", "Symbol"}, + r = {"<cmd>Telescope grep_string<cr>", "String"}, + p = {"<cmd>Telescope planets<cr>", "Planet"}, + }, + }, { + prefix = "<leader>", + }) +end + +return { + setup = setup, +} diff --git a/config/nvim/lua/config/lsp.lua b/config/nvim/lua/config/lsp.lua index bc78093..d1171cf 100644 --- a/config/nvim/lua/config/lsp.lua +++ b/config/nvim/lua/config/lsp.lua @@ -1,27 +1,28 @@ local lspconfig = require("lspconfig") +local keys = require("which-key") local function on_attach(client, buffer) vim.bo[buffer].omnifunc = "v:lua.vim.lsp.omnifunc" - require("which-key").register({ + keys.register({ a = { name = "lsp", a = {"<cmd>Telescope lsp_code_actions<cr>", "Actions"}, d = {"<cmd>lua vim.lsp.buf.definition()<cr>", "Declaration"}, D = {"<cmd>Telescope lsp_definitions<cr>", "Definition"}, - e = {"<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<cr>", "Show Diagnostic"}, + e = {"<cmd>lua vim.diagnostic.open_float()<cr>", "Show Diagnostic"}, f = {"<cmd>lua vim.lsp.buf.formatting()<cr>", "Format"}, i = {"<cmd>Telescope lsp_implementations<cr>", "Implementation"}, k = {"<cmd>lua vim.lsp.buf.hover()<cr>", "Hover"}, K = {"<cmd>lua vim.lsp.buf.signature_help()<cr>", "Help"}, - l = {"<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics"}, - L = {"<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics"}, + l = {"<cmd>Telescope diagnostics bufnr="..buffer.."<cr>", "Document Diagnostics"}, + L = {"<cmd>Telescope diagnostics<cr>", "Diagnostics"}, n = {"<cmd>lua vim.lsp.buf.rename()<cr>", "Rename"}, r = {"<cmd>Telescope lsp_references<cr>", "References"}, s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"}, S = {"<cmd>Telescope lsp_workspace_symbols<cr>", "Workspace Symbols"}, - ["["] = {"<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "Previous Diagnostic" }, - ["]"] = {"<cmd>lua vim.lsp.diagnostic.goto_next()<cr>", "Next Diagnostic" }, + ["["] = {"<cmd>lua vim.diagnostic.goto_prev()<cr>", "Previous Diagnostic" }, + ["]"] = {"<cmd>lua vim.diagnostic.goto_next()<cr>", "Next Diagnostic" }, } }, { prefix = "<leader>", @@ -37,63 +38,14 @@ local function setup() } } - if vim.env.NVIM_DENO ~= "off" then - lspconfig.denols.setup { - on_attach = on_attach, - init_options = {lint = true}, - } - else - lspconfig.tsserver.setup { - on_attach = function (client, buffer) - client.resolved_capabilities.document_formatting = false - on_attach(client, buffer) - end - } - lspconfig.diagnosticls.setup { - filetypes = {"javascript", "typescript", "typescriptreact"}, - init_options = { - linters = { - eslint = { - sourceName = "eslint", - rootPatterns = {"package.json"}, - command = "./node_modules/.bin/eslint", - args = {"--stdin", "--stdin-filename", "%filepath", "--format", "json"}, - debounce = 100, - parseJson = { - errorsRoot = "[0].messages", - line = "line", - column = "column", - endLine = "endLine", - endColumn = "endColumn", - message = "${message} [${ruleId}]", - security = "severity", - }, - securities = { - [2] = "error", - [1] = "warning", - }, - }, - }, - filetypes = { - javascript = "eslint", - typescript = "eslint", - typescriptreact = "eslint", - }, - formatters = { - prettier = { - rootPatterns = {"package.json"}, - command = "./node_modules/.bin/prettier", - args = {"--stdin-filepath", "%filepath"}, - }, - }, - formatFiletypes = { - javascript = "prettier", - typescript = "prettier", - typescriptreact = "prettier", - }, - }, - } - end + lspconfig.denols.setup { + on_attach = on_attach, + init_options = { + lint = true, + }, + } end -return {setup = setup} +return { + setup = setup, +} diff --git a/config/nvim/lua/ft/ecmascript.lua b/config/nvim/lua/ft/ecmascript.lua new file mode 100644 index 0000000..a3efd72 --- /dev/null +++ b/config/nvim/lua/ft/ecmascript.lua @@ -0,0 +1,7 @@ +local set = require("utils.set") +local keys = require("which-key") + +set.opts { + expandtab = true, + shiftwidth = 2, +} diff --git a/config/nvim/lua/ft/rust.lua b/config/nvim/lua/ft/rust.lua index 5f98a2a..841c782 100644 --- a/config/nvim/lua/ft/rust.lua +++ b/config/nvim/lua/ft/rust.lua @@ -1,6 +1,7 @@ -local utils = require("utils") +local set = require("utils.set") +local keys = require("which-key") -require("which-key").register({ +keys.register({ c = { name = "cargo", b = {"<cmd>!cargo build<cr>", "Build"}, @@ -11,6 +12,10 @@ require("which-key").register({ t = {"<cmd>!cargo test<cr>", "Test"}, T = {"<cmd>!cargo test --workspace --all-features<cr>", "Test Workspace"}, } -}, {prefix = "<leader>"}) +}, { + prefix = "<leader>", +}) -utils.bbopts {expandtab=true} +set.opts { + expandtab = true, +} diff --git a/config/nvim/lua/ft/typescript.lua b/config/nvim/lua/ft/typescript.lua deleted file mode 100644 index e858b6e..0000000 --- a/config/nvim/lua/ft/typescript.lua +++ /dev/null @@ -1,18 +0,0 @@ -local utils = require("utils") - -if vim.env.NVIM_DENO == "off" then - require("which-key").register({ - y = { - name = "yarn", - b = {"<cmd>!yarn build<cr>", "Build"}, - f = {"<cmd>!npx eslint --fix %<cr>", "Fix"}, - F = {"<cmd>!yarn lint --fix", "Fix Project"}, - t = {"<cmd>!yarn test<cr>", "Test"}, - } - }, {prefix = "<leader>"}) -end - -utils.bbopts { - expandtab = true, - shiftwidth = 2, -} diff --git a/config/nvim/lua/utils.lua b/config/nvim/lua/utils.lua deleted file mode 100644 index aa21d0d..0000000 --- a/config/nvim/lua/utils.lua +++ /dev/null @@ -1,27 +0,0 @@ -local function scoped_vars(scopes) - return function (vars) - for _, s in ipairs(scopes) do - for k, v in pairs(vars) do - s[k] = v - end - end - end -end - -local function scoped_opts(scopes) - return function (options) - for _, s in ipairs(scopes) do - for k, v in pairs(options) do - s[k] = v - end - end - end -end - -return { - vars = scoped_vars({vim.g}), - opts = scoped_opts({vim.o}), - bopts = scoped_opts({vim.o, vim.bo}), - bbopts = scoped_opts({vim.bo}), - wopts = scoped_opts({vim.o, vim.wo}), -} diff --git a/config/nvim/lua/utils/packer.lua b/config/nvim/lua/utils/packer.lua new file mode 100644 index 0000000..bb71646 --- /dev/null +++ b/config/nvim/lua/utils/packer.lua @@ -0,0 +1,13 @@ +local function startup(...) + local ok, packer = pcall(require, "packer") + if not ok then + print("packer not installed") + return nil + end + + return packer.startup(...) +end + +return { + startup = startup, +} diff --git a/config/nvim/lua/utils/set.lua b/config/nvim/lua/utils/set.lua new file mode 100644 index 0000000..45ddbf4 --- /dev/null +++ b/config/nvim/lua/utils/set.lua @@ -0,0 +1,14 @@ +local function scoped_setter(scopes) + return function (properties) + for _, s in ipairs(scopes) do + for k, v in pairs(properties) do + s[k] = v + end + end + end +end + +return { + vars = scoped_setter({vim.g}), + opts = scoped_setter({vim.opt}), +} diff --git a/config/nvim/old.vim b/config/nvim/old.vim deleted file mode 100644 index 4bce9bb..0000000 --- a/config/nvim/old.vim +++ /dev/null @@ -1,34 +0,0 @@ -let g:polyglot_disabled = ['autoindent', 'sensible'] - -call plug#begin(stdpath('cache').'/plugged') -Plug 'dense-analysis/ale' -Plug 'itchyny/lightline.vim' -Plug 'junegunn/fzf' -Plug 'junegunn/fzf.vim' -Plug 'sheerun/vim-polyglot' -Plug 'terryma/vim-multiple-cursors' -Plug 'tpope/vim-commentary' -Plug 'tpope/vim-surround' -call plug#end() - -set inccommand=nosplit -set noshowmode -set number relativenumber -set list -set listchars=tab:»\ ,nbsp:␣,trail:· -set autoindent copyindent -set noexpandtab tabstop=4 shiftwidth=4 smarttab - -call matchadd('ColorColumn', '\%81v.') - -let g:ale_sign_error = "\uf06a" -let g:ale_sign_warning = "\uf071" - -nnoremap <silent> <Leader>af :ALEFix<CR> -nnoremap <silent> <Leader>an :ALENext<CR> -nnoremap <silent> <Leader>ap :ALEPrevious<CR> -nnoremap <silent> <Leader>gm :Rg =======<CR> -nnoremap <silent> <Leader>fb :Buffers<CR> -nnoremap <silent> <Leader>ff :Files<CR> -nnoremap <silent> <Leader>fg :GFiles<CR> -nnoremap <silent> <Leader>fl :Lines<CR> diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf deleted file mode 100644 index 20843f6..0000000 --- a/config/tmux/tmux.conf +++ /dev/null @@ -1,2 +0,0 @@ -set -g escape-time 0 -set -g status-position top @@ -18,10 +18,6 @@ dotlink() { fi } -nvimpack() { - echo "$HOME/.local/share/nvim/site/pack/$1/start/$2" -} - gitinst() { if [[ ! -e "$2" ]]; then local remote="[email protected]:$1.git" @@ -31,12 +27,10 @@ gitinst() { mkdir -p "$HOME/.config" +dotlink "config/emacs" dotlink "config/nvim" -dotlink "config/kak" -dotlink "config/tmux" - gitinst \ "wbthomason/packer.nvim" \ - "$(nvimpack "packer" "packer.nvim")" + "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" -nvim +PackerInstall +PackerCompile +qall +nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync" |
