1
0
Fork 0

refactor modules to provide submodules

This commit is contained in:
Andrey Listopadov 2021-03-19 21:00:49 +03:00
parent 4e6c9a8575
commit a8436627c3
14 changed files with 116 additions and 166 deletions

View file

@ -1,12 +1,7 @@
# ╭─────────────╥───────────────────╮
# │ Author: ║ Plugin: │
# │ Andrey Orst ║ fzf.kak │
# ╞═════════════╩═══════════════════╡
# │ This plugin implements fzf │
# │ mode for Kakoune. This mode │
# │ adds several mappings to invoke │
# │ different fzf commands. │
# ╰─────────────────────────────────╯
# Author: Andrey Listopadov
# This plugin implements fzf mode for Kakoune.
# This mode adds several mappings to invoke different fzf commands.
# https://github.com/andreyorst/fzf.kak
define-command -docstring "Enter fzf-mode.
fzf-mode contains mnemonic key bindings for every fzf.kak command

View file

@ -1,13 +1,12 @@
# ╭─────────────╥─────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-svn.kak │
# ╞═════════════╩═════════════════════════╡
# │ Submodule for Bzr support for fzf.kak │
# ╞═══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰───────────────────────────────────────╯
# Author: Andrey Listopadov
# Submodule for Bzr support for fzf.kak
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf_vcs %§
hook global ModuleLoaded fzf-vcs %{
map global fzf-vcs -docstring "edit file from GNU Bazaar tree" 'b' '<esc>: require-module fzf-bzr; fzf-bzr<ret>'
}
provide-module fzf-bzr %§
declare-option -docstring "command to provide list of files in GNU Bazaar repository to fzf. Arguments are supported
Supported tools:
@ -19,8 +18,6 @@ Default arguments:
" \
str fzf_bzr_command "bzr"
map global fzf-vcs -docstring "edit file from GNU Bazaar tree" 'b' '<esc>: fzf-bzr<ret>'
define-command -hidden fzf-bzr %{ evaluate-commands %sh{
repo_root=$(bzr root)
case $kak_opt_fzf_bzr_command in

View file

@ -1,13 +1,12 @@
# ╭─────────────╥─────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-svn.kak │
# ╞═════════════╩═════════════════════════╡
# │ Submodule for Git support for fzf.kak │
# ╞═══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰───────────────────────────────────────╯
# Author: Andrey Listopadov
# Submodule for Git support for fzf.kak
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf_vcs %§
hook global ModuleLoaded fzf-vcs %§
map global fzf-vcs -docstring "edit file from Git tree" 'g' '<esc>: require-module fzf-git; fzf-git<ret>'
§
provide-module fzf-git %§
declare-option -docstring "command to provide list of files in git tree to fzf. Arguments are supported
Supported tools:
@ -19,9 +18,7 @@ Default arguments:
" \
str fzf_git_command "git"
map global fzf-vcs -docstring "edit file from Git tree" 'g' '<esc>: fzf-git<ret>'
define-command -override -hidden fzf-git %{ evaluate-commands %sh{
define-command -hidden fzf-git %{ evaluate-commands %sh{
case $kak_opt_fzf_git_command in
(git) cmd='git ls-tree --full-tree --name-only -r HEAD' ;;

View file

@ -1,13 +1,12 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-svn.kak │
# ╞═════════════╩════════════════════════╡
# │ Submodule for Hg support for fzf.kak │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Submodule for Hg support for fzf.kak
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf_vcs %§
hook global ModuleLoaded fzf-vcs %{
map global fzf-vcs -docstring "edit file from mercurial tree" 'h' '<esc>: require-module fzf-hg; fzf-hg<ret>'
}
provide-module fzf-hg %§
declare-option -docstring "command to provide list of files in mercurial repository to fzf. Arguments are supported
Supported tools:
@ -19,7 +18,6 @@ Default arguments:
" \
str fzf_hg_command "hg"
map global fzf-vcs -docstring "edit file from mercurial tree" 'h' '<esc>: fzf-hg<ret>'
define-command -hidden fzf-hg %{ evaluate-commands %sh{
case $kak_opt_fzf_hg_command in

View file

@ -1,13 +1,12 @@
# ╭─────────────╥─────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-svn.kak │
# ╞═════════════╩═════════════════════════╡
# │ Submodule for Svn support for fzf.kak │
# ╞═══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰───────────────────────────────────────╯
# Author: Andrey Listopadov
# Submodule for Svn support for fzf.kak
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf_vcs %§
hook global ModuleLoaded fzf-vcs %§
map global fzf-vcs -docstring "edit file from Subversion tree" 's' '<esc>: require-module fzf-svn; fzf-svn<ret>'
§
provide-module fzf-svn %§
declare-option -docstring "command to provide list of files in svn repository to fzf. Arguments are supported
Supported tools:
@ -19,8 +18,6 @@ Default arguments:
" \
str fzf_svn_command "svn"
map global fzf-vcs -docstring "edit file from Subversion tree" 's' '<esc>: fzf-svn<ret>'
define-command -hidden fzf-svn %{ evaluate-commands %sh{
current_path=$(pwd)
repo_root=$(svn info | awk -F': ' '/Working Copy Root Path: .*/ {print $2}')

View file

@ -1,17 +1,13 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-buffer.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for changing buffers with fzf │
# │ for fzf.kak plugin │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for changing buffers with fzf for fzf.kak plugin
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map global fzf -docstring "open buffer" 'b' '<esc>: require-module fzf-buffer; fzf-buffer<ret>'
map global fzf -docstring "delete buffer" '<a-b>' '<esc>: require-module fzf-buffer; fzf-delete-buffer<ret>'
}
map global fzf -docstring "open buffer" 'b' '<esc>: fzf-buffer<ret>'
map global fzf -docstring "delete buffer" '<a-b>' '<esc>: fzf-delete-buffer<ret>'
provide-module fzf-buffer %§
define-command -hidden fzf-buffer %{ evaluate-commands %sh{
buffers=""

View file

@ -1,14 +1,12 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-cd.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for changing directories with │
# │ fzf for fzf.kak plugin │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for changing directories with fzf for fzf.kak plugin
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map global fzf -docstring "change directory" 'c' '<esc>: require-module fzf-cd; fzf-cd<ret>'
}
provide-module fzf-cd %§
declare-option -docstring "command to provide list of directories to fzf.
Default value:
@ -31,9 +29,6 @@ str cd_preview_command "tree -d {}"
declare-option -docstring 'maximum amount of previewed directories' \
int fzf_preview_dirs '300'
map global fzf -docstring "change directory" 'c' '<esc>: fzf-cd<ret>'
define-command -hidden fzf-cd %{ evaluate-commands %sh{
tmux_height=$kak_opt_fzf_tmux_height
printf '%s\n' "info -title %{fzf change directory} %{Change the server's working directory

View file

@ -1,20 +1,17 @@
# ╭─────────────╥──────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-ctags.kak │
# ╞═════════════╩══════════════════════════╡
# │ Module for searching tags with fzf │
# │ and universal-ctags for fzf.kak plugin │
# ╞════════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰────────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for searching tags with fzf and universal-ctags for fzf.kak plugin
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map global fzf -docstring "find tag" 't' '<esc>: require-module fzf-ctags; fzf-tag<ret>'
}
provide-module fzf-ctags %§
declare-option -docstring "file that should be used by fzf-tag to provide tags.
Default value: tags" \
str fzf_tag_file_name "tags"
map global fzf -docstring "find tag" 't' '<esc>: fzf-tag<ret>'
declare-option -hidden bool fzf_tag_filters_defined false

View file

@ -1,14 +1,12 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-file.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for opening files with fzf │
# │ for fzf.kak plugin │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for opening files with fzf for fzf.kak plugin
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map global fzf -docstring "open file" 'f' '<esc>: require-module fzf-file; fzf-file<ret>'
}
provide-module fzf-file %§
declare-option -docstring "command to provide list of files to fzf. Arguments are supported
Supported tools:
@ -32,7 +30,6 @@ Default value:
' \
bool fzf_file_preview true
map global fzf -docstring "open file" 'f' '<esc>: fzf-file<ret>'
define-command -hidden fzf-file %{ evaluate-commands %sh{
if [ -z "$(command -v $kak_opt_fzf_file_command)" ]; then

View file

@ -1,13 +1,12 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-grep.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for grepping file contents │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for grepping file contents
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map -docstring 'grep file contents recursively' global fzf g ': require-module fzf-grep; fzf-grep<ret>'
}
provide-module fzf-grep %§
declare-option -docstring "what command to use to provide list of grep search matches.
Grep output must follow the format of 'filename:line-number:text'
@ -16,7 +15,6 @@ Default value:
grep -RHn" \
str fzf_grep_command 'grep'
map -docstring 'grep file contents recursively' global fzf g ': fzf-grep<ret>'
define-command -hidden fzf-grep %{ evaluate-commands %sh{
if [ -z "$(command -v $kak_opt_fzf_grep_command)" ]; then

View file

@ -1,19 +1,18 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-project.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for storing and loading │
# │ projects with fzf for fzf.kak plugin │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for storing and loading projects with fzf for fzf.kak plugin
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map global fzf -docstring "open project" 'p' '<esc>: require-module fzf-project; fzf-project<ret>'
}
provide-module fzf-project %§
require-module fzf-file
declare-option -docstring "file where saved projects are stored" str fzf_project_file "%val{config}/.fzf-projects"
declare-option -docstring %sh{ printf "%s\n" "use '~/' instead of '${HOME}'" } bool fzf_project_use_tilda false
map global fzf -docstring "open project" 'p' '<esc>: fzf-project<ret>'
try %{ declare-user-mode fzf-project }

View file

@ -1,16 +1,12 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-search.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for searching inside current │
# │ buffer with fzf for fzf.kak │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module for searching inside current buffer with fzf for fzf.kak
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
hook global ModuleLoaded fzf %{
map global fzf -docstring "search in buffer" 's' '<esc>: require-module fzf-search; fzf-buffer-search<ret>'
}
map global fzf -docstring "search in buffer" 's' '<esc>: fzf-buffer-search<ret>'
provide-module fzf-search %§
define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{
title="fzf buffer search"

View file

@ -1,26 +1,18 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-vcs.kak │
# ╞═════════════╩════════════════════════╡
# │ Module that declares VCS submodule │
# │ for various version control systems │
# │ to open files with fzf │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module that declares VCS submodule for various version control systems to open files with fzf
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
map global fzf -docstring "edit file from vcs repo" 'v' '<esc>: require-module fzf_vcs; fzf-vcs<ret>'
map global fzf -docstring "switch to vcs selection mode" '<a-v>' '<esc>: fzf-vcs-mode<ret>'
define-command -docstring "Enter fzf-vcs-mode.
This mode allows selecting specific vcs command." \
fzf-vcs-mode %{ require-module fzf_vcs; evaluate-commands 'enter-user-mode fzf-vcs' }
map global fzf -docstring "edit file from vcs repo" 'v' '<esc>: require-module fzf-vcs; fzf-vcs<ret>'
map global fzf -docstring "switch to vcs selection mode" '<a-v>' '<esc>: require-module fzf-vcs; enter-user-mode fzf-vcs<ret>'
§
provide-module fzf_vcs %§
provide-module fzf-vcs %§
require-module fzf-git
require-module fzf-svn
require-module fzf-hg
require-module fzf-bzr
declare-user-mode fzf-vcs

View file

@ -1,14 +1,16 @@
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ sk-grep.kak │
# ╞═════════════╩════════════════════════╡
# │ Module running interactive grep with │
# │ ski for fzf.kak │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
# Author: Andrey Listopadov
# Module running interactive grep with skim for fzf.kak
# https://github.com/andreyorst/fzf.kak
hook global ModuleLoaded fzf %§
evaluate-commands %sh{
if [ -n "$(command -v sk)" ]; then
printf "%s\n" "map global fzf -docstring %{Interactive grep with skim} '<a-g>' '<esc>: require-module fzf-sk-grep; fzf-sk-grep<ret>'"
fi
}
§
provide-module fzf-sk-grep %§
declare-option -docstring "what command to use to provide list of grep search matches.
Grep output must follow the format of 'filename:line-number:text'
@ -19,12 +21,6 @@ str fzf_sk_grep_command 'grep -RHn'
declare-option -hidden str fzf_sk_first_file ''
evaluate-commands %sh{
if [ -n "$(command -v sk)" ]; then
printf "%s\n" "map global fzf -docstring %{Interactive grep with skim} '<a-g>' '<esc>: fzf-sk-grep<ret>'"
fi
}
define-command -hidden fzf-sk-grep %{ evaluate-commands %sh{
if [ -z "$(command -v sk)" ]; then
printf "%s\n" "echo -markup %{{Information}skim required to run this command}"