[submodule "config/foot/base16"]
path = config/foot/base16
url = https://github.com/tinted-theming/base16-foot
+ branch = main
-Subproject commit eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce
+Subproject commit ac91059cde702c38e44e6c93e67edf1b84f9720e
--- /dev/null
+Subproject commit 2e92602eef5ed1717660689765b93583eecce099
+++ /dev/null
-MIT License
-
-Copyright (c) 2021 Ersikan
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+++ /dev/null
-# bookmarks.kak
-
-A bookmarks plugin for the kakoune editor.
-
-## Installation
-
-The recommended way to install this plugin is using [plug.kak](https://github.com/andreyorst/plug.kak).
-
-```kak
-plug "Ersikan/bookmarks.kak"
-```
-
-## Configuration
-
-You can enable the bookmarks user mode for all windows like this :
-```kak
-plug "Ersikan/bookmarks.kak" %{
- hook global WinCreate .* bookmarks-enable
-}
-```
-
-## Usage
-
-`bookmarks-enable` enables the `bookmarks` user mode, which can be entered by pressing `,b`.
-
-`bookmarks-add` (`,ba`) adds a new bookmark at the current cursor position.
-
-`bookmarks-delete` (`,bd`) deletes an existing bookmark.
-
-`bookmarks-menu` (`,bb`) jumps to a specific bookmark.
+++ /dev/null
-declare-option -hidden line-specs bookmarks
-
-declare-user-mode bookmarks
-
-map global bookmarks j '<esc>: bookmarks-menu<ret>' -docstring "Jump to a bookmark"
-map global bookmarks d '<esc>: bookmarks-delete<ret>' -docstring "Delete a bookmark"
-map global bookmarks a '<esc>: bookmarks-add<ret>' -docstring "Bookmark current cursor position"
-
-define-command bookmarks-enable %{
- map window user j '<esc>: enter-user-mode bookmarks<ret>' -docstring "Bookmarks mode"
-} -docstring "Enables bookmarks user mode"
-
-define-command bookmarks-disable %{
- unmap window user j '<esc>: enter-user-mode bookmarks<ret>'
-} -docstring "Disables bookmarks user mode"
-
-define-command bookmarks-add %{
- prompt "Bookmark name:" %{
- update-option window bookmarks
- set-option -add window bookmarks "%val{cursor_line}|%val{text}"
- }
-}
-
-define-command bookmarks-menu %{
- bookmarks-menu-command bookmarks-jump-id
-}
-
-define-command bookmarks-delete %{
- bookmarks-menu-command bookmarks-delete-id
-}
-
-define-command -params 1 bookmarks-menu-command %{ evaluate-commands %sh{
- arg=$1
- eval set -- ${kak_quoted_opt_bookmarks}
- shift
-
- if [ $# -eq 0 ] ; then
- printf "fail 'Bookmarks list is empty'\n"
- exit
- fi
-
-
- # Start the menu
- printf 'menu '
-
- # Iterate over bookmarks
- i=1
- for bookmark; do
- #printf 'echo -debug "bookmark %i: %s"\n' $i "$bookmark"
- name=$(printf "$bookmark" | cut -s -d '|' -f 2)
-
- # Print the menu entry
- printf "'%s' '%s %i' " "$name" "$arg" $i
-
- i=$((i+1))
- done
-}}
-
-define-command -params 1 bookmarks-jump-id %{
- update-option window bookmarks
- evaluate-commands %sh{
- arg=$1
- eval set -- ${kak_quoted_opt_bookmarks}
- shift $arg
- line=$(printf "$1" | cut -s -d '|' -f 1)
- name=$(printf "$1" | cut -s -d '|' -f 2)
- if [ -z "$line" -o -z "$name"]; then
- printf 'fail "Invalid bookmark number: %s"\n' "$arg"
- else
- printf "execute-keys '%ig'\n" "$line"
- printf "echo 'bookmark arg $arg line $line name $name'\n"
- printf "info 'Went to bookmark \"$name\"'"
- fi
-}}
-
-define-command -params 1 bookmarks-delete-id %{
- update-option window bookmarks
- evaluate-commands %sh{
- arg="$1"
- eval set -- ${kak_quoted_opt_bookmarks}
- shift
- printf 'set-option window bookmarks %%val{timestamp}'
- i=1
- for bookmark; do
- if [ $i -ne "$arg" ] ; then
- printf " '%s'" "$bookmark"
- fi
- i=$((i+1))
- done
- }
-}
-
-Subproject commit 15e0a01d2c5720c576375e7e6b271a5f84dcad2a
+Subproject commit e160d16dff4e61eab53ef126f6b1eb04006b3e4b
--- /dev/null
+Subproject commit f28b3fb88fbc77d69b1027780cb9a16b0bd7fc76
+++ /dev/null
-MIT License
-
-Copyright (c) 2018 Andrey Orst
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+++ /dev/null
-# plug.kak
-[![GitHub issues][1]][2] ![license][3]
-
-![plug.kak][4]
-
-**plug.kak** is a plugin manager for Kakoune, that was inspired by [vim-plug][5] and [use-package][6].
-It can install and update plugins, run post-update actions, and helps to encapsulate the configuration within itself.
-
-
-## Installation
-
-**plug.kak** can be installed anywhere in your system, but in order to update itself, it is required to install **plug.kak** in the plugin installation directory.
-By default, **plug.kak** installs plugins to the `%val{config}/plugins`, which is usually at `$HOME/.config/kak/plugins`:
-
-``` sh
-mkdir -p $HOME/.config/kak/plugins
-git clone https://github.com/andreyorst/plug.kak.git $HOME/.config/kak/plugins/plug.kak
-```
-
-Now, when **plug.kak** is installed, we need to tell Kakoune about it.
-Add this to the `kakrc` file:
-
-``` kak
-source "%val{config}/plugins/plug.kak/rc/plug.kak"
-plug "andreyorst/plug.kak" noload
-```
-
-Alternatively, this process can be automated, by adding the following snippet to the `kakrc`:
-
-``` sh
-evaluate-commands %sh{
- plugins="$kak_config/plugins"
- mkdir -p "$plugins"
- [ ! -e "$plugins/plug.kak" ] && \
- git clone -q https://github.com/andreyorst/plug.kak.git "$plugins/plug.kak"
- printf "%s\n" "source '$plugins/plug.kak/rc/plug.kak'"
-}
-plug "andreyorst/plug.kak" noload
-```
-
-This will create all needed directories on Kakoune launch, and download **plug.kak** if it is not installed already.
-
-**Note**: `plug "andreyorst/plug.kak" noload` is needed to register **plug.kak** as manually loaded plugin, so `plug-clean` will not delete **plug.kak**.
-
-
-## Usage
-
-All plugins are installed and loaded with the `plug` command.
-This command accepts one-or-more arguments, which are keywords and attributes, that change how **plug.kak** behaves.
-
-The first strict rule of the `plug` command is that the first argument is always the plugin name formatted as in GitHub URL: `"author/repository"`.
-
-``` kak
-plug "author/repository"
-```
-
-By default **plug.kak** will look for the plugin at GitHub.com, and download it.
-When the plugin is hosted on a different service, a URL can be used as the first argument.
-So in most cases it is enough to add this to the `kakrc` to use a plugin:
-
-```kak
-plug "delapouite/kakoune-text-objects"
-```
-
-Or with URL:
-
-```kak
-plug "https://gitlab.com/Screwtapello/kakoune-inc-dec"
-```
-
-After adding this, `kakrc` needs to be re-sourced to let **plug.kak** know that configuration was changed.
-Alternatively, Kakoune can be restarted.
-After that newly added plugins can be installed with the `plug-install` command.
-More information about other commands available in [Commands](#Commands) section.
-
-
-### Keywords and attributes
-
-The `plug` command accepts optional attributes, that change how **plug.kak** works, or add additional steps for `plug` to perform.
-
-These keywords are supported:
-
-- [branch, tag, commit](#branch-tag-or-commit)
-- [load-path](#loading-plugin-from-different-path)
-- [noload](#skipping-loading-of-a-plugin)
-- [do](#automatically-do-certain-tasks-on-install-or-update)
-- [theme](#installing-color-schemes)
-- [config](#handling-user-configurations)
-- [defer](#deferring-plugin-configuration)
-- [demand](#demanding-plugin-module-configuration)
-- [ensure](#ensuring-that-plugins-are-installed)
-
-
-#### Branch, Tag or Commit
-
-`plug` can checkout a plugin to desired branch, commit or tag before loading it.
-It can be done by adding the following keywords with parameters: `branch "branch_name"`, `tag "tag_name"` or `commit "commit_hash"`.
-
-
-#### Loading plugin from different path
-
-Plugins can be loaded from arbitrary path by specifying the `load-path` keyword and providing the path as an argument:
-
-``` kak
-plug "plugin_name" load-path "~/Development/plugin_dir"
-```
-
-However all `plug` related commands, like `plug-update` or `plug-clean` will not work for plugins that aren't installed to `plug_install_dir`.
-
-
-#### Skipping loading of a plugin
-
-If plugin needs to be loaded manually, the `noload` keyword can be used.
-This can also be used to avoid loading the plugin second time, like in the example with **plug.kak** from the [installation](#installation) section:
-
-```kak
-source "%val{config}/plugins/plug.kak/rc/plug.kak"
-plug "andreyorst/plug.kak" noload
-```
-
-Note, that plugins with the `noload` keyword are still configured and managed.
-See [handling-user-configuration](#handling-user-configurations) for more details.
-
-
-#### Automatically do certain tasks on install or update
-
-When the plugin requires some additional steps to preform after installation or update, the `do` keyword can be used.
-This keyword expects the body which will be executed in the shell, thus it can only contain shell commands, not Kakoune commands.
-
-```kak
-plug "ul/kak-lsp" do %{
- cargo build --release --locked
- cargo install --force --path .
-}
-```
-
-In the example above **plug.kak** will run these `cargo` commands after `kak-lsp` was installed or updated.
-
-**Note** that even though this is technically a shell expansion, the `%sh{}` expansion can't be used with `do`, as it will be evaluated immediately each time `kakrc` loaded.
-Use `%{}` instead.
-
-
-#### Installing color schemes
-
-To register the plugin as a color scheme, use `theme` keyword.
-Such plugins will be copied to the `%val{config}/colors` directory.
-
-```kak
-plug "andreyorst/base16-gruvbox.kak" theme config %{
- colorscheme base16-gruvbox-dark-soft
-}
-```
-
-
-#### Ensuring that plugins are installed
-
-`plug` command can be explicitly told to install the plugin automatically with the `ensure` keyword.
-The `plug_always_ensure` option can be set to `true` to perform this for each and every plugin specified in the `kakrc`.
-
-Note that `ensure` plugins are installed (if missing) in a background job; they are then only loaded when the install finishes.
-Thus, subsequent `kakrc` commands should not depend on functionality provided by such plugins.
-Only use `ensure` with non-essential plugins, which are not required for `kakrc` to complete loading.
-
-
-#### Handling user configurations
-
-The configuration of the plugin is performed only when the plugin is installed.
-There's a second strict rule of `plug` command: every parameter that doesn't have a keyword before it, is treated as plugin configuration.
-For example:
-
-```kak
-plug "andreyorst/fzf.kak" config %{
- map -docstring 'fzf mode' global normal '<c-p>' ': fzf-mode<ret>'
-}
-```
-
-Here, `plug` will map <kbd>Ctrl</kbd>+<kbd>p</kbd> key only if the plugin is installed.
-Everything within the `config %{}` block is an ordinary kakscript.
-
-The `config` keyword is optional, and can be skipped.
-Multiple `config` blocks are also supported.
-
-
-#### Commenting out `plug` options
-
-It may be tricky to "toggle" `plug` options, for debugging or testing purposes, because it is impossible to continue a command past a `#...` comment (also, `config` blocks usually span multiple lines).
-To solve this, `plug` supports a `comment` keyword that ignores its next argument.
-For example, to toggle a `load-path` option, wrap it in `comment %{}`; then remove the "wrapper" to turn it back on (without having to re-type the full path):
-```kak
-plug "andreyorst/fzf.kak" comment %{load-path /usr/local/src/fzf} config %{
- # ...
-}
-```
-
-
-### Deferring plugin configuration
-
-With the introduction of the module system, some configurations have to be preformed after loading the module.
-The `defer` keyword is a shorthand to register a `ModuleLoaded` hook for given `module`.
-You need to **`require` the module explicitly** elsewhere.
-
-Below is the configuration of [fzf.kak](https://github.com/andreyorst/fzf.kak) plugin, which provides the `fzf` module:
-
-```kak
-plug "andreyorst/fzf.kak" config %{
- map -docstring 'fzf mode' global normal '<c-p>' ': fzf-mode<ret>'
-} defer fzf %{
- set-option global fzf_preview_width '65%'
- set-option global fzf_project_use_tilda true
-}
-```
-
-**Note**: the `ModuleLoaded` hook is defined as early as possible - before sourcing any of plugin files.
-
-### Demanding plugin module configuration
-
-Works the same as `defer` except requires the module immediately:
-
-```kak
-plug "andreyorst/fzf.kak" config %{
- # config1 (evaluated before demanding the module)
-} demand fzf %{
- # demand block (will generate `require-modlue fzf` call, and a respective hook)
- set-option global fzf_project_use_tilda true
-} config %{
- # config2 (evaluated after demanding the module)
-}
-```
-
-The above snippet is a shorthand for this code:
-
-``` kak
-plug "andreyorst/fzf.kak" defer fzf %{
- # the body of demand block
- set-option global fzf_project_use_tilda true # demand block
-} config %{
- # config1 (evaluated before demanding the module)
- require-module fzf # the demand hook
- # config2 (evaluated after demanding the module)
-}
-```
-
-**Note**: the `ModuleLoaded` hook is defined as early as possible - before sourcing any of plugin files.
-The place where `require-module` call will be placed depends on the order of config blocks in the `plug` command.
-As soon as the module is required, the `ModuleLoaded` hook will execute.
-
-
-## **plug.kak** Configuration
-
-Several configuration options are available:
-
-- Changing the [plugin installation directory](#plugin-installation-directory),
-- Limiting the [maximum amount of active downloads](#maximum-downloads),
-- Specifying the [default git domain](#default-git-domain),
-- And [ensuring that plugins are installed](#ensuring-that-plugins-are-installed).
-
-Proper way to configure **plug.kak** is to load it with the `plug` command, and providing both `noload` and `config` blocks:
-This should be done before loading other plugins.
-
-```kak
-plug "andreyorst/plug.kak" noload config %{
- # configure plug.kak here
-}
-```
-
-
-### Plugin installation directory
-
-By default **plug.kak** automatically detects its installation path and installs plugins to the same directory.
-To change this, use the `plug_install_dir` option:
-
-```kak
-plug "andreyorst/plug.kak" noload config %{
- set-option global plug_install_dir %sh{ echo $HOME/.cache/kakoune_plugins }
-}
-```
-
-
-### Maximum downloads
-
-**plug.kak** downloads plugins from github.com asynchronously via `git`.
-By default it allows only `10` simultaneously active `git` processes.
-To change this, use the `plug_max_simultaneous_downloads` option.
-
-
-### Default git domain
-
-If majority of plugins is installed from the service other than GitHub, default git domain can be changed to avoid specifying the `domain` keyword for each plugin, or using URLs.
-
-
-### Notify on configuration error
-
-By default, **plug.kak** will display an `info` box when any plugin's `config` block has errors while being evaluated.
-To change this, use the `plug_report_conf_errors` option:
-
-```kak
-set-option global plug_report_conf_errors false
-```
-
-
-## Commands
-
-**plug.kak** adds five new commands to Kakoune.
-
-
-### `plug-install`
-
-This command installs all plugins that were specified in any of the configuration files sourced after Kakoune launch.
-It accepts optional argument, which can be the plugin name or the URL, so it could be used to install a plugin from command prompt without restarting Kakoune.
-This plugin will be enabled automatically, but you still need to add `plug` command to your configuration files in order to use that plugin after the restart.
-
-
-### `plug-list`
-
-Display the buffer with all installed plugins, and check for updates.
-The <kbd>Enter</kbd> key is remapped to execute `plug-update` or `plug-install` command for selected plugin, depending on its state.
-This command accepts an optional argument `noupdate`, and if it is specified, check for updates will not be performed.
-
-
-### `plug-update`
-
-This command updates all installed plugins.
-It accepts one optional argument, which is a plugin name, so it could be used to update single plugin.
-When called from prompt, it shows all installed plugins in the completion menu.
-
-
-### `plug-clean`
-
-Remove plugins, that are installed, but disabled or missing in configuration files.
-This command also accepts optional argument, which is a plugin name, and can be used to remove any installed plugin.
-
-
-### `plug`
-
-Load plugin from plugin installation directory by its name.
-
-
-### `plug-chain`
-
-This command can collapse separate `plug` invocations and thus saves startup time by reducing multiple shell calls; it may come in handy if you're invoking `kak` frequently (e.g. as the `$EDITOR`). Replace the first `plug` command in your `kakrc` with `plug-chain`, then append subsequent `plug` calls and their parameters, as in the following:
-```
-plug-chain https://github.com/Delapouite/kakoune-select-view config %{
- map global view s '<esc>: select-view<ret>' -docstring 'select view'
-} plug https://github.com/occivink/kakoune-vertical-selection %{
-} plug https://github.com/jbomanson/search-doc.kak demand search-doc %{
- alias global doc-search search-doc
-}
-```
-
-Backslashes can also be used to separate individual `plug` "clauses" (which avoids the "visual hack" of empty config blocks, as above, serving as newlines).
-An initial `plug` redundant argument is also supported for symmetry.
-Either way, `plug-chain` simply figures out the parameters intended for each individual `plug` clause (using "`plug`" as a delimiter), and executes all implied `plug`s in a single shell call.
-All regular `plug` features are supported.
-Mix and match `plug` / `plug-chain` invocations in any order, any number of times.
-
-Note, that if plug.kak own variables are altered in the `plug-chain` body, the chained `plug` commands won't get updated values.
-This happens because Kakoune reads its variables only once per shell invocation, and calling `set-option` won't update the value of a variable for current shell.
-
-
-### Alternative plugin managers
-
-Here are some other plugin managers to consider as alternatives to plug.kak:
-
-- [kak-bundle][7]
-- [cork.kak][8]
-
-[1]: https://img.shields.io/github/issues/andreyorst/plug.kak.svg
-[2]: https://github.com/andreyorst/plug.kak/issues
-[3]: https://img.shields.io/github/license/andreyorst/plug.kak.svg
-[4]: https://user-images.githubusercontent.com/19470159/51197223-f2c26a80-1901-11e9-9494-b79ce823a364.png
-[5]: https://github.com/junegunn/vim-plug
-[6]: https://github.com/jwiegley/use-package
-[7]: https://github.com/jdugan6240/kak-bundle
-[8]: https://github.com/topisani/cork.kak
-
-<!-- LocalWords: kak Kakoune Kakoune's GitLab Gitea noload config
- LocalWords: kakscript kbd Ctrl github fzf
- -->
+++ /dev/null
-# Author: Andrey Listopadov
-# plug.kak is a plugin manager for Kakoune. It can install plugins, keep them updated, configure and build dependencies
-# https://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 \
-"Profile plugin loading." \
-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
-
-declare-option -docstring \
-"Block UI until operation completes." \
-bool plug_block_ui false
-
-# Private options
-declare-option -hidden -docstring \
-"Path to plug.sh script." \
-str plug_sh_source %sh{ echo "${kak_source%%.kak}.sh" }
-
-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 -docstring \
-"Whether or not to report errors in config blocks. Defaults to true." \
-bool plug_report_conf_errors true
-
-declare-option -hidden -docstring \
-"This will be set if there are any errors with a plugin's config block. Has no default value.
-Should not be cleared during update of configuration files. Should not be modified by user." \
-str plug_conf_errors ""
-
-# 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|plug-chain|do|config|domain|defer|demand|load-path|branch|tag|commit|comment)(?=[ \t])' 0:keyword
- add-highlighter shared/kakrc/code/plug_attributes regex '(?<=[ \t])(noload|ensure|theme)\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 "Error: plug.kak: can't declare highlighters for 'kak' filetype: %val{error}"
- $
-@ catch %{
- echo -debug "Error: plug.kak: can't require 'kak' module to declare highlighters for plug.kak. 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 "Error: plug.kak: Can't declare highlighters for *plug* buffer: %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_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug "$@"
- }
-}}
-
-define-command -override plug-chain -params 0.. -docstring %{
- Chain plug commands (see docs, saves startup time by reducing sh calls)
-} %{ try %{
- evaluate-commands %sh{
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- set -u
- . "${kak_opt_plug_sh_source}"
- plug1() {
- for _plug_param; do
- # reset "$@" on 1st iteration; args still in 'for'
- [ "$_plug_processed_args" != 0 ] || set --
- _plug_processed_args=$((_plug_processed_args + 1))
- [ plug != "$_plug_param" ] || break
- set -- "$@" "$_plug_param"
- done
- [ $# = 0 ] || plug "$@" # subshell would be safer, but slower
- }
- while [ "$#" != 0 ]; do
- _plug_processed_args=0
- plug1 "$@"
- shift "$_plug_processed_args"
- done
- }
-}}
-
-define-command -override -docstring \
-"plug-install [<plugin>] [<noload>]: install <plugin>.
-If <plugin> omitted installs all plugins mentioned in configuration
-files. If <noload> is supplied skip loading the plugin." \
-plug-install -params ..2 %{ nop %sh{
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug_install "$@"
-}}
-
-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{
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug_update "$@"
-}}
-
-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{
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug_clean "$@"
-}}
-
-define-command -override -hidden \
--docstring "plug-eval-hooks: wrapper for post update/install hooks" \
-plug-eval-hooks -params 1 %{ nop %sh{
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug_eval_hooks "$@"
-}}
-
-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{
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug_list "$@"
-}}
-
-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{
- # $kak_reg_t
- # $kak_client
- # $kak_config
- # $kak_opt_plug_always_ensure
- # $kak_opt_plug_git_domain
- # $kak_opt_plug_install_dir
- # $kak_opt_plug_loaded_plugins
- # $kak_opt_plug_max_active_downloads
- # $kak_opt_plug_plugin
- # $kak_opt_plug_plugins
- # $kak_opt_plug_profile
- # $kak_opt_plug_block_ui
- # $kak_opt_plug_report_conf_errors
- # $kak_opt_plug_conf_errors
- # $kak_session
-
- . "${kak_opt_plug_sh_source}"
- plug_fifo_operate "$@"
-}}}
-
-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"
-}
+++ /dev/null
-#!/usr/bin/env sh
-
-# Author: Andrey Listopadov
-# https://github.com/andreyorst/plug.kak
-#
-# plug.kak is a plugin manager for Kakoune. It can install plugins,
-# keep them updated, configure and build dependencies.
-#
-# plug.sh contains a set of functions plug.kak calls via shell
-# expansions.
-
-plug_code_append () {
- eval "$1=\"\$$1
-\$2\""
-}
-
-plug () {
- [ "${kak_opt_plug_profile:-}" = "true" ] && plug_save_timestamp profile_start
- plugin_arg=$1
- plugin="${1%%.git}"; plugin=${plugin%%/}
- shift
- plugin_name="${plugin##*/}"
- path_to_plugin="${kak_opt_plug_install_dir:?}/$plugin_name"
- build_dir="${kak_opt_plug_install_dir:?}/.build/$plugin_name"
- conf_file="$build_dir/config"
- hook_file="$build_dir/hooks"
- domain_file="$build_dir/domain"
-
- configurations= hooks= domain= checkout= checkout_type= noload= ensure=
-
- case "${kak_opt_plug_loaded_plugins:-}" in
- (*"$plugin"*)
- printf "%s\n" "echo -markup %{{Information}$plugin_name already loaded}"
- exit
- ;;
- (*)
- printf "%s\n" "set-option -add global plug_plugins %{$plugin }"
- ;;
- esac
-
- while [ $# -gt 0 ]; do
- case $1 in
- (branch|tag|commit) checkout_type=$1; shift; checkout=${1?} ;;
- (noload) noload=1 ;;
- (load-path) shift; eval "path_to_plugin=${1?}" ;;
- (comment) shift ;;
- (defer|demand)
- demand=$1
- shift; module=${1?}
- if [ $# -ge 2 ]; then
- case "$2" in
- (branch|tag|commit|noload|load-path|ensure|theme|domain|depth-sort|subset|no-depth-sort|config|defer|demand|comment)
- ;;
- (*)
- shift
- deferred=$1
- case "$deferred" in (*[![:space:]]*)
- case "$deferred" in (*'@'*)
- deferred=$(printf "%s\n" "$deferred" | sed "s/@/@@/g") ;;
- esac
- printf "%s\n" "hook global ModuleLoaded '$module' %@ $deferred @"
- esac
- [ "$demand" = demand ] && plug_code_append configurations "require-module $module" ;;
- esac
- fi
- ;;
- ('do') shift; plug_code_append hooks "set -e
-${1?}" ;;
- (ensure) ensure=1 ;;
- (theme)
- noload=1
- plug_code_append hooks "[ -d \"${kak_config:?}/colors\" ] || mkdir -p \"${kak_config}/colors\"; ln -sf \"\$PWD\" \"$kak_config/colors\""
- ;;
- (domain) shift; domain=${1?} ;;
- (depth-sort|subset)
- printf "%s\n" "echo -debug %{Error: plug.kak: '$plugin_name': keyword '$1' is no longer supported. Use the module system instead}"
- exit 1 ;;
- (no-depth-sort) printf "%s\n" "echo -debug %{Warning: plug.kak: '$plugin_name': use of deprecated '$1' keyword which has no effect}" ;;
- (config) shift; plug_code_append configurations "${1?}" ;;
- (*) plug_code_append configurations "$1" ;;
- esac
- shift
- done
-
- [ -d "$build_dir" ] || mkdir -p "$build_dir"
- rm -rf "$build_dir"/* "$build_dir"/.[!.]* "$build_dir"/..?*
- [ -n "$hooks" ] && printf "%s" "$hooks" > "$hook_file"
- [ -n "$domain" ] && printf "%s" "$domain" > "$domain_file"
-
- if [ -n "$configurations" ]; then
- if [ "${kak_opt_plug_report_conf_errors:-}" = "true" ]; then
- cat > "$conf_file" <<ERRHANDLE
-try %{ $configurations } catch %{
- echo -debug "Error while evaluating '$plugin_name' configuration: %val{error}"
-
- set-option -add current plug_conf_errors "Error while evaluating '$plugin_name' configuration:"
- set-option -add current plug_conf_errors %sh{ printf "\n " }
- set-option -add current plug_conf_errors %val{error}
- set-option -add current plug_conf_errors %sh{ printf "\n\n" }
-
- hook -once -group plug-conf-err global WinDisplay .* %{
- info -style modal -title "plug.kak error" "%opt{plug_conf_errors}"
- on-key %{
- info -style modal
- execute-keys -with-maps -with-hooks %val{key}
- }
- }
-}
-ERRHANDLE
- else
- printf "%s" "$configurations" > "$conf_file"
- fi
- fi
-
- if [ -d "$path_to_plugin" ]; then
- if [ -n "$checkout" ]; then
- (
- cd "$path_to_plugin" || exit
- # shellcheck disable=SC2030,SC2031
- [ -z "${GIT_TERMINAL_PROMPT:-}" ] && export GIT_TERMINAL_PROMPT=0
- if [ "$checkout_type" = "branch" ]; then
- [ "$(git branch --show-current)" != "$checkout" ] && git fetch >/dev/null 2>&1
- fi
- git checkout "$checkout" >/dev/null 2>&1
- )
- fi
- plug_load "$plugin" "$path_to_plugin" "$noload"
- if [ "$kak_opt_plug_profile" = "true" ]; then
- plug_save_timestamp profile_end
- profile_time=$(echo "scale=3; x=($profile_end-$profile_start)/1000; if(x<1) print 0; x" | bc -l)
- printf "%s\n" "echo -debug %{'$plugin_name' loaded in $profile_time sec}"
- fi
- else
- if [ -n "$ensure" ] || [ "${kak_opt_plug_always_ensure:-}" = "true" ]; then
- (
- plug_install "$plugin_arg" "$noload"
- wait
- if [ "$kak_opt_plug_profile" = "true" ]; then
- plug_save_timestamp profile_end
- profile_time=$(echo "scale=3; x=($profile_end-$profile_start)/1000; if(x<1) print 0; x" | bc -l)
- printf "%s\n" "echo -debug %{'$plugin_name' loaded in $profile_time sec}" | kak -p "${kak_session:?}"
- fi
- ) > /dev/null 2>&1 < /dev/null &
- fi
- fi
-}
-
-plug_install () {
- (
- plugin="${1%%.git}"; plugin=${plugin%%/}
- noload=$2
- plugin_name="${plugin##*/}"
- build_dir="${kak_opt_plug_install_dir:?}/.build/$plugin_name"
- domain_file="$build_dir/domain"
-
- # shellcheck disable=SC2030,SC2031
- [ -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 'Error: plug.kak: 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
- plug_fifo_update "${plugin_name}" "Waiting for .plug.kak.lock"
- fi
-
- # this creates the lock file for a plugin, if specified to
- # prevent several processes of installation of the same
- # plugin, but will allow install different plugins without
- # waiting for each other. Should be fine, since different
- # plugins doesn't interfere with each other.
- while ! mkdir "${lockfile}" 2>/dev/null; do sleep 1; done
- # shellcheck disable=SC2064
- 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##*/}"
- [ -e "$domain_file" ] && git_domain="https://$(cat "$domain_file")" || git_domain=${kak_opt_plug_git_domain:?}
- 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\"}} " | kak -p "${kak_session}"
- plug_fifo_update "${plugin_name}" "Installing"
- cd "${kak_opt_plug_install_dir}" || exit
- case ${plugin} in
- (https://*|http://*|*@*|file://*|ext::*)
- git clone --recurse-submodules "${plugin}" "$plugin_name" >> "$plugin_log" 2>&1 ;;
- (*)
- git clone --recurse-submodules "$git_domain/$plugin" "$plugin_name" >> "$plugin_log" 2>&1 ;;
- esac
- status=$?
- if [ ${status} -ne 0 ]; then
- plug_fifo_update "$plugin_name" "Download Error ($status)"
- else
- plug_eval_hooks "$plugin_name"
- wait
- plug_load "$plugin" "${kak_opt_plug_install_dir:?}/$plugin_name" "$noload" | 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=$(mktemp "${TMPDIR:-/tmp}"/plug.kak.jobs.XXXXXX)
- 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
- rm -rf "${jobs}"
- done
- wait
- ) > /dev/null 2>&1 < /dev/null &
-}
-
-plug_load() {
- plugin="${1%%.git}"
- path_to_plugin=$2
- noload=$3
- plugin_name="${plugin##*/}"
- build_dir="${kak_opt_plug_install_dir:?}/.build/$plugin_name"
- conf_file="$build_dir/config"
-
- if [ -z "${noload}" ]; then
- find -L "${path_to_plugin}" -path '*/.git' -prune -o -type f -name '*.kak' -exec printf 'source "%s"\n' {} +
- fi
- [ -e "$conf_file" ] && printf "%s\n" "source $conf_file"
- printf "%s\n" "set-option -add global plug_loaded_plugins %{${plugin} }"
-}
-
-plug_update () {
- (
- plugin="${1%%.git}"
- plugin_name="${plugin##*/}"
-
- # shellcheck disable=SC2030,SC2031
- [ -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
- plug_fifo_update "${plugin##*/}" "Waiting for .plug.kak.lock"
- fi
-
- while ! mkdir "${lockfile}" 2>/dev/null; do sleep 1; done
- # shellcheck disable=SC2064
- 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}}} " | kak -p "${kak_session}"
- plug_fifo_update "${plugin_name}" "Updating"
- cd "${kak_opt_plug_install_dir}/${plugin_name}" && rev=$(git rev-parse HEAD) && git pull --recurse-submodules >> "${plugin_log}" 2>&1
- status=$?
- if [ ${status} -ne 0 ]; then
- plug_fifo_update "${plugin_name}" "Update Error (${status})"
- 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
- plug_fifo_update "${plugin_name}" "Done"
- fi
- fi
- ) > /dev/null 2>&1 < /dev/null &
- fi
- jobs=$(mktemp "${TMPDIR:-/tmp}"/jobs.XXXXXX)
- 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 $((kak_opt_plug_max_active_downloads * 5)) ]; do
- sleep 1
- jobs > "${jobs}"; active=$(wc -l < "${jobs}")
- done
- rm -rf "${jobs}"
- done
- wait
- ) > /dev/null 2>&1 < /dev/null &
-
- if [ "${kak_opt_plug_block_ui:-}" = "true" ]; then
- wait
- fi
-}
-
-
-plug_clean () {
- (
- plugin="${1%%.git}"
- 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
- plug_fifo_update "${plugin_name}" "Waiting for .plug.kak.lock"
- fi
-
- while ! mkdir "${lockfile}" 2>/dev/null; do sleep 1; done
- # shellcheck disable=SC2064
- 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}"
- plug_fifo_update "${plugin_name}" "Deleted"
- )
- 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
- plug_fifo_update "${plugin##*/}" "Deleted"
- rm -rf "${plugin}"
- done
- fi
- ) > /dev/null 2>&1 < /dev/null &
-
- if [ "$kak_opt_plug_block_ui" = "true" ]; then
- wait
- fi
-}
-
-plug_eval_hooks () {
- (
- plugin="${1%%.git}"
- plugin_name="${plugin##*/}"
- path_to_plugin="${kak_opt_plug_install_dir:?}/$plugin_name"
- build_dir="${kak_opt_plug_install_dir:?}/.build/$plugin_name"
- hook_file="$build_dir/hooks"
-
- plugin_log="${TMPDIR:-/tmp}/${plugin_name}-log"
- cd "$path_to_plugin" || exit
-
- printf "%s\n" "hook global -always KakEnd .* %{ nop %sh{rm -rf ${plugin_log}}}" | kak -p "${kak_session}"
- plug_fifo_update "${plugin_name}" "Running post-update hooks"
-
- status=0
- if [ -e "$hook_file" ]; then
- # shellcheck disable=SC1090
- (. "$hook_file" >> "$plugin_log" 2>&1)
- status=$?
- fi
- [ ${status} -ne 0 ] && message="Error (${status})" || message="Done"
-
- plug_fifo_update "${plugin_name}" "${message}"
- ) > /dev/null 2>&1 < /dev/null &
-
- if [ "$kak_opt_plug_block_ui" = "true" ]; then
- wait
- fi
-}
-
-plug_list () {
- 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 existing_plugin in "${kak_opt_plug_install_dir}"/*; do
- case "${kak_opt_plug_plugins}" in
- (*"${existing_plugin##*/}"*) ;;
- (*)
- printf "%s: Not loaded\n" "${existing_plugin##*/}" >> "${plug_buffer}"
- ;;
- esac
- done
-
- ( sort "${plug_buffer}" > "${fifo}" ) > /dev/null 2>&1 < /dev/null &
-
- if [ -z "${noupdate}" ]; then
- (
- # shellcheck disable=SC2030,SC2031
- [ -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}" || exit
- git fetch > /dev/null 2>&1
- status=$?
- if [ ${status} -eq 0 ]; then
- { IFS= read -r LOCAL; IFS= read -r REMOTE; IFS= read -r BASE; } <<EOF
-$(
- git rev-parse @ '@{u}' # prints 2 lines
- git merge-base @ '@{u}'
-)
-EOF
-
- 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
- plug_fifo_update "$1" "${message}"
- ) > /dev/null 2>&1 < /dev/null & fi
- shift
- done
- ) > /dev/null 2>&1 < /dev/null &
- fi
-}
-
-plug_fifo_operate() {
- plugin="${kak_reg_t%:*}"
- case $1 in
- (install-update)
- if [ -d "${kak_opt_plug_install_dir}/${plugin##*/}" ]; then
- plug_update "${plugin}"
- else
- plug_install "${plugin}" true
- fi ;;
- (update)
- if [ -d "${kak_opt_plug_install_dir}/${plugin##*/}" ]; then
- 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
- plug_install "${plugin}"
- else
- printf "%s\n" "echo -markup %{{Information}'${plugin}' already installed}"
- fi ;;
- (clean) plug_clean "${plugin}" ;;
- (log) printf "%s\n" "plug-display-log $plugin" ;;
- (hooks) plug_eval_hooks "${plugin##*/}" ;;
- (*) ;;
- esac
-}
-
-plug_fifo_update() {
- printf "%s\n" "
- evaluate-commands -draft -buffer *plug* -save-regs \"/\"\"\" %{ try %{
- set-register / \"$1: \"
- set-register dquote %{$2}
- execute-keys -draft /<ret>lGlR
- }}" | kak -p "$kak_session"
-}
-
-plug_save_timestamp() {
- plug_tstamp=${EPOCHREALTIME:-}
- if [ -n "$plug_tstamp" ]; then
- plug_tstamp_ms=${plug_tstamp#*.}
- case "$plug_tstamp_ms" in
- (????*) plug_tstamp_ms=${plug_tstamp_ms%"${plug_tstamp_ms#???}"} ;;
- (???) ;;
- (*) plug_tstamp= ;; # redo with date
- esac
- if [ -n "$plug_tstamp" ]; then
- plug_tstamp=${plug_tstamp%.*}${plug_tstamp_ms}
- fi
- fi
- : "${plug_tstamp:=$(date +%s%3N)}"
- if [ -n "$1" ]; then eval "$1=\$plug_tstamp"; fi
-}
-
-# Spell-checker local dictionary
-# LocalWords: Andrey Listopadov github kak usr config dir Kakoune
-# LocalWords: expr ModuleLoaded mkdir ln PWD conf shellcheck noload
-# LocalWords: TMPDIR tmp noupdate lockfile rmdir ret gjO esc KakEnd
-# LocalWords: nop rf hacky eval fifo filetype BufCloseFifo regs
-# LocalWords: dquote lGlR
+++ /dev/null
-The preferred way to contribute would be through GitHub pull requests,
-as an alternative patches can be discussed on the IRC channel.
-
-When contributing your first changes, please include an empty commit for
-copyright waiver using the following message (replace 'John Doe' with
-your name or nickname):
-
- John Doe Copyright Waiver
-
- I dedicate any and all copyright interest in this software to the
- public domain. I make this dedication for the benefit of the public at
- large and to the detriment of my heirs and successors. I intend this
- dedication to be an overt act of relinquishment in perpetuity of all
- present and future rights to this software under copyright law.
-
-The command to create an empty commit from the command-line is:
-
- git commit --allow-empty
+++ /dev/null
-# prelude.kak
-
-Prelude of shell blocks for [Kakoune].
-
-## Installation
-
-Add [`prelude.kak`](rc/prelude.kak) to your autoload or source it manually.
-
-``` kak
-require-module prelude
-```
-
-## Usage
-
-```
-kak_escape [text…]
-```
-
-Similar to `shell_escape` you may find in other programming languages,
-`kak_escape` escapes each argument so that it can be safely passed to Kakoune.
-
-**Implementation**:
-Single quotes each argument and doubles the single quotes inside.
-
-**Note**:
-The resulted text should be used unquoted and is not intended for use in double quotes, nor in single quotes.
-
-**Example**:
-
-``` kak
-evaluate-commands %sh{
- . "$kak_opt_prelude_path"
- kak_escape evaluate-commands -try-client "$kak_client" 'echo Tchou' | kak -p "$kak_session"
-}
-```
-
-[Kakoune]: https://kakoune.org
+++ /dev/null
-This is free and unencumbered software released into the public domain.
-
-Anyone is free to copy, modify, publish, use, compile, sell, or
-distribute this software, either in source code form or as a compiled
-binary, for any purpose, commercial or non-commercial, and by any
-means.
-
-In jurisdictions that recognize copyright laws, the author or authors
-of this software dedicate any and all copyright interest in the
-software to the public domain. We make this dedication for the benefit
-of the public at large and to the detriment of our heirs and
-successors. We intend this dedication to be an overt act of
-relinquishment in perpetuity of all present and future rights to this
-software under copyright law.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-For more information, please refer to <https://unlicense.org/>
+++ /dev/null
-declare-option -hidden str prelude_root_path %sh(dirname "$kak_source")
-
-provide-module prelude %{
- declare-option -docstring 'Path to the prelude of shell blocks' str prelude_path "%opt{prelude_root_path}/prelude.sh"
-}
+++ /dev/null
-kak_escape() {
- for text do
- printf "'"
- while true; do
- case "$text" in
- *"'"*)
- head=${text%%"'"*}
- tail=${text#*"'"}
- printf "%s''" "$head"
- text=$tail
- ;;
- *)
- printf "%s' " "$text"
- break
- ;;
- esac
- done
- done
- printf "${KAK_ESCAPE_EOF:-\n}"
-}
-
-kak_escape_partial() {
- KAK_ESCAPE_EOF=' ' kak_escape "$@"
-}
--- /dev/null
+Subproject commit 4e633978c119bbb71f215828f7b59cea71a2c5a4
+++ /dev/null
-This is free and unencumbered software released into the public domain.
-
-Anyone is free to copy, modify, publish, use, compile, sell, or
-distribute this software, either in source code form or as a compiled
-binary, for any purpose, commercial or non-commercial, and by any
-means.
-
-In jurisdictions that recognize copyright laws, the author or authors
-of this software dedicate any and all copyright interest in the
-software to the public domain. We make this dedication for the benefit
-of the public at large and to the detriment of our heirs and
-successors. We intend this dedication to be an overt act of
-relinquishment in perpetuity of all present and future rights to this
-software under copyright law.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-For more information, please refer to <http://unlicense.org>
+++ /dev/null
-# shellcheck.kak
-[ShellCheck](https://www.shellcheck.net) integration for [Kakoune](https://kakoune.org)
-
-## Installation
-
-First, install `shellcheck`. See [here](https://github.com/koalaman/shellcheck#installing) for directions.
-
-### With plug.kak
-
-To install the plugin, I recommend using [`plug.kak`](https://github.com/andreyorst/plug.kak). You can install it by adding the following to your `kakrc`:
-
-```
-plug "whereswaldon/shellcheck.kak"
-```
-
-### Manually
-
-If you prefer to install it manually, you can use:
-
-```bash
-mkdir -p ~/.config/kak/plugins/
-git clone https://github.com/whereswaldon/shellcheck.kak ~/.config/kak/plugins/shellcheck.kak/
-```
-
-You'll need to add the following to your kakrc as well:
-
-```
-source "%val{config}/plugins/shellcheck.kak/shellcheck.kak"
-```
-
-## Commands
-
-- `shellcheck-enable` starts linting the current window with shellcheck when you `:write` it.
-- `shellcheck-disable` turns off linting the current window.
-
-## Configuration
-
-Currently, the plugin will automatically enable linting when kakoune
-determines that the current filetype is a shell script.
-
-## Contribute
-
-Feature requests and pull requests welcome!
-
-## License
-
-Unlicense
-
+++ /dev/null
-######################
-# Internal utilities #
-######################
-
-define-command -hidden -override -docstring "check whether shellcheck is installed" shellcheck-check-installed %{
- evaluate-commands %sh{
- if command -v shellcheck > /dev/null 2>&1; then
- printf "set-option window shellcheck_installed true\n"
- else
- printf "set-option window shellcheck_installed false\n"
- fi
- }
-}
-
-define-command -hidden -override -docstring "populate options with shellcheck version information" shellcheck-parse-version %{
- evaluate-commands %sh{
- version="$(shellcheck -V|egrep 'version:'|tr -s ' '|cut -d' ' -f2)"
- printf "set-option window shellcheck_major_version %d\n" "$(echo "$version" | cut -d'.' -f 1)"
- printf "set-option window shellcheck_minor_version %d\n" "$(echo "$version" | cut -d'.' -f 2)"
- printf "set-option window shellcheck_patch_version %d\n" "$(echo "$version" | cut -d'.' -f 3)"
- }
- echo -debug "Using shellcheck v%opt{shellcheck_major_version}.%opt{shellcheck_minor_version}.%opt{shellcheck_patch_version}"
-}
-
-define-command -hidden -override -docstring "enable shellcheck in the current window" shellcheck-configure-window %{
- set window lintcmd %sh{
- # format like gcc, check files other than the current buffer if they are 'source'd
- flags="-f gcc -x"
- # if version >= v0.4.7
- if [ "$kak_opt_shellcheck_minor_version" -ge 4 ] && [ "$kak_opt_shellcheck_patch_version" -ge 7 ]; then
- # enable warnings from sourced files
- flags="$flags -a"
- fi
- echo "shellcheck $flags"
- }
- lint
- hook -group shellcheck window BufWritePre .* %{
- lint
- }
-}
-
-###############################
-# Externally-visible commands #
-###############################
-
-define-command -override -docstring "enable shellcheck in the current window" shellcheck-enable %{
- evaluate-commands %sh{
- if $kak_optshellcheck_installed; then
- echo "shellcheck-parse-version"
- echo "shellcheck-configure-window"
- else
- echo "echo -debug 'Missing shellcheck executable'"
- fi
- }
-}
-define-command -override -docstring "disable shellcheck in the current window" shellcheck-disable %{
- lint-hide-diagnostics
- remove-hooks window shellcheck
-}
-
-##################
-# Initialization #
-##################
-
-declare-option -hidden int shellcheck_major_version
-declare-option -hidden int shellcheck_minor_version
-declare-option -hidden int shellcheck_patch_version
-declare-option -hidden bool shellcheck_installed
-
-hook global WinSetOption filetype=sh %{
- # check whether binary exists
- shellcheck-check-installed
- shellcheck-enable
-}
--- /dev/null
+Subproject commit 86ac6599b13617ff938905ba4cdd8225d7eb6a2e
+++ /dev/null
-MIT License
-
-Copyright (c) 2018 Andrey Orst
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+++ /dev/null
-# smarttab.kak
-
-
-`smarttab.kak` is a plugin for [Kakoune](https://github.com/mawww/kakoune).
-It provides three different ways for handling indentation and alignment with the tab key.
-
-
-## Installation
-
-### With [plug.kak](https://github.com/andreyorst/plug.kak)
-
-Add this to your `kakrc`:
-
-```kak
-plug "andreyorst/smarttab.kak"
-```
-
-Source your `kakrc`, or restart Kakoune.
-Then execute `:plug-install`.
-Or, if you don't want to restart Kakoune or source its config, simply run `plug-install andreyorst/smarttab.kak`.
-It will then be enabled automatically.
-
-### Without plugin manager
-
-Clone this repo:
-
-```sh
-git clone https://github.com/andreyorst/smarttab.kak.git
-```
-
-You can put this repo in your `autoload` directory, or else manually `source` the `smarttab.kak` script in your configuration file.
-
-After that, you can use `smarttab.kak`.
-
-
-## Usage
-
-This plugin adds three commands to toggle between different policies when using the <kbd>Tab</kbd> and <kbd>></kbd> keys:
-
-- `noexpandtab` - use `tab` for everything.
- <kbd>Tab</kbd> will insert the `\t` character, and <kbd>></kbd> will use the `\t` character when indenting.
- Aligning cursors with <kbd>&</kbd> uses the `\t` character.
-- `expandtab` - use `space` for everything.
- <kbd>Tab</kbd> will insert `%opt{indentwidth}` amount of spaces, and <kbd>></kbd> will indent with spaces.
-- `smarttab` - indent with `tab`, align with `space`.
- <kbd>Tab</kbd> will insert the `\t` character if your cursor is inside an indentation area, e.g., before any non-whitespace character, and insert spaces if the cursor is after any non-whitespace character.
- Aligning cursors with <kbd>&</kbd> uses `space`.
-- `autoconfigtab` - choose the above based upon one of the existing settings (see later section).
-
-By default, smarttab.kak affects only the <kbd>Tab</kbd> and <kbd>></kbd> keys.
-If you want to deindent lines that are being indented with spaces when hitting <kbd>Backspace</kbd>, you can set the `softtabstop` option.
-This option specifies how many `space`s should be treated as a single `tab` character when deleting them with a backspace.
-
-In order to automatically enable different modes for different languages, you can use `hook`s like so:
-
-```kak
-hook global WinSetOption filetype=c smarttab
-hook global WinSetOption filetype=rust expandtab
-```
-
-To adjust smarttab.kak related options, you need to use the `ModuleLoaded` hook, because all options are defined withing the `smarttab` module:
-
-```sh
-hook global ModuleLoaded smarttab %{
- set-option global softtabstop 4
- # you can configure text that is being used to represent curent active mode
- set-option global smarttab_expandtab_mode_name 'exp'
- set-option global smarttab_noexpandtab_mode_name 'noexp'
- set-option global smarttab_smarttab_mode_name 'smart'
-}
-```
-
-If you've used plug.kak for installation, it's better to configure smarttab.kak from within the `plug` command because it can handle lazy loading the configurations for the plugin, as well as configure the editor's behavior:
-
-```sh
-plug "andreyorst/smarttab.kak" defer smarttab %{
- # when `backspace' is pressed, 4 spaces are deleted at once
- set-option global softtabstop 4
-} config %{
- # these languages will use `expandtab' behavior
- hook global WinSetOption filetype=(rust|markdown|kak|lisp|scheme|sh|perl) expandtab
- # these languages will use `noexpandtab' behavior
- hook global WinSetOption filetype=(makefile|gas) noexpandtab
- # these languages will use `smarttab' behavior
- hook global WinSetOption filetype=(c|cpp) smarttab
-}
-```
-
-### Setting the default mode
-
-In your `kakrc` add:
-
-```kak
-hook global BufOpenFile .* _mode_
-hook global BufNewFile .* _mode_
-```
-
-Where the `_mode_` is one of the `smarttab.kak` modes, described [above](#usage).
-
-
-### `autoconfigtab` configuration
-
-If you just want to set the behavior based upon your `editorconfig` settings, you can use the `autoconfigtab` setting:
-
-```kak
-hook global BufCreate .* %{
- editorconfig-load
- autoconfigtab
-}
-```
-
-This config will choose `expandtab` or `noexpandtab` based upon whether `indent_style` is set as `space` or `tab` respectively.
-
-If you'd prefer to use `smarttab` instead of `noexpandtab` for `indent_style = tab` (without affecting `indent_style = space`), you can manually override the `aligntab` option to `false` before running `autoconfigtab`, as seen in the below config:
-
-```kak
-hook global BufCreate .* %{
- editorconfig-load
- set-option buffer aligntab false
- autoconfigtab
-}
-```
-
-Currently, `autoconfigtab` does not cover the case where `indentwidth` is nonzero but `aligntab` is set to `true`, as this would mean indenting with spaces and aligning with tabs.
-In this particular case, tab alignment takes priority and `noexpandtab` is chosen.
+++ /dev/null
-# ╭─────────────╥────────────────────────╮
-# │ Author: ║ File: │
-# │ Andrey Orst ║ smarttab-powerline.kak │
-# ╞═════════════╩════════════════════════╡
-# │ Smarttab module for powerline.kak │
-# ╞══════════════════════════════════════╡
-# │ GitHub.com/andreyorst/smarttab.kak │
-# │ GitHub.com/andreyorst/powerline.kak │
-# ╰──────────────────────────────────────╯
-
-hook global ModuleLoaded powerline %{ require-module powerline_expandtab }
-
-provide-module powerline_expandtab %§
-
-declare-option -hidden bool powerline_module_smarttab true
-
-declare-option -hidden str-list powerline_modules
-set-option -add global powerline_modules 'smarttab'
-
-define-command -hidden powerline-smarttab %{ evaluate-commands %sh{
- default=$kak_opt_powerline_base_bg
- next_bg=$kak_opt_powerline_next_bg
- normal=$kak_opt_powerline_separator
- thin=$kak_opt_powerline_separator_thin
- if [ "$kak_opt_powerline_module_smarttab" = "true" ]; then
- fg=$kak_opt_powerline_color18
- bg=$kak_opt_powerline_color20
- if [ ! -z "$kak_opt_smarttab_mode" ]; then
- [ "$next_bg" = "$bg" ] && separator="{$fg,$bg}$thin" || separator="{$bg,${next_bg:-$default}}$normal"
- echo "set-option -add global powerlinefmt %{$separator{$fg,$bg} %opt{smarttab_mode} }"
- echo "set-option global powerline_next_bg $bg"
- fi
- fi
-}}
-
-define-command -hidden powerline-toggle-smarttab -params ..1 %{ evaluate-commands %sh{
- [ "$kak_opt_powerline_module_smarttab" = "true" ] && value=false || value=true
- if [ -n "$1" ]; then
- [ "$1" = "on" ] && value=true || value=false
- fi
- echo "set-option global powerline_module_smarttab $value"
- echo "powerline-rebuild"
-}}
-
-§
+++ /dev/null
-# ╭─────────────╥──────────────────────╮
-# │ Author: ║ File: │
-# │ Andrey Orst ║ smarttab.kak │
-# ╞═════════════╩══════════════════════╡
-# │ Extends tab handling by adding │
-# │ three different commands for │
-# │ each mode. │
-# ╞════════════════════════════════════╡
-# │ Rest of .dotfiles: │
-# │ GitHub.com/andreyorst/smarttab.kak │
-# ╰────────────────────────────────────╯
-
-define-command -docstring "noexpandtab: use tab character to indent and align" \
-noexpandtab %{ require-module smarttab; noexpandtab-impl }
-
-define-command -docstring "expandtab: use space character to indent and align" \
-expandtab %{ require-module smarttab; expandtab-impl }
-
-define-command -docstring "smarttab: use tab character for indentation and space character for alignment" \
-smarttab %{ require-module smarttab; smarttab-impl }
-
-# note: there is no space-indent, tab-align setting; this is assumed to be equivalent to noexpandtab
-define-command -docstring "autoconfigtab: use tab or space character to indent and align based upon existing settings (e.g. via editorconfig)" \
-autoconfigtab %{ require-module smarttab; autoconfigtab-impl }
-
-provide-module smarttab %§
-
-# Options
-# ‾‾‾‾‾‾‾
-
-declare-option -docstring "amount of spaces that should be treated as single tab character when deleting spaces" \
-int softtabstop 0
-
-declare-option -docstring "displays current tab handling mode" \
-str smarttab_mode ''
-
-declare-option -docstring 'what text to display in ''%opt{smarttab_mode}'' when expandtab mode is on' \
-str smarttab_expandtab_mode_name 'expandtab'
-
-declare-option -docstring 'what text to display in ''%opt{smarttab_mode}'' when expandtab mode is on' \
-str smarttab_noexpandtab_mode_name 'noexpandtab'
-
-declare-option -docstring 'what text to display in ''%opt{smarttab_mode}'' when expandtab mode is on' \
-str smarttab_smarttab_mode_name 'smarttab'
-
-declare-option -hidden int oldindentwidth %opt{indentwidth}
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden noexpandtab-impl %{
- set-option buffer smarttab_mode %opt{smarttab_noexpandtab_mode_name}
- remove-hooks buffer smarttab-mode
- smarttab-set
- set-option buffer indentwidth 0
- set-option buffer aligntab true
- hook -group smarttab-mode buffer InsertDelete ' ' %{ try %sh{
- if [ $kak_opt_softtabstop -gt 1 ]; then
- printf "%s\n" 'execute-keys -draft "<a-h><a-k>^\h+.\z<ret>I<space><esc><lt>"'
- fi
- } catch %{ try %{
- execute-keys -itersel -draft "h%opt{softtabstop}<s-h>2<s-l>s\h+\z<ret>d"
- }}}
-}
-
-define-command -hidden expandtab-impl %{
- set-option buffer smarttab_mode %opt{smarttab_expandtab_mode_name}
- remove-hooks buffer smarttab-mode
- smarttab-set
- set-option buffer aligntab false
- hook -group smarttab-mode buffer InsertChar '\t' %{ execute-keys -draft "h%opt{indentwidth}@" }
- hook -group smarttab-mode buffer InsertDelete ' ' %{ try %sh{
- if [ $kak_opt_softtabstop -gt 1 ]; then
- printf "%s\n" 'execute-keys -draft -itersel "<a-h><a-k>^\h+.\z<ret>I<space><esc><lt>"'
- fi
- } catch %{ try %{
- execute-keys -itersel -draft "h%opt{softtabstop}<s-h>2<s-l>s\h+\z<ret>d"
- }}}
-}
-
-define-command -hidden smarttab-impl %{
- set-option buffer smarttab_mode %opt{smarttab_smarttab_mode_name}
- remove-hooks buffer smarttab-mode
- smarttab-set
- set-option buffer indentwidth 0
- set-option buffer aligntab false
- hook -group smarttab-mode buffer InsertChar '\t' %{ try %{
- execute-keys -draft "<a-h><a-k>^\h*.\z<ret>"
- } catch %{
- execute-keys -draft "h@"
- }}
- hook -group smarttab-mode buffer InsertDelete ' ' %{ try %sh{
- if [ $kak_opt_softtabstop -gt 1 ]; then
- printf "%s\n" 'execute-keys -draft "<a-h><a-k>^\h+.\z<ret>I<space><esc><lt>"'
- fi
- } catch %{ try %{
- execute-keys -itersel -draft "h%opt{softtabstop}<s-h>2<s-l>s\h+\z<ret>d"
- }}}
-}
-
-define-command -hidden autoconfigtab-impl %{ evaluate-commands %sh{
- if [ $kak_opt_aligntab = true ]; then
- echo "noexpandtab"
- elif [ $kak_opt_indentwidth -eq 0 ]; then
- echo "smarttab"
- else
- echo "expandtab"
- fi
-}}
-
-define-command -hidden smarttab-set %{ evaluate-commands %sh{
- if [ $kak_opt_indentwidth -eq 0 ]; then
- printf "%s\n" "set-option buffer indentwidth $kak_opt_oldindentwidth"
- else
- printf "%s\n" "set-option buffer oldindentwidth $kak_opt_indentwidth"
- fi
-}}
-
-§