Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: All The Plugins #1950

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions aliases/available/general.aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ fi
# List directory contents
alias sl=ls
alias la='ls -AF' # Compact view, show hidden
alias ll='ls -al'
alias l='ls -a'
alias ll='ls -Al'
alias l='ls -A'
alias l1='ls -1'
alias lf='ls -F'

Expand Down Expand Up @@ -47,8 +47,8 @@ alias py='python'
alias ipy='ipython'

# Pianobar can be found here: http://github.com/PromyLOPh/pianobar/

alias piano='pianobar'
_command_exists pianobar \
&& alias piano='pianobar'

alias ..='cd ..' # Go up one directory
alias cd..='cd ..' # Common misspelling for going up one directory
Expand All @@ -69,11 +69,12 @@ alias md='mkdir -p'
alias rd='rmdir'

# Shorten extract
alias xt='extract'
_command_exists 'extract' \
&& alias xt='extract'

# sudo editors
alias svim='sudo ${VISUAL:-vim}'
alias snano='sudo nano'
alias svim='sudo "${VISUAL:-vim}"'
alias snano='sudo "${ALTERNATE_EDITOR:-nano}"'

# Display whatever file is regular file or folder
function catt() {
Expand Down
21 changes: 11 additions & 10 deletions bash_it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ _bash_it_library_finalize_hook=()
# We need to load logging module early in order to be able to log
source "${BASH_IT}/lib/log.bash"

# libraries, but skip appearance (themes) for now
_log_debug "Loading libraries(except appearance)..."
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
# Load libraries
_log_debug "Loading libraries..."
for _bash_it_main_file_lib in "${BASH_IT}/lib"/*.bash; do
[[ "$_bash_it_main_file_lib" == "$APPEARANCE_LIB" ]] && continue
_bash-it-log-prefix-by-path "${_bash_it_main_file_lib}"
_log_debug "Loading library file..."
# shellcheck disable=SC1090
Expand All @@ -38,8 +36,7 @@ done
# "_bash_it_main_file_type" param is empty so that files get sourced in glob order
for _bash_it_main_file_type in "" "aliases" "plugins" "completion"; do
BASH_IT_LOG_PREFIX="core: reloader: "
# shellcheck disable=SC2140
source "${BASH_IT}/scripts/reloader.bash" ${_bash_it_main_file_type:+"skip" "$_bash_it_main_file_type"}
source "${BASH_IT}/scripts/reloader.bash" "${_bash_it_main_file_type:+skip}" "$_bash_it_main_file_type"
BASH_IT_LOG_PREFIX="core: main: "
done

Expand All @@ -55,10 +52,14 @@ if [[ -n "${BASH_IT_THEME:-}" ]]; then
source "${BASH_IT}/themes/base.theme.bash"

BASH_IT_LOG_PREFIX="lib: appearance: "
# appearance (themes) now, after all dependencies
# shellcheck source=SCRIPTDIR/lib/appearance.bash
source "$APPEARANCE_LIB"
BASH_IT_LOG_PREFIX="core: main: "
# shellcheck disable=SC1090
if [[ -f "${BASH_IT_THEME}" ]]; then
source "${BASH_IT_THEME}"
elif [[ -f "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]]; then
source "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash"
elif [[ -f "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]]; then
source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash"
fi
fi

_log_debug "Loading custom aliases, completion, plugins..."
Expand Down
15 changes: 3 additions & 12 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
aliases/
docs/
hooks/
lib/
scripts/
template/

# root files
#
Expand All @@ -28,6 +30,7 @@ bash_it.sh
clean_files.txt
install.sh
lint_clean_files.sh
uninstall.sh

# completions
#
Expand Down Expand Up @@ -75,18 +78,6 @@ completion/available/vault.completion.bash
completion/available/vuejs.completion.bash
completion/available/wpscan.completion.bash

# libraries
lib/appearance.bash
lib/colors.bash
lib/command_duration.bash
lib/helpers.bash
lib/history.bash
lib/log.bash
lib/preexec.bash
lib/preview.bash
lib/search.bash
lib/utilities.bash

# plugins
#
plugins/available/alias-completion.plugin.bash
Expand Down
2 changes: 1 addition & 1 deletion completion/available/grunt.completion.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
# shellcheck shell=bash

# grunt-cli
# http://gruntjs.com/
Expand Down
14 changes: 6 additions & 8 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Installation

#. Check out a clone of this repo to a location of your choice, such as
``git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it``
#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bash_profile`` or ``~/.bashrc``\ , depending on your OS)
#. Edit your modified config (\ ``~/.bash_profile`` or ``~/.bashrc``\ ) file in order to customize Bash-it.
#. Run ``~/.bash_it/install.sh`` (it automatically backs up your ``~/.bashrc``\ )
#. Edit your modified config (\ ``~/.bashrc``\ ) file in order to customize Bash-it.
#. Check out available aliases, completions, and plugins and enable the ones you want to use (see the next section for more details).

Install Options
Expand All @@ -18,7 +18,7 @@ The install script can take the following options:

* ``--interactive``\ : Asks the user which aliases, completions and plugins to enable.
* ``--silent``\ : Ask nothing and install using default settings.
* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bash_profile`` or ``~/.bashrc``\ ).
* ``--no-modify-config``\ : Do not modify the existing config file (\ ``~/.bashrc``\ ).
* ``--append-to-config``\ : Back up existing config file and append bash-it templates at the end.

When run without the ``--interactive`` switch, Bash-it only enables a sane default set of functionality to keep your shell clean and to avoid issues with missing dependencies.
Expand All @@ -28,16 +28,14 @@ When you run without the ``--no-modify-config`` switch, the Bash-it installer au
Use the ``--no-modify-config`` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it.

**NOTE**\ : Keep in mind how Bash loads its configuration files,
``.bash_profile`` for login shells (and in macOS in terminal emulators like `Terminal.app <http://www.apple.com/osx/apps/>`_ or
`iTerm2 <https://www.iterm2.com/>`_\ ) and ``.bashrc`` for interactive shells (default mode in most of the GNU/Linux terminal emulators),
to ensure that Bash-it is loaded correctly.
``.bash_profile`` for login shells and ``.bashrc`` for interactive shells, to ensure that Bash-it is loaded correctly.
A good "practice" is sourcing ``.bashrc`` into ``.bash_profile`` to keep things working in all the scenarios.
To achieve this, you can add this snippet in your ``.bash_profile``\ :

.. code-block::

if [ -f ~/.bashrc ]; then
. ~/.bashrc
if [[ $- == *"i"* && -f ~/.bashrc ]]; then
source ~/.bashrc
fi

Refer to the official `Bash documentation <https://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files>`_ to get more info.
Expand Down
3 changes: 1 addition & 2 deletions docs/themes-list/atomic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Automatically via terminal


#. You can install the theme automatically using the ``sed`` command from your Linux or OSX Terminal.
#. On macOS, the ~/.bash_profile is used, not the ~/.bashrc.
#. For installation on windows you should use `\ ``Git-Bash`` <https://git-for-windows.github.io/>`_ or make sure the terminal emulator you use (ej: cygwin, mintty, etc) has the ``sed`` command installed.

Command to execute For Windows and Linux:
Expand All @@ -51,7 +50,7 @@ Command to execute for macOS:
.. code-block:: bash

# Set the "atomic" theme replacing the theme you are using of bash-it
sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bash_profile
sed -i '' 's/'"$BASH_IT_THEME"'/atomic/g' ~/.bashrc

Features
--------
Expand Down
2 changes: 1 addition & 1 deletion docs/themes-list/powerline-base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ all powerline themes.

**IMPORTANT:** This theme requires that `a font with the Powerline symbols <https://github.com/powerline/fonts>`_ needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.

**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` or ``~/.bash_profile`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes.
**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where ``sudo`` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your ``~/.bashrc`` to disable the Powerline theme's ``sudo`` check. This will apply to all ``powerline*`` themes.

Provided Information
--------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/themes-list/powerline-multiline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To get the length of the left and right segments right, a *padding* value is use
In most cases, the default value (\ *2*\ ) works fine, but on some operating systems, this needs to be adjusted.
One example is *macOS High Sierra*\ , where the default padding causes the right segment to extend to the next line.
On macOS High Sierra, the padding value needs to be changed to *3* to make the theme look right.
This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bash_profile`` or ``~/.bashrc`` file:
This can be done by setting the ``POWERLINE_PADDING`` variable before Bash-it is loaded, e.g. in your ``~/.bashrc`` file:

.. code-block:: bash

Expand Down
2 changes: 1 addition & 1 deletion docs/vcs_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Turn version control checking off to prevent slow directory navigation within la
Controlling Flags
^^^^^^^^^^^^^^^^^

Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bash_profile`` file that turns off/on version control information checking and display within all themes.
Bash-it provides a flag (\ ``SCM_CHECK``\ ) within the ``~/.bashrc`` file that turns off/on version control information checking and display within all themes.
Version control checking is on by default unless explicitly turned off.

Set ``SCM_CHECK`` to 'false' to **turn off** version control checks for all themes:
Expand Down
Loading