├── .github └── workflows │ └── build.yaml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── apps └── README.md ├── autocomplete └── README.md ├── autocomplete_actions.json ├── bin ├── fig_buffer ├── fig_callback ├── fig_get_shell └── figterm ├── fig.sh ├── shell ├── bash-preexec.sh ├── post.bash ├── post.fish ├── post.sh ├── post.zsh ├── pre.fish ├── pre.sh └── zle.zsh ├── ssh ├── team └── README.md ├── themes ├── apple-dark.json ├── apple-light.json ├── atlantic-night.json ├── aura-dark.json ├── catppuccin.json ├── cobalt.json ├── cobalt2.json ├── darkclown.json ├── dracula.json ├── dubdub-dark.json ├── dubdub-light.json ├── github-dark.json ├── gruvbox.json ├── halloween.json ├── monokai-dark.json ├── nightowl.json ├── nord.json ├── oceanic-next.json ├── palenight.json ├── panda.json ├── plastic.json ├── poimandres.json ├── solarized-dark.json ├── solarized-light.json ├── synthwave-84.json ├── the-unnamed.json └── tokyo-night.json ├── tmux ├── tools ├── all-settings.json ├── check_for_upgrade.sh ├── cli │ ├── --help.sh │ ├── -h.sh │ ├── community.sh │ ├── contribute.sh │ ├── debug-ssh.sh │ ├── debug.sh │ ├── email_dotfiles.sh │ ├── help.sh │ ├── invite.sh │ ├── issue.sh │ ├── list.sh │ ├── remove.sh │ ├── set-path.sh │ ├── settings-docs.sh │ ├── settings-open.sh │ ├── source.sh │ ├── team-download.sh │ ├── team-upload.sh │ ├── tweet.sh │ └── update.sh ├── doctor.sh ├── drip │ ├── autolaunch.sh │ ├── drip_1.sh │ ├── drip_2.sh │ ├── fig_onboarding.sh │ └── prompt_to_update.sh ├── install-shell-integration.sh ├── install_and_upgrade.sh ├── install_integrations.sh ├── prompts.sh ├── remote_cwd.sh ├── setup_fish_integration.sh ├── ssh_prompt.sh ├── uninstall-script.sh └── zle.sh └── user └── README.md /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | branches: 5 | - "main" 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | env: 10 | UPDATE_SITE_TOKEN: ${{ secrets.UPDATE_SITE_TOKEN }} 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Create tar file 14 | run: | 15 | tar -czvf shell-integration.tar.gz \ 16 | shell/ \ 17 | tools/install_integrations.sh \ 18 | fig.sh 19 | - name: Update Site 20 | run: | 21 | git clone https://withfig-bot:$UPDATE_SITE_TOKEN@github.com/withfig/public-site-nextjs 22 | cp shell-integration.tar.gz tools/install-shell-integration.sh public-site-nextjs/public/ 23 | cd public-site-nextjs 24 | 25 | git config user.email "hello@withfig.com" 26 | git config user.name "Figbot" 27 | 28 | git add . 29 | git commit -m "Updated shell integration script" 30 | git push origin main 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | autocomplete/* 2 | !autocomplete/README.md 3 | 4 | # custom files and folders 5 | user/* 6 | !user/README.md 7 | 8 | team/* 9 | !team/README.md 10 | 11 | # temp files directories 12 | cache/ 13 | log/ 14 | .DS_Store 15 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Our Pledge 2 | 3 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 4 | 5 | ## Our Standards 6 | 7 | Examples of behavior that contributes to creating a positive environment include: 8 | 9 | - Using welcoming and inclusive language 10 | - Being respectful of differing viewpoints and experiences 11 | - Gracefully accepting constructive criticism 12 | - Focusing on what is best for the community 13 | - Showing empathy towards other community members 14 | 15 | Examples of unacceptable behavior by participants include: 16 | 17 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 18 | - Trolling, insulting/derogatory comments, and personal or political attacks 19 | - Public or private harassment 20 | - Publishing others’ private information, such as a physical or electronic address, without explicit permission 21 | - Other conduct which could reasonably be considered inappropriate in a professional setting 22 | 23 | ## Our Responsibilities 24 | 25 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 26 | 27 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 28 | 29 | ## Scope 30 | 31 | This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 32 | 33 | ## Enforcement 34 | 35 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 36 | 37 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership. 38 | 39 | ## Attribution 40 | 41 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 42 | 43 | For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Fig 2 | 3 | Thanks for taking the time to build out the future of the terminal with us! 🥳 4 | 5 | We want to make contributing to Fig as easy and transparent as possible, whether it's: 6 | 7 | - Reporting a bug 8 | 9 | - Submitting feature requests 10 | 11 | - Contributing content or feature changes 12 | 13 | ## Our Repos 14 | 15 | We use GitHub to host code, to track issues and feature requests, as well as accept pull requests. 16 | 17 | Here are some of our primary repos. 18 | 19 | [withfig/fig](https://github.com/withfig/fig): The central repo. All issues taken here. 20 | 21 | [withfig/autocomplete](https://github.com/withfig/autocomplete): Collection of all specs for [autocomplete](https://fig.io/docs/autocomplete). Contribute new specs and update old specs here. 22 | 23 | [withfig/config](https://github.com/withfig/config): Fig's default configuration at install. Contains apps, installation, and update scripts. 24 | 25 | 26 | ## Proposing changes 27 | 28 | Fig welcomes code contributions via pull request. Here are a few styling guides to keep in mind: 29 | 30 | **Git Commit Messages** 31 | 32 | - Use the present tense ("Add feature" not "Added feature") 33 | - Use the imperative mood ("Move cursor to..." not "Moves cursor to...") 34 | - Limit the first line to 72 characters or less 35 | - Reference issues and pull requests liberally after the first line 36 | 37 | ## Code Style 38 | 39 | Fig adheres very nearly to Google's [shell style 40 | guide](https://google.github.io/styleguide/shellguide.html#s6.5-wildcard-expansion-of-filenames). 41 | 42 | ## Bug reports and feature requests 43 | 44 | We use GitHub issues to track public bugs as well as new feature requests. If you have any input, [open a new issue](https://github.com/withfig/fig)! Note that all issues should be filed under the [withfig/fig](https://github.com/withfig/fig) repo, not under independent feature repos. 45 | 46 | 47 | ## License 48 | 49 | By contributing, you agree that your contributions will be licensed under its MIT License. 50 | 51 | 52 | ## Questions and support 53 | 54 | For product support, visit our [docs](https://fig.io/docs) and join the [Fig Community Discord](https://fig.io/community) for instant support and discussion. 55 | 56 | Any unanswered questions or inquiries? We're always open to chat at hello@fig.io. 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Hercules Labs Inc. (Fig) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This repo is now archived! If you find any bugs, please open an issue in [withfig/fig](https://github.com/withfig/fig/issue/new) 2 | --- 3 | 4 | # Config Directory (~/.fig/) 5 | Yes, the name **fig** comes from con**fig**uration 6 | 7 | 8 | 9 | Fig's configuration files are located in the `~/.fig` directory. 10 | 11 | 12 | 13 | The config directory is structured like so: 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
autocomplete/autocomplete completion specs. See withfig/autocomplete
apps/installed Fig apps. See withfig/fig-apps
team/reserved for team apps, runbooks, and completion specs. Not tracked by git
tools/config scripts e.g. installation, onboarding, uninstallation...
user/reserved for individual user apps, runbooks, and completion specs. Not tracked by git
fig.shestablishes Fig's shell and env variables. This file is sourced on every new shell session. See below
42 | 43 | 44 | 45 | # The fig.sh script 46 | 47 | Fig sources the `fig.sh script` by adding the following line of code to your `.bashrc`, `.zshrc`, `.zprofile`, `.profile`, and `.bash_profile` 48 | 49 | ```bash 50 | [ -s ~/.fig/fig.sh ] && source ~/.fig/fig.sh 51 | ``` 52 | 53 | 54 | 55 | Why do we source `fig.sh` in so many dotfiles? In order to get context on your Terminal (e.g. current working directory), we need to source Fig for each new *shell* session, not just *Terminal* session. e.g. if you open a new terminal, and switch between bash and zsh shells. 56 | 57 | 58 | ### fig.sh sourcing time 59 | 60 | Sourcing `fig.sh` takes around **9ms**. We use conditionals to make sure the script is only run once . If you haven't started a new shell session in a while, it could take up to 200ms. But afterwards will go back to 9ms. 61 | 62 | -------------------------------------------------------------------------------- /apps/README.md: -------------------------------------------------------------------------------- 1 | Install apps here -------------------------------------------------------------------------------- /autocomplete/README.md: -------------------------------------------------------------------------------- 1 | # Want autocomplete? 2 | 3 | Please refer to our public [withfig/autocomplete](https://github.com/withfig/autocomplete) repo for more details. 4 | 5 | ### Get up to date completion scripts 6 | 7 | If you have **fig** installed, simply run `fig update` 8 | 9 | 10 | Run the following: 11 | 12 | ``` 13 | # Make the autocomplete folder where Fig looks for completion specs. Cd into it 14 | mkdir -p ~/.fig/autocomplete; cd $_ 15 | 16 | # Download all the files in the specs folder of this repo 17 | curl https://codeload.github.com/withfig/autocomplete/tar.gz/master | \ 18 | tar -xz --strip=2 autocomplete-master/specs 19 | ``` -------------------------------------------------------------------------------- /autocomplete_actions.json: -------------------------------------------------------------------------------- 1 | [ 2 | "insertSelected", 3 | "insertSelectedAndExecute", 4 | "insertCommonPrefix", 5 | "insertCommonPrefixOrInsertSelected", 6 | "insertCommonPrefixOrNavigateDown", 7 | "execute", 8 | 9 | "hideAutocomplete", 10 | "showAutocomplete", 11 | "toggleAutocomplete", 12 | 13 | "navigateUp", 14 | "navigateDown", 15 | 16 | "hideDescription", 17 | "showDescription", 18 | "toggleDescription", 19 | 20 | "toggleHistoryMode", 21 | "toggleFuzzySearch" 22 | ] 23 | -------------------------------------------------------------------------------- /bin/fig_buffer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/withfig/config/f302ce6a2dedd3ff1962b55602799a31d40cd17e/bin/fig_buffer -------------------------------------------------------------------------------- /bin/fig_callback: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/withfig/config/f302ce6a2dedd3ff1962b55602799a31d40cd17e/bin/fig_callback -------------------------------------------------------------------------------- /bin/fig_get_shell: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/withfig/config/f302ce6a2dedd3ff1962b55602799a31d40cd17e/bin/fig_get_shell -------------------------------------------------------------------------------- /bin/figterm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/withfig/config/f302ce6a2dedd3ff1962b55602799a31d40cd17e/bin/figterm -------------------------------------------------------------------------------- /fig.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pathadd() { 4 | if [[ -d "$1" ]] && [[ ":$PATH:" != *":$1:"* ]]; then 5 | PATH="${PATH:+"$PATH:"}$1" 6 | fi 7 | } 8 | 9 | __fig() { 10 | if [[ -d /Applications/Fig.app || -d ~/Applications/Fig.app ]] && command -v fig 2>&1 1>/dev/null; then 11 | fig "$@" 12 | fi 13 | } 14 | 15 | pathadd ~/.fig/bin 16 | 17 | if [[ ! "${TERMINAL_EMULATOR}" = JetBrains-JediTerm ]]; then 18 | if [[ -t 1 ]] && [[ -z "${FIG_ENV_VAR}" || -n "${TMUX}" || "${TERM_PROGRAM}" = vscode ]]; then 19 | export FIG_ENV_VAR=1 20 | 21 | # Gives fig context for cwd in each window 22 | export TTY=$(tty) 23 | 24 | __fig bg:init "$$" "$TTY" 25 | 26 | # Check for prompts or onboarding must be last, so Fig has context for 27 | # onboarding! 28 | if [[ -s ~/.fig/tools/prompts.sh ]]; then 29 | # don't source this, to ensure the #! is respected 30 | ~/.fig/tools/prompts.sh 31 | export FIG_CHECKED_PROMPTS=1 32 | fi 33 | fi 34 | 35 | # We use a shell variable to make sure this doesn't load twice 36 | if [[ -z "${FIG_SHELL_VAR}" ]]; then 37 | source ~/.fig/shell/post.sh 38 | FIG_SHELL_VAR=1 39 | fi 40 | 41 | # todo: Add a check to confirm "add-zle-hook-widget" facility exists 42 | # Not included in fig.zsh, because should be run last 43 | if [[ -n "${ZSH_NAME}" ]]; then 44 | source ~/.fig/shell/zle.zsh 45 | fi 46 | fi 47 | -------------------------------------------------------------------------------- /shell/bash-preexec.sh: -------------------------------------------------------------------------------- 1 | # The MIT License 2 | # 3 | # Copyright (c) 2017 Ryan Caloras and contributors (see https://github.com/rcaloras/bash-preexec) 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining a copy 6 | # of this software and associated documentation files (the "Software"), to deal 7 | # in the Software without restriction, including without limitation the rights 8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | # copies of the Software, and to permit persons to whom the Software is 10 | # furnished to do so, subject to the following conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be included in 13 | # all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | # THE SOFTWARE. 22 | 23 | # bash-preexec.sh -- Bash support for ZSH-like 'preexec' and 'precmd' functions. 24 | # https://github.com/rcaloras/bash-preexec 25 | # 26 | # 27 | # 'preexec' functions are executed before each interactive command is 28 | # executed, with the interactive command as its argument. The 'precmd' 29 | # function is executed before each prompt is displayed. 30 | # 31 | # Author: Ryan Caloras (ryan@bashhub.com) 32 | # Forked from Original Author: Glyph Lefkowitz 33 | # 34 | # V0.4.1 35 | # 36 | 37 | # General Usage: 38 | # 39 | # 1. Source this file at the end of your bash profile so as not to interfere 40 | # with anything else that's using PROMPT_COMMAND. 41 | # 42 | # 2. Add any precmd or preexec functions by appending them to their arrays: 43 | # e.g. 44 | # precmd_functions+=(my_precmd_function) 45 | # precmd_functions+=(some_other_precmd_function) 46 | # 47 | # preexec_functions+=(my_preexec_function) 48 | # 49 | # 3. Consider changing anything using the DEBUG trap or PROMPT_COMMAND 50 | # to use preexec and precmd instead. Preexisting usages will be 51 | # preserved, but doing so manually may be less surprising. 52 | # 53 | # Note: This module requires two Bash features which you must not otherwise be 54 | # using: the "DEBUG" trap, and the "PROMPT_COMMAND" variable. If you override 55 | # either of these after bash-preexec has been installed it will most likely break. 56 | 57 | # Make sure this is bash that's running and return otherwise. 58 | if [[ -z "${BASH_VERSION:-}" ]]; then 59 | return 1; 60 | fi 61 | 62 | # Avoid duplicate inclusion 63 | if [[ "${__bp_imported:-}" == "defined" ]]; then 64 | return 0 65 | fi 66 | __bp_imported="defined" 67 | 68 | # Should be available to each precmd and preexec 69 | # functions, should they want it. $? and $_ are available as $? and $_, but 70 | # $PIPESTATUS is available only in a copy, $BP_PIPESTATUS. 71 | # TODO: Figure out how to restore PIPESTATUS before each precmd or preexec 72 | # function. 73 | __bp_last_ret_value="$?" 74 | BP_PIPESTATUS=("${PIPESTATUS[@]}") 75 | __bp_last_argument_prev_command="$_" 76 | 77 | __bp_inside_precmd=0 78 | __bp_inside_preexec=0 79 | 80 | # Initial PROMPT_COMMAND string that is removed from PROMPT_COMMAND post __bp_install 81 | __bp_install_string=$'__bp_trap_string="$(trap -p DEBUG)"\ntrap - DEBUG\n__bp_install' 82 | 83 | # Fails if any of the given variables are readonly 84 | # Reference https://stackoverflow.com/a/4441178 85 | __bp_require_not_readonly() { 86 | local var 87 | for var; do 88 | if ! ( unset "$var" 2> /dev/null ); then 89 | echo "bash-preexec requires write access to ${var}" >&2 90 | return 1 91 | fi 92 | done 93 | } 94 | 95 | # Remove ignorespace and or replace ignoreboth from HISTCONTROL 96 | # so we can accurately invoke preexec with a command from our 97 | # history even if it starts with a space. 98 | __bp_adjust_histcontrol() { 99 | local histcontrol 100 | histcontrol="${HISTCONTROL//ignorespace}" 101 | # Replace ignoreboth with ignoredups 102 | if [[ "$histcontrol" == *"ignoreboth"* ]]; then 103 | histcontrol="ignoredups:${histcontrol//ignoreboth}" 104 | fi; 105 | export HISTCONTROL="$histcontrol" 106 | } 107 | 108 | # This variable describes whether we are currently in "interactive mode"; 109 | # i.e. whether this shell has just executed a prompt and is waiting for user 110 | # input. It documents whether the current command invoked by the trace hook is 111 | # run interactively by the user; it's set immediately after the prompt hook, 112 | # and unset as soon as the trace hook is run. 113 | __bp_preexec_interactive_mode="" 114 | 115 | # Trims leading and trailing whitespace from $2 and writes it to the variable 116 | # name passed as $1 117 | __bp_trim_whitespace() { 118 | local var=${1:?} text=${2:-} 119 | text="${text#"${text%%[![:space:]]*}"}" # remove leading whitespace characters 120 | text="${text%"${text##*[![:space:]]}"}" # remove trailing whitespace characters 121 | printf -v "$var" '%s' "$text" 122 | } 123 | 124 | 125 | # Trims whitespace and removes any leading or trailing semicolons from $2 and 126 | # writes the resulting string to the variable name passed as $1. Used for 127 | # manipulating substrings in PROMPT_COMMAND 128 | __bp_sanitize_string() { 129 | local var=${1:?} text=${2:-} sanitized 130 | __bp_trim_whitespace sanitized "$text" 131 | sanitized=${sanitized%;} 132 | sanitized=${sanitized#;} 133 | __bp_trim_whitespace sanitized "$sanitized" 134 | printf -v "$var" '%s' "$sanitized" 135 | } 136 | 137 | # This function is installed as part of the PROMPT_COMMAND; 138 | # It sets a variable to indicate that the prompt was just displayed, 139 | # to allow the DEBUG trap to know that the next command is likely interactive. 140 | __bp_interactive_mode() { 141 | __bp_preexec_interactive_mode="on"; 142 | } 143 | 144 | 145 | # This function is installed as part of the PROMPT_COMMAND. 146 | # It will invoke any functions defined in the precmd_functions array. 147 | __bp_precmd_invoke_cmd() { 148 | # Save the returned value from our last command, and from each process in 149 | # its pipeline. Note: this MUST be the first thing done in this function. 150 | __bp_last_ret_value="$?" BP_PIPESTATUS=("${PIPESTATUS[@]}") 151 | 152 | # Don't invoke precmds if we are inside an execution of an "original 153 | # prompt command" by another precmd execution loop. This avoids infinite 154 | # recursion. 155 | if (( __bp_inside_precmd > 0 )); then 156 | return 157 | fi 158 | local __bp_inside_precmd=1 159 | 160 | # Invoke every function defined in our function array. 161 | local precmd_function 162 | for precmd_function in "${precmd_functions[@]}"; do 163 | 164 | # Only execute this function if it actually exists. 165 | # Test existence of functions with: declare -[Ff] 166 | if type -t "$precmd_function" 1>/dev/null; then 167 | __bp_set_ret_value "$__bp_last_ret_value" "$__bp_last_argument_prev_command" 168 | # Quote our function invocation to prevent issues with IFS 169 | "$precmd_function" 170 | fi 171 | done 172 | } 173 | 174 | # Sets a return value in $?. We may want to get access to the $? variable in our 175 | # precmd functions. This is available for instance in zsh. We can simulate it in bash 176 | # by setting the value here. 177 | __bp_set_ret_value() { 178 | return ${1:-} 179 | } 180 | 181 | __bp_in_prompt_command() { 182 | 183 | local prompt_command_array 184 | IFS=$'\n;' read -rd '' -a prompt_command_array <<< "$PROMPT_COMMAND" 185 | 186 | local trimmed_arg 187 | __bp_trim_whitespace trimmed_arg "${1:-}" 188 | 189 | local command trimmed_command 190 | for command in "${prompt_command_array[@]:-}"; do 191 | __bp_trim_whitespace trimmed_command "$command" 192 | if [[ "$trimmed_command" == "$trimmed_arg" ]]; then 193 | return 0 194 | fi 195 | done 196 | 197 | return 1 198 | } 199 | 200 | # This function is installed as the DEBUG trap. It is invoked before each 201 | # interactive prompt display. Its purpose is to inspect the current 202 | # environment to attempt to detect if the current command is being invoked 203 | # interactively, and invoke 'preexec' if so. 204 | __bp_preexec_invoke_exec() { 205 | 206 | # Save the contents of $_ so that it can be restored later on. 207 | # https://stackoverflow.com/questions/40944532/bash-preserve-in-a-debug-trap#40944702 208 | __bp_last_argument_prev_command="${1:-}" 209 | # Don't invoke preexecs if we are inside of another preexec. 210 | if (( __bp_inside_preexec > 0 )); then 211 | return 212 | fi 213 | local __bp_inside_preexec=1 214 | 215 | # Checks if the file descriptor is not standard out (i.e. '1') 216 | # __bp_delay_install checks if we're in test. Needed for bats to run. 217 | # Prevents preexec from being invoked for functions in PS1 218 | if [[ ! -t 1 && -z "${__bp_delay_install:-}" ]]; then 219 | return 220 | fi 221 | 222 | if [[ -n "${COMP_LINE:-}" ]]; then 223 | # We're in the middle of a completer. This obviously can't be 224 | # an interactively issued command. 225 | return 226 | fi 227 | if [[ -z "${__bp_preexec_interactive_mode:-}" ]]; then 228 | # We're doing something related to displaying the prompt. Let the 229 | # prompt set the title instead of me. 230 | return 231 | else 232 | # If we're in a subshell, then the prompt won't be re-displayed to put 233 | # us back into interactive mode, so let's not set the variable back. 234 | # In other words, if you have a subshell like 235 | # (sleep 1; sleep 2) 236 | # You want to see the 'sleep 2' as a set_command_title as well. 237 | if [[ 0 -eq "${BASH_SUBSHELL:-}" ]]; then 238 | __bp_preexec_interactive_mode="" 239 | fi 240 | fi 241 | 242 | if __bp_in_prompt_command "${BASH_COMMAND:-}"; then 243 | # If we're executing something inside our prompt_command then we don't 244 | # want to call preexec. Bash prior to 3.1 can't detect this at all :/ 245 | __bp_preexec_interactive_mode="" 246 | return 247 | fi 248 | 249 | local this_command 250 | this_command=$( 251 | export LC_ALL=C 252 | HISTTIMEFORMAT= builtin history 1 | sed '1 s/^ *[0-9][0-9]*[* ] //' 253 | ) 254 | 255 | # Sanity check to make sure we have something to invoke our function with. 256 | if [[ -z "$this_command" ]]; then 257 | return 258 | fi 259 | 260 | # Invoke every function defined in our function array. 261 | local preexec_function 262 | local preexec_function_ret_value 263 | local preexec_ret_value=0 264 | for preexec_function in "${preexec_functions[@]:-}"; do 265 | 266 | # Only execute each function if it actually exists. 267 | # Test existence of function with: declare -[fF] 268 | if type -t "$preexec_function" 1>/dev/null; then 269 | __bp_set_ret_value ${__bp_last_ret_value:-} 270 | # Quote our function invocation to prevent issues with IFS 271 | "$preexec_function" "$this_command" 272 | preexec_function_ret_value="$?" 273 | if [[ "$preexec_function_ret_value" != 0 ]]; then 274 | preexec_ret_value="$preexec_function_ret_value" 275 | fi 276 | fi 277 | done 278 | 279 | # Restore the last argument of the last executed command, and set the return 280 | # value of the DEBUG trap to be the return code of the last preexec function 281 | # to return an error. 282 | # If `extdebug` is enabled a non-zero return value from any preexec function 283 | # will cause the user's command not to execute. 284 | # Run `shopt -s extdebug` to enable 285 | __bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command" 286 | } 287 | 288 | __bp_install() { 289 | # Exit if we already have this installed. 290 | if [[ "${PROMPT_COMMAND:-}" == *"__bp_precmd_invoke_cmd"* ]]; then 291 | return 1; 292 | fi 293 | 294 | trap '__bp_preexec_invoke_exec "$_"' DEBUG 295 | 296 | # Preserve any prior DEBUG trap as a preexec function 297 | local prior_trap=$(sed "s/[^']*'\(.*\)'[^']*/\1/" <<<"${__bp_trap_string:-}") 298 | unset __bp_trap_string 299 | if [[ -n "$prior_trap" ]]; then 300 | eval '__bp_original_debug_trap() { 301 | '"$prior_trap"' 302 | }' 303 | preexec_functions+=(__bp_original_debug_trap) 304 | fi 305 | 306 | # Adjust our HISTCONTROL Variable if needed. 307 | __bp_adjust_histcontrol 308 | 309 | # Issue #25. Setting debug trap for subshells causes sessions to exit for 310 | # backgrounded subshell commands (e.g. (pwd)& ). Believe this is a bug in Bash. 311 | # 312 | # Disabling this by default. It can be enabled by setting this variable. 313 | if [[ -n "${__bp_enable_subshells:-}" ]]; then 314 | 315 | # Set so debug trap will work be invoked in subshells. 316 | set -o functrace > /dev/null 2>&1 317 | shopt -s extdebug > /dev/null 2>&1 318 | fi; 319 | 320 | local existing_prompt_command 321 | # Remove setting our trap install string and sanitize the existing prompt command string 322 | existing_prompt_command="${PROMPT_COMMAND//$__bp_install_string[;$'\n']}" # Edge case of appending to PROMPT_COMMAND 323 | existing_prompt_command="${existing_prompt_command//$__bp_install_string}" 324 | __bp_sanitize_string existing_prompt_command "$existing_prompt_command" 325 | 326 | # Install our hooks in PROMPT_COMMAND to allow our trap to know when we've 327 | # actually entered something. 328 | PROMPT_COMMAND=$'__bp_precmd_invoke_cmd\n' 329 | if [[ -n "$existing_prompt_command" ]]; then 330 | PROMPT_COMMAND+=${existing_prompt_command}$'\n' 331 | fi; 332 | PROMPT_COMMAND+='__bp_interactive_mode' 333 | 334 | # Add two functions to our arrays for convenience 335 | # of definition. 336 | precmd_functions+=(precmd) 337 | preexec_functions+=(preexec) 338 | 339 | # Invoke our two functions manually that were added to $PROMPT_COMMAND 340 | __bp_precmd_invoke_cmd 341 | __bp_interactive_mode 342 | } 343 | 344 | # Sets an installation string as part of our PROMPT_COMMAND to install 345 | # after our session has started. This allows bash-preexec to be included 346 | # at any point in our bash profile. 347 | __bp_install_after_session_init() { 348 | # bash-preexec needs to modify these variables in order to work correctly 349 | # if it can't, just stop the installation 350 | __bp_require_not_readonly PROMPT_COMMAND HISTCONTROL HISTTIMEFORMAT || return 351 | 352 | local sanitized_prompt_command 353 | __bp_sanitize_string sanitized_prompt_command "$PROMPT_COMMAND" 354 | if [[ -n "$sanitized_prompt_command" ]]; then 355 | PROMPT_COMMAND=${sanitized_prompt_command}$'\n' 356 | fi; 357 | PROMPT_COMMAND+=${__bp_install_string} 358 | } 359 | 360 | # Run our install so long as we're not delaying it. 361 | if [[ -z "${__bp_delay_install:-}" ]]; then 362 | __bp_install_after_session_init 363 | fi; 364 | -------------------------------------------------------------------------------- /shell/post.bash: -------------------------------------------------------------------------------- 1 | # Add preexec, but override __bp_adjust_histcontrol to preserve histcontrol. 2 | source ~/.fig/shell/bash-preexec.sh 3 | function __bp_adjust_histcontrol() { :; } 4 | 5 | __fig() { 6 | if [[ -d /Applications/Fig.app || -d ~/Applications/Fig.app ]] && command -v fig 2>&1 1>/dev/null; then 7 | fig "$@" 8 | fi 9 | } 10 | 11 | FIG_LAST_PS1="$PS1" 12 | FIG_LAST_PS2="$PS2" 13 | FIG_LAST_PS3="$PS3" 14 | 15 | FIG_HOSTNAME=$(hostname -f 2> /dev/null || hostname) 16 | 17 | if [[ -e /proc/1/cgroup ]] && grep -q docker /proc/1/cgroup; then 18 | FIG_IN_DOCKER=1 19 | else 20 | FIG_IN_DOCKER=0 21 | fi 22 | 23 | # Construct Operating System Command. 24 | function fig_osc { printf "\033]697;"; printf $@; printf "\007"; } 25 | 26 | function __fig_preexec() { 27 | __fig bg:exec $$ $TTY & disown 28 | 29 | fig_osc PreExec 30 | 31 | # Reset user prompts before executing a command, but only if it hasn't 32 | # changed since we last set it. 33 | if [[ -n "${FIG_USER_PS1+x}" && "${PS1}" = "${FIG_LAST_PS1}" ]]; then 34 | FIG_LAST_PS1="${FIG_USER_PS1}" 35 | export PS1="${FIG_USER_PS1}" 36 | fi 37 | if [[ -n "${FIG_USER_PS2+x}" && "${PS2}" = "${FIG_LAST_PS2}" ]]; then 38 | FIG_LAST_PS2="${FIG_USER_PS2}" 39 | export PS2="${FIG_USER_PS2}" 40 | fi 41 | if [[ -n "${FIG_USER_PS3+x}" && "${PS3}" = "${FIG_LAST_PS3}" ]]; then 42 | FIG_LAST_PS3="${FIG_USER_PS3}" 43 | export PS3="${FIG_USER_PS3}" 44 | fi 45 | 46 | _fig_done_preexec="yes" 47 | } 48 | 49 | function __fig_preexec_preserve_status() { 50 | __fig_ret_value="$?" 51 | __fig_preexec "$@" 52 | __bp_set_ret_value "${__fig_ret_value}" "${__bp_last_argument_prev_command}" 53 | } 54 | 55 | function __fig_prompt () { 56 | __fig_ret_value="$?" 57 | 58 | # Work around bug in CentOS 7.2 where preexec doesn't run if you press ^C 59 | # while entering a command. 60 | [[ -z "${_fig_done_preexec:-}" ]] && __fig_preexec "" 61 | _fig_done_preexec="" 62 | 63 | __fig bg:prompt $$ $TTY & disown 64 | 65 | # If FIG_USER_PSx is undefined or PSx changed by user, update FIG_USER_PSx. 66 | if [[ -z "${FIG_USER_PS1+x}" || "${PS1}" != "${FIG_LAST_PS1}" ]]; then 67 | FIG_USER_PS1="${PS1}" 68 | fi 69 | if [[ -z "${FIG_USER_PS2+x}" || "${PS2}" != "${FIG_LAST_PS2}" ]]; then 70 | FIG_USER_PS2="${PS2}" 71 | fi 72 | if [[ -z "${FIG_USER_PS3+x}" || "${PS3}" != "${FIG_LAST_PS3}" ]]; then 73 | FIG_USER_PS3="${PS3}" 74 | fi 75 | 76 | fig_osc "Dir=%s" "${PWD}" 77 | fig_osc "Shell=bash" 78 | fig_osc "PID=%d" "$$" 79 | fig_osc "SessionId=%s" "${TERM_SESSION_ID}" 80 | fig_osc "ExitCode=%s" "$__fig_ret_value" 81 | fig_osc "TTY=%s" "${TTY}" 82 | fig_osc "Log=%s" "${FIG_LOG_LEVEL}" 83 | 84 | if [[ -n "${SSH_TTY}" ]]; then 85 | fig_osc "SSH=1" 86 | else 87 | fig_osc "SSH=0" 88 | fi 89 | fig_osc "Docker=%d" "${FIG_IN_DOCKER}" 90 | fig_osc "Hostname=%s@%s" "${USER:-root}" "${FIG_HOSTNAME}" 91 | 92 | START_PROMPT="\[$(fig_osc StartPrompt)\]" 93 | END_PROMPT="\[$(fig_osc EndPrompt)\]" 94 | NEW_CMD="\[$(fig_osc NewCmd)\]" 95 | 96 | # Reset $? first in case it's used in $FIG_USER_PSx. 97 | __bp_set_ret_value "${__fig_ret_value}" "${__bp_last_argument_prev_command}" 98 | export PS1="${START_PROMPT}${FIG_USER_PS1}${END_PROMPT}${NEW_CMD}" 99 | export PS2="${START_PROMPT}${FIG_USER_PS2}${END_PROMPT}" 100 | export PS3="${START_PROMPT}${FIG_USER_PS3}${END_PROMPT}${NEW_CMD}" 101 | 102 | FIG_LAST_PS1="${PS1}" 103 | FIG_LAST_PS2="${PS2}" 104 | FIG_LAST_PS3="${PS3}" 105 | } 106 | 107 | # trap DEBUG -> preexec -> command -> PROMPT_COMMAND -> prompt shown. 108 | preexec_functions=(__fig_preexec_preserve_status "${preexec_functions[@]}") 109 | precmd_functions=(__fig_prompt "${precmd_functions[@]}") 110 | -------------------------------------------------------------------------------- /shell/post.fish: -------------------------------------------------------------------------------- 1 | contains $HOME/.fig/bin $fish_user_paths 2 | or set -Ua fish_user_paths $HOME/.fig/bin 3 | 4 | function __fig 5 | if [ -d /Applications/Fig.app -o -d ~/Applications/Fig.app ] && command -v fig 2>&1 1>/dev/null 6 | fig $argv &; disown 7 | end 8 | end 9 | 10 | set FIG_HOSTNAME (hostname -f 2> /dev/null || hostname) 11 | 12 | if [ -t 1 ] && [ -z "$FIG_ENV_VAR" ] || [ -n "$TMUX" ] 13 | 14 | # Gives fig context for cwd in each window. 15 | __fig bg:init $fish_pid (tty) 16 | 17 | # Run aliases shell script 18 | if [ -s ~/.fig/user/aliases/_myaliases.sh ] 19 | bash ~/.fig/user/aliases/*.sh 20 | end 21 | 22 | # Check for prompts or onboarding. 23 | if [ -s ~/.fig/tools/prompts.sh ] 24 | bash ~/.fig/tools/prompts.sh 25 | export FIG_CHECKED_PROMPTS=1 26 | end 27 | 28 | export TTY=(tty) 29 | export FIG_ENV_VAR=1 30 | end 31 | 32 | if [ -z "$FIG_SHELL_VAR" ] 33 | if [ -e /proc/1/cgroup ] && grep -q docker /proc/1/cgroup 34 | set FIG_IN_DOCKER 1 35 | else 36 | set FIG_IN_DOCKER 0 37 | end 38 | 39 | function fig_osc; printf "\033]697;"; printf $argv; printf "\007"; end 40 | function fig_copy_fn; functions $argv[1] | sed "s/^function $argv[1]/function $argv[2]/" | source; end 41 | function fig_fn_defined; test (functions $argv[1] | grep -vE '^ *(#|function |end$|$)' | wc -l | xargs) != 0; end 42 | 43 | function fig_wrap_prompt 44 | set -l last_status $status 45 | fig_osc StartPrompt 46 | 47 | sh -c "exit $last_status" 48 | printf "%b" (string join "\n" $argv) 49 | fig_osc EndPrompt 50 | 51 | sh -c "exit $last_status" 52 | end 53 | 54 | function fig_preexec --on-event fish_preexec 55 | __fig bg:exec $fish_pid (tty) 56 | fig_osc PreExec 57 | 58 | if fig_fn_defined fig_user_mode_prompt 59 | fig_copy_fn fig_user_mode_prompt fish_mode_prompt 60 | end 61 | 62 | if fig_fn_defined fig_user_right_prompt 63 | fig_copy_fn fig_user_right_prompt fish_right_prompt 64 | end 65 | 66 | fig_copy_fn fig_user_prompt fish_prompt 67 | 68 | set fig_has_set_prompt 0 69 | end 70 | 71 | function fig_precmd --on-event fish_prompt 72 | set -l last_status $status 73 | __fig bg:prompt $fish_pid (tty) 74 | 75 | if [ $fig_has_set_prompt = 1 ] 76 | fig_preexec 77 | end 78 | 79 | fig_osc "Dir=%s" "$PWD" 80 | fig_osc "Shell=fish" 81 | fig_osc "PID=%d" "$fish_pid" 82 | fig_osc "SessionId=%s" "$TERM_SESSION_ID" 83 | fig_osc "ExitCode=%s" "$last_status" 84 | fig_osc "TTY=%s" (tty) 85 | fig_osc "Log=%s" "$FIG_LOG_LEVEL" 86 | fig_osc "FishSuggestionColor=%s" "$fish_color_autosuggestion" 87 | 88 | if [ -n "$SSH_TTY" ] 89 | fig_osc "SSH=1" 90 | else 91 | fig_osc "SSH=0" 92 | end 93 | 94 | fig_osc "Docker=%d" "$FIG_IN_DOCKER" 95 | 96 | if [ -n "$USER" ] 97 | fig_osc "Hostname=%s@%s" "$USER" "$FIG_HOSTNAME" 98 | else 99 | fig_osc "Hostname=%s@%s" "root" "$FIG_HOSTNAME" 100 | end 101 | 102 | if fig_fn_defined fish_mode_prompt 103 | fig_copy_fn fish_mode_prompt fig_user_mode_prompt 104 | function fish_mode_prompt; fig_wrap_prompt (fig_user_mode_prompt); end 105 | end 106 | 107 | if fig_fn_defined fish_right_prompt 108 | fig_copy_fn fish_right_prompt fig_user_right_prompt 109 | function fish_right_prompt; fig_wrap_prompt (fig_user_right_prompt); end 110 | end 111 | 112 | fig_copy_fn fish_prompt fig_user_prompt 113 | function fish_prompt; fig_wrap_prompt (fig_user_prompt); fig_osc NewCmd; end 114 | 115 | set fig_has_set_prompt 1 116 | end 117 | 118 | set FIG_SHELL_VAR 1 119 | set fig_has_set_prompt 0 120 | 121 | # Prevents weird interaction where setting the title with ANSI escape 122 | # sequence triggers prompt redraw. 123 | __fig settings autocomplete.addStatusToTerminalTitle false & 124 | __fig bg:exec $fish_pid (tty) & 125 | end 126 | -------------------------------------------------------------------------------- /shell/post.sh: -------------------------------------------------------------------------------- 1 | if [[ -n "$BASH" ]]; then 2 | source ~/.fig/shell/post.bash 3 | elif [[ -n "$ZSH_NAME" ]]; then 4 | source ~/.fig/shell/post.zsh 5 | else 6 | # Fallback to naive method, exposed alteration of prompt variables if in unrecognized shell. 7 | if [ -z "${FIG_TERM_SHELL_VAR}" ]; then 8 | FIG_SHELL="\001\033]697;Shell=unknown\007\002" 9 | FIG_START_PROMPT="${FIG_SHELL}\001\033]697;StartPrompt\007\002" 10 | FIG_END_PROMPT="\001\033]697;EndPrompt\007\002" 11 | FIG_NEW_CMD="\001\033]697;NewCmd\007\002" 12 | 13 | PS1="${FIG_START_PROMPT}${PS1}${FIG_END_PROMPT}${FIG_NEW_CMD}" 14 | PS2="${FIG_START_PROMPT}${PS2}${FIG_END_PROMPT}" 15 | PS3="${FIG_START_PROMPT}${PS3}${FIG_END_PROMPT}${FIG_NEW_CMD}" 16 | 17 | FIG_TERM_SHELL_VAR=1 18 | fi 19 | fi 20 | -------------------------------------------------------------------------------- /shell/post.zsh: -------------------------------------------------------------------------------- 1 | autoload -Uz add-zsh-hook 2 | 3 | FIG_HOSTNAME=$(hostname -f 2> /dev/null || hostname) 4 | 5 | if [[ -e /proc/1/cgroup ]] && grep -q docker /proc/1/cgroup; then 6 | FIG_IN_DOCKER=1 7 | else 8 | FIG_IN_DOCKER=0 9 | fi 10 | 11 | __fig() { 12 | if [[ -d /Applications/Fig.app || -d ~/Applications/Fig.app ]] && command -v fig 2>&1 1>/dev/null; then 13 | fig "$@" 14 | fi 15 | } 16 | 17 | function fig_osc { printf "\033]697;"; printf $@; printf "\007"; } 18 | 19 | FIG_HAS_ZSH_PTY_HOOKS=1 20 | FIG_HAS_SET_PROMPT=0 21 | 22 | fig_preexec() { 23 | __fig bg:exec $$ $TTY &! 24 | 25 | # Restore user defined prompt before executing. 26 | [[ -v PS1 ]] && PS1="$FIG_USER_PS1" 27 | [[ -v PROMPT ]] && PROMPT="$FIG_USER_PROMPT" 28 | [[ -v prompt ]] && prompt="$FIG_USER_prompt" 29 | 30 | [[ -v PS2 ]] && PS2="$FIG_USER_PS2" 31 | [[ -v PROMPT2 ]] && PROMPT2="$FIG_USER_PROMPT2" 32 | 33 | [[ -v PS3 ]] && PS3="$FIG_USER_PS3" 34 | [[ -v PROMPT3 ]] && PROMPT3="$FIG_USER_PROMPT3" 35 | 36 | [[ -v PS4 ]] && PS4="$FIG_USER_PS4" 37 | [[ -v PROMPT4 ]] && PROMPT4="$FIG_USER_PROMPT4" 38 | 39 | [[ -v RPS1 ]] && RPS1="$FIG_USER_RPS1" 40 | [[ -v RPROMPT ]] && RPROMPT="$FIG_USER_RPROMPT" 41 | 42 | [[ -v RPS2 ]] && RPS2="$FIG_USER_RPS2" 43 | [[ -v RPROMPT2 ]] && RPROMPT2="$FIG_USER_RPROMPT2" 44 | 45 | FIG_HAS_SET_PROMPT=0 46 | fig_osc PreExec 47 | } 48 | 49 | fig_precmd() { 50 | local LAST_STATUS=$? 51 | __fig bg:prompt $$ $TTY &! 52 | 53 | if [ $FIG_HAS_SET_PROMPT -eq 1 ]; then 54 | # ^C pressed while entering command, call preexec manually to clear fig prompts. 55 | fig_preexec 56 | fi 57 | 58 | fig_osc "Dir=%s" "$PWD" 59 | fig_osc "Shell=zsh" 60 | fig_osc "PID=%d" "$$" 61 | fig_osc "SessionId=%s" "${TERM_SESSION_ID}" 62 | fig_osc "ExitCode=%s" "${LAST_STATUS}" 63 | fig_osc "TTY=%s" "${TTY}" 64 | fig_osc "Log=%s" "${FIG_LOG_LEVEL}" 65 | 66 | if [[ -n "${SSH_TTY}" ]]; then 67 | fig_osc "SSH=1" 68 | else 69 | fig_osc "SSH=0" 70 | fi 71 | 72 | fig_osc "Docker=%d" "${FIG_IN_DOCKER}" 73 | fig_osc "Hostname=%s@%s" "${USER:-root}" "${FIG_HOSTNAME}" 74 | 75 | START_PROMPT=$(fig_osc StartPrompt) 76 | END_PROMPT=$(fig_osc EndPrompt) 77 | NEW_CMD=$(fig_osc NewCmd) 78 | 79 | # Save user defined prompts. 80 | FIG_USER_PS1="$PS1" 81 | FIG_USER_PROMPT="$PROMPT" 82 | FIG_USER_prompt="$prompt" 83 | 84 | FIG_USER_PS2="$PS2" 85 | FIG_USER_PROMPT2="$PROMPT2" 86 | 87 | FIG_USER_PS3="$PS3" 88 | FIG_USER_PROMPT3="$PROMPT3" 89 | 90 | FIG_USER_PS4="$PS4" 91 | FIG_USER_PROMPT4="$PROMPT4" 92 | 93 | FIG_USER_RPS1="$RPS1" 94 | FIG_USER_RPROMPT="$RPROMPT" 95 | 96 | FIG_USER_RPS2="$RPS2" 97 | FIG_USER_RPROMPT2="$RPROMPT2" 98 | 99 | [[ -v PS1 ]] && PS1="%{$START_PROMPT%}$PS1%{$END_PROMPT$NEW_CMD%}" 100 | [[ -v PROMPT ]] && PROMPT="%{$START_PROMPT%}$PROMPT%{$END_PROMPT$NEW_CMD%}" 101 | [[ -v prompt ]] && prompt="%{$START_PROMPT%}$prompt%{$END_PROMPT$NEW_CMD%}" 102 | 103 | [[ -v PS2 ]] && PS2="%{$START_PROMPT%}$PS2%{$END_PROMPT%}" 104 | [[ -v PROMPT2 ]] && PROMPT2="%{$START_PROMPT%}$PROMPT2%{$END_PROMPT%}" 105 | 106 | [[ -v PS3 ]] && PS3="%{$START_PROMPT%}$PS3%{$END_PROMPT$NEW_CMD%}" 107 | [[ -v PROMPT3 ]] && PROMPT3="%{$START_PROMPT%}$PROMPT3%{$END_PROMPT$NEW_CMD%}" 108 | 109 | [[ -v PS4 ]] && PS4="%{$START_PROMPT%}$PS4%{$END_PROMPT%}" 110 | [[ -v PROMPT4 ]] && PROMPT4="%{$START_PROMPT%}$PROMPT4%{$END_PROMPT%}" 111 | 112 | # The af-magic theme adds a final % to expand. We need to paste without the % 113 | # to avoid doubling up and mangling the prompt. 114 | if [[ "$ZSH_THEME" == "af-magic" ]]; then 115 | RPS1="%{$START_PROMPT%}$RPS1{$END_PROMPT%}" 116 | else 117 | [[ -v RPS1 ]] && RPS1="%{$START_PROMPT%}$RPS1%{$END_PROMPT%}" 118 | fi 119 | [[ -v RPROMPT ]] && RPROMPT="%{$START_PROMPT%}$RPROMPT%{$END_PROMPT%}" 120 | 121 | [[ -v RPS2 ]] && RPS2="%{$START_PROMPT%}$RPS2%{$END_PROMPT%}" 122 | [[ -v RPROMPT2 ]] && RPROMPT2="%{$START_PROMPT%}$RPROMPT2%{$END_PROMPT%}" 123 | 124 | FIG_HAS_SET_PROMPT=1 125 | 126 | # Temporary workaround for bug where istrip is activated when running brew install. 127 | # When istrip is turned on, input characters are strippped to seven bits. 128 | # This causes zle insertion to stop due to our reliance on `fig_insert` being bound to a unicode character 129 | [[ -t 1 ]] && command stty -istrip 130 | } 131 | 132 | add-zsh-hook precmd fig_precmd 133 | add-zsh-hook preexec fig_preexec 134 | -------------------------------------------------------------------------------- /shell/pre.fish: -------------------------------------------------------------------------------- 1 | contains $HOME/.fig/bin $fish_user_paths 2 | or set -Ua fish_user_paths $HOME/.fig/bin 3 | 4 | if [ -d /Applications/Fig.app -o -d ~/Applications/Fig.app ] \ 5 | && command -v fig 1>/dev/null 2>/dev/null \ 6 | && [ -t 1 ] 7 | 8 | # Generated automatically by iTerm and Terminal But needs to be 9 | # explicitly set for VSCode and Hyper. This variable is inherited when 10 | # new ttys are created using tmux and must be explictly overwritten. 11 | if [ -z "$TERM_SESSION_ID" ] || [ -n "$TMUX" ] || [ "$TERM_PROGRAM" = vscode ] 12 | export TERM_SESSION_ID=(uuidgen) 13 | end 14 | export FIG_INTEGRATION_VERSION=4 15 | 16 | if command -v figterm 1>/dev/null 2>/dev/null 17 | if [ -z "$FIG_TERM" ] || [ -z "$FIG_TERM_TMUX" -a -n "$TMUX" ] 18 | set FIG_SHELL (~/.fig/bin/fig_get_shell) 19 | set FIG_IS_LOGIN_SHELL 0 20 | if status --is-login 21 | set FIG_IS_LOGIN_SHELL 1 22 | end 23 | set FIG_TERM_NAME (basename "$FIG_SHELL")" (figterm)" 24 | set FIG_SHELL_PATH "$HOME/.fig/bin/$FIG_TERM_NAME" 25 | 26 | if [ -f "$FIG_SHELL_PATH" ] 27 | cp -p ~/.fig/bin/figterm "$FIG_SHELL_PATH" 28 | end 29 | 30 | exec bash -c "FIG_SHELL=$FIG_SHELL FIG_IS_LOGIN_SHELL=$FIG_IS_LOGIN_SHELL exec -a \"$FIG_TERM_NAME\" \"$FIG_SHELL_PATH\"" 31 | end 32 | end 33 | end 34 | 35 | -------------------------------------------------------------------------------- /shell/pre.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pathadd() { 4 | if [[ -d "$1" ]] && [[ ":$PATH:" != *":$1:"* ]]; then 5 | PATH="${PATH:+"$PATH:"}$1" 6 | fi 7 | } 8 | 9 | pathadd ~/.fig/bin 10 | 11 | if [[ "${TERMINAL_EMULATOR}" != JetBrains-JediTerm ]] \ 12 | && [[ ! "${TERM_PROGRAM}" = WarpTerminal ]] \ 13 | && [[ -t 1 ]]; then 14 | 15 | # Generated automatically by iTerm and Terminal, but needs to be 16 | # explicitly set for VSCode and Hyper. This variable is inherited when 17 | # new ttys are created using Tmux of VSCode and must be explictly 18 | # overwritten. 19 | if [[ -z "${TERM_SESSION_ID}" || -n "${TMUX}" || "${TERM_PROGRAM}" = vscode ]]; then 20 | export TERM_SESSION_ID="$(uuidgen)" 21 | fi 22 | export FIG_INTEGRATION_VERSION=4 23 | 24 | # Only launch figterm if current session is not already inside PTY and command exists 25 | if [[ -z "${FIG_PTY}" ]] && command -v ~/.fig/bin/figterm 2>&1 1>/dev/null; then 26 | if [[ -z "${FIG_TERM}" || (-z "${FIG_TERM_TMUX}" && -n "${TMUX}") ]]; then 27 | # Pty module sets FIG_TERM or FIG_TERM_TMUX to avoid running twice. 28 | FIG_SHELL=$(~/.fig/bin/fig_get_shell) 29 | FIG_IS_LOGIN_SHELL=0 30 | 31 | if ([[ -n "$BASH" ]] && shopt -q login_shell) \ 32 | || ([[ -n "$ZSH_NAME" && -o login ]]); then 33 | FIG_IS_LOGIN_SHELL=1 34 | fi 35 | FIG_TERM_NAME="${FIG_SHELL} (figterm)" 36 | FIG_SHELL_PATH="${HOME}/.fig/bin/$(basename "${FIG_SHELL}") (figterm)" 37 | 38 | # Only copy figterm binary if it doesn't already exist 39 | if [[ ! -f "${FIG_SHELL_PATH}" ]]; then 40 | cp -p ~/.fig/bin/figterm "${FIG_SHELL_PATH}" 41 | fi 42 | 43 | # Get initial text. 44 | INITIAL_TEXT="" 45 | if [[ -z "${BASH}" || "${BASH_VERSINFO[0]}" -gt "3" ]]; then 46 | while read -t 0; do 47 | if [[ -n "${BASH}" ]]; then 48 | read 49 | fi 50 | INITIAL_TEXT="${INITIAL_TEXT}${REPLY}\n" 51 | done 52 | fi 53 | FIG_START_TEXT="$(printf "%b" "${INITIAL_TEXT}")" FIG_SHELL="${FIG_SHELL}" FIG_IS_LOGIN_SHELL="${FIG_IS_LOGIN_SHELL}" exec -a "${FIG_TERM_NAME}" "${FIG_SHELL_PATH}" 54 | fi 55 | fi 56 | fi 57 | -------------------------------------------------------------------------------- /shell/zle.zsh: -------------------------------------------------------------------------------- 1 | 2 | # Check if running under emulation to avoid running zsh specific code 3 | # fixes https://github.com/withfig/fig/issues/291 4 | EMULATION="$(emulate 2>"$HOME"/.fig/logs/zsh.log)" 5 | if [[ "${EMULATION}" != "zsh" ]]; then 6 | return 7 | fi 8 | 9 | zmodload zsh/system 10 | 11 | # Integrate with ZSH line editor 12 | autoload -U +X add-zle-hook-widget 13 | function fig_zsh_keybuffer() { 14 | if (( PENDING || KEYS_QUEUED_COUNT )); then 15 | if (( ! ${+_fig_redraw_fd} )); then 16 | typeset -gi _fig_redraw_fd 17 | if sysopen -o cloexec -ru _fig_redraw_fd /dev/null; then 18 | zle -F $_fig_redraw_fd fig_zsh_redraw 19 | else 20 | unset _fig_redraw_fd 21 | fi 22 | fi 23 | else 24 | fig_zsh_redraw 25 | fi 26 | } 27 | 28 | function fig_zsh_redraw() { 29 | if (( ${+_fig_redraw_fd} )); then 30 | zle -F "$_fig_redraw_fd" 31 | exec {_fig_redraw_fd}>&- 32 | unset _fig_redraw_fd 33 | fi 34 | 35 | 36 | (echo fig bg:zsh-keybuffer "${TERM_SESSION_ID}" "${FIG_INTEGRATION_VERSION}" "${TTY}" "$$" "${HISTNO}" "${CURSOR}" \""$BUFFER"\" | /usr/bin/base64 | /usr/bin/nc -U /tmp/fig.socket 2>"$HOME"/.fig/logs/zsh.log &) 37 | } 38 | 39 | function fig_hide() { 40 | command -v fig 2>"$HOME"/.fig/logs/zsh.log 1>/dev/null && fig bg:hide &! 41 | } 42 | 43 | # Hint: to list all special widgets, run `add-zle-hook-widget -L` 44 | 45 | # Delete any widget, if it already exists 46 | add-zle-hook-widget line-pre-redraw fig_zsh_keybuffer 47 | 48 | add-zle-hook-widget line-init fig_zsh_keybuffer 49 | 50 | # Hide when going through history (see also: histno logic in ShellHooksManager.updateKeybuffer) 51 | add-zle-hook-widget history-line-set fig_hide 52 | 53 | # Hide when searching 54 | add-zle-hook-widget isearch-update fig_hide 55 | 56 | # Create insertion facility 57 | function fig_insert () { 58 | immediate=$(< ~/.fig/zle/immediate) 59 | insertion=$(< ~/.fig/zle/insert) 60 | deletion=$(< ~/.fig/zle/delete) 61 | offset=$(< ~/.fig/zle/offset) 62 | 63 | if [ ! $deletion = "0" ]; then 64 | LBUFFER=${LBUFFER:0:-deletion} 65 | fi 66 | 67 | RBUFFER=${insertion}${RBUFFER} 68 | CURSOR=$CURSOR+${#insertion}-$offset 69 | 70 | if [ $immediate = "1" ]; then 71 | zle accept-line 72 | fi 73 | 74 | } 75 | 76 | zle -N fig_insert 77 | 78 | # Used to force z-asug to clear suggestion 79 | # This function will by used when inserting immediately 80 | function fig_insert_and_clear_autosuggestion () { 81 | zle fig_insert 82 | } 83 | 84 | zle -N fig_insert_and_clear_autosuggestion 85 | 86 | 87 | # Store bindkey command to reset original 'main' keymap 88 | RESET_KEYMAP=$(bindkey -lL main) 89 | # Note: ‘bindkey -lL main’ shows which keymap is linked to ‘main’, if any, 90 | # and hence if the standard emacs or vi emulation is in effect. 91 | # https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#index-bindkey 92 | 93 | # Bind to arbitrary unicode character 94 | # If this changes, make sure to update coresponding keycode in ZLEIntegration.insert 95 | # And increment $FIG_INTEGRATION_VERSION 96 | 97 | # bind to viins keymap 98 | bindkey -v '◧' fig_insert 99 | bindkey -v '◨' fig_insert_and_clear_autosuggestion 100 | 101 | # bind to emacs keymap 102 | bindkey -e '◧' fig_insert 103 | bindkey -e '◨' fig_insert_and_clear_autosuggestion 104 | 105 | # Restore original keymapm (the -v and -e flags override the main keymap) 106 | eval $RESET_KEYMAP 107 | 108 | # Ensure compatibility w/ z-asug -- resolves https://github.com/withfig/fig/issues/62 109 | # Add `fig_insert_and_clear_autosuggestion` to list of widgets that clear suggestions, if not already included 110 | if ! command test -z "$ZSH_AUTOSUGGEST_CLEAR_WIDGETS" && ! (($ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(Ie)fig_insert_and_clear_autosuggestion])); then 111 | ZSH_AUTOSUGGEST_CLEAR_WIDGETS=(${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS} fig_insert_and_clear_autosuggestion) 112 | fi 113 | 114 | -------------------------------------------------------------------------------- /ssh: -------------------------------------------------------------------------------- 1 | ControlPath ~/.ssh/%C 2 | ControlMaster auto 3 | ControlPersist 1 4 | PermitLocalCommand yes 5 | LocalCommand fig bg:ssh ~/.ssh/%C & -------------------------------------------------------------------------------- /team/README.md: -------------------------------------------------------------------------------- 1 | Coming Soon 2 | -------------------------------------------------------------------------------- /themes/apple-dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Sebastian Danielsson", 4 | "github": "SebDanielsson" 5 | }, 6 | "version": "1.0", 7 | "theme": { 8 | "textColor": "#FAFAFA", 9 | "backgroundColor": "#1C1C1E", 10 | "matchBackgroundColor": "#2C2C2E", 11 | "selection": { 12 | "textColor": "#FF9F0A", 13 | "backgroundColor": "#2C2C2E" 14 | }, 15 | "description": { 16 | "textColor": "#8E8E93", 17 | "borderColor": "#FF9F0A" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /themes/apple-light.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Sebastian Danielsson", 4 | "github": "SebDanielsson" 5 | }, 6 | "version": "1.0", 7 | "theme": { 8 | "textColor": "#1C1C1E", 9 | "backgroundColor": "#F2F2F7", 10 | "matchBackgroundColor": "#E5E5EA", 11 | "selection": { 12 | "textColor": "#007AFF", 13 | "backgroundColor": "#E5E5EA" 14 | }, 15 | "description": { 16 | "textColor": "#48484A", 17 | "borderColor": "#007AFF" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /themes/atlantic-night.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Paul Bennett", 4 | "twitter": "@mrpbennett", 5 | "github": "mrpbennett" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#d6deeb", 10 | "backgroundColor": "#000720", 11 | "matchBackgroundColor": "#396cb335", 12 | "selection": { 13 | "textColor": "#6ba9ff", 14 | "backgroundColor": "#396cb335" 15 | }, 16 | "description": { 17 | "textColor": "#6bb9f0", 18 | "borderColor": "#1b213b" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/aura-dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./schema.json", 3 | "author": { 4 | "name": "Dalton Menezes", 5 | "twitter": "@daltonmenezes", 6 | "github": "daltonmenezes" 7 | }, 8 | "version": "", 9 | "theme": { 10 | "textColor": "#61ffca", 11 | "backgroundColor": "#15141b", 12 | "matchBackgroundColor": "#3d375e7f", 13 | "selection": { 14 | "textColor": "#a277ff", 15 | "backgroundColor": "#3d375e7f" 16 | }, 17 | "description": { 18 | "textColor": "#a277ff", 19 | "borderColor": "#6d6d6d" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /themes/catppuccin.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./schema.json", 3 | "author": { 4 | "name": "enno", 5 | "github": "ennochian" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#d9e0ee", 10 | "backgroundColor": "#1e1e2e", 11 | "matchBackgroundColor": "#575268", 12 | "selection": { 13 | "textColor": "#F5E0DC", 14 | "backgroundColor": "#302D41" 15 | }, 16 | "description": { 17 | "textColor": "#F5E0DC", 18 | "borderColor": "#DDB6F2" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/cobalt.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Wes Bos", 4 | "twitter": "@wesbos", 5 | "github": "wesbos" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#ffc600", 10 | "backgroundColor": "#193549", 11 | "matchBackgroundColor": "#6b8039", 12 | "selection": { 13 | "textColor": "#fff", 14 | "backgroundColor": "#005aae" 15 | }, 16 | "description": { 17 | "textColor": "#b3b3b3", 18 | "borderColor": "#152733" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/cobalt2.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Wes Bos", 4 | "twitter": "@wesbos", 5 | "github": "wesbos" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#ffc600", 10 | "backgroundColor": "#1b2c3f", 11 | "matchBackgroundColor": "#6b8039", 12 | "selection": { 13 | "textColor": "#fff", 14 | "backgroundColor": "#193549" 15 | }, 16 | "description": { 17 | "textColor": "#ffffff", 18 | "borderColor": "#ffc600" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/darkclown.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Arun", 4 | "twitter": "@imthedarkclown", 5 | "github": "darkclown97" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "rgb(0, 255, 0)", 10 | "backgroundColor": "rgb(0, 0, 0)", 11 | "matchBackgroundColor": "rgb(255, 0, 0)", 12 | "selection": { 13 | "textColor": "#000", 14 | "backgroundColor": "rgb(0, 255, 0)" 15 | }, 16 | "description": { 17 | "textColor": "rgb(0, 255, 0)", 18 | "borderColor": "rgb(0, 255, 0)" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /themes/dracula.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Zeno Rocha", 4 | "twitter": "@zenorocha", 5 | "github": "zenorocha" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#f8f8f2", 10 | "backgroundColor": "#282a36", 11 | "matchBackgroundColor": "#6272a4", 12 | "selection": { 13 | "textColor": "#f8f8f2", 14 | "backgroundColor": "#44475a" 15 | }, 16 | "description": { 17 | "textColor": "#bd93f9", 18 | "borderColor": "#44475a" 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /themes/dubdub-dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Shawn McClelland", 4 | "twitter": "@gimballocked", 5 | "github": "shawnmcclelland" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#ffffff", 10 | "backgroundColor": "#292b34", 11 | "matchBackgroundColor": "#4ca8a3", 12 | "selection": { 13 | "textColor": "#ffffff", 14 | "backgroundColor": "#43454f" 15 | }, 16 | "description": { 17 | "textColor": "#f7d0a2", 18 | "borderColor": "#a9aab640" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/dubdub-light.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Shawn McClelland", 4 | "twitter": "@gimballocked", 5 | "github": "shawnmcclelland" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#2a2c36", 10 | "backgroundColor": "#fffeff", 11 | "matchBackgroundColor": "#ddfeb6", 12 | "selection": { 13 | "textColor": "#2a2c36", 14 | "backgroundColor": "#a9abb5" 15 | }, 16 | "description": { 17 | "textColor": "#6161b9", 18 | "borderColor": "#a9aab640" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/github-dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "theme": { 4 | "textColor": "#83befc", 5 | "backgroundColor": "#282e34", 6 | "matchBackgroundColor": "#2d5072", 7 | "selection": { 8 | "textColor": "rgb(253,253,253)", 9 | "backgroundColor": "rgb(30,90,199)" 10 | }, 11 | "description": { 12 | "textColor": "#757e88", 13 | "borderColor": "#1d2227" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /themes/gruvbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Pavel Pertsev", 4 | "github": "morhetz" 5 | }, 6 | "version": "1.0", 7 | "theme": { 8 | "backgroundColor": "#282828", 9 | "textColor": "#e9d9b0", 10 | "matchBackgroundColor": "#a89984", 11 | "selection": { 12 | "textColor": "#b8bb26", 13 | "backgroundColor": "#1d2021" 14 | }, 15 | "description": { 16 | "textColor": "#d79921", 17 | "borderColor": "#928374" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /themes/halloween.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Brendan Falk", 4 | "twitter": "@brendanfalk", 5 | "github": "brendanfalk" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#c900ff", 10 | "backgroundColor": "#160000", 11 | "matchBackgroundColor": "#00000", 12 | "selection": { 13 | "textColor": "#2D6934", 14 | "backgroundColor": "#E69229" 15 | }, 16 | "description": { 17 | "textColor": "#ECCA39", 18 | "borderColor": "#C84C28" 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /themes/monokai-dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Wimer Hazenberg" 4 | }, 5 | "version": "1.0", 6 | "theme": { 7 | "textColor": "#f8f8f2", 8 | "backgroundColor": "#272822", 9 | "matchBackgroundColor": "#3e3d32", 10 | "selection": { 11 | "textColor": "#cfcfc2", 12 | "backgroundColor": "#75715e" 13 | }, 14 | "description": { 15 | "textColor": "#839496", 16 | "borderColor": "#cfcfc2" 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /themes/nightowl.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Sarah Drasner", 4 | "twitter": "@sarah_edo", 5 | "github": "sdras" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "backgroundColor": "#01162c", 10 | "textColor": "#dbe2ee", 11 | "matchBackgroundColor": "#525f7b", 12 | "selection": { 13 | "textColor": "#dbe2ee", 14 | "backgroundColor": "#000C1D" 15 | }, 16 | "description": { 17 | "textColor": "#6988a0", 18 | "borderColor": "#2b3041" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/nord.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Arctic Ice Studio & Sven Greb", 4 | "twitter": "@arcticicestudio", 5 | "github": "arcticicestudio" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#d8dde8", 10 | "backgroundColor": "#2e333f", 11 | "matchBackgroundColor": "#6272a4", 12 | "selection": { 13 | "textColor": "#d8dde8", 14 | "backgroundColor": "#4c5569" 15 | }, 16 | "description": { 17 | "textColor": "#e5e8ef", 18 | "borderColor": "#434b5d" 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /themes/oceanic-next.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../schema.json", 3 | "author": { 4 | "name": "Tanner B. Hess Webber", 5 | "github": "tbhesswebber" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "backgroundColor": "#1b2b34", 10 | "matchBackgroundColor": "#1b2b34", 11 | "textColor": "#a7adba", 12 | "selection": { 13 | "textColor": "#d8dee9", 14 | "backgroundColor": "#343d46" 15 | }, 16 | "description": { 17 | "textColor": "#5fafaf", 18 | "borderColor": "#44475a" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/palenight.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Jamie Weavis", 4 | "twitter": "@jamieweavis", 5 | "github": "jamieweavis" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#676e95", 10 | "backgroundColor": "#292d3e", 11 | "matchBackgroundColor": "#444267", 12 | "selection": { 13 | "textColor": "#ffffff", 14 | "backgroundColor": "#717cb470" 15 | }, 16 | "description": { 17 | "textColor": "#515772", 18 | "borderColor": "#515772" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/panda.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Shy Ruparel", 4 | "twitter": "@ShyRuparel", 5 | "github": "Shy" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#f3f3f3", 10 | "backgroundColor": "#292A2B", 11 | "matchBackgroundColor": "#B084eb", 12 | "selection": { 13 | "textColor": "#f3f3f3", 14 | "backgroundColor": "#757474" 15 | }, 16 | "description": { 17 | "textColor": "#15fbdb", 18 | "borderColor": "#f3f2f2" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/plastic.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Rod Beccari", 4 | "twitter": "@rodbecc", 5 | "github": "rodbecc" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "backgroundColor": "#21252B", 10 | "textColor": "#A9B2C3", 11 | "matchBackgroundColor": "#5F6672", 12 | "selection": { 13 | "textColor": "#21252B", 14 | "backgroundColor": "#E9D16C" 15 | }, 16 | "description": { 17 | "textColor": "#1085FF", 18 | "borderColor": "#E9D16C" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /themes/poimandres.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "drcmda", 4 | "twitter": "@0xca0a", 5 | "github": "drcmda" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#e4f0fb", 10 | "backgroundColor": "#1b1e28", 11 | "matchBackgroundColor": "#5fb3a1", 12 | "selection": { 13 | "textColor": "#e4f0fb", 14 | "backgroundColor": "#ADD7FF40" 15 | }, 16 | "description": { 17 | "textColor": "#a6accd", 18 | "borderColor": "#ADD7FF40" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/solarized-dark.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Ethan Schoonover", 4 | "twitter": "@ethanschoonover", 5 | "github": "altercation" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#839496", 10 | "backgroundColor": "#002b36", 11 | "matchBackgroundColor": "#586e75", 12 | "selection": { 13 | "textColor": "#93a1a1", 14 | "backgroundColor": "#268bd2" 15 | }, 16 | "description": { 17 | "textColor": "#839496", 18 | "borderColor": "#073642" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/solarized-light.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Ethan Schoonover", 4 | "twitter": "@ethanschoonover", 5 | "github": "altercation" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#657b83", 10 | "backgroundColor": "#fdf6e3", 11 | "matchBackgroundColor": "#93a1a1", 12 | "selection": { 13 | "textColor": "#586e75", 14 | "backgroundColor": "#268bd2" 15 | }, 16 | "description": { 17 | "textColor": "#657b83", 18 | "borderColor": "#eee8d5" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/synthwave-84.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Don Isaac", 4 | "github": "DonIsaac" 5 | }, 6 | "version": "1.0", 7 | "theme": { 8 | "textColor": "#e799ff", 9 | "backgroundColor": "#2f003d", 10 | "matchBackgroundColor": "#f4d7fa50", 11 | "selection": { 12 | "textColor": "#e799ff", 13 | "backgroundColor": "#f4d7fa50" 14 | }, 15 | "description": { 16 | "textColor": "#fc28a8", 17 | "borderColor": "#02A3AB" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /themes/the-unnamed.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Elio Struyf", 4 | "twitter": "@eliostruyf", 5 | "github": "estruyf" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "textColor": "#F3EFF5", 10 | "backgroundColor": "#0E131F", 11 | "matchBackgroundColor": "#F3EFF550", 12 | "selection": { 13 | "textColor": "#F3EFF5", 14 | "backgroundColor": "#F3EFF550" 15 | }, 16 | "description": { 17 | "textColor": "#F141A8", 18 | "borderColor": "#242d34" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /themes/tokyo-night.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Matt Kelly", 4 | "twitter": "@mattkellyhacks", 5 | "github": "mathisto" 6 | }, 7 | "version": "1.0", 8 | "theme": { 9 | "backgroundColor": "#24283b", 10 | "textColor": "#c0caf5", 11 | "matchBackgroundColor": "#565f89", 12 | "selection": { 13 | "textColor": "#a9b1d6", 14 | "backgroundColor": "#414868" 15 | }, 16 | "description": { 17 | "textColor": "#414868", 18 | "borderColor": "#f7768e" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tmux: -------------------------------------------------------------------------------- 1 | set-hook -ga window-pane-changed 'run-shell "fig bg:tmux #{pane_id}"' 2 | #set-hook -ga session-windows-changed 'run-shell "fig bg:tmux #{pane_id}"' 3 | set-hook -ga client-session-changed 'run-shell "fig bg:tmux #{pane_id}"' 4 | 5 | # set-hook -ga client-detached run-shell 'run-shell "fig bg:tmux closed"' 6 | set-hook -ga session-closed 'run-shell "fig bg:tmux '%'"' -------------------------------------------------------------------------------- /tools/all-settings.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "settingName": "autocomplete.developerMode", 4 | "title": "Dev Mode", 5 | "description": "Turns off completion-spec caching and loads completion specs from the Completion Specs Folder.", 6 | "type": "boolean", 7 | "details": "Developer Mode changes the way specs are loaded", 8 | "default": false, 9 | "category": "Autocomplete" 10 | }, 11 | { 12 | "settingName": "autocomplete.devCompletionsFolder", 13 | "title": "Specs Folder", 14 | "description": "When Developer Mode is enabled, Fig loads completion specs from the specified directory.", 15 | "type": "text", 16 | "default": "", 17 | "category": "Autocomplete" 18 | }, 19 | { 20 | "settingName": "autocomplete.theme", 21 | "title": "Theme", 22 | "description": "Change Fig's theme", 23 | "type": "single_select", 24 | "options": [ 25 | "dark", 26 | "light", 27 | "cobalt", 28 | "cobalt2", 29 | "dracula", 30 | "github-dark", 31 | "gruvbox", 32 | "nightowl", 33 | "nord", 34 | "poimandres", 35 | "the-unnamed" 36 | ], 37 | "default": "dark", 38 | "category": "Appearance" 39 | }, 40 | { 41 | "settingName": "autocomplete.onlyShowOnTab", 42 | "title": "Show on Tab", 43 | "description": "If true, Fig will only show autocomplete when Tab is pressed instead of showing it automatically.", 44 | "type": "boolean", 45 | "default": false, 46 | "category": "Autocomplete" 47 | }, 48 | { 49 | "settingName": "autocomplete.fontFamily", 50 | "title": "Font Family", 51 | "description": "Change the font of autocomplete", 52 | "type": "text", 53 | "category": "Appearance" 54 | }, 55 | { 56 | "settingName": "autocomplete.fontSize", 57 | "title": "Font Size", 58 | "description": "Change the font size of autocomplete", 59 | "type": "number", 60 | "category": "Appearance" 61 | }, 62 | { 63 | "settingName": "autocomplete.sortMethod", 64 | "title": "Sort Suggestions", 65 | "description": "Specifies how Fig should sort suggestions.", 66 | "type": "single_select", 67 | "default": "recency", 68 | "options": [ 69 | { 70 | "name": "recency", 71 | "description": "Sort by most recently used" 72 | }, 73 | { 74 | "name": "alphabetical", 75 | "description": "Sort in alphabetical order" 76 | } 77 | ], 78 | "category": "Autocomplete" 79 | }, 80 | { 81 | "settingName": "autocomplete.scrollWrapAround", 82 | "title": "Wrap Around", 83 | "description": "If true, when the end of suggestions are reached by pressing the down arrow key, it will wrap back around to the top.", 84 | "type": "boolean", 85 | "default": false, 86 | "category": "Appearance" 87 | }, 88 | { 89 | "settingName": "autocomplete.insertSpaceAutomatically", 90 | "title": "Insert Space", 91 | "description": "If true, Fig will automatically insert a space after you select a suggestion that contains a mandatory argument (e.g selecting git clone).", 92 | "type": "boolean", 93 | "default": true, 94 | "category": "Autocomplete" 95 | }, 96 | { 97 | "settingName": "autocomplete.immediatelyRunDangerousCommands", 98 | "title": "Dangerous", 99 | "description": "If true, users will be able to immediately run suggestions that completion specs have marked as \"dangerous\" (e.g. rm -rf) rather than having to hit enter twice.", 100 | "type": "boolean", 101 | "default": false, 102 | "category": "Autocomplete" 103 | }, 104 | { 105 | "settingName": "autocomplete.immediatelyRunGitAliases", 106 | "title": "Git Aliases", 107 | "description": "If false, Fig will treat git aliases as 'dangerous' (described above).", 108 | "type": "boolean", 109 | "default": false, 110 | "category": "Autocomplete" 111 | }, 112 | { 113 | "settingName": "autocomplete.immediatelyExecuteAfterSpace", 114 | "title": "Instant Execute", 115 | "description": "If true, Fig will allow user to immediately execute commands after the user hits space.", 116 | "type": "boolean", 117 | "default": false, 118 | "category": "Autocomplete" 119 | }, 120 | { 121 | "settingName": "autocomplete.disableForCommands", 122 | "title": "Disable CLIs", 123 | "description": "A list of CLI tools that Fig should not autocomplete on.", 124 | "type": "multiselect", 125 | "default": [], 126 | "details": "e.g. git,npm", 127 | "category": "Autocomplete" 128 | }, 129 | { 130 | "settingName": "autocomplete.enter", 131 | "title": "Enter Behavior", 132 | "description": "Set the behavior of the enter key.", 133 | "type": "single_select", 134 | "options": ["insert", "ignore"], 135 | "default": "insert", 136 | "category": "Autocomplete" 137 | }, 138 | { 139 | "settingName": "autocomplete.tab", 140 | "title": "Tab Behavior", 141 | "description": "Set the behavior of the tab key.", 142 | "type": "single_select", 143 | "default": "shake", 144 | "options": [ 145 | { "name": "shake", "descrition": "Insert matching prefix or shake" }, 146 | { "name": "insert", "description": "Insert immediately" }, 147 | { 148 | "name": "insertOrPrefix", 149 | "description": "Insert matching prefix or selected suggestion." 150 | }, 151 | { "name": "navigate", "decription": "Navigate" } 152 | ], 153 | "category": "Autocomplete" 154 | }, 155 | { 156 | "settingName": "autocomplete.height", 157 | "title": "Window Height", 158 | "description": "Set the height of the autocomplete window in pixels.", 159 | "type": "number", 160 | "default": "140", 161 | "category": "Appearance", 162 | "commonlyUsed": true 163 | }, 164 | { 165 | "settingName": "autocomplete.width", 166 | "title": "Window Width", 167 | "description": "Set the width of the autocomplete window in pixels.", 168 | "type": "number", 169 | "default": "320", 170 | "category": "Appearance", 171 | "commonlyUsed": true 172 | }, 173 | { 174 | "settingName": "autocomplete.fuzzySearch", 175 | "title": "Fuzzy Search", 176 | "description": "Search suggestions using substring matching rather than prefix search.", 177 | "type": "boolean", 178 | "default": false, 179 | "details": "This currently does not support the tab autocomplete underlining that prefix search has", 180 | "category": "Autocomplete" 181 | }, 182 | { 183 | "settingName": "pty.path", 184 | "title": "PTY Path", 185 | "description": "Sets the PATH variable used in pseudoterminals.", 186 | "type": "text", 187 | "default": "", 188 | "details": "The error text 'commands not found' often appears if this path is not set correctly.", 189 | "category": "Pseudoterminal", 190 | "commonlyUsed": true 191 | }, 192 | { 193 | "settingName": "pty.rc", 194 | "title": "Init File for", 195 | "description": "A file that will be sourced when Fig creates a pseudoterminal.", 196 | "type": "text", 197 | "default": "~/.fig/user/ptyrc", 198 | "details": "Add environment variables to this file, in order for commands like `aws` to use them when generating completions.", 199 | "category": "Pseudoterminal" 200 | }, 201 | { 202 | "settingName": "app.launchOnStartup", 203 | "title": "Launch on Start", 204 | "description": "If true, the Fig app is added to Login Items and will launch automatically whenever you restart your computer.", 205 | "type": "boolean", 206 | "default": true, 207 | "category": "Application" 208 | }, 209 | { 210 | "settingName": "app.hideMenubarIcon", 211 | "title": "Hide Icon", 212 | "description": "Hide Fig's icon from the macOS menu bar", 213 | "type": "boolean", 214 | "default": false, 215 | "category": "Application" 216 | }, 217 | { 218 | "settingName": "app.beta", 219 | "title": "Beta", 220 | "description": "Opt-in to more frequent updates with all the newest features (and bugs).", 221 | "type": "boolean", 222 | "default": false, 223 | "category": "Application" 224 | }, 225 | { 226 | "settingName": "integrations.terminal.disabled", 227 | "title": "Disable Terminal", 228 | "description": "Disables Fig for the macOS Terminal", 229 | "type": "boolean", 230 | "default": false, 231 | "category": "Integrations" 232 | }, 233 | { 234 | "settingName": "integrations.hyper.disabled", 235 | "title": "Disable Hyper", 236 | "description": "Disables Fig for Hyper", 237 | "type": "boolean", 238 | "default": false, 239 | "category": "Integrations" 240 | }, 241 | { 242 | "settingName": "integrations.vscode.disabled", 243 | "title": "Disable VSCode", 244 | "description": "Disables Fig for the VSCode integrated terminal", 245 | "type": "boolean", 246 | "default": false, 247 | "category": "Integrations" 248 | }, 249 | { 250 | "settingName": "integrations.iterm.disabled", 251 | "title": "Disable iTerm", 252 | "description": "Disables Fig for iTerm", 253 | "type": "boolean", 254 | "default": false, 255 | "category": "Integrations" 256 | }, 257 | { 258 | "settingName": "app.disableAutoupdates", 259 | "title": "AutoUpdate", 260 | "description": "Turn off automatic updates when launching a new shell session.", 261 | "type": "boolean", 262 | "default": false, 263 | "category": "Application" 264 | }, 265 | { 266 | "settingName": "app.disableAutolaunch", 267 | "title": "AutoLaunch", 268 | "description": "Do not automatically start Fig when launching a new shell session.", 269 | "type": "boolean", 270 | "default": false, 271 | "category": "Application" 272 | }, 273 | { 274 | "settingName": "telemetry.disabled", 275 | "title": "Telemetry", 276 | "description": "Opt-out of all telemetry. By default, Fig collects limited usage information to provide support and improve the product.", 277 | "type": "boolean", 278 | "default": false, 279 | "details": "Read our statement on privacy at fig.io/privacy for more details.", 280 | "category": "Application" 281 | }, 282 | { 283 | "settingName": "autocomplete.keybindings.tab", 284 | "default": "insertCommonPrefix" 285 | }, 286 | { 287 | "settingName": "autocomplete.keybindings.enter", 288 | "default": "insertSelected" 289 | }, 290 | { 291 | "settingName": "autocomplete.keybindings.up", 292 | "default": "navigateUp" 293 | }, 294 | { 295 | "settingName": "autocomplete.keybindings.down", 296 | "default": "navigateDown" 297 | }, 298 | { 299 | "settingName": "autocomplete.keybindings.control+k", 300 | "default": "navigateUp" 301 | }, 302 | { 303 | "settingName": "autocomplete.keybindings.control+j", 304 | "default": "navigateDown" 305 | }, 306 | { 307 | "settingName": "autocomplete.keybindings.control+p", 308 | "default": "navigateUp" 309 | }, 310 | { 311 | "settingName": "autocomplete.keybindings.control+n", 312 | "default": "navigateDown" 313 | }, 314 | { 315 | "settingName": "autocomplete.keybindings.esc", 316 | "default": "hideAutocomplete" 317 | }, 318 | { 319 | "settingName": "autocomplete.keybindings.command+i", 320 | "default": "toggleDescription" 321 | }, 322 | { 323 | "settingName": "autocomplete.keybindings.control+r", 324 | "default": "toggleHistoryMode" 325 | } 326 | ] 327 | -------------------------------------------------------------------------------- /tools/check_for_upgrade.sh: -------------------------------------------------------------------------------- 1 | # coming soon 2 | 3 | # this will likely prompt a user to upgrade fig when they spawn a new terminal, just like oh-my-zshell -------------------------------------------------------------------------------- /tools/cli/--help.sh: -------------------------------------------------------------------------------- 1 | help.sh -------------------------------------------------------------------------------- /tools/cli/-h.sh: -------------------------------------------------------------------------------- 1 | help.sh -------------------------------------------------------------------------------- /tools/cli/community.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # community.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 5/24/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | echo 9 | echo "→ Joining Fig community..." 10 | echo 11 | open https://fig.io/community 12 | -------------------------------------------------------------------------------- /tools/cli/contribute.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # contribute.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 1/7/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | 9 | echo "→ Opening GitHub repo..." 10 | open https://github.com/withfig/autocomplete 11 | -------------------------------------------------------------------------------- /tools/cli/debug-ssh.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # debug-ssh.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 3/2/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | 9 | \ssh -V 10 | echo "~/.ssh/config:" 11 | \cat ~/.ssh/config 12 | -------------------------------------------------------------------------------- /tools/cli/debug.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | heading() { 3 | printf "\n\n===$1===\n" 4 | } 5 | 6 | 7 | HIGHLIGHT=$(tput smso) 8 | HIGHLIGHT_END=$(tput rmso) 9 | 10 | # Structure. 11 | TAB=' ' 12 | 13 | press_any_key_to_continue() { 14 | echo # new line 15 | read -n 1 -s -r -p "${TAB}${HIGHLIGHT} Press any key to continue ${HIGHLIGHT_END}" 16 | echo # new line 17 | echo # new line 18 | clear 19 | } 20 | 21 | case "$1" in 22 | "logs") 23 | fig settings developer.logging true 24 | 25 | if [ "$#" -eq 1 ]; then 26 | tail -n0 -qf ~/.fig/logs/*.log 27 | else 28 | shift 29 | array=( "$@" ) 30 | array=( "${array[@]/#/$HOME/.fig/logs/}" ) # prepend ~/.fig/logs 31 | array=( "${array[@]/%/.log}" ) # append .log 32 | tail -n0 -qf "${array[@]}" 33 | fi 34 | fig settings developer.logging false 35 | 36 | ;; 37 | "app") 38 | if [ "$(fig app:running)" -eq 0 ]; then 39 | echo "Fig app is not currently running..." 40 | /Applications/Fig.app/Contents/MacOS/fig 41 | exit 0 42 | fi 43 | 44 | BUNDLE_PATH=$(lsappinfo info -only "bundlepath" -app com.mschrage.fig | cut -f2 -d= | tr -d '"') 45 | TERMINAL_EMULATOR=$(lsappinfo info -only "name" -app $(lsappinfo front) | cut -f2 -d= | tr -d '"') 46 | fig quit > /dev/null 47 | echo "Running the Fig.app executable directly from $BUNDLE_PATH." 48 | echo "You will need to grant accessibility permissions to the current terminal ($TERMINAL_EMULATOR)!" 49 | 50 | $BUNDLE_PATH/Contents/MacOS/fig 51 | ;; 52 | "sample") 53 | PID=$(lsappinfo info -only "pid" -app com.mschrage.fig | cut -f2 -d=) 54 | OUT_FILE=/tmp/fig-sample 55 | echo "Sampling Fig process ($PID). Writing output to $OUT_FILE" 56 | sample $PID -f $OUT_FILE 57 | printf "\n\n\n-------\nFinished writing to $OUT_FILE\n" 58 | echo "Please send this file to the Fig Team" 59 | echo "Or attach it to a GitHub issue (run 'fig issue')" 60 | ;; 61 | "terminal") 62 | clear 63 | heading "tty characteristics" 64 | stty -a 65 | press_any_key_to_continue 66 | heading "environment vars" 67 | env 68 | ;; 69 | "dotfiles") 70 | "$HOME"/.fig/tools/cli/email_dotfiles.sh 71 | ;; 72 | # "shell-startup") 73 | 74 | # echo "Append 'set -x' to /etc/profile. You will be prompted for permission." 75 | # printf "\nset -x" | sudo tee -a /etc/profile 76 | # open /etc/profile 77 | # ;; 78 | "prefs") 79 | clear 80 | heading settings.json 81 | cat ~/.fig/settings.json 82 | press_any_key_to_continue 83 | 84 | heading user/config 85 | cat ~/.fig/user/config 86 | press_any_key_to_continue 87 | 88 | heading NSUserDefaults 89 | defaults read com.mschrage.fig 90 | defaults read com.mschrage.fig.shared 91 | 92 | ;; 93 | "unix-socket") 94 | echo Listening on /tmp/fig.socket... 95 | echo "Note: You will need to restart Fig afterwards" 96 | rm /tmp/fig.socket && nc -Ulk /tmp/fig.socket 97 | echo "Remember to restart Fig!" 98 | 99 | ;; 100 | "verify-codesign") 101 | codesign -vvvv /Applications/Fig.app 102 | ;; 103 | *) 104 | echo "Not a valid debug command." 105 | exit 1 106 | ;; 107 | esac -------------------------------------------------------------------------------- /tools/cli/email_dotfiles.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GREEN='\033[0;32m' 4 | RED='\033[0;31m' 5 | 6 | echo -e "We will be sending the following files (if they exist) to hello@fig.io and will CC you:\n" 7 | echo -e ' -' ~/.profile 8 | echo -e ' -' ~/.zprofile 9 | echo -e ' -' ~/.bash_profile 10 | echo -e ' -' ~/.bashrc 11 | echo -e ' -' ~/.zshrc 12 | echo -e ' -' ~/.config/fish/config.fish 13 | echo -e '\n' 14 | 15 | function abort { 16 | echo -e "${RED}Aborting..." 17 | exit 1 18 | } 19 | 20 | read -rp "Continue? (Y/N): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || abort 21 | 22 | echo -e '\n' 23 | 24 | curl -X POST --data "$(defaults read com.mschrage.fig | grep userEmail)" \ 25 | --data FILEBREAK --data-binary @"$HOME/.profile" \ 26 | --data FILEBREAK --data-binary @"$HOME/.zprofile" \ 27 | --data FILEBREAK --data-binary @"$HOME/.bash_profile" \ 28 | --data FILEBREAK --data-binary @"$HOME/.bashrc" \ 29 | --data FILEBREAK --data-binary @"$HOME/.zshrc" \ 30 | --data FILEBREAK --data-binary @"$HOME/.config/fish/config.fish" \ 31 | https://waitlist.withfig.com/dotfiles 2>/dev/null 32 | 33 | echo -e "\n${GREEN}Dotfiles emailed!" 34 | -------------------------------------------------------------------------------- /tools/cli/help.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # help.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 1/6/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | BOLD=$(tput bold) 9 | NORMAL=$(tput sgr0) 10 | 11 | cat < /dev/null) 44 | 45 | 46 | if [[ "$mail" == "" ]] 47 | then 48 | echo 49 | print_special "${BOLD}${RED}Error${NORMAL}${BOLD}: It does not seem like you are logged into Fig.${NORMAL}" 50 | echo 51 | print_special "Run ${BOLD}${MAGENTA}fig util:logout${NORMAL} then follow the prompts to log back. Then try again" 52 | exit 1 53 | fi 54 | 55 | 56 | # Given a user's email, get their referral code 57 | url=$(curl "https://waitlist.withfig.com/waitlist/get-referral-link-from-email/$mail" 2> /dev/null ) 58 | 59 | 60 | if [[ "$url" == "" ]] || [[ "$url" == "ERROR" ]] 61 | then 62 | echo 63 | print_special "${BOLD}${RED}Error${NORMAL}${BOLD}: We can't find a referral code for this email address: $mail${NORMAL}" 64 | echo 65 | print_special "${UNDERLINE}Are you sure you are logged in correctly?${UNDERLINE_END}" 66 | echo 67 | print_special "Run ${BOLD}${MAGENTA}fig util:logout${NORMAL} then follow the prompts to log back. Then try again" 68 | echo 69 | print_special "If you think there is a mistake, please contact ${UNDERLINE}hello@fig.io${UNDERLINE_END}" 70 | echo 71 | echo 72 | print_special "P.S. This error may also occur if you are not connected to the internet" 73 | exit 1 74 | else 75 | echo $url | pbcopy 76 | echo 77 | echo " ${BOLD}Thank you for sharing Fig.${NORMAL}" 78 | echo 79 | echo "› ${BOLD}${MAGENTA}${UNDERLINE}$url${UNDERLINE_END}${NORMAL}" 80 | echo " Your referral link has been copied to the clipboard." 81 | echo 82 | 83 | fi 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /tools/cli/issue.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # issue.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 1/7/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | 9 | echo "→ Opening GitHub..." 10 | open https://github.com/withfig/fig/issues/new 11 | -------------------------------------------------------------------------------- /tools/cli/list.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | while IFS= read -ra line; do 4 | IFS=\":. read -ra file <<<"${line[@]}" 5 | echo "${file[4]}" 6 | done <<<"$(curl \ 7 | -H "Accept: application/vnd.github.v3+json" \ 8 | https://api.github.com/repos/withfig/autocomplete/contents/src | grep "name")" 9 | -------------------------------------------------------------------------------- /tools/cli/remove.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # uninstall_spec.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 1/6/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | BOLD=$(tput bold) 9 | NORMAL=$(tput sgr0) 10 | 11 | SPEC=$1 12 | 13 | if [[ $# -ne 1 ]]; then 14 | 15 | cat < 18 | 19 | EOF 20 | exit 21 | 22 | 23 | fi 24 | 25 | rm -rf ~/.fig/autocomplete/$SPEC.js 26 | 27 | cat < /dev/null 6 | printf "\n${MAGENTA}${BOLD}fig${NORMAL} is now connected to this terminal session. ($(tty))\n\n" 7 | fig bg:init $SHELLPID $(tty) 8 | -------------------------------------------------------------------------------- /tools/cli/team-download.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script lets users upload a specific cli spec to fig's cloud 4 | 5 | MAGENTA=$(tput setaf 5) 6 | RED=$(tput setaf 1) 7 | BOLD=$(tput bold) 8 | NORMAL=$(tput sgr0) 9 | HIGHLIGHT=$(tput smso) 10 | HIGHLIGHT_END=$(tput rmso) 11 | TAB=' ' 12 | 13 | print_special() { 14 | echo "${TAB}$@${NORMAL}"$'\n' 15 | } 16 | 17 | 18 | ##################################### 19 | # State 20 | ##################################### 21 | 22 | # Make sure dev_mode != 1 when this is pushed live 23 | dev_mode=0 24 | 25 | if [[ "$dev_mode" == '1' ]] 26 | then 27 | echo 28 | echo "currently in dev mode" 29 | echo 30 | filename_endpoint="http://localhost:3000/autocomplete/team-file-name" 31 | download_endpoint="http://localhost:3000/autocomplete/download-team-file" 32 | 33 | else 34 | filename_endpoint="https://waitlist.withfig.com/autocomplete/team-file-name" 35 | download_endpoint="https://waitlist.withfig.com/autocomplete/download-team-file" 36 | 37 | fi 38 | 39 | subcommand_name="team:download" 40 | upload_subcommand_name="team:upload" 41 | 42 | ##################################### 43 | # Functions 44 | ##################################### 45 | 46 | 47 | prompt_to_logout() { 48 | 49 | # cat < /dev/null) 86 | 87 | if [ -z $local_access_token ] 88 | then 89 | prompt_to_logout 90 | fi 91 | 92 | ##################################### 93 | # Make post request to fig server 94 | ##################################### 95 | 96 | file_name=$(curl -s -X POST \ 97 | -H "Authorization: Bearer $local_access_token" \ 98 | $filename_endpoint 2> /dev/null) 99 | 100 | 101 | 102 | ##################################### 103 | # Support 104 | ##################################### 105 | 106 | if [[ "$file_name" == ERROR* ]] 107 | then 108 | 109 | cat < 136 | 137 | ${BOLD}Examples${NORMAL} 138 | 139 | fig $upload_subcommand_name ~/.fig/team/acme.js 140 | fig $upload_subcommand_name /path/to/acme.js 141 | 142 | EOF 143 | 144 | fi 145 | 146 | 147 | # If we are here, we know we have a file that exists 148 | 149 | 150 | # https://stackoverflow.com/questions/21950049/create-a-text-file-in-node-js-from-a-string-and-stream-it-in-response 151 | 152 | # -o "$file_name" 153 | result=$(curl -s -X POST \ 154 | -H "Authorization: Bearer $local_access_token" \ 155 | $download_endpoint \ 156 | 2> /dev/null ) 157 | 158 | if [[ -z "$result" ]] || [[ "$result" == ERROR* ]] 159 | then 160 | 161 | cat < ~/.fig/team/$file_name 178 | 179 | # symlink and force option 180 | ln -fs ~/.fig/team/"$file_name" ~/.fig/autocomplete/"$file_name" 181 | 182 | cat < 89 | 90 | ${BOLD}Examples${NORMAL} 91 | 92 | fig $subcommand_name ~/.fig/team/acme.js 93 | fig $subcommand_name /path/to/acme.js 94 | 95 | EOF 96 | exit 1 97 | 98 | # check if file path exists 99 | elif [ ! -f $1 ] 100 | then 101 | 102 | cat < 107 | 108 | ${BOLD}Examples${NORMAL} 109 | 110 | fig $subcommand_name ~/.fig/team/acme.js 111 | fig $subcommand_name /path/to/acme.js 112 | 113 | EOF 114 | 115 | exit 1 116 | 117 | fi 118 | 119 | 120 | 121 | ##################################### 122 | # Check token exists locally and is valid 123 | ##################################### 124 | 125 | local_access_token=$(defaults read com.mschrage.fig access_token 2> /dev/null) 126 | 127 | if [ -z $local_access_token ] 128 | then 129 | prompt_to_logout 130 | fi 131 | 132 | 133 | 134 | ##################################### 135 | # Make post request to fig server 136 | ##################################### 137 | 138 | result=$(curl -s -X POST \ 139 | -H "Authorization: Bearer $local_access_token" \ 140 | -H "file_path: $1" \ 141 | -H "Content-Type: text/plain" \ 142 | --data-binary "@$1" \ 143 | $fig_endpoint 2> /dev/null ) 144 | 145 | 146 | 147 | ##################################### 148 | # Support 149 | ##################################### 150 | 151 | if [[ -z "$result" ]] || [[ "$result" == ERROR* ]] 152 | then 153 | 154 | cat </dev/null) ; 15 | build=$(defaults read com.mschrage.fig "build" 2>/dev/null) ; 16 | app_version=$(fig --version) ; 17 | mkdir -p ~/.fig/autocomplete; cd $_ 18 | 19 | curl -s "$base_url?version=$current_version&app=$app_version&build=$build" | tar -xz --strip-components=1 specs 20 | -------------------------------------------------------------------------------- /tools/doctor.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Output helpers 4 | RED='\033[0;31m' 5 | YELLOW='\033[0;33m' 6 | GREEN='\033[0;32m' 7 | BLUE='\033[0;34m' 8 | CYAN='\033[0;36m' 9 | NC='\033[0m' # No Color 10 | pass="${GREEN}pass${NC}" 11 | fail="${RED}fail${NC}\n" 12 | BOLD=$(tput bold) 13 | NORMAL=$(tput sgr0) 14 | 15 | function warn { 16 | echo -e "\n${YELLOW}$1${NC}" 17 | } 18 | 19 | function note { 20 | echo -e "\n${CYAN}$1${NC}" 21 | } 22 | 23 | function command { 24 | echo -e "${BLUE}$1${NC}" 25 | } 26 | 27 | function contact_support { 28 | echo -e "Run $(command "fig issue") to let us know about this error!" 29 | echo -e "Or, email us at ${CYAN}hello@fig.io${NC}!" 30 | } 31 | 32 | function fix { 33 | # Output the command we're running to a tmp file. 34 | # If the command exists in the file, then we've already 35 | # run this command and it's likely the fix didn't 36 | # work and we are in an infinite loop. We should 37 | # exit and cleanup the file. 38 | if grep -q "$*" fig_fixes &>/dev/null; then 39 | rm -f fig_fixes 40 | warn "\nLooks like we've already tried this fix before and it's not working.\n" 41 | echo "Run $(command "fig issue") to let us know!" 42 | echo "Or, email us at ${CYAN}hello@fig.io${NC}!" 43 | exit 44 | else 45 | echo "I can fix this!" 46 | echo -e "\n" 47 | echo "$*" >>fig_fixes 48 | echo "> $*" 49 | "$@" 50 | # There needs to be some time for any fig util scripts to do their 51 | # thing. 5 seconds seems to be sufficient. 52 | sleep 5 53 | echo -e "\n${GREEN}${BOLD}Fix applied!${NORMAL}${NC}\n" 54 | # Everytime we attempt a fix, there is a chance that other checks 55 | # will be affected. Script should be re-run to ensure we are 56 | # looking at an up to date environment. 57 | note "Let's restart our checks to see if the problem is resolved..." 58 | "$HOME/.fig/tools/$(basename "$0")" && exit 59 | fi 60 | } 61 | 62 | function is_installed { 63 | if mdfind "kMDItemKind == 'Application'" | grep -q "$1"; then 64 | echo true >/dev/null 65 | else 66 | echo false >/dev/null 67 | fi 68 | } 69 | 70 | # Initial checks 71 | echo -e "\nLet's make sure Fig is running...\n" 72 | if find "$HOME"/.fig/bin/fig >/dev/null; then 73 | echo -e "Fig bin exists: $pass" 74 | else 75 | echo -e "Fig bin exists: $fail" 76 | fi 77 | 78 | if grep -q .fig/bin <<<"$PATH"; then 79 | echo -e "Fig in path: $pass" 80 | else 81 | echo -e "Fig in path: $fail" 82 | fi 83 | 84 | # Is Fig running? Yes, continue. No, launch fig and restart doctor. 85 | if [[ $("$HOME"/.fig/bin/fig app:running) == 1 ]]; then 86 | echo -e "Fig running: $pass" 87 | ################ 88 | # check .zshrc # 89 | ################ 90 | 91 | # Check that Fig ENV vars are all in the right place. If not, user needs to move them and put back 92 | # correctly. 93 | for file in "$HOME"/.profile "$HOME"/.zprofile "$HOME"/.bash_profile "$HOME"/.bashrc "$HOME"/.zshrc; do 94 | if [[ -f "$file" ]]; then 95 | # strip out whitespace and commented out lines 96 | clean_config=$(sed -e 's/#.*$//' "$file") 97 | # all lines that source other files or directly manipulate the $PATH 98 | path_manip=$(echo "$clean_config" | grep -E 'PATH|source') 99 | 100 | first=$(echo "$path_manip" | sed -n '1p') 101 | last=$(echo "$path_manip" | sed -n '$p') 102 | 103 | if [[ $first != "[ -s ~/.fig/shell/pre.sh ] && source ~/.fig/shell/pre.sh" ]] || 104 | [[ $last != "[ -s ~/.fig/fig.sh ] && source ~/.fig/fig.sh" ]]; then 105 | warn "Fig ENV variables need to be at the very beginning and end of $file" 106 | warn "If you see the FIG ENV VARs in $file, make sure they're at the very beginning (pre) and end (post). Open a new terminal then rerun the the doctor." 107 | warn "If you don't see the FIG ENV VARs in $file, run 'fig util:install-script' to add them. Open a new terminal then rerun the doctor." 108 | fi 109 | fi 110 | done 111 | 112 | # Check for macOS version 113 | # Latest supported version is 10.13.6 (High Sierra) 114 | macos_version="$(sw_vers -productVersion)" 115 | IFS="=. " read -ra version <<<"$macos_version" 116 | major="${version[0]}" 117 | minor="${version[1]}" 118 | 119 | if (("$major" > 10)); then 120 | echo -e "macOS version: $pass" 121 | else 122 | if (("$major" == 10)); then 123 | if (("$minor" > 13)); then 124 | echo -e "macOS version: $pass" 125 | else 126 | echo -e "macOS version: $fail" 127 | warn "Your macOS version ($macos_version) is incompatible with Fig. Earliest supported version is 10.14.x (Mojave)" 128 | fi 129 | else 130 | echo -e "macOS version: $fail" 131 | warn "Your macOS version ($macos_version) is incompatible with Fig. Earliest supported version is 10.14.x (Mojave)" 132 | fi 133 | fi 134 | 135 | ######################## 136 | # check fig diagnostic # 137 | ######################## 138 | 139 | echo -e "\nLet's see what $(command "fig diagnostic") tells us...\n" 140 | # run fig diagnostic and split output into lines 141 | while IFS= read -ra line; do 142 | # for each line, split by ':' into the check and value 143 | IFS=: read -r check value <<<"${line[@]}" 144 | # strip leading and trailing whitespace from diagnostic value 145 | value=$(echo "$value" | xargs) 146 | 147 | case $check in 148 | "Installation Script") 149 | if [[ $value == true ]]; then 150 | echo -e "Installation script: $pass" 151 | else 152 | echo -e "Installation script: $fail" 153 | fix "$HOME"/.fig/bin/fig util:install-script 154 | fi 155 | ;; 156 | "UserShell") 157 | if [[ $SHELL == *"zsh"* || $SHELL == *"bash"* || $SHELL == *"fish"* ]]; then 158 | echo -e "Compatible shell: $pass" 159 | else 160 | echo -e "Compatible shell: $fail" 161 | warn "You are not using a supported shell." 162 | echo -e "${CYAN}Only ${BOLD}zsh${NORMAL}${CYAN}, ${BOLD}bash${NORMAL}${CYAN}, or ${BOLD}fish${NORMAL}${CYAN} are integrated with Fig.${NC}" 163 | exit 164 | fi 165 | ;; 166 | "Bundle path") 167 | if [[ $value == *"/Applications/Fig.app"* ]]; then 168 | echo -e "Bundle path: $pass" 169 | else 170 | echo -e "Bundle path: $fail" 171 | note "You need to install Fig in /Applications.\n" 172 | note "To fix: uninstall, then reinstall Fig." 173 | note "Remember to drag Fig into the Applications folder." 174 | exit 175 | fi 176 | ;; 177 | "Autocomplete") 178 | if [[ $value == true ]]; then 179 | echo -e "Autocomplete enabled: $pass" 180 | else 181 | echo -e "Autocomplete enabled: $fail" 182 | note "To fix: run: $(command "fig settings autocomplete.disable false")" 183 | exit 184 | fi 185 | ;; 186 | "CLI installed") 187 | if [[ $value == true ]]; then 188 | echo -e "CLI installed: $pass" 189 | else 190 | echo -e "CLI installed: $fail" 191 | fix "$HOME"/.fig/bin/fig util:symlink-cli 192 | fi 193 | ;; 194 | "CLI tool path") 195 | if [[ $value == $HOME/.fig/bin/fig || $value == /usr/local/bin/.fig/bin/fig ]]; then 196 | echo -e "CLI tool path: $pass" 197 | else 198 | echo -e "CLI tool path: $fail" 199 | note "The Fig CLI must be in $HOME/.fig/bin/fig" 200 | exit 201 | fi 202 | ;; 203 | "Accessibility") 204 | if [[ $value == true ]]; then 205 | echo -e "Accessibility enabled: $pass" 206 | else 207 | echo -e "Accessibility enabled: $fail" 208 | fix "$HOME"/.fig/bin/fig util:axprompt 209 | fi 210 | ;; 211 | "Number of specs") 212 | if ((value > 1)); then 213 | echo -e "Autocomplete specs installed: $pass" 214 | else 215 | echo -e "Autocomplete specs installed: $fail" 216 | fix "$HOME"/.fig/bin/fig update 217 | fi 218 | ;; 219 | "SSH Integration") 220 | if [[ $value == true ]]; then 221 | if [ ! -w "$HOME"/.ssh/config ]; then 222 | note "FYI, your ssh config is read-only. Make sure Fig installed its integration in ~/.ssh/config.\n" 223 | fi 224 | 225 | if grep -q "Include ~/.fig/ssh" "$HOME"/.ssh/config; then 226 | echo -e "SSH config: $pass" 227 | else 228 | echo -e "SSH config: $fail" 229 | warn "SSH config is missing Include ~/.fig/ssh" 230 | note "To fix: Re-enable SSH integration from the Fig menu" 231 | fi 232 | fi 233 | ;; 234 | "Tmux Integration") 235 | if [[ $value == true ]]; then 236 | echo -e "Tmux integration: $pass" 237 | else 238 | # Check if $HOME/.tmux.conf exists 239 | echo -e "Tmux integration: $fail" 240 | if ! find "$HOME"/.tmux.conf &>/dev/null; then 241 | warn "$HOME/.tmux.conf file is missing!" 242 | note "To fix: Re-enable Tmux integration from the Fig menu" 243 | else 244 | # Check if integration is in config 245 | if ! grep -q "source-file ~/.fig/tmux" "$HOME/.tmux.conf"; then 246 | warn "Missing 'source-file ~/.fig/tmux' in $HOME/.tmux.conf" 247 | note "To fix: Re-enable Tmux integration from the Fig menu" 248 | fi 249 | fi 250 | fi 251 | ;; 252 | "iTerm Integration") 253 | if [[ $value == *"true"* ]]; then 254 | IFS="=. " read -ra version <<<"$(mdls -name kMDItemVersion /Applications/iTerm.app | xargs)" 255 | iterm_version="${version[1]}${version[2]}" 256 | if (("$iterm_version" > 33)); then 257 | echo -e "iTerm integration: $pass" 258 | else 259 | echo -e "iTerm integration: $fail" 260 | warn "Your iTerm version is incompatible with Fig. Please update iTerm to latest version." 261 | fi 262 | else 263 | # only care about integration if iTerm is installed 264 | if is_installed "iTerm.app"; then 265 | echo -e "iTerm integration: $fail" 266 | 267 | # API enabled? 268 | IFS="=; " read -r _ right <<<"$(defaults read com.googlecode.iterm2 | grep EnableAPIServer | xargs)" 269 | if [[ "$right" != 1 ]]; then 270 | warn "The iTerm API server is not enabled." 271 | fi 272 | 273 | # fig-iterm-integration.scpt exists in ~/Library/Application\ Support/iTerm2/Scripts/AutoLaunch/ 274 | if ! find "$HOME"/Library/Application\ Support/iTerm2/Scripts/AutoLaunch/fig-iterm-integration.scpt &>/dev/null; then 275 | warn "fig-iterm-integration.scpt is missing." 276 | fi 277 | fi 278 | fi 279 | ;; 280 | "Hyper Integration") 281 | if [[ $value == true ]]; then 282 | echo -e "Hyper integration: $pass" 283 | else 284 | # only care about integration if Hyper is installed 285 | if is_installed "Hyper.app"; then 286 | echo -e "Hyper integration: $fail" 287 | # Check ~/.hyper_plugins/local/fig-hyper-integration/index.js" exists 288 | if ! find "$HOME"/.hyper_plugins/local/fig-hyper-integration/index.js &>/dev/null; then 289 | warn "fig-hyper-integration plugin is missing!" 290 | fi 291 | # Tell them to add to localPlugins: ["fig-hyper-integration"] 292 | if ! grep -q "fig-hyper-integration" "$HOME"/.hyper.js; then 293 | warn "fig-hyper-integration plugin needs to be added to localPlugins!" 294 | fi 295 | fi 296 | fi 297 | ;; 298 | "VSCode Integration") 299 | if [[ $value == true ]]; then 300 | echo -e "VSCode integration: $pass" 301 | else 302 | # only care about integration if VSCode is installed 303 | if is_installed "Visual Studio Code.app"; then 304 | echo -e "VSCode integration: $fail" 305 | # Check if withfig.fig exists 306 | if ! find "$HOME"/.vscode/extensions/withfig.fig-* &>/dev/null; then 307 | warn "VSCode extension is missing!" 308 | fi 309 | fi 310 | fi 311 | ;; 312 | "Symlinked dotfiles") 313 | if [[ $value == true ]]; then 314 | dotfiles_symlinked=true 315 | else 316 | dotfiles_symlinked=false 317 | fi 318 | ;; 319 | "PseudoTerminal Path") 320 | pseudo_terminal_path=$value 321 | ;; 322 | "PATH") 323 | if [[ $value == "$pseudo_terminal_path" ]]; then 324 | echo -e "PATH and PseudoTerminal PATH match: $pass" 325 | else 326 | echo -e "PATH and PseudoTerminal PATH match: $fail" 327 | fix "$HOME"/.fig/bin/fig set:path 328 | fi 329 | ;; 330 | "SecureKeyboardInput") 331 | secure_keyboard_input=$value 332 | ;; 333 | "SecureKeyboardProcess") 334 | if [[ $secure_keyboard_input != true ]]; then 335 | echo -e "Secure keyboard input: $pass" 336 | else 337 | if is_installed "Bitwarden.app"; then 338 | IFS="=. " read -ra version <<<"$(mdls -name kMDItemVersion /Applications/Bitwarden.app | xargs)" 339 | bitwarden_version="${version[1]}${version[2]}" 340 | if (("$bitwarden_version" < 128)); then 341 | warn "Bitwarden may be enabling secure keyboard entry even when not focused." 342 | warn "This was fixed in version 1.28.0. See https://github.com/bitwarden/desktop/issues/991 for details." 343 | note "To fix: upgrade Bitwarden to the latest version." 344 | exit 345 | else 346 | echo -e "Secure keyboard input: $fail" 347 | warn "Secure keyboard input is on" 348 | warn "Secure keyboard process is $value" 349 | note "Please follow debugging steps at https://fig.io/docs/support/secure-keyboard-input" 350 | exit 351 | fi 352 | else 353 | echo -e "Secure keyboard input: $fail" 354 | warn "Secure keyboard input is on" 355 | warn "Secure keyboard process is $value" 356 | note "Please follow debugging steps at https://fig.io/docs/support/secure-keyboard-input" 357 | exit 358 | fi 359 | fi 360 | ;; 361 | "FIG_INTEGRATION_VERSION") 362 | if [[ $value != *"?"* ]]; then 363 | echo -e "Fig integration version: $pass" 364 | else 365 | echo -e "Fig integration version: $fail" 366 | contact_support 367 | exit 368 | fi 369 | ;; 370 | *) 371 | # Default pass 372 | continue 373 | ;; 374 | esac 375 | done <<<"$("$HOME"/.fig/bin/fig diagnostic)" 376 | 377 | ############### 378 | # misc checks # 379 | ############### 380 | 381 | if [[ "$(defaults read com.mschrage.fig debugAutocomplete)" == 1 ]]; then 382 | warn "Forced popup is enabled.\nDisable in Fig menu under Integrations -> Developer -> Force Popup to Appear." 383 | fi 384 | 385 | ########################### 386 | # additional help prompts # 387 | ########################### 388 | 389 | # Clean up any fix logs 390 | rm -f fig_fixes 391 | 392 | if $dotfiles_symlinked; then 393 | note "FYI, looks like your dotfiles are symlinked." 394 | note "If you need to make modifications, make sure they're made in the right place." 395 | fi 396 | 397 | echo -e "\nFig still not working?" 398 | 399 | echo -e "Run $(command "fig issue") to let us know!" 400 | echo -e "Or, email us at ${CYAN}hello@fig.io${NC}!" 401 | else 402 | echo -e "Fig running: $fail" 403 | fix "$HOME"/.fig/bin/fig launch 404 | fi 405 | -------------------------------------------------------------------------------- /tools/drip/autolaunch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | MAGENTA=$(tput setaf 5) 3 | NORMAL=$(tput sgr0) 4 | 5 | DISABLE_AUTOLAUNCH="$(fig settings app.disableAutolaunch)" 6 | if [[ "${DISABLE_AUTOLAUNCH}" == "true" ]]; then 7 | : echo Autolaunch Disabled... 8 | else 9 | (fig launch > /dev/null &) 10 | echo "Launching ${MAGENTA}Fig${NORMAL}..." 11 | if [[ -z "${DISPLAYED_AUTOLAUNCH_SETTINGS_HINT}" ]]; then 12 | echo "(To turn off autolaunch, run \`fig settings app.disableAutolaunch true\`)" 13 | printf "\nDISPLAYED_AUTOLAUNCH_SETTINGS_HINT=1" >> ~/.fig/user/config 14 | fi 15 | fi 16 | 17 | -------------------------------------------------------------------------------- /tools/drip/drip_1.sh: -------------------------------------------------------------------------------- 1 | # coming soon 2 | 3 | 4 | cat < /dev/null 107 | else 108 | sed -i='' "s/FIG_ONBOARDING=.*/FIG_ONBOARDING=1/g" ~/.fig/user/config 2> /dev/null 109 | fi 110 | 111 | echo 112 | 113 | trap - SIGINT SIGTERM SIGQUIT # clear the trap 114 | kill -- -$$ # Kill the fig onboarding process 115 | } 116 | 117 | # In case user quits script 118 | exit_script_nice() { 119 | sed -i='' "s/FIG_ONBOARDING=.*/FIG_ONBOARDING=1/g" ~/.fig/user/config 2> /dev/null 120 | 121 | clear 122 | echo 123 | echo 124 | print_special "${BOLD}${UNDERLINE}Fig's onboarding was quit${UNDERLINE_END}${NORMAL}" 125 | echo 126 | print_special "You can redo this onboarding any time. Just run ${BOLD}${MAGENTA}fig onboarding${NORMAL}" 127 | echo 128 | echo 129 | print_special "Have feedback? Use ${BOLD}${MAGENTA}fig report${NORMAL}" 130 | echo 131 | echo 132 | 133 | trap - SIGINT SIGTERM SIGQUIT # clear the trap 134 | 135 | fig bg:event "Quit Shell Onboarding" 136 | 137 | exit 1 138 | # kill -- -$$# Kill the fig onboarding process. 139 | } 140 | 141 | # If the user does ctrl + c, run the exit_script function 142 | trap exit_script_nice SIGINT SIGTERM SIGQUIT 143 | 144 | # Help text 145 | show_help() { 146 | # make sure the final EOF is aligned with the end 147 | less -R < Settings > Developer > Install CLI Tool 174 | 175 | 3. Make sure Accessibility is enabled 176 | * Go to Fig Menu (◧) > Settings > Developer > Request Accessibility Permission 177 | (This should take you to System Preferences > Security & Privacy > Accessibility) 178 | * Click the lock icon to unlock (it may prompt for your password) 179 | * If Fig is unchecked, check it. If Fig is checked, uncheck it then check it again. 180 | 181 | 4. Toggle Autocomplete off and on again 182 | * Go to Fig Menu (◧) > Autocomplete 183 | 184 | 185 | If the problem persists: please let us know! Contact the Fig team at hello@fig.io 186 | 187 | 188 | ${BOLD}What does the ↪ symbol / suggestion mean?${NORMAL} 189 | This lets you run the command that's currently in your Terminal. 190 | Sometimes Fig's autocomplete appears when you actually want to run a command. Rather than clicking escape or the up arrow, this lets you run the command by clicking enter. 191 | 192 | 193 | 194 | ${BOLD}I want to quit this onboarding / walkthrough${NORMAL} 195 | Hit ctrl + c 196 | 197 | 198 | 199 | ${BOLD}I want to quit Fig${NORMAL} 200 | * Go to Fig Menu (◧) > Quit Fig 201 | 202 | 203 | 204 | ${BOLD}I want to uninstall Fig${NORMAL} 205 | * Go to Fig Menu (◧) > Settings > Uninstall Fig 206 | 3. If you're feeling generous, we would love to hear why you uninstalled Fig. hello@fig.io 207 | 208 | 209 | 210 | ${BOLD}What is cd?${NORMAL} 211 | cd is a shell command that lets you change directories. e.g. cd ~/Desktop will change the current directory in your shell to the Desktop. 212 | 213 | 214 | 215 | EOF 216 | fig bg:clear-keybuffer 217 | reset_prompt 218 | } 219 | 220 | ### Core Script ### 221 | clear 222 | 223 | # Make absolutely sure that settings listener has been launched! 224 | (fig settings:init > /dev/null &) 225 | 226 | # Done using http://patorjk.com/software/taag/#p=testall&f=Graffiti&t=fig 227 | # Font name = ANSI Shadow 228 | cat <<'EOF' 229 | 230 | 231 | ███████╗██╗ ██████╗ 232 | ██╔════╝██║██╔════╝ 233 | █████╗ ██║██║ ███╗ 234 | ██╔══╝ ██║██║ ██║ 235 | ██║ ██║╚██████╔╝ 236 | ╚═╝ ╚═╝ ╚═════╝ ....is now installed! 237 | 238 | 239 | EOF 240 | 241 | 242 | ## you can also use <<-'EOF' to strip tab character from start of each line 243 | cat < /dev/null 436 | fig > /dev/null 437 | 438 | if [[ -d $(echo /Applications/Bartender*.app/) ]]; then 439 | echo 440 | print_special "${BOLD}Well this is awkward...${NORMAL} It looks like you are using ${BOLD}Bartender${NORMAL} which means the ${BOLD}${MAGENTA}Fig${NORMAL} command may not work." 441 | echo 442 | print_special "Instead click the Fig icon ◧ in your status bar" 443 | else 444 | print_special "${BOLD}Awesome!${NORMAL}" 445 | fi 446 | echo 447 | print_special "If Fig ever stops working, you can ${BOLD}use the debug tool${NORMAL} at the top of this menu to see what's wrong." 448 | press_enter_to_continue 449 | break 450 | ;; 451 | "fig report"*) 452 | eval $input 453 | print_special "${BOLD}Thanks${NORMAL} so much for your feedback :)" 454 | echo 455 | print_special "${BOLD}To Continue...${NORMAL}" 456 | print_special "Run the ${MAGENTA}${BOLD}fig${NORMAL} command." 457 | print_special "(You can also type ${UNDERLINE}continue${NORMAL})" 458 | ;; 459 | "fig invite"*) 460 | eval $input 461 | print_special "${BOLD}Thanks${NORMAL} so much for inviting friends to Fig:)" 462 | echo 463 | print_special "${BOLD}To Continue...${NORMAL}" 464 | print_special "Run the ${MAGENTA}${BOLD}fig${NORMAL} command." 465 | print_special "(You can also type ${UNDERLINE}continue${NORMAL})" 466 | ;; 467 | continue) break ;; 468 | "") 469 | echo 470 | print_special "${BOLD}To Continue...${NORMAL}" 471 | print_special "Run the ${MAGENTA}${BOLD}fig${NORMAL} command." 472 | print_special "(You can also type ${UNDERLINE}continue${NORMAL})" 473 | ;; 474 | help|HELP|--help|-h) 475 | show_help 476 | echo 477 | print_special "${BOLD}To Continue...${NORMAL}" 478 | print_special "Run the ${MAGENTA}${BOLD}fig${NORMAL} command." 479 | print_special "(You can also type ${UNDERLINE}continue${NORMAL})" 480 | ;; 481 | *) 482 | print_special "${YELLOW}Whoops. Looks like you tried something unexpected. Maybe pick another command?" 483 | echo 484 | print_special "${BOLD}To Continue...${NORMAL}" 485 | print_special "Run the ${MAGENTA}${BOLD}fig${NORMAL} command." 486 | print_special "(You can also type ${UNDERLINE}continue${NORMAL})" 487 | ;; 488 | esac 489 | done 490 | (fig bg:clear-keybuffer &) 491 | clear 492 | 493 | cat < /dev/null 527 | fig bg:event "Completed Shell Onboarding" 528 | 529 | echo # new line 530 | press_enter_to_continue 'Press enter to finish' 531 | echo # new line 532 | echo # new line 533 | 534 | clear 535 | 536 | # Done using http://patorjk.com/software/taag/#p=testall&f=Graffiti&t=fig 537 | # Font name = Ivrit 538 | cat <<'EOF' 539 | 540 | We hope you enjoy 541 | ___ ___ 542 | /\__\ /\__\ 543 | /:/ _/_ ___ /:/ _/_ 544 | /:/ /\__\ /\__\ /:/ /\ \ 545 | /:/ /:/ / /:/__/ /:/ /::\ \ 546 | /:/_/:/ / /::\ \ /:/__\/\:\__\ 547 | \:\/:/ / \/\:\ \__ \:\ \ /:/ / 548 | \::/__/ ~~\:\/\__\ \:\ /:/ / 549 | \:\ \ \::/ / \:\/:/ / 550 | \:\__\ /:/ / \::/ / 551 | \/__/ \/__/ \/__/ 552 | 553 | 554 | EOF 555 | 556 | cat < /dev/null &) 11 | echo "Updating ${MAGENTA}Fig${NORMAL} to latest version..." 12 | (sleep 3 && fig launch > /dev/null &) 13 | if [[ -z "${DISPLAYED_AUTOUPDATE_SETTINGS_HINT}" ]]; then 14 | echo "(To turn off automatic updates, run \`fig settings app.disableAutoupdates true\`)" 15 | printf "\nDISPLAYED_AUTOUPDATE_SETTINGS_HINT=1" >> ~/.fig/user/config 16 | fi 17 | fi 18 | fi 19 | 20 | -------------------------------------------------------------------------------- /tools/install-shell-integration.sh: -------------------------------------------------------------------------------- 1 | mkdir -p ~/.fig/ 2 | 3 | curl -Ls fig.sh/shell-integration.tar.gz | tar -xz -C ~/.fig && 4 | ~/.fig/tools/install_integrations.sh --minimal && 5 | echo Successfully installed fig shell integrations || 6 | echo Failed to download and extract shell integration 7 | 8 | [ -n "$FISH_VERSION" ] && source ~/.fig/shell/post.fish || source ~/.fig/shell/post.sh 9 | -------------------------------------------------------------------------------- /tools/install_and_upgrade.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #set -e 3 | 4 | # This is the fig installation script. It runs just after you sign in for the 5 | # first time. 6 | 7 | # Replace TAG_NAME with the commit hash, git tag (like v1.0.25), or leave empty 8 | # This script should be run via curl: 9 | # sh <(curl -fsSL https://raw.githubusercontent.com/withfig/config/main/tools/install_and_upgrade.sh) TAG_NAME 10 | # or via wget: 11 | # sh <(wget -qO- https://raw.githubusercontent.com/withfig/config/main/tools/install_and_upgrade.sh) TAG_NAME 12 | # or via fetch: 13 | # sh <(fetch -o - https://raw.githubusercontent.com/withfig/config/main/tools/install_and_upgrade.sh) TAG_NAME 14 | 15 | FIGREPO='https://github.com/withfig/config.git' 16 | 17 | # We are constantly pushing changes to the public repo. Each version of the 18 | # swift app is only compatible with a certain version of the public repo. 19 | # The commit hash is passed in as a parameter to this script. We hard reset to 20 | # this commit hash. If we don't get a hash, we just hard reset to the most 21 | # recent version of the repo... 22 | FIG_TAG="$1" 23 | if [[ -z "${FIG_TAG}" ]]; then 24 | FIG_TAG="main" 25 | fi 26 | 27 | echo "Tag is ${FIG_TAG}" 28 | date_string=$(date '+%Y-%m-%d_%H-%M-%S') 29 | 30 | error() { 31 | echo "Error: $@" >&2 32 | exit 1 33 | } 34 | 35 | # Install fig. Override if already exists 36 | install_fig() { 37 | # Create fig dir an cd into it 38 | mkdir -p ~/.fig 39 | 40 | # delete binary artifacts to ensure ad-hoc code signature works for arm64 binaries on M1 41 | rm ~/.fig/bin/*figterm* 42 | rm ~/.fig/bin/fig_callback 43 | rm ~/.fig/bin/fig_get_shell 44 | 45 | if [[ "${FIG_TAG}" == "local" ]]; then 46 | cp -R "$PWD"/* ~/.fig 47 | cd ~/.fig 48 | else 49 | cd ~/.fig 50 | curl "https://codeload.github.com/withfig/config/tar.gz/${FIG_TAG}" \ 51 | | tar -xz --strip-components=1 \ 52 | || ( 53 | echo "downloading from main instead of fig tag_name" \ 54 | && curl https://codeload.github.com/withfig/config/tar.gz/main \ 55 | | tar -xz --strip-components=1 \ 56 | ) \ 57 | || error "pulling withfig/config repo failed" 58 | fi 59 | 60 | # Make files and folders that the user can edit (that aren't overridden by above) 61 | mkdir -p ~/.fig/{bin,zle,autocomplete} 62 | mkdir -p ~/.fig/user/{aliases,apps,autocomplete,aliases} 63 | 64 | # rename figterm binaries to mirror supported shell 65 | # copy binaries on install to avoid issues with file permissions at runtime 66 | cp -p "${HOME}"/.fig/bin/figterm "${HOME}"/.fig/bin/zsh\ \(figterm\) 67 | cp -p "${HOME}"/.fig/bin/figterm "${HOME}"/.fig/bin/bash\ \(figterm\) 68 | cp -p "${HOME}"/.fig/bin/figterm "${HOME}"/.fig/bin/fish\ \(figterm\) 69 | 70 | if [[ ! -f ~/.fig/settings.json ]]; then 71 | echo "{}" > ~/.fig/settings.json 72 | fi 73 | 74 | touch ~/.fig/user/aliases/_myaliases.sh 75 | 76 | # Figpath definition. 77 | touch ~/.fig/user/figpath.sh 78 | 79 | # Determine user's login shell by explicitly reading from "/Users/$(whoami)" 80 | # rather than ~ to handle rare cases where these are different. 81 | USER_SHELL="$(dscl . -read /Users/$(whoami) UserShell)" 82 | defaults write com.mschrage.fig userShell "${USER_SHELL}" 83 | 84 | USER_SHELL_TRIMMED="$(echo "${USER_SHELL}" | cut -d ' ' -f 2)" 85 | 86 | # Hardcode figcli path because symlinking has not happened when this script 87 | # runs. 88 | FIGCLI=/Applications/Fig.app/Contents/MacOS/figcli 89 | "${FIGCLI}" settings userShell "${USER_SHELL_TRIMMED}" 90 | 91 | "${FIGCLI}" settings pty.path $("${USER_SHELL_TRIMMED}" -li -c "/usr/bin/env | /usr/bin/grep '^PATH=' | /bin/cat | /usr/bin/sed 's|PATH=||g'") 92 | 93 | # hotfix for infinite looping when writing "☑ fig" title to a tty backed by figterm 94 | "${FIGCLI}" settings autocomplete.addStatusToTerminalTitle false 95 | 96 | # Restart file watcher 97 | "${FIGCLI}" settings:init 98 | 99 | # Define the figpath variable in the figpath file 100 | # The file should look like this: 101 | # export FIGPATH="~/.fig/bin:~/run:" 102 | # FIGPATH=$FIGPATH'~/abc/de fg/hi''~/zyx/wvut' 103 | if ! grep -q 'FIGPATH=$FIGPATH' ~/.fig/user/figpath.sh; then 104 | echo $'\n''FIGPATH=$FIGPATH' >> ~/.fig/user/figpath.sh 105 | fi 106 | } 107 | 108 | setup_onboarding() { 109 | # Create config file if it doesn't exist. 110 | if [[ ! -s ~/.fig/user/config ]]; then 111 | touch ~/.fig/user/config 112 | fi 113 | 114 | # If this is first download, mark download time as now. 115 | grep -q 'DOWNLOAD_TIME' ~/.fig/user/config || echo "DOWNLOAD_TIME=$(date +'%s')" >> ~/.fig/user/config 116 | 117 | # Create last_update if it doesn't exist and mark last update as now. 118 | grep -q 'LAST_UPDATE' ~/.fig/user/config || echo "LAST_UPDATE=$(date +'%s')" >> ~/.fig/user/config 119 | sed -i '' "s/LAST_UPDATE=.*/LAST_UPDATE=$(date +'%s')/g" ~/.fig/user/config 2> /dev/null 120 | 121 | add_conf_var() { grep -q "$1" ~/.fig/user/config || echo "$1=0" >> ~/.fig/user/config ; } 122 | 123 | add_conf_var FIG_LOGGED_IN 124 | add_conf_var FIG_ONBOARDING 125 | add_conf_var DONT_SHOW_DRIP 126 | for num in ONE TWO THREE FOUR FIVE SIX SEVEN; do 127 | add_conf_var "DRIP_${num}" 128 | done 129 | } 130 | 131 | # hotfix for infinite looping when writing "☑ fig" title to a tty backed by figterm 132 | disable_setting_tty_title() { 133 | defaults write com.mschrage.fig addIndicatorToTitlebar false 134 | } 135 | 136 | install_fig 137 | setup_onboarding 138 | disable_setting_tty_title 139 | 140 | ~/.fig/tools/install_integrations.sh 141 | 142 | echo success 143 | -------------------------------------------------------------------------------- /tools/install_integrations.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TMP_DIR=${TMPDIR:-'/tmp/'} 4 | 5 | error() { 6 | echo "Error: $@" >&2 7 | exit 1 8 | } 9 | 10 | # TODO(sean) add backup for ssh config (not currently done in this file) 11 | fig_backup() { 12 | full_path=$1 13 | name=$2 14 | if [[ -e "${full_path}" ]]; then 15 | backup_dir="${HOME}/.fig.dotfiles.bak/${date_string}" 16 | mkdir -p $backup_dir 17 | 18 | cp $full_path "${backup_dir}/${name}" || error "Failed to backup file $1" 19 | fi 20 | } 21 | 22 | fig_source() { 23 | printf "\n#### FIG ENV VARIABLES ####\n" 24 | if [[ -n $2 ]]; then 25 | printf "# $2\n" 26 | fi 27 | printf "[ -s ~/.fig/$1 ] && source ~/.fig/$1\n" 28 | printf "#### END FIG ENV VARIABLES ####\n" 29 | } 30 | 31 | fig_append() { 32 | # Appends line to a config file to source file from the ~/.fig directory. 33 | # Usage: fig_append fig.sh path/to/rc 34 | # Don't append to files that don't exist to avoid creating file and 35 | # changing shell behavior. 36 | if [ -f "$2" ] && ! grep -q "source ~/.fig/$1" "$2"; then 37 | echo "$(fig_source $1 "Please make sure this block is at the end of this file.")" >> "$2" 38 | fi 39 | } 40 | 41 | fig_prepend() { 42 | # Prepends line to a config file to source file from the ~/.fig directory. 43 | # Usage: fig_prepend fig_pre.sh path/to/rc 44 | # Don't prepend to files that don't exist to avoid creating file and 45 | # changing shell behavior. 46 | if [ -f "$2" ] && ! grep -q "source ~/.fig/$1" "$2"; then 47 | echo "$(fig_source $1 "Please make sure this block is at the start of this file.")" | cat - "$2" > "${TMP_DIR}fig_prepend" && cat "${TMP_DIR}fig_prepend" > "$2" 48 | fi 49 | } 50 | 51 | # Add the fig.sh to your profiles so it can be sourced on new terminal window load 52 | append_to_profiles() { 53 | # Make sure one of [.bash_profile|.bash_login|.profile] exists to ensure fig 54 | # is sourced on login shells. We choose .profile to be as minimally 55 | # disruptive to existing user set up as possible. 56 | # https://superuser.com/questions/320065/bashrc-not-sourced-in-iterm-mac-os-x 57 | touch "${HOME}/.profile" 58 | 59 | # Replace old sourcing in profiles. 60 | for rc in .profile .zprofile .bash_profile; do 61 | if [[ -e "${HOME}/${rc}" ]]; then 62 | # Ignore failures if we don't find old contents. 63 | sed -i '' 's/~\/.fig\/exports\/env.sh/~\/.fig\/fig.sh/g' "${HOME}/${rc}" 2> /dev/null || : 64 | fi 65 | done 66 | 67 | 68 | # Create .zshrc/.bashrc regardless of whether it exists or not 69 | touch "${HOME}/.zshrc" "${HOME}/.bashrc" 70 | 71 | # Don't modify files until all are backed up. 72 | for rc in .profile .zprofile .bash_profile .bash_login .bashrc .zshrc; do 73 | fig_backup "${HOME}/${rc}" "${rc}" 74 | done 75 | 76 | for rc in .profile .zprofile .bash_profile .bash_login .bashrc .zshrc; do 77 | if [[ $1 != "--no-prepend" ]]; then 78 | fig_prepend shell/pre.sh "${HOME}/${rc}" 79 | fi 80 | fig_append fig.sh "${HOME}/${rc}" 81 | done 82 | 83 | # Handle fish separately. 84 | mkdir -p ~/.config/fish/conf.d 85 | 86 | # Use 00_/99_ prefix to load script earlier/later in fish startup. 87 | ln -sf ~/.fig/shell/pre.fish ~/.config/fish/conf.d/00_fig_pre.fish 88 | ln -sf ~/.fig/shell/post.fish ~/.config/fish/conf.d/99_fig_post.fish 89 | 90 | # Remove deprecated fish config file. 91 | if [[ -f ~/.config/fish/conf.d/fig.fish ]]; then 92 | rm ~/.config/fish/conf.d/fig.fish 93 | fi 94 | } 95 | 96 | install_tmux_integration() { 97 | TMUX_INTEGRATION=$'\n# Fig Tmux Integration: Enabled\nsource-file ~/.fig/tmux\n# End of Fig Tmux Integration' 98 | 99 | # If ~/.tmux.conf.local exists, append integration here to workaround conflict with oh-my-tmux. 100 | if [[ -s "${HOME}/.tmux.conf.local" ]]; then 101 | fig_backup "${HOME}/.tmux.conf.local" ".tmux.conf.local" 102 | if ! grep -q 'source-file ~/.fig/tmux' ~/.tmux.conf.local; then 103 | echo "${TMUX_INTEGRATION}" >> ~/.tmux.conf.local 104 | fi 105 | elif [[ -s "${HOME}/.tmux.conf" ]]; then 106 | fig_backup "${HOME}/.tmux.conf" ".tmux.conf" 107 | if ! grep -q 'source-file ~/.fig/tmux' ~/.tmux.conf; then 108 | echo "${TMUX_INTEGRATION}" >> ~/.tmux.conf 109 | fi 110 | fi 111 | } 112 | 113 | if [[ $1 == "--minimal" ]]; then 114 | append_to_profiles --no-prepend 115 | else 116 | append_to_profiles 117 | install_tmux_integration 118 | fi 119 | -------------------------------------------------------------------------------- /tools/prompts.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # invariants: 4 | # 1. Fig.app is installed 5 | # 2. fig CLI tool is in $PATH 6 | # 3. prompts.sh will only be called once per terminal session 7 | 8 | if [[ "$FIG_CHECKED_PROMPTS" == "1" ]]; then 9 | exit 10 | fi 11 | 12 | # Read all the user defaults. 13 | if [[ -s ~/.fig/user/config ]]; then 14 | source ~/.fig/user/config 15 | else 16 | exit 17 | fi 18 | 19 | # To update a specific variable: 20 | # sed -i '' "s/FIG_VAR=.*/FIG_VAR=1/g" ~/.fig/user/config 2> /dev/null 21 | 22 | # Check if onboarding variable is empty or not 23 | # if [[ -z "$FIG_ONBOARDING" ]]; then 24 | # # Is empty. Set it to false 25 | # grep -q 'FIG_ONBOARDING' ~/.fig/user/config || echo "FIG_ONBOARDING=0" >> ~/.fig/user/config 26 | # fi 27 | 28 | # https://unix.stackexchange.com/questions/290146/multiple-logical-operators-a-b-c-and-syntax-error-near-unexpected-t 29 | if [[ "$FIG_ONBOARDING" == '0' ]] \ 30 | && ([[ "$TERM_PROGRAM" == "iTerm.app" ]] \ 31 | || [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]); then 32 | # Check if we're logged in. 33 | if [[ "$FIG_LOGGED_IN" == '0' ]]; then 34 | # If we are actually logged in, update accordingly and run onboarding campaign. 35 | if [[ -n $(defaults read com.mschrage.fig userEmail 2> /dev/null) ]]; then 36 | sed -i '' "s/FIG_LOGGED_IN=.*/FIG_LOGGED_IN=1/g" ~/.fig/user/config 2> /dev/null 37 | if [[ -s ~/.fig/tools/drip/fig_onboarding.sh ]]; then 38 | ~/.fig/tools/drip/fig_onboarding.sh 39 | exit 40 | fi 41 | fi 42 | else 43 | # If we are logged in, proceed as usual. 44 | if [[ -s ~/.fig/tools/drip/fig_onboarding.sh ]]; then 45 | ~/.fig/tools/drip/fig_onboarding.sh 46 | exit 47 | fi 48 | fi 49 | fi 50 | 51 | if [[ "$FIG_LOGGED_IN" == "0" ]]; then 52 | exit 53 | fi 54 | # invariant: 55 | # 1. User is logged in to Fig 56 | 57 | export FIG_IS_RUNNING="$(fig app:running)" 58 | # Ask for confirmation before updating 59 | if [[ ! -z "$NEW_VERSION_AVAILABLE" ]]; then 60 | export NEW_VERSION_AVAILABLE="${NEW_VERSION_AVAILABLE}" 61 | export DISPLAYED_AUTOUPDATE_SETTINGS_HINT="${DISPLAYED_AUTOUPDATE_SETTINGS_HINT}" 62 | ~/.fig/tools/drip/prompt_to_update.sh 63 | unset NEW_VERSION_AVAILABLE 64 | unset DISPLAYED_AUTOUPDATE_SETTINGS_HINT 65 | fi 66 | 67 | if [[ -z "$APP_TERMINATED_BY_USER" && "$FIG_IS_RUNNING" == '0' ]]; then 68 | export DISPLAYED_AUTOLAUNCH_SETTINGS_HINT="${DISPLAYED_AUTOLAUNCH_SETTINGS_HINT}" 69 | ~/.fig/tools/drip/autolaunch.sh 70 | unset DISPLAYED_AUTOLAUNCH_SETTINGS_HINT 71 | fi 72 | 73 | unset FIG_IS_RUNNING 74 | 75 | # NOTE: FIG_CHECKED_PROMPTS must be set to 1 in parent shell script. 76 | 77 | # In the future we will calculate when a user signed up and if there are any 78 | # drip campaigns remaining for the user. We will hardcode time since sign up 79 | # versus drip campaign date here. 80 | -------------------------------------------------------------------------------- /tools/remote_cwd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # remote_cwd.sh 4 | # fig 5 | # 6 | # Created by Matt Schrage on 1/7/21. 7 | # Copyright © 2021 Matt Schrage. All rights reserved. 8 | 9 | # Do not delete the following comment: 10 | # FIG_SETTINGS 11 | 12 | # Heuristic for getting user's pid. Find all processes with a TTY and pick most recent. 13 | pid=$(ps -e -o pid,tty,comm | grep -v "?" | grep 'zsh\|bash\|fish' | tail -n -1 | xargs | cut -d ' ' -f 1); 14 | 15 | # https://stackoverflow.com/a/8597411/926887 16 | if [ "$OSTYPE" == "linux-gnu"* ]; then 17 | readlink /proc/$pid/cwd 18 | elif [ "$OSTYPE" == "darwin"* ]; then 19 | lsof -p $pid | grep cwd | awk '{print $9}' 20 | elif [ "$OSTYPE" == "cygwin" ]; then 21 | pwd # not gonna handle this right now 22 | elif [ "$OSTYPE" == "msys" ]; then 23 | pwd # not gonna handle this right now 24 | elif [ "$OSTYPE" == "win32" ]; then 25 | pwd # not gonna handle this right now 26 | elif [ "$OSTYPE" == "freebsd"* ]; then 27 | procstat -f $pid | grep cwd | awk '{print $10}' 28 | else 29 | pwd # Unknown. 30 | fi 31 | -------------------------------------------------------------------------------- /tools/setup_fish_integration.sh: -------------------------------------------------------------------------------- 1 | mkdir -p ~/.config/fish/conf.d 2 | cp ./fig.fish ~/.config/fish/conf.d/fig.fish -------------------------------------------------------------------------------- /tools/ssh_prompt.sh: -------------------------------------------------------------------------------- 1 | touch ~/.fig/ssh_hostnames 2 | if ! cat ~/.fig/ssh_hostnames | grep -q $1; then 3 | 4 | BOLD=$(tput bold) 5 | UNDERLINE=$(tput smul) 6 | MAGENTA=$(tput setaf 5) 7 | NORMAL=$(tput sgr0) 8 | 9 | cat <> ~/.fig/ssh_hostnames 21 | fi 22 | -------------------------------------------------------------------------------- /tools/uninstall-script.sh: -------------------------------------------------------------------------------- 1 | echo "Deleting .fig folder & completion specs" 2 | rm -rf ~/.fig 3 | 4 | echo "Delete backup Fig CLI" 5 | rm /usr/local/bin/fig 6 | 7 | echo "Deleting WKWebViewCache" 8 | fig util:reset-cache 9 | 10 | # delete defaults 11 | echo "Deleting fig defaults & preferences" 12 | saved_id="$(defaults read com.mschrage.fig 'uuid')" 13 | defaults delete com.mschrage.fig 14 | defaults delete com.mschrage.fig.shared 15 | defaults write com.mschrage.fig 'uuid' "$saved_id" 16 | 17 | echo "Remove iTerm integration (if set up)" 18 | rm ~/Library/Application\ Support/iTerm2/Scripts/AutoLaunch/fig-iterm-integration.py 19 | rm ~/.config/iterm2/AppSupport/Scripts/AutoLaunch/fig-iterm-integration.py 20 | rm ~/Library/Application\ Support/iTerm2/Scripts/AutoLaunch/fig-iterm-integration.scpt 21 | 22 | echo "Remove VSCode integration (if set up)" 23 | rm -rf ~/.vscode/extensions/withfig.fig-* 24 | rm -rf ~/.vscode-insiders/extensions/withfig.fig-* 25 | 26 | echo "Remove fish integration..." 27 | rm ~/.config/fish/conf.d/fig.fish 28 | 29 | # remove from .profiles 30 | echo "Removing fig.sh setup from .profile, .zprofile, .zshrc, .bash_profile, and .bashrc" 31 | 32 | INSTALLATION1="#### FIG ENV VARIABLES ####" 33 | INSTALLATION2="# Please make sure this block is at the start of this file." 34 | INSTALLATIONPRE="\[ -s ~/.fig/shell/pre.sh \] && source ~/.fig/shell/pre.sh" 35 | INSTALLATIONPOST="\[ -s ~/.fig/fig.sh \] && source ~/.fig/fig.sh" 36 | INSTALLATION3="# Please make sure this block is at the end of this file." 37 | INSTALLATION4="#### END FIG ENV VARIABLES ####" 38 | 39 | for file in "$HOME"/.profile "$HOME"/.zprofile "$HOME"/.bash_profile "$HOME"/.bashrc "$HOME"/.zshrc; do 40 | /usr/bin/sed -i '' -e "s/$INSTALLATION1//g" "$file" 41 | /usr/bin/sed -i '' -e "s/$INSTALLATION2//g" "$file" 42 | # change delimeter to '#' in order to escape '/' 43 | /usr/bin/sed -i '' -e "s#$INSTALLATIONPRE##g" "$file" 44 | /usr/bin/sed -i '' -e "s#$INSTALLATIONPOST##g" "$file" 45 | /usr/bin/sed -i '' -e "s/$INSTALLATION3//g" "$file" 46 | /usr/bin/sed -i '' -e "s/$INSTALLATION4//g" "$file" 47 | done 48 | 49 | echo "Removing fish integration" 50 | FISH_INSTALLATION="contains $HOME/.fig/bin $fish_user_paths; or set -Ua fish_user_paths $HOME/.fig/bin" 51 | 52 | sed -i '' -e "s|$FISH_INSTALLATION||g" ~/.config/fish/config.fish 53 | rm ~/.config/fish/conf.d/fig.fish 54 | 55 | echo "Removing SSH integration" 56 | SSH_CONFIG_PATH=~/.ssh/config 57 | SSH_TMP_PATH=$SSH_CONFIG_PATH'.tmp' 58 | # make backup? 59 | cp $SSH_CONFIG_PATH $SSH_CONFIG_PATH'.backup' 60 | 61 | # remove all three implementation 62 | START="# Fig SSH Integration: Enabled" 63 | 64 | END1="(fig bg:ssh ~/.ssh/%r@%h:%p &)" 65 | END2="fig bg:ssh ~/.ssh/%r@%h:%p &" 66 | END3="# End of Fig SSH Integration" 67 | 68 | if grep -q "$END1" $SSH_CONFIG_PATH; then 69 | cat $SSH_CONFIG_PATH | /usr/bin/sed -e '\|'"$START"'|,\|'"$END1"'|d' >$SSH_TMP_PATH 70 | elif grep -q "$END2" $SSH_CONFIG_PATH; then 71 | cat $SSH_CONFIG_PATH | /usr/bin/sed -e '\|'"$START"'|,\|'"$END2"'|d' >$SSH_TMP_PATH 72 | elif grep -q "$END3" $SSH_CONFIG_PATH; then 73 | cat $SSH_CONFIG_PATH | /usr/bin/sed -e '\|'"$START"'|,\|'"$END3"'|d' >$SSH_TMP_PATH 74 | else 75 | echo "SSH Integration appears not to be installed. Ignoring." 76 | fi 77 | 78 | mv $SSH_TMP_PATH $SSH_CONFIG_PATH 79 | 80 | echo "Removing TMUX integration" 81 | TMUX_CONFIG_PATH=~/.tmux.conf 82 | TMUX_TMP_PATH=$TMUX_CONFIG_PATH'.tmp' 83 | 84 | TMUX_START="# Fig Tmux Integration: Enabled" 85 | TMUX_END="# End of Fig Tmux Integration" 86 | 87 | cat $TMUX_CONFIG_PATH | /usr/bin/sed -e '\|'"$TMUX_START"'|,\|'"$TMUX_END"'|d' >$TMUX_TMP_PATH 88 | 89 | mv $TMUX_TMP_PATH $TMUX_CONFIG_PATH 90 | 91 | echo "Remove Hyper plugin, if it exists" 92 | HYPER_CONFIG=~/.hyper.js 93 | test -f $HYPER_CONFIG && sed -i '' -e 's/"fig-hyper-integration",//g' $HYPER_CONFIG 94 | test -f $HYPER_CONFIG && sed -i '' -e 's/"fig-hyper-integration"//g' $HYPER_CONFIG 95 | 96 | echo "Remove Kitty integration, if it exists" 97 | KITTY_COMMANDLINE_FILE="${HOME}/.config/kitty/macos-launch-services-cmdline" 98 | KITTY_COMMANDLINE_ARGS="--watcher ${HOME}/.fig/tools/kitty-integration.py" 99 | test -f "$KITTY_COMMANDLINE_FILE" && [[ $(< "$KITTY_COMMANDLINE_FILE") == "$KITTY_COMMANDLINE_ARGS" ]] && rm -f "$KITTY_COMMANDLINE_FILE"; 100 | 101 | 102 | 103 | #fig bg:event "Uninstall App" 104 | echo "Finished removing fig resources. You may now delete the Fig app by moving it to the Trash." 105 | #fig bg:alert "Done removing Fig resources." "You may now delete the Fig app by moving it to the Trash." 106 | 107 | rm -rf "${HOME}/Library/Input Methods/FigInputMethod.app" 108 | rm -rf /Applications/Fig.app 109 | -------------------------------------------------------------------------------- /tools/zle.sh: -------------------------------------------------------------------------------- 1 | function accept-and-hold() { 2 | zle .accept-and-hold 3 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 4 | } 5 | zle -N accept-and-hold 6 | 7 | function accept-and-infer-next-history() { 8 | zle .accept-and-infer-next-history 9 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 10 | } 11 | zle -N accept-and-infer-next-history 12 | 13 | function accept-and-menu-complete() { 14 | zle .accept-and-menu-complete 15 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 16 | } 17 | zle -N accept-and-menu-complete 18 | 19 | function accept-line() { 20 | zle .accept-line 21 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 22 | } 23 | zle -N accept-line 24 | 25 | function accept-search() { 26 | zle .accept-search 27 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 28 | } 29 | zle -N accept-search 30 | 31 | function argument-base() { 32 | zle .argument-base 33 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 34 | } 35 | zle -N argument-base 36 | 37 | function auto-suffix-remove() { 38 | zle .auto-suffix-remove 39 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 40 | } 41 | zle -N auto-suffix-remove 42 | 43 | function auto-suffix-retain() { 44 | zle .auto-suffix-retain 45 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 46 | } 47 | zle -N auto-suffix-retain 48 | 49 | function backward-char() { 50 | zle .backward-char 51 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 52 | } 53 | zle -N backward-char 54 | 55 | function backward-delete-char() { 56 | zle .backward-delete-char 57 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 58 | } 59 | zle -N backward-delete-char 60 | 61 | function backward-delete-word() { 62 | zle .backward-delete-word 63 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 64 | } 65 | zle -N backward-delete-word 66 | 67 | function backward-kill-line() { 68 | zle .backward-kill-line 69 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 70 | } 71 | zle -N backward-kill-line 72 | 73 | function backward-kill-word() { 74 | zle .backward-kill-word 75 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 76 | } 77 | zle -N backward-kill-word 78 | 79 | function backward-word() { 80 | zle .backward-word 81 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 82 | } 83 | zle -N backward-word 84 | 85 | function beep() { 86 | zle .beep 87 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 88 | } 89 | zle -N beep 90 | 91 | function beginning-of-buffer-or-history() { 92 | zle .beginning-of-buffer-or-history 93 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 94 | } 95 | zle -N beginning-of-buffer-or-history 96 | 97 | function beginning-of-history() { 98 | zle .beginning-of-history 99 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 100 | } 101 | zle -N beginning-of-history 102 | 103 | function beginning-of-line() { 104 | zle .beginning-of-line 105 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 106 | } 107 | zle -N beginning-of-line 108 | 109 | function beginning-of-line-hist() { 110 | zle .beginning-of-line-hist 111 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 112 | } 113 | zle -N beginning-of-line-hist 114 | 115 | function bracketed-paste() { 116 | zle .bracketed-paste 117 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 118 | } 119 | zle -N bracketed-paste 120 | 121 | function capitalize-word() { 122 | zle .capitalize-word 123 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 124 | } 125 | zle -N capitalize-word 126 | 127 | function clear-screen() { 128 | zle .clear-screen 129 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 130 | } 131 | zle -N clear-screen 132 | 133 | function complete-word() { 134 | zle .complete-word 135 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 136 | } 137 | zle -N complete-word 138 | 139 | function copy-prev-shell-word() { 140 | zle .copy-prev-shell-word 141 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 142 | } 143 | zle -N copy-prev-shell-word 144 | 145 | function copy-prev-word() { 146 | zle .copy-prev-word 147 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 148 | } 149 | zle -N copy-prev-word 150 | 151 | function copy-region-as-kill() { 152 | zle .copy-region-as-kill 153 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 154 | } 155 | zle -N copy-region-as-kill 156 | 157 | function deactivate-region() { 158 | zle .deactivate-region 159 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 160 | } 161 | zle -N deactivate-region 162 | 163 | function delete-char() { 164 | zle .delete-char 165 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 166 | } 167 | zle -N delete-char 168 | 169 | function delete-char-or-list() { 170 | zle .delete-char-or-list 171 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 172 | } 173 | zle -N delete-char-or-list 174 | 175 | function delete-word() { 176 | zle .delete-word 177 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 178 | } 179 | zle -N delete-word 180 | 181 | function describe-key-briefly() { 182 | zle .describe-key-briefly 183 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 184 | } 185 | zle -N describe-key-briefly 186 | 187 | function digit-argument() { 188 | zle .digit-argument 189 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 190 | } 191 | zle -N digit-argument 192 | 193 | function down-case-word() { 194 | zle .down-case-word 195 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 196 | } 197 | zle -N down-case-word 198 | 199 | function emacs-backward-word() { 200 | zle .emacs-backward-word 201 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 202 | } 203 | zle -N emacs-backward-word 204 | 205 | function emacs-forward-word() { 206 | zle .emacs-forward-word 207 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 208 | } 209 | zle -N emacs-forward-word 210 | 211 | function end-of-buffer-or-history() { 212 | zle .end-of-buffer-or-history 213 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 214 | } 215 | zle -N end-of-buffer-or-history 216 | 217 | function end-of-history() { 218 | zle .end-of-history 219 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 220 | } 221 | zle -N end-of-history 222 | 223 | function end-of-line() { 224 | zle .end-of-line 225 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 226 | } 227 | zle -N end-of-line 228 | 229 | function end-of-line-hist() { 230 | zle .end-of-line-hist 231 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 232 | } 233 | zle -N end-of-line-hist 234 | 235 | function end-of-list() { 236 | zle .end-of-list 237 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 238 | } 239 | zle -N end-of-list 240 | 241 | function exchange-point-and-mark() { 242 | zle .exchange-point-and-mark 243 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 244 | } 245 | zle -N exchange-point-and-mark 246 | 247 | function execute-last-named-cmd() { 248 | zle .execute-last-named-cmd 249 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 250 | } 251 | zle -N execute-last-named-cmd 252 | 253 | function execute-named-cmd() { 254 | zle .execute-named-cmd 255 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 256 | } 257 | zle -N execute-named-cmd 258 | 259 | function expand-cmd-path() { 260 | zle .expand-cmd-path 261 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 262 | } 263 | zle -N expand-cmd-path 264 | 265 | function expand-history() { 266 | zle .expand-history 267 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 268 | } 269 | zle -N expand-history 270 | 271 | function expand-or-complete() { 272 | zle .expand-or-complete 273 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 274 | } 275 | zle -N expand-or-complete 276 | 277 | function expand-or-complete-prefix() { 278 | zle .expand-or-complete-prefix 279 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 280 | } 281 | zle -N expand-or-complete-prefix 282 | 283 | function expand-word() { 284 | zle .expand-word 285 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 286 | } 287 | zle -N expand-word 288 | 289 | function forward-char() { 290 | zle .forward-char 291 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 292 | } 293 | zle -N forward-char 294 | 295 | function forward-word() { 296 | zle .forward-word 297 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 298 | } 299 | zle -N forward-word 300 | 301 | function get-line() { 302 | zle .get-line 303 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 304 | } 305 | zle -N get-line 306 | 307 | function gosmacs-transpose-chars() { 308 | zle .gosmacs-transpose-chars 309 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 310 | } 311 | zle -N gosmacs-transpose-chars 312 | 313 | function insert-last-word() { 314 | zle .insert-last-word 315 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 316 | } 317 | zle -N insert-last-word 318 | 319 | function kill-buffer() { 320 | zle .kill-buffer 321 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 322 | } 323 | zle -N kill-buffer 324 | 325 | function kill-line() { 326 | zle .kill-line 327 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 328 | } 329 | zle -N kill-line 330 | 331 | function kill-region() { 332 | zle .kill-region 333 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 334 | } 335 | zle -N kill-region 336 | 337 | function kill-whole-line() { 338 | zle .kill-whole-line 339 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 340 | } 341 | zle -N kill-whole-line 342 | 343 | function kill-word() { 344 | zle .kill-word 345 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 346 | } 347 | zle -N kill-word 348 | 349 | function list-choices() { 350 | zle .list-choices 351 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 352 | } 353 | zle -N list-choices 354 | 355 | function list-expand() { 356 | zle .list-expand 357 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 358 | } 359 | zle -N list-expand 360 | 361 | function magic-space() { 362 | zle .magic-space 363 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 364 | } 365 | zle -N magic-space 366 | 367 | function menu-complete() { 368 | zle .menu-complete 369 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 370 | } 371 | zle -N menu-complete 372 | 373 | function menu-expand-or-complete() { 374 | zle .menu-expand-or-complete 375 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 376 | } 377 | zle -N menu-expand-or-complete 378 | 379 | function neg-argument() { 380 | zle .neg-argument 381 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 382 | } 383 | zle -N neg-argument 384 | 385 | function overwrite-mode() { 386 | zle .overwrite-mode 387 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 388 | } 389 | zle -N overwrite-mode 390 | 391 | function pound-insert() { 392 | zle .pound-insert 393 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 394 | } 395 | zle -N pound-insert 396 | 397 | function push-input() { 398 | zle .push-input 399 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 400 | } 401 | zle -N push-input 402 | 403 | function push-line() { 404 | zle .push-line 405 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 406 | } 407 | zle -N push-line 408 | 409 | function push-line-or-edit() { 410 | zle .push-line-or-edit 411 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 412 | } 413 | zle -N push-line-or-edit 414 | 415 | function put-replace-selection() { 416 | zle .put-replace-selection 417 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 418 | } 419 | zle -N put-replace-selection 420 | 421 | function quote-line() { 422 | zle .quote-line 423 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 424 | } 425 | zle -N quote-line 426 | 427 | function quote-region() { 428 | zle .quote-region 429 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 430 | } 431 | zle -N quote-region 432 | 433 | function quoted-insert() { 434 | zle .quoted-insert 435 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 436 | } 437 | zle -N quoted-insert 438 | 439 | function read-command() { 440 | zle .read-command 441 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 442 | } 443 | zle -N read-command 444 | 445 | function recursive-edit() { 446 | zle .recursive-edit 447 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 448 | } 449 | zle -N recursive-edit 450 | 451 | function redisplay() { 452 | zle .redisplay 453 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 454 | } 455 | zle -N redisplay 456 | 457 | function redo() { 458 | zle .redo 459 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 460 | } 461 | zle -N redo 462 | 463 | function reset-prompt() { 464 | zle .reset-prompt 465 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 466 | } 467 | zle -N reset-prompt 468 | 469 | function reverse-menu-complete() { 470 | zle .reverse-menu-complete 471 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 472 | } 473 | zle -N reverse-menu-complete 474 | 475 | function run-help() { 476 | zle .run-help 477 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 478 | } 479 | zle -N run-help 480 | 481 | function select-a-blank-word() { 482 | zle .select-a-blank-word 483 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 484 | } 485 | zle -N select-a-blank-word 486 | 487 | function select-a-shell-word() { 488 | zle .select-a-shell-word 489 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 490 | } 491 | zle -N select-a-shell-word 492 | 493 | function select-a-word() { 494 | zle .select-a-word 495 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 496 | } 497 | zle -N select-a-word 498 | 499 | function select-in-blank-word() { 500 | zle .select-in-blank-word 501 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 502 | } 503 | zle -N select-in-blank-word 504 | 505 | function select-in-shell-word() { 506 | zle .select-in-shell-word 507 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 508 | } 509 | zle -N select-in-shell-word 510 | 511 | function select-in-word() { 512 | zle .select-in-word 513 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 514 | } 515 | zle -N select-in-word 516 | 517 | function self-insert-unmeta() { 518 | zle .self-insert-unmeta 519 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 520 | } 521 | zle -N self-insert-unmeta 522 | 523 | function send-break() { 524 | zle .send-break 525 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 526 | } 527 | zle -N send-break 528 | 529 | function set-local-history() { 530 | zle .set-local-history 531 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 532 | } 533 | zle -N set-local-history 534 | 535 | function set-mark-command() { 536 | zle .set-mark-command 537 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 538 | } 539 | zle -N set-mark-command 540 | 541 | function spell-word() { 542 | zle .spell-word 543 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 544 | } 545 | zle -N spell-word 546 | 547 | function split-undo() { 548 | zle .split-undo 549 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 550 | } 551 | zle -N split-undo 552 | 553 | function transpose-chars() { 554 | zle .transpose-chars 555 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 556 | } 557 | zle -N transpose-chars 558 | 559 | function transpose-words() { 560 | zle .transpose-words 561 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 562 | } 563 | zle -N transpose-words 564 | 565 | function undefined-key() { 566 | zle .undefined-key 567 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 568 | } 569 | zle -N undefined-key 570 | 571 | function undo() { 572 | zle .undo 573 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 574 | } 575 | zle -N undo 576 | 577 | function universal-argument() { 578 | zle .universal-argument 579 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 580 | } 581 | zle -N universal-argument 582 | 583 | function up-case-word() { 584 | zle .up-case-word 585 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 586 | } 587 | zle -N up-case-word 588 | 589 | function vi-add-eol() { 590 | zle .vi-add-eol 591 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 592 | } 593 | zle -N vi-add-eol 594 | 595 | function vi-add-next() { 596 | zle .vi-add-next 597 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 598 | } 599 | zle -N vi-add-next 600 | 601 | function vi-backward-blank-word() { 602 | zle .vi-backward-blank-word 603 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 604 | } 605 | zle -N vi-backward-blank-word 606 | 607 | function vi-backward-blank-word-end() { 608 | zle .vi-backward-blank-word-end 609 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 610 | } 611 | zle -N vi-backward-blank-word-end 612 | 613 | function vi-backward-char() { 614 | zle .vi-backward-char 615 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 616 | } 617 | zle -N vi-backward-char 618 | 619 | function vi-backward-delete-char() { 620 | zle .vi-backward-delete-char 621 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 622 | } 623 | zle -N vi-backward-delete-char 624 | 625 | function vi-backward-kill-word() { 626 | zle .vi-backward-kill-word 627 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 628 | } 629 | zle -N vi-backward-kill-word 630 | 631 | function vi-backward-word() { 632 | zle .vi-backward-word 633 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 634 | } 635 | zle -N vi-backward-word 636 | 637 | function vi-backward-word-end() { 638 | zle .vi-backward-word-end 639 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 640 | } 641 | zle -N vi-backward-word-end 642 | 643 | function vi-beginning-of-line() { 644 | zle .vi-beginning-of-line 645 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 646 | } 647 | zle -N vi-beginning-of-line 648 | 649 | function vi-caps-lock-panic() { 650 | zle .vi-caps-lock-panic 651 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 652 | } 653 | zle -N vi-caps-lock-panic 654 | 655 | function vi-change() { 656 | zle .vi-change 657 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 658 | } 659 | zle -N vi-change 660 | 661 | function vi-change-eol() { 662 | zle .vi-change-eol 663 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 664 | } 665 | zle -N vi-change-eol 666 | 667 | function vi-change-whole-line() { 668 | zle .vi-change-whole-line 669 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 670 | } 671 | zle -N vi-change-whole-line 672 | 673 | function vi-cmd-mode() { 674 | zle .vi-cmd-mode 675 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 676 | } 677 | zle -N vi-cmd-mode 678 | 679 | function vi-delete() { 680 | zle .vi-delete 681 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 682 | } 683 | zle -N vi-delete 684 | 685 | function vi-delete-char() { 686 | zle .vi-delete-char 687 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 688 | } 689 | zle -N vi-delete-char 690 | 691 | function vi-digit-or-beginning-of-line() { 692 | zle .vi-digit-or-beginning-of-line 693 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 694 | } 695 | zle -N vi-digit-or-beginning-of-line 696 | 697 | function vi-down-case() { 698 | zle .vi-down-case 699 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 700 | } 701 | zle -N vi-down-case 702 | 703 | function vi-end-of-line() { 704 | zle .vi-end-of-line 705 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 706 | } 707 | zle -N vi-end-of-line 708 | 709 | function vi-fetch-history() { 710 | zle .vi-fetch-history 711 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 712 | } 713 | zle -N vi-fetch-history 714 | 715 | function vi-find-next-char() { 716 | zle .vi-find-next-char 717 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 718 | } 719 | zle -N vi-find-next-char 720 | 721 | function vi-find-next-char-skip() { 722 | zle .vi-find-next-char-skip 723 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 724 | } 725 | zle -N vi-find-next-char-skip 726 | 727 | function vi-find-prev-char() { 728 | zle .vi-find-prev-char 729 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 730 | } 731 | zle -N vi-find-prev-char 732 | 733 | function vi-find-prev-char-skip() { 734 | zle .vi-find-prev-char-skip 735 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 736 | } 737 | zle -N vi-find-prev-char-skip 738 | 739 | function vi-first-non-blank() { 740 | zle .vi-first-non-blank 741 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 742 | } 743 | zle -N vi-first-non-blank 744 | 745 | function vi-forward-blank-word() { 746 | zle .vi-forward-blank-word 747 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 748 | } 749 | zle -N vi-forward-blank-word 750 | 751 | function vi-forward-blank-word-end() { 752 | zle .vi-forward-blank-word-end 753 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 754 | } 755 | zle -N vi-forward-blank-word-end 756 | 757 | function vi-forward-char() { 758 | zle .vi-forward-char 759 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 760 | } 761 | zle -N vi-forward-char 762 | 763 | function vi-forward-word() { 764 | zle .vi-forward-word 765 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 766 | } 767 | zle -N vi-forward-word 768 | 769 | function vi-forward-word-end() { 770 | zle .vi-forward-word-end 771 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 772 | } 773 | zle -N vi-forward-word-end 774 | 775 | function vi-goto-column() { 776 | zle .vi-goto-column 777 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 778 | } 779 | zle -N vi-goto-column 780 | 781 | function vi-goto-mark() { 782 | zle .vi-goto-mark 783 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 784 | } 785 | zle -N vi-goto-mark 786 | 787 | function vi-goto-mark-line() { 788 | zle .vi-goto-mark-line 789 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 790 | } 791 | zle -N vi-goto-mark-line 792 | 793 | function vi-history-search-backward() { 794 | zle .vi-history-search-backward 795 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 796 | } 797 | zle -N vi-history-search-backward 798 | 799 | function vi-history-search-forward() { 800 | zle .vi-history-search-forward 801 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 802 | } 803 | zle -N vi-history-search-forward 804 | 805 | function vi-indent() { 806 | zle .vi-indent 807 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 808 | } 809 | zle -N vi-indent 810 | 811 | function vi-insert() { 812 | zle .vi-insert 813 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 814 | } 815 | zle -N vi-insert 816 | 817 | function vi-insert-bol() { 818 | zle .vi-insert-bol 819 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 820 | } 821 | zle -N vi-insert-bol 822 | 823 | function vi-join() { 824 | zle .vi-join 825 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 826 | } 827 | zle -N vi-join 828 | 829 | function vi-kill-eol() { 830 | zle .vi-kill-eol 831 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 832 | } 833 | zle -N vi-kill-eol 834 | 835 | function vi-kill-line() { 836 | zle .vi-kill-line 837 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 838 | } 839 | zle -N vi-kill-line 840 | 841 | function vi-match-bracket() { 842 | zle .vi-match-bracket 843 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 844 | } 845 | zle -N vi-match-bracket 846 | 847 | function vi-open-line-above() { 848 | zle .vi-open-line-above 849 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 850 | } 851 | zle -N vi-open-line-above 852 | 853 | function vi-open-line-below() { 854 | zle .vi-open-line-below 855 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 856 | } 857 | zle -N vi-open-line-below 858 | 859 | function vi-oper-swap-case() { 860 | zle .vi-oper-swap-case 861 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 862 | } 863 | zle -N vi-oper-swap-case 864 | 865 | function vi-pound-insert() { 866 | zle .vi-pound-insert 867 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 868 | } 869 | zle -N vi-pound-insert 870 | 871 | function vi-put-after() { 872 | zle .vi-put-after 873 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 874 | } 875 | zle -N vi-put-after 876 | 877 | function vi-put-before() { 878 | zle .vi-put-before 879 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 880 | } 881 | zle -N vi-put-before 882 | 883 | function vi-quoted-insert() { 884 | zle .vi-quoted-insert 885 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 886 | } 887 | zle -N vi-quoted-insert 888 | 889 | function vi-repeat-change() { 890 | zle .vi-repeat-change 891 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 892 | } 893 | zle -N vi-repeat-change 894 | 895 | function vi-repeat-find() { 896 | zle .vi-repeat-find 897 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 898 | } 899 | zle -N vi-repeat-find 900 | 901 | function vi-repeat-search() { 902 | zle .vi-repeat-search 903 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 904 | } 905 | zle -N vi-repeat-search 906 | 907 | function vi-replace() { 908 | zle .vi-replace 909 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 910 | } 911 | zle -N vi-replace 912 | 913 | function vi-replace-chars() { 914 | zle .vi-replace-chars 915 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 916 | } 917 | zle -N vi-replace-chars 918 | 919 | function vi-rev-repeat-find() { 920 | zle .vi-rev-repeat-find 921 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 922 | } 923 | zle -N vi-rev-repeat-find 924 | 925 | function vi-rev-repeat-search() { 926 | zle .vi-rev-repeat-search 927 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 928 | } 929 | zle -N vi-rev-repeat-search 930 | 931 | function vi-set-buffer() { 932 | zle .vi-set-buffer 933 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 934 | } 935 | zle -N vi-set-buffer 936 | 937 | function vi-set-mark() { 938 | zle .vi-set-mark 939 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 940 | } 941 | zle -N vi-set-mark 942 | 943 | function vi-substitute() { 944 | zle .vi-substitute 945 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 946 | } 947 | zle -N vi-substitute 948 | 949 | function vi-swap-case() { 950 | zle .vi-swap-case 951 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 952 | } 953 | zle -N vi-swap-case 954 | 955 | function vi-undo-change() { 956 | zle .vi-undo-change 957 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 958 | } 959 | zle -N vi-undo-change 960 | 961 | function vi-unindent() { 962 | zle .vi-unindent 963 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 964 | } 965 | zle -N vi-unindent 966 | 967 | function vi-up-case() { 968 | zle .vi-up-case 969 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 970 | } 971 | zle -N vi-up-case 972 | 973 | function vi-yank() { 974 | zle .vi-yank 975 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 976 | } 977 | zle -N vi-yank 978 | 979 | function vi-yank-eol() { 980 | zle .vi-yank-eol 981 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 982 | } 983 | zle -N vi-yank-eol 984 | 985 | function vi-yank-whole-line() { 986 | zle .vi-yank-whole-line 987 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 988 | } 989 | zle -N vi-yank-whole-line 990 | 991 | function visual-line-mode() { 992 | zle .visual-line-mode 993 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 994 | } 995 | zle -N visual-line-mode 996 | 997 | function visual-mode() { 998 | zle .visual-mode 999 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1000 | } 1001 | zle -N visual-mode 1002 | 1003 | function what-cursor-position() { 1004 | zle .what-cursor-position 1005 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1006 | } 1007 | zle -N what-cursor-position 1008 | 1009 | function where-is() { 1010 | zle .where-is 1011 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1012 | } 1013 | zle -N where-is 1014 | 1015 | function which-command() { 1016 | zle .which-command 1017 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1018 | } 1019 | zle -N which-command 1020 | 1021 | function yank() { 1022 | zle .yank 1023 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1024 | } 1025 | zle -N yank 1026 | 1027 | function yank-pop() { 1028 | zle .yank-pop 1029 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1030 | } 1031 | zle -N yank-pop 1032 | 1033 | ## Control-R 1034 | 1035 | function history-beginning-search-backward() { 1036 | ( fig bg:hide ) &! 1037 | zle .history-beginning-search-backward 1038 | } 1039 | zle -N history-beginning-search-backward 1040 | 1041 | function history-beginning-search-forward() { 1042 | ( fig bg:hide ) &! 1043 | zle .history-beginning-search-forward 1044 | } 1045 | zle -N history-beginning-search-forward 1046 | 1047 | function history-incremental-pattern-search-backward() { 1048 | ( fig bg:hide ) &! 1049 | zle .history-incremental-pattern-search-backward 1050 | } 1051 | zle -N history-incremental-pattern-search-backward 1052 | 1053 | function history-incremental-pattern-search-forward() { 1054 | ( fig bg:hide ) &! 1055 | zle .history-incremental-pattern-search-forward 1056 | } 1057 | zle -N history-incremental-pattern-search-forward 1058 | 1059 | function history-incremental-search-backward() { 1060 | ( fig bg:hide ) &! 1061 | zle .history-incremental-search-backward 1062 | } 1063 | zle -N history-incremental-search-backward 1064 | 1065 | function history-incremental-search-forward() { 1066 | ( fig bg:hide ) &! 1067 | zle .history-incremental-search-forward 1068 | } 1069 | zle -N history-incremental-search-forward 1070 | 1071 | function history-search-backward() { 1072 | ( fig bg:hide ) &! 1073 | zle .history-search-backward 1074 | } 1075 | zle -N history-search-backward 1076 | 1077 | function history-search-forward() { 1078 | ( fig bg:hide ) &! 1079 | zle .history-search-forward 1080 | } 1081 | zle -N history-search-forward 1082 | 1083 | function infer-next-history() { 1084 | ( fig bg:hide ) &! 1085 | zle .infer-next-history 1086 | } 1087 | zle -N infer-next-history 1088 | 1089 | ## Up arrow 1090 | 1091 | function up-history() { 1092 | zle .up-history 1093 | ( fig bg:hide ) &! 1094 | } 1095 | zle -N up-history 1096 | 1097 | function up-line() { 1098 | zle .up-line 1099 | ( fig bg:hide ) &! 1100 | } 1101 | zle -N up-line 1102 | 1103 | function up-line-or-history() { 1104 | zle .up-line-or-history 1105 | ( fig bg:hide ) &! 1106 | } 1107 | zle -N up-line-or-history 1108 | 1109 | function up-line-or-search() { 1110 | zle .up-line-or-search 1111 | ( fig bg:hide ) &! 1112 | } 1113 | zle -N up-line-or-search 1114 | 1115 | function vi-up-line-or-history() { 1116 | zle .vi-up-line-or-history 1117 | ( fig bg:hide ) &! 1118 | } 1119 | zle -N vi-up-line-or-history 1120 | 1121 | ## Down arrow 1122 | 1123 | function down-history() { 1124 | zle .down-history 1125 | ( fig bg:hide ) &! 1126 | } 1127 | zle -N down-history 1128 | 1129 | function down-line() { 1130 | zle .down-line 1131 | ( fig bg:hide ) &! 1132 | } 1133 | zle -N down-line 1134 | 1135 | function down-line-or-history() { 1136 | zle .down-line-or-history 1137 | ( fig bg:hide ) &! 1138 | } 1139 | zle -N down-line-or-history 1140 | 1141 | function down-line-or-search() { 1142 | zle .down-line-or-search 1143 | ( fig bg:hide ) &! 1144 | } 1145 | zle -N down-line-or-search 1146 | 1147 | function accept-line-and-down-history() { 1148 | zle .accept-line-and-down-history 1149 | ( fig bg:hide ) &! 1150 | } 1151 | zle -N accept-line-and-down-history 1152 | 1153 | function vi-down-line-or-history() { 1154 | zle .vi-down-line-or-history 1155 | ( fig bg:hide ) &! 1156 | } 1157 | zle -N vi-down-line-or-history 1158 | 1159 | ## Add insertion lock. See ShellBridge.insertUnicodeString 1160 | function self-insert() { 1161 | zle .self-insert 1162 | if [ ! -f ~/.fig/insertion-lock ]; then 1163 | ( fig bg:zsh-keybuffer $CURSOR "$BUFFER" ) &! 1164 | fi 1165 | } 1166 | zle -N self-insert 1167 | 1168 | # Don't export, limit to ZSH 1169 | # FIG_ZLE_INTEGRATION=1 1170 | -------------------------------------------------------------------------------- /user/README.md: -------------------------------------------------------------------------------- 1 | Install your own custom apps, autocomplete specs and more here 2 | --------------------------------------------------------------------------------