Commit Graph

612 Commits (2fe9e0105159ab96a2286c2f073d829e85ef2f15)

Author SHA1 Message Date
John D Pell 2fe9e01051 plugins/latex: 2009 was 12 years ago
Locate the currently installed edition, instead of transpoting us back to undergrad.
2022-01-08 08:43:32 -08:00
Noah Gorny 931f27ee3e
Merge pull request #2016 from gaelicWizard/plugin/python
plugin/python: OS detection & `shfmt`
2022-01-07 08:50:07 +02:00
Noah Gorny c060eb46ea
Merge pull request #2001 from gaelicWizard/plugin-dirs
Plugin/dirs: use `$XDG_STATE_HOME`
2022-01-07 08:42:24 +02:00
Noah Gorny dba610cdc8
Merge pull request #2009 from gaelicWizard/plugin-man
Plugin/man: Add `R` to `$LESS`
2022-01-07 08:41:41 +02:00
Noah Gorny 5d68fca7e5
Merge pull request #2008 from gaelicWizard/plugin-osx
Plugin/OSX: cleanup
2022-01-07 08:41:17 +02:00
Noah Gorny 48a1ff7fb4
Merge pull request #2005 from gaelicWizard/plugin-todo
Plugin/todo: cleanup and simplify
2022-01-07 08:40:52 +02:00
Noah Gorny 682b51c195
Merge pull request #2015 from gaelicWizard/plugin/git-subrepo
plugin/git-subrepo: use `$HOME` instead of `~`
2022-01-07 08:31:49 +02:00
John D Pell 139baedf5d plugin/python: Pyton 2 is dead; Long Live Python 3! 2022-01-05 13:29:35 -08:00
Noah Gorny f0abc3fbc4
Merge pull request #1998 from tsiflimagas/fzf-plugin
Fix checking whether fzf is already in PATH
2022-01-03 13:33:14 +02:00
John D Pell 29216c0fd4 plugin/python: `shfmt`
My apologies to future `git blame` hunters ♥
2022-01-01 23:00:48 -08:00
John D Pell dd911f1256 plugins/python: code style improvements
Use shell functionality to avoid invoking external binaries, and quote some stuff. Alsö, use $EDITOR and related variables in order to fall through if some aren't defined.
2022-01-01 23:00:48 -08:00
John D Pell c030f2108b plugin/git-subrepo: `shellcheck` 2022-01-01 22:48:01 -08:00
John D Pell a99b597217 plugin/git-subrepo: use `$HOME` instead of `~`
If the outer variable is double-quoted, then the default expansion when undefined does not get tilde-expanded. Use `$HOME`.
2022-01-01 22:32:03 -08:00
John D Pell d6bcedfa96 plugin/base: rewrite `t()` function to use `todo.sh`
Move the test for whether `plugin/todo` is enabled inside the function, and remove the alias from there.

Alsö, respect `$XDG_STATE_HOME` and move the old `~/.t` file if it exists.
2022-01-01 17:50:55 -08:00
John D Pell 02b57a83ef plugins/todo: lint
plugin/base: use `_bash-it-component-item-is-enabled()`
2022-01-01 17:50:55 -08:00
John D Pell 45aeb86c21 plugin/osx-timemachine: abuse `$SUDO_COMMAND`
Use `$SUDO_COMMAND` as a back-channel to `ssh-askpass` to set a reasonable title if it pops up.
2022-01-01 17:50:22 -08:00
John D Pell 03653fc141 plugins/osx-timemachine: `shellcheck` && `shfmt`
Use bash functionality rather than external binaries. Alsö, if $SUDO_ASKPASS is set then pass -A to sudo.
2022-01-01 17:50:22 -08:00
John D Pell caa0d48c60 plugin/osx: move `$OSTYPE` check to top of file 2022-01-01 17:50:22 -08:00
John D Pell db9027989d plugin/osx: remove `dock-switch()`
...it hasn't worked in *years*
2022-01-01 17:50:22 -08:00
John D Pell 75aabd5d20 plugin/osx: `shellcheck` && `shfmt`
plugins/osx: dead code removal

No need for gymnastics to determine if variable had been exported priort to modification. If it was, then it still is. See man bash(1).
2022-01-01 17:50:22 -08:00
John D Pell dc5c9e107c plugin/man: simplify
Don't overwrite variables that the user has already set.

plugins/man: unbound `$LESS`
2022-01-01 17:49:45 -08:00
John D Pell 290aab4efe plugins/man: Add "R" to `$LESS`
Otherwise, `-R` must be added on the command line or colors just won't be rendered and these variables will be ignored.
2022-01-01 17:49:45 -08:00
John D Pell 8b308df939 plugin/dirs: use `$BASH_IT_DIRS_BKS.new` instead of `~/.dirs1` 2022-01-01 17:49:15 -08:00
John D Pell 71b4f3c1bc plugin/dirs: `shfmt` && `shellcheck` 2022-01-01 17:49:15 -08:00
John D Pell d8e7b173b5 plugins/dirs: use XDG_STATE_HOME
Locate the bookmarks file in $XDG_STATE_HOME, and migrate an existing file from the old location if it exists.
2022-01-01 17:49:15 -08:00
Noah Gorny 2e51e92699
Merge pull request #2000 from gaelicWizard/lint
Revert most of "Fix linting errors that snuck in."
2022-01-01 23:01:09 +02:00
Noah Gorny 2dd4426a7c
Merge branch 'master' into plugin-java 2022-01-01 22:53:18 +02:00
John D Pell 33df3a2bcd plugin/java: show message on missing *or* blank 2021-12-30 22:35:34 -08:00
John D Pell f03a89836e plugins/java: quote path && `shfmt`
Provides an error message if no file is specified.
2021-12-30 20:25:19 -08:00
Kostas Giapis 1c03eb6b3b Fix checking whether fzf is already in PATH 2021-12-28 06:54:25 +02:00
John D Pell 64f75ce22d Revert most of "Fix linting errors that snuck in."
This reverts commit 2c8ee40566.

- _Shellcheck_ documentation for the [`source-path`]( https://github.com/koalaman/shellcheck/wiki/Directive#source-path ) directive indicates this is correct usage. We're `source`ing the `bash-preexec.sh` file from inside the `vendor/github.com/rcaloras/bash-preexec` directory. If we used the [`source`]( https://github.com/koalaman/shellcheck/wiki/Directive#source ) directive, then the full complete path to the file itself would need to be specified.
- Fix `disable=1090` to `disable=SC1090` and remove duplicate lines since this `shellcheck` directive will apply to the entire if-ladder.
- Disabling `SC2154` is almost never appropriate. In this case, several `_git_bash_completion*` variables are expressly assigned in this file, so there is no "unknown" to ignore.

Aside: the `${!_git_bash_completion@}` construct will expand to all variables starting with the previx `_git_bash_completion`, so this line is just a shorthand way to clear all our variables concisely without forgetting any.
2021-12-27 16:18:20 -08:00
John D Pell 3fe9c8d6bc plugin/jekyll: try to shorten the flow
Alsö, use `pushd`/`popd` instead of `builtin cd`.

Alsö, SC2153
2021-12-27 12:22:42 -08:00
John D Pell e38eeefc5f plugin/jekyll: second `shellcheck` pass 2021-12-27 12:22:42 -08:00
John D Pell c0aad51afd main: move Jekyll stuff to plugins/jekyll
If the user doesn't load the Jekyll plugin, then don't load any Jeykll stuff.
2021-12-27 12:22:42 -08:00
John D Pell 1c3a7ffdb3 plugin/jekyll: `shfmt` && `shellcheck`
Use bashisms, remove suplerfous variable, use parameter default value replacement
2021-12-27 12:22:42 -08:00
David Farrell 1bc56b1d8f
plugin(dirs): remove shopt -s cdable_vars 2021-12-02 13:42:29 -08:00
cornfeedhobo 2c8ee40566
Fix linting errors that snuck in. 2021-12-02 09:14:01 -06:00
cornfeedhobo bdb5289660
Wholesale cleanup of all history plugins
- remove the use of redundant cite
- minor cleanups to history.plugin.bash
- set explicit load orders for history-search and history-substring-search
- add new plugin history-eternal
- replace superfluous trap for managing HISTTIMEFORMAT changes
2021-12-02 09:13:56 -06:00
Ajeet D'Souza a89f2f8f13 plugin: add zoxide 2021-11-24 16:49:46 +05:30
John D Pell bdfb987f0c plugin/xterm: don't rely on `$1`
_bash-preexec_ passes the "current" command line as `$1`, but this is unreliable and we explicitly discourage it's use.

Use `$BASH_COMMAND` instead.
2021-10-20 15:50:15 -04:00
Noah Gorny c3382c7b50
Merge pull request #1884 from NoahGorny/add-blesh-plugin
plugins: Add ble.sh plugin
2021-10-06 22:49:15 +03:00
Noah Gorny 7fb7bb9cb8
Merge pull request #1952 from gaelicWizard/uncle
lib/helpers: new function `_bash-it-find-in-ancestor()`
2021-09-28 16:51:30 +03:00
Noah Gorny c360f0c7c5 plugins: Add ble.sh plugin 2021-09-28 16:48:16 +03:00
cornfeedhobo ec075a404a
clean up pyenv plugin
This commit cleans up the pyenv plugin to follow the newer conventions of the
other *env plugins, as well as addresses the changes made to pyenv for PATH
munging.
2021-09-28 07:44:40 -05:00
John D Pell c2c76a380a
plugin/base: improvements (#1930)
* plugins/base: code style improvements

Quote variables, use $@ and $array[@] instead of $*, typeset some integers, remove unneccesasary binary invocation, use shell features when possible, remove `eval`, &c.

* plugins/base: conditional function definitions

Instead of functions failing when required tools aren't installed, just don't define the function.
Alsö, don't redefine del() if it already exists.

* plugins/base: rewrite `usage()`

Reimplement disk usage function using Bash syntax and simpler layout, without having to invoke an external binary.

* plugins/base: revamp `quiet()`

New implementation that is even quieter.

* plugins/base: `myip()`

* plugins/base: `pickfrom()`

* plugins/base: `passgen()`

Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`.

* plugins/base: `mkcd()`

* plugins/base: `mkiso()`

* plugins/base: remove `banish-cookies()`

Adobe Flash is gone with the wind. Alsö, this would be something someone would do *once* and shouldn't be a function...

* plugins/base: `lsgrep` is SC2010

The `lsgrep()` function is *itself* explicitly forbidden by `shellcheck` rule SC2010.

Alsö, s/`$*`/`$@`

* plugins/base: `mkiso()`

Expressly handle unbound parameters.

* plugins/base: remove `command_exists`

* plugin/base: lint SC2154 && SC2144

Newly undisabled `shellcheck` rules

* plugin/base: import libs for tests

* plugin/base: `shfmt`

Apply `shfmt` using current project settings. My apologies to future `git blame` hunters. ♥
2021-09-28 15:13:27 +03:00
Noah Gorny 127cbbd4e3
Merge pull request #1957 from gaelicWizard/plugin-less-pretty-cat
plugin/less-pretty-cat improvements
2021-09-28 15:09:28 +03:00
Noah Gorny 05aac8ef39
Merge pull request #1956 from gaelicWizard/plugin-percol
plugin/percol `shellcheck`
2021-09-28 15:06:33 +03:00
John D Pell a4e4f30ff1 plugins/percol: `bind`
Move `bind` below function definition
2021-09-26 11:54:32 -07:00
John D Pell 92282c4795 plugin/percol: `shellcheck` & `shfmt`
According to `shellcheck`, the `_tac` alias simply doesn't work. At all. Ever. See SC2262 and SC2263.
2021-09-24 00:39:07 -07:00
John D Pell 2ada414266 plugins/percol: use `_command_exists`
Addresses bash-it/bash-it#1632

And use `_log_warning`.

Alsö, code style cleanup: quote things, handle unbound parameters, &c.

Alsö alsö, short-circuit if not installed or inadequate _Bash_ version.
2021-09-24 00:38:54 -07:00