From f75e48a40e7de52202040a5c4de388285b1ca350 Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Mon, 20 May 2019 13:35:10 +0300 Subject: [PATCH] move all variables to respective modules --- README.md | 10 ++++++++-- rc/fzf.kak | 19 +++++++++---------- rc/modules/VCS/fzf-bzr.kak | 4 ++-- rc/modules/VCS/fzf-git.kak | 4 ++-- rc/modules/VCS/fzf-hg.kak | 4 ++-- rc/modules/VCS/fzf-svn.kak | 3 ++- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 758ebeb..b1500c5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Github commits (since latest release)][5] ![license][6] **fzf.kak** is a plugin for [Kakoune][7] editor, that brings integration with -[fzf][8] tool. This plugin is being tested against Kakoune 2018.09.04. +[fzf][8] tool. This plugin is being tested against Kakoune master branch. **fzf.kak** also supports [skim][9], which can be used via `fzf_implementation` option. @@ -107,7 +107,13 @@ is being used to create new windows. ## Configuration **fzf.kak** features a lot of settings via options that can be altered to change -how **fzf.kak** behaves. +how **fzf.kak** behaves. All settings belong to `fzf` module, so in order to +change variable values use `defer "fzf %{ ... }"` if you're using **plug.kak**, +and if not, use `hook global ModuleLoad fzf %{ ... }`, or simply `requier-module +fzf` before configuring options. Same goes for `fzf_vcs` module. + +From now on I assume that you're using one of the methods listed above for all +configurations below. ### Mappings You can define what keys to use in `fzf` window via these options: diff --git a/rc/fzf.kak b/rc/fzf.kak index 38031a5..70cde2c 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -8,6 +8,15 @@ # │ different fzf commands. │ # ╰─────────────────────────────────╯ +define-command -docstring "Enter fzf-mode. +fzf-mode contains mnemonic key bindings for every fzf.kak command + +Best used with mapping like: + map global normal '' ': fzf-mode' +" \ +fzf-mode %{ require-module fzf; evaluate-commands 'enter-user-mode fzf' } + +provide-module fzf %§ # Options declare-option -docstring 'implementation of fzf that you want to use. @@ -75,16 +84,6 @@ str fzf_vertical_map 'ctrl-v' declare-option -docstring "mapping to execute action in new horizontal split" \ str fzf_horizontal_map 'ctrl-s' -define-command -docstring "Enter fzf-mode. -fzf-mode contains mnemonic key bindings for every fzf.kak command - -Best used with mapping like: - map global normal '' ': fzf-mode' -" \ -fzf-mode %{ require-module fzf; evaluate-commands 'enter-user-mode fzf' } - -provide-module fzf %§ - try %{ declare-user-mode fzf } define-command -hidden -docstring "wrapper command to create new vertical split" \ diff --git a/rc/modules/VCS/fzf-bzr.kak b/rc/modules/VCS/fzf-bzr.kak index 5dcb0c2..8527b7e 100644 --- a/rc/modules/VCS/fzf-bzr.kak +++ b/rc/modules/VCS/fzf-bzr.kak @@ -7,6 +7,8 @@ # │ GitHub.com/andreyorst/fzf.kak │ # ╰───────────────────────────────────────╯ +hook global ModuleLoad fzf_vcs %§ + declare-option -docstring "command to provide list of files in GNU Bazaar repository to fzf. Arguments are supported Supported tools: : : @@ -17,8 +19,6 @@ Default arguments: " \ str fzf_bzr_command "bzr" -hook global ModuleLoad fzf_vcs %§ - map global fzf-vcs -docstring "edit file from GNU Bazaar tree" 'b' ': fzf-bzr' define-command -hidden fzf-bzr %{ evaluate-commands %sh{ diff --git a/rc/modules/VCS/fzf-git.kak b/rc/modules/VCS/fzf-git.kak index cbac91a..151ff07 100644 --- a/rc/modules/VCS/fzf-git.kak +++ b/rc/modules/VCS/fzf-git.kak @@ -7,6 +7,8 @@ # │ GitHub.com/andreyorst/fzf.kak │ # ╰───────────────────────────────────────╯ +hook global ModuleLoad fzf_vcs %§ + declare-option -docstring "command to provide list of files in git tree to fzf. Arguments are supported Supported tools: : : @@ -17,8 +19,6 @@ Default arguments: " \ str fzf_git_command "git" -hook global ModuleLoad fzf_vcs %§ - map global fzf-vcs -docstring "edit file from Git tree" 'g' ': fzf-git' define-command -override -hidden fzf-git %{ evaluate-commands %sh{ diff --git a/rc/modules/VCS/fzf-hg.kak b/rc/modules/VCS/fzf-hg.kak index ab21d51..4c79c0f 100644 --- a/rc/modules/VCS/fzf-hg.kak +++ b/rc/modules/VCS/fzf-hg.kak @@ -7,6 +7,8 @@ # │ GitHub.com/andreyorst/fzf.kak │ # ╰──────────────────────────────────────╯ +hook global ModuleLoad fzf_vcs %§ + declare-option -docstring "command to provide list of files in mercurial repository to fzf. Arguments are supported Supported tools: : : @@ -17,8 +19,6 @@ Default arguments: " \ str fzf_hg_command "hg" -hook global ModuleLoad fzf_vcs %§ - map global fzf-vcs -docstring "edit file from mercurial tree" 'h' ': fzf-hg' define-command -hidden fzf-hg %{ evaluate-commands %sh{ diff --git a/rc/modules/VCS/fzf-svn.kak b/rc/modules/VCS/fzf-svn.kak index 48b520c..272b03f 100644 --- a/rc/modules/VCS/fzf-svn.kak +++ b/rc/modules/VCS/fzf-svn.kak @@ -7,6 +7,8 @@ # │ GitHub.com/andreyorst/fzf.kak │ # ╰───────────────────────────────────────╯ +hook global ModuleLoad fzf_vcs %§ + declare-option -docstring "command to provide list of files in svn repository to fzf. Arguments are supported Supported tools: : : @@ -17,7 +19,6 @@ Default arguments: " \ str fzf_svn_command "svn" -hook global ModuleLoad fzf_vcs %§ map global fzf-vcs -docstring "edit file from Subversion tree" 's' ': fzf-svn' define-command -hidden fzf-svn %{ evaluate-commands %sh{