Commit Graph

21 Commits (c060eb46ea29537b4cf735bf9d4454f1db5411e9)

Author SHA1 Message Date
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 de9ea54b81
Don't call external `uname` when `$OSTYPE` will do (#1911)
* lib/helpers: use `$OSTYPE` instead of `$(uname)`

* plugins/osx: use `$OSTYPE` instead of `$(uname)`

* plugins/boot2docker: use `$OSTYPE` instead of `$(uname)`

* plugins/python: use `$OSTYPE` instead of `$(uname)`

* plugins/base: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[` as the former has less insane argument handling being shell syntax rather than a builtin command that must emulate being a real binary

* completion/brew: use `$OSTYPE` instead of `$(uname)`

* completion/git: use `$OSTYPE` instead of `$(uname)`

Alsö, use `[[` instead of `[`.

* completion/fabric: use `$OSTYPE` instead of `uname`

* theme/demula: use `$OSTYPE` instead of `$(uname)`

* theme/rana: use `$OSTYPE` instead of `$(uname)`
2021-08-14 10:20:12 +03:00
Truong Ma Phi 9945e078b3 Add plugin list jvms and pick default system-wide 2019-04-28 17:44:22 +07:00
Enze Chi f847371447 Avoid double semicolon in the PROMPT_COMMAND
The direnv bash hook already add a semicolon to the PROMPT_COMMAND and this
plugin will add another one if direnv is installed. This commit will check if
the PROMPT_COMMAND ends with semicolon to avoid have double ones.
2018-08-02 22:01:15 +10:00
Nils Winkler f3439c7370
Merge pull request #1162 from kaimingguo/refresh-launchpad
Add reset launchpad layout function
2018-03-20 03:54:14 -04:00
Kai-Ming Guo f168ce8109 Add reset launchpad layout function
The layout will have returned to the default, placing all bundled
apps onto the first screen of Launchpad, and third party apps onto
the secondary (and third, if applicable) screens
2018-03-15 22:57:02 +08:00
Claudia 3f05d6b3fd Fix prompt issue for non-login subshells in OS X
This commit fixes an issue with themes on OS X which are sometimes
left in a partially broken environment with missing dependencies.

When a `BASH_IT_THEME` is active on OS X and has a
dynamic `PROMPT_COMMAND` which is not exported, and such
`PROMPT_COMMAND` is backed by shell functions which are not
exported either, and at the same time the theme is not
OS-X-aware (regarding `update_terminal_cwd`), and the
user launches a (non-login) interactive subshell from
the OS X Terminal, a `command not found` appears on every
command invocation.

The issue is caused by a regression in PR #514, which attempts to
inject `update_terminal_cwd` into the prompt. As a side effect, it
also escalates the exportedness of `PROMPT_COMMAND` while the
theme-specific backing functions (which power the dynamic prompt)
remain unexported.

The subshell cannot recover from this partially broken environment
because unlike in Linux, Bash-it on OS X is not invoked for non-login
subshells. The dependencies remain broken which leads to the error.

The fix is to preserve `PROMPT_COMMAND`’s exportedness on OS X,
leaving the individual theme responsible for consistently
exporting either all or nothing of its environment.
2016-04-22 19:27:18 +02:00
cs-networks 98eb5495fe osx_terminal_exit_code_fix
The update_terminal_cmd is interfering with the $? variable. Somehow it
is always 0.

```
caesium@Mac:~/Documents/projects/git/bash-it 0 >export
PROMPT_COMMAND="update_terminal_cwd;set_prompt"
caesium@Mac:~/Documents/projects/git/bash-it 0 >false
caesium@Mac:~/Documents/projects/git/bash-it 0 >true
caesium@Mac:~/Documents/projects/git/bash-it 0 >export
PROMPT_COMMAND="set_prompt;update_terminal_cwd"
caesium@Mac:~/Documents/projects/git/bash-it 0 >false
caesium@Mac:~/Documents/projects/git/bash-it 1 >true
caesium@Mac:~/Documents/projects/git/bash-it 0 >
```

After the fix it is working properly.
2016-01-07 20:37:01 +01:00
Nils Winkler 74a9f5c411 Moved some functions
Some functions were specific to OS X, but were defined in the `base` plugin. I have moved them to the `osx` plugin:

* pman
* pcurl
* pri

As for `pcurl`, the `osx` plugin already had an existing `prevcurl` function, which was doing the same thing. I've aliased `pcurl` to simply call `prevcurl` to avoid breaking existing installations.

As far as I know the `open -fa $PREVIEW` thing only works on OS X, which means that these functions have only worked on OS X anyway.
2015-08-31 08:52:57 +02:00
Nils Winkler 5d00373359 Added check for OS X update_terminal_cwd
This will allow to open new terminal tabs in the same directory as the
current terminal. Uses the fact that plugins are loaded after the
selected theme. Themes often manipulate the $PROMPT_COMMAND variable.

Implementation inspired by the pathmunge function.
2015-06-25 12:26:53 +02:00
Nils Winkler 44e1ae0002 Fixed script execution to always use the frontmost window, instead of window 1.
If you had multiple terminal windows open, there was a chance that the command was sent to another window (the one with index 1). Using index 0 will execute it in the currently visible window.
2014-11-05 08:18:58 +01:00
Faro 1560d7b9bb adding functions to rename os x terminal tab and window titles 2014-08-22 11:26:57 +02:00
Nils Winkler 964850d6da Subtle change: Added a space in front of the command that's run in the
new tab. If you use `export HISTIGNORE=' *'` in your shell, this will
ensure that commands starting with a space will not be included in the
history. Since the command sent to the new tab by the `tab` command
probably shouldn't show up in the history, I added a leading space
character.
2013-12-10 17:05:28 +01:00
Erich Smith 08e439c4f0 update plugin management 2012-05-13 22:13:54 -04:00
Erich Smith 55e77deac1 standardize plugins, update metadata
add about-plugin metadata
chmod -x plugins
cleanup filenames to standardize on x.plugin.bash format
only plugin files intended to be executable from the command line should
contain a shebang line, and should be a+x.
2012-05-13 22:13:54 -04:00
Eitan Adler 3fc60b5358 Fix bogus bash binary location 2012-04-17 00:24:58 -04:00
Mark Szymanski 3a2b525ac6 Added prevcurl function
Downloads a file and opens it in Preivew.app
2011-07-07 11:04:27 -05:00
Mark Szymanski 1a96945885 Fix grammar on error message 2011-06-30 08:30:46 -05:00
Travis Swicegood ffa45b0391 Create the concept of enabled plugins
This allows users to disable a plugin without completely removing it.
Instead, they simply remove the `plugins/enabled/*.bash` file for the
plugin they want to disable.  This continues the concept of "everything
on" while providing greater flexibility to future users.

It might be a good idea to allow turning these off by default in the
future and allowing not only the `plugins/enabled/*.bash` files but also
an array of `<plugin_name>` values that would search for
`plugins/available/<plugin_name>.plugin.bash` to enable them.  That
method would make it easier for people custom tune their plugins from
within their `.bash_profile` script.
2011-05-02 23:12:50 -05:00