Commit Graph

13 Commits (b31c7a0afa847e8f601c23acaa7679aa319cd11c)

Author SHA1 Message Date
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