GithubHelp home page GithubHelp logo

scmbreeze / scm_breeze Goto Github PK

View Code? Open in Web Editor NEW
2.8K 38.0 192.0 741 KB

Adds numbered shortcuts to the output git status, and much more

Home Page: https://madebynathan.com/2011/10/19/git-shortcuts-like-youve-never-seen-before/

License: MIT License

Shell 88.60% Ruby 11.40%

scm_breeze's Introduction

SCM Breeze TravisCI

Streamline your SCM workflow.

SCM Breeze is a set of shell scripts (for bash and zsh) that enhance your interaction with git. It integrates with your shell to give you numbered file shortcuts, a repository index with tab completion, and many other useful features.

Installation

git clone https://github.com/scmbreeze/scm_breeze.git ~/.scm_breeze
~/.scm_breeze/install.sh
source ~/.bashrc   # or source "${ZDOTDIR:-$HOME}/.zshrc"

The install script creates required default configs and adds the following line to your .bashrc or .zshrc:

[ -s "$HOME/.scm_breeze/scm_breeze.sh" ] && source "$HOME/.scm_breeze/scm_breeze.sh"

Note: You need to install ruby for some SCM Breeze commands to work. This also improves performance. See ruby-lang.org for installation information.

File Shortcuts

SCM Breeze makes it really easy to work with changed files, and groups of changed files. Whenever you view your SCM status, each modified path is stored in a numbered environment variable. You can configure the variable prefix, which is 'e' by default.

Git Status Shortcuts:

Git Status With Shortcuts

'ls' shortcuts:

Ls With Shortcuts

These numbers (or ranges of numbers) can be used with any SCM or system command.

For example, if ga was your alias for git add, instead of typing something like:

$ ga assets/git_breeze/config* assets/git_breeze/install.sh

You can type this instead:

$ ga $e2 $e3 $e11

But SCM Breeze aliases ga to the git_add_shortcuts function, which is smart enough to expand integers and ranges, so all you need to type is:

$ ga 2 3 11

And if you want to add all unstaged changes (files 1 to 10):

$ ga 1-10

(Note that ga will also remove deleted files, unlike the standard git add command. This behaviour can be turned off if you don't like it.)

You can also diff, reset or checkout a file by typing:

$ gd 3
$ grs 4
$ gco 5

You can use these shortcuts with system commands by passing your command through exec_scmb_expand_args (default alias is ge):

$ echo $e4
# => assets/git_breeze/git_breeze.sh
$ ge echo 4
# => assets/git_breeze/git_breeze.sh
$ ge echo 1-3
# expands to echo $e1 $e2 $e3
# => _shared.sh assets/git_breeze/config.example.sh assets/git_breeze/config.sh

Other shortcuts

SCM Breeze adds a number of aliases to your shell. Use list_aliases to view all the aliases and their corresponding commands. You can filter aliases by adding a search string: list_aliases git log

There's also a git_aliases command, which just shows aliases for git commands. You can also pass in additional filters, e.g. git_aliases log.

Keyboard bindings

Some of my most common git commands are git add and git commit, so I wanted these to be as streamlined as possible. One way of speeding up commonly used commands is by binding them to keyboard shortcuts.

Here are the default key bindings:

  • CTRL+x c => git_add_and_commit - add given files (if any), then commit staged changes
  • CTRL+x SPACE => git_commit_all - commit everything

The commit shortcuts use the git_commit_prompt function, which gives a simple prompt like this:

Git Commit All

(When using bash, this commit prompt gives you access to your bash history via the arrow keys.)

And if you really want to speed up your workflow, you can type this:

$ 2 3 <CTRL+x c>

This sends the HOME key, followed by git_add_and_commit:

Git Add And Commit

Repository Index

The second feature is a repository index for all of your projects and submodules. This gives you super-fast switching between your project directories, with tab completion, and it can even tab-complete down to project subdirectories. This means that you can keep your projects organized in subfolders, but switch between them as easily as if they were all in one folder.

It's similar to autojump, but it doesn't need to 'learn' anything, and it can do SCM-specific stuff like:

  • Running a command for all of your repos (useful if you ever need to update a lot of remote URLs)
  • Update all of your repositories via a cron task

The default alias for git_index is 'c', which might stand for 'code'

You will first need to configure your repository directory by setting GIT_REPO_DIR in ~/.git.scmbrc.

Then, build the index:

$ c --rebuild
# => == Scanning /home/ndbroadbent/code for git repos & submodules...
# => ===== Indexed 64 repos in /home/ndbroadbent/code/.git_index

Then you'll be able to switch between your projects, or show the list of indexed repos.

To switch to a project directory, you don't need to type the full project name. For example, to switch to the capistrano project, you could type any of the following:

$ c capistrano
$ c cap
$ c istra

Or if you wanted to go straight to a subdirectory within capistrano:

$ c cap<TAB>
$ c capistrano/<TAB>
# => bin/   lib/   test/
$ c capistrano/l<TAB>
$ c capistrano/lib/
# => cd ~/code/gems/capistrano/lib

Or if you want to go to a subdirectory within the ~/code directory, prefix the first argument with a /:

~ $ c /gems
~/code/gems $

Linking External Project Design Directories

When you're creating logos or icons for a project that uses git, have you ever wondered where you should store those .psd or .xcf files? Do you commit all of your raw design files, or does it put you off that any changes to those files will bloat your repository?

Here were my goals when I set out to find a solution:

  • I wanted a design directory for each of my projects
  • I didn't want the design directory to be checked in to the git repository
  • The design directory needed to be synchronized across all of my machines

The simplest way for me to synchronize files was via my Dropbox account. However, if you work with a larger team, you could set up a shared design directory on one of your servers and synchronize it with rsync.

1) Create and configure a root design directory

I created my root design directory at ~/Dropbox/Design.

After you've created your root design directory, edit ~/.scmbrc and set root_design_dir to the directory you just created. You can also configure the design directory that's created in each of your projects (default: design_assets), as well as the subdirectories you would like to use. The default base subdirectories are: Images, Backgrounds, Logos, Icons, Mockups, and Screenshots.

After you have changed these settings, remember to run source ~/.bashrc or source "${ZDOTDIR:-$HOME}/.zshrc".

2) Initialize design directories for your projects

To set up the design directories and symlinks, go to a project's directory and run:

design init

If your root directory is ~/Dropbox/Design, directories will be created at ~/Dropbox/Design/projects/my_project/Backgrounds, ~/Dropbox/Design/projects/my_project/Icons, etc.

It will then symlink the project from your root design directory into your project's design directory, so you end up with:

  • my_project/design_assets -> ~/Dropbox/Design/projects/my_project

It also adds this directory to .git/info/exclude so that git ignores it.

If you use the git repository index, you can run the following batch command to set up these directories for all of your git repos at once:

git_index --batch-cmd design init

If you want to remove any empty design directories, run:

design trim

And if you want to remove all of a project's design directories, even if they contain files:

design rm

3) Link existing design directories into your projects

If you've set up your design directories on one machine, you'll want them to be synchronized across all of your other development machines.

Just run the following command on your other machines after you've configured the root design directory:

design link

This uses your git index to figure out where to create the symlinks. If you don't use the git index, the same outcome could be achieved by running 'design init' for each of the projects.

Configuration

SCM Breeze is configured via automatically installed ~/.*.scmbrc files. To change git configuration, edit ~/.git.scmbrc.

Each feature is modular, so you are free to ignore the parts you don't want to use. Just comment out the relevant line in ~/.scm_breeze/scm_breeze.sh.

Note: After changing any settings, you will need to run source ~/.bashrc (or source "${ZDOTDIR:-$HOME}/.zshrc")

I know we grow attached to the aliases we use every day, so I've made the alias system completely customizable. You have two options when it comes to aliases:

1) Configure and use the provided SCM Breeze aliases

Just tweak the aliases in ~/.git.scmbrc. You can also change or remove any keyboard shortcuts. These aliases also come with tab completion. For example, you can type gco <tab> to tab complete your list of branches.

2) Use your own aliases

In your git.scmbrc config file, just set the git_setup_aliases option to no. Your existing git aliases will then be used, and you will still be able to use the numeric shortcuts feature. SCM Breeze creates a function to wrap the 'git' command, which expands numeric arguments, and uses hub if available.

A few aliases will still be defined for the central SCM Breeze features, such as gs for the extended git status, and ga for the git add function.

If you already have an alias like alias gco="git checkout", you can now type gco 1 to checkout the first file in the output of SCM Breeze's git status.

Custom emojis for username and "staff" group

The ll command adds numbered shortcuts to files, but another fun feature is replacing your username and the "staff" group with custom emojis. You can set these in ~/.user_sym and ~/.staff_sym.

Custom user and staff emojis

Set your own emojis by running:

echo 🍀 > ~/.user_sym
echo 🖥 > ~/.staff_sym

I also like using ~/.user_sym in my Bash prompt.

Notes about Tab Completion for Aliases

Bash

If you use your own aliases, SCM Breeze will not set up bash tab completion for your aliases. You will need to set that up yourself.

Zsh

You just need to set the option: setopt no_complete_aliases (oh-my-zsh sets this by default). Zsh will then expand aliases like gb to git branch, and use the completion for that.

Updating

Please run update_scm_breeze to fetch the latest code. This will update SCM Breeze from Github, and will create or patch your ~/.*.scmbrc config files if any new settings are added.

Uninstalling

~/.scm_breeze/uninstall.sh

The uninstall script removes the following line from your .bashrc or .zshrc:

[ -s "$HOME/.scm_breeze/scm_breeze.sh" ] && source "$HOME/.scm_breeze/scm_breeze.sh"

Contributing

SCM Breeze lives on Github at scmbreeze/scm_breeze

If you have any awesome SCM scripts lurking in your .bashrc or .zshrc, please feel free to send me a pull request. It would be cool to make this project into an oh-my-zsh for SCMs.

Enjoy!

Alternative Projects

  1. https://github.com/shinriyo/breeze fish support
  2. https://github.com/mroth/scmpuff static go binary

scm_breeze's People

Contributors

abhshkdz avatar ajsalminen avatar alexconlin avatar alhad avatar armen avatar arthas-rtzr avatar bernardobarreto avatar brianpeiris avatar chasballew avatar cliffrowley avatar coryt-indeed avatar daverigby avatar dlee avatar eballerini avatar g5pw avatar galonsky avatar ghthor avatar grota avatar haletom avatar interfere avatar jawshooah avatar jeffbyrnes avatar jsravn avatar keen99 avatar lfdm avatar mroth avatar ndbroadbent avatar shinriyo avatar treyhunner avatar vise890 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scm_breeze's Issues

Keyboard shortcuts do not work with zsh

Using zsh 4.3.17 in ITerm2 on a mac

Ctrl-x c produces

❯ "dd_and_commit
"dd_and_commit
dquote> "

Ctrl-x SPC produces

❯ " git_commit_all
" git_commit_all
dquote> "

MAC OSX - error

I am trying to try scm_breeze on MAC OS X - 10.7.2 with ITERM2

After I followed the installation steps I get the following error

sed: 1: "s/^* ([^ ]*)/\1/;tm; ...": undefined label 'm;d;:m'

Any thoughts on what is going on here?

parse_git_branch is not defined

Hello,

When using scm_breeze's index functionality I'm getting the below error and this is due to undefined function being used in repo_index.sh

s watch_tower/                                                                                                                                                                                                                                               wael@Phoenix-X
_git_index_pull_or_status:11: command not found: parse_git_branch

Thank you, this project is really helpful and can speed up workflow

Regards,
Wael Nasreddine

git command completion doesn't work after installing scm breeze

Hello,

After installing scm breeze, I don't have any completions for git commands.

For example, previously, if I typed git checkout and pressed TAB, zsh would show me a list of branches to checkout to, this no longer happens when using scm breeze.

How can I check what is wrong?

I am using oh-my-zsh and Mac OS X.

Thanks

Getting errors under Mac OS X Mountain Lion...

I updated scm_breeze and now I'm getting the following errors upon opening a new terminal window:

/Users/interhive/.scm_breeze/lib/git/aliases.sh:78: exec_scmb_expand_args not found
/Users/interhive/.scm_breeze/lib/git/branch_shortcuts.sh:43: exec_scmb_expand_args _scmb_git_branch_shortcuts -m not found

Any clue what I've seemed to have messed up in the update?

Thanks!

scm_breeze conflict with gitflow scripts

Thank you for great tool. I always use scm_breeze shortcut set.

'gitflow' propose standard branching model with 'master, develop, feature, hotfix' and support good tool for that process.

example

git flow feature start feature_name 
... working and commit in feature/feature_name ...
git flow feature finish feature_name

You could see on https://github.com/nvie/gitflow

Until now, I have been used scm_breeze and gitflow with no problem. But after recent upgrade scm_breeze, my gitflow operation is broken.

for example.

'git flow feature start' function work well. But 'git flow feature finish' don't work.

$ git f feature start SCV-18_block_swipe_action_with_view_pager

... work...

$ gs
# On branch: feature/SCV-18_block_swipe_action_with_view_pager  |  No changes (working directory clean)

$ gb
  [1] develop
* [2] feature/SCV-18_block_swipe_action_with_view_pager
  [3] master

$ git f feature finish feature/SCV-18_block_swipe_action_with_view_pager
No branch matches prefix 'feature/SCV-18_block_swipe_action_with_view_pager'

Could you check your scm_breeze functionality?

or Could you support 'temporary turn off' in scm_breeze ?

ga does not work in zsh

ga does not work on zsh for me. It seems that it has something to do with the number of change files, I saw this behavior:

  • with 1 changed file ga 1 worked fine
  • with 2 changed files ga 1 produces an error (see below)
  • with 2 changed files ga 2 does nothing (see below)
tri:...git/blau_de[trunk]> gs
# On branch: trunk  |  [*] => $e*
#
➤ Changes not staged for commit
#
#       modified: [1] README.md 
#       modified: [2] Rakefile 
#
tri:...git/blau_de[trunk]> ga 1
# fatal: Could not switch to '/Users/tri/Documents/git/blau_de/README.md|/Users/tri/Documents/git/blau_de': No such file or directory
#
# On branch: trunk  |  [*] => $e*
#
➤ Changes not staged for commit
#
#       modified: [1] README.md 
#       modified: [2] Rakefile 
#
tri:...git/blau_de[trunk]> ga 2
#
# On branch: trunk  |  [*] => $e*
#
➤ Changes not staged for commit
#
#       modified: [1] README.md 
#       modified: [2] Rakefile 
#
tri:...git/blau_de[trunk]>

scm_breeze messes up my "mv"


billy-woopra 福 ~ 
3804 ± : which mv                                                                                                                     
mv: aliased to exec_scmb_expand_args nocorrect mv

billy-woopra 福 ~ 
3805 ± : mv                                                                                                                           

billy-woopra 福 ~ 
3806 ± : /bin/mv                                                                                                                      
usage: mv [-f | -i | -n] [-v] source target
       mv [-f | -i | -n] [-v] source ... directory

How do I undo this?

exec_scmb_expand_args not found

/Users/ptaylor/.scm_breeze/lib/git/aliases.sh:78: exec_scmb_expand_args not found
/Users/ptaylor/.scm_breeze/lib/git/branch_shortcuts.sh:44: exec_scmb_expand_args _scmb_git_branch_shortcuts -m not found

This is after running ./install and opening a new Tab.

$e1, $e2 etc outputs branch names instead of file names

In the latest version of scm_breeze (2ef3776), typing gs followed by echo $e1 outputs the name of the first branch of the current git directory. For example:

~/dev/scm_breeze (master) $ git log -1
commit 2ef3776fe132a779ad657b976035d1d56677ed79
Author: Nathan Broadbent <[email protected]>
Date:   Wed Nov 28 19:40:38 2012 +1300

    git_branch_delete_all should take '-f' arg to use -D arg
~/dev/scm_breeze (master) $ gs
# On branch: master  |  No changes (working directory clean)
~/dev/scm_breeze (master) $ echo $e1
master

I have not used any previous version of scm_breeze but these appears to be a bug.

Problem with spaces in path

Having a little problem on OS X 10.7.3:
$ ga 1

fatal: Could not switch to '/Users/alan/Documents/AdobeFlashBuilder4.6/restofpath'

The spaces between Adobe Flash Builder 4.6 have gone away.

SH_WORD_SPLIT needs setting for zsh with IFS

Heya - at least in my zsh (4.3.9 (i386-apple-darwin10.0) on Snow Leopard), it seems that you need to run "setopt SH_WORD_SPLIT" before zsh will consider the IFS setting.

Without this, I'd run 'gs; gd 1', and was just getting :

fatal: failed to stat '/Users/jon/Developer/web/app/gui/gui/views/audioboo/follow_button_section.rb|/Users/jon/Developer/web/config/environments/development.rb|/Users/jon/Developer/web/deploy/lib/sphinx.rb|[..............................]': File name too long
  • scm_breeze had just exported every filename concatenated with '|' into $e1.

Rather than messing with setopt environment, an alternative option would be to use ${=foo} - eg in git_status_shortcuts :

for file in ${=files}; do export $git_env_char$e="$file"; let e++; done

but I'm guessing that won't work in bash.

Any thoughts?

I would like my normal git branch back

Hi,

I have a script that uses the output of the original git branch command. Upon installing scm_breeze, it appears that not only gb, but the original git branch also now has additional things bound to it.

Is there a way I can still run git's vanilla git branch command?

# normal git
$ git branch
* master

# scm_breeze
$ git branch
* [1] master

errors by aliasing

I'm getting following errors after installing the current master at adedf86

~/.scm_breeze (master) $ source ~/.bashrc
-bash: alias: =exec_scmb_expand_args _scmb_git_branch_shortcuts -m: not found
-bash: alias: =exec_scmb_expand_args _scmb_git_branch_shortcuts -d: not found
-bash: alias: =exec_scmb_expand_args _scmb_git_branch_shortcuts -D: not found

using bash on osx

mv broken

Running latest master on OSX 10.7.5 in Terminal.app with oh-my-zsh

mv: aliased to exec_scmb_expand_args nocorrect mv

When trying to move a file it just hangs for a moment, and the file is not moved.

compdef error on OSX Lion

After installing scm_breeze on a zsh shell on OSX 10.7.4, I get this error every time I reload my .zshrc file:

 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:117: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:118: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:119: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:120: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:121: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:122: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:123: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:124: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:125: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:126: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:127: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:128: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:129: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:130: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:131: command not found: compdef
 /Users/seth/.scm_breeze/lib/git/aliases_and_bindings.sh:132: command not found: compdef
 complete:13: command not found: compdef
 complete:13: command not found: compdef

Most functionality appears to work correctly, but I'm also experiencing this issue.

SCM Breeze feature - Shortcut to files from ls, and wrap common shell commands

I've just finished some work that integrates the numeric shortcuts into the rest of your shell commands.
So, as well as shortcuts for files in git status, you can now also get shortcuts to files from the output of ls. I was using ll as an alias for ls -l, but now I've turned ll into an SCM Breeze function that gives the following output:

ll

After typing ll, you can use any of the following commands with the numbered shortcuts:

  • vim, emacs, gedit, cat, rm, cp, mv, ln, ls, cd

For example, let's say you wanted display the contents of scmbrc.example - now you can just type cat 11.

I've tested it out as much as I can, but I'm sure we will run into some strange issues at some point.
If you would like to help test it, please update scm_breeze from the master branch and let me know how it works for you.
Also let me know if you have any suggestions for commands that should be added to the list above.

Thanks!

gbd should use '-d', not '-D'

I expect gbd to use a non-destructive '-d', which fails if the branch is not merged. Just like gcob using '-b' and not '-B'. Or make it configurable.

c does not auto complete.

c works, in that it indexes and jumps to projects correctly, but it does not autocomplete.
Any ideas?

_scmb_git_branch_shortcuts -D not found

I'm getting the following after I upgraded to the lastest version

/home/colin/.scm_breeze/lib/git/branch_shortcuts.sh:46: exec_scmb_expand_args _scmb_git_branch_shortcuts -D not found

gap alias error: "bash: syntax error: unexpected end of file"

Example Error output

$ gap 1
bash: syntax error: unexpected end of file
#
# On branch: some-branch  |  [*] => $e*
#
➤ Changes not staged for commit
#
#      modified: [1] README
#

After running a git bisect I have identified 5e507af as the first commit that causes this error.

My environment

$ bash --version
GNU bash, version 4.2.20(2)-release (x86_64-unknown-linux-gnu)
$ git --version
git version 1.7.9

bashcompinit should be autoloaded with -U

In lib/git/aliases_and_bindings.sh, on line 113, the function bashcompinit is autoloaded by:

autoload bashcompinit

This presents a slight problem if the user defines some aliases, that are expanded in bashcompinit and cause errors.
To avoid that, you can use the -U option, which suppresses alias expansion:

autoload -U bashcompinit

source: not found

I'm using Ubuntu 12.10 and ran into this error when running ./install.sh

--- ~ » /.scm_breeze/install.sh
== Added SCM Breeze to '
/.bashrc'
== Added SCM Breeze to '~/.zshrc'
/home/ptaylor/.scm_breeze/install.sh: 22: /home/ptaylor/.scm_breeze/install.sh: source: not found
/home/ptaylor/.scm_breeze/install.sh: 24: /home/ptaylor/.scm_breeze/install.sh: _create_or_patch_scmbrc: not found
== Run 'source ~/.bashrc' or 'source ~/.zshrc' to load SCM Breeze into your current shell.

So I decided to amuse myself:
--- ~ » which source
source: shell built-in command

Anyway, I just changed source to "." and that seemed to work. Here's the diff:

--- ~scmbDir ‹master* M⁇› » git diff
diff --git a/install.sh b/install.sh
index c2e2798..bfa99cb 100755
--- a/install.sh
+++ b/install.sh
@@ -19,7 +19,7 @@ for rc in bashrc zshrc; do
done

Load SCM Breeze update scripts

-source "$scmbDir/lib/scm_breeze.sh"
+. "$scmbDir/lib/scm_breeze.sh"

Create '~/.*.scmbrc' files from example files

_create_or_patch_scmbrc

https://gist.github.com/3901149

generating a git prompt with scm_breeze loaded is slow

This is more of a support question than a bug report.. but when I load scm_breeze my bash prompt takes over a second to render where before there was no delay. This the the only code I have to setup my prompt:

export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUPSTREAM="auto"
function git_ps1() {
    builtin hash __git_ps1 2>&- \
      && __git_ps1 " on \[\e[0;36m\]%s \[\e[0;32m\]∓\[\e[0m\]"
}

PS1='\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;36m\]\w\[\e[00;33m\]$(__git_ps1 " (%s)")\[\e[00;00m\]$ '

My guess is that a lot of time is being taking up in the git function wrapper that scm_breeze defines but I don't really know for sure. It seems like other people would have run into this same issue before.. is there a workaround for this? Do you use __git_ps1 in your setup?

BTW, I'm on OSx 10.8.1 (Mountain Lion), bash version 4.1.7(2), and git 1.7.11.4.

ll entry colorization on mac

In the screenshot of the new shell-wrapped commands it shows the directories/files been color coded like a normal ls -l will do if colors are turned on. On my Mac (10.8) the wrapped ll command does not produce colors. I'm using bash shell.

Is there something I need to do to enable colorization?

Error during initialization

Using zsh and the latest scm_breeze revision, following errors occur:

➜ ~ source .scm_breeze/scm_breeze.sh
.scm_breeze/lib/git/aliases.sh:78: exec_scmb_expand_args not found
.scm_breeze/lib/git/branch_shortcuts.sh:43: exec_scmb_expand_args _scmb_git_branch_shortcuts -m not found

using "git diff --color-words" for "gd" alias

Hi,

I'm trying to use colors in my diffs. I tried adding an alias in my git-config like this:

[alias]
        diff = diff --color-words

But it didn't work. Any ideas? --color-words is awesome to use.

Thanks and keep up the good work!

git-1.7.12 - broke bash autocompletion

I upgraded from 1.7.11.5 ==> 1.7.12 and I get this output when I try to tab autocomplete.

bash: completion: function `_git' not found

Upstream may have changed something? Or the Arch package is missing something? I've downgraded back to 1.7.11.5 so this isn't a critical problem for me and we can take out time solving this one.

git_index --update-all appears to not work?

On Mac OS X 10.8.2, using bash 4.2.42(2)-release, line 239 of lib/git/repo_index.sh appears to not work, specifically, this bit of code:

$(git rev-parse ${remotes[$index]}/${merges[$index]})

The two array references, $remotes[$index] and $merges[$index] both return as an empty value, which means it tries to run this command:

$ git rev-parse /

which responds with:

$ fatal: Not a valid object name /

arrow keys for history not functioning correcty

I have my arrow keys set to search through history with:

--arrow up
"\e[A":history-search-backward
--arrown down
"\e[B":history-search-forward

Disabling scm_breeze in my bashrc fixes it, and I cant figure out where its being changed at. How can I fix this?

syntax error near unexpected token `cd(){'

I just did an update and I'm getting the following error when I open a terminal:

bash: eval: line 44: syntax error near unexpected token `('
bash: eval: line 44: `cd(){'
$ bash --version
GNU bash, version 4.2.37(2)-release (i686-pc-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ uname -a
Linux dell-17 3.5.4-1-ARCH #1 SMP PREEMPT Sat Sep 15 13:04:04 UTC 2012 i686 GNU/Linux

haven't got time to troubleshoot this, and after this it seems to still work just fine... But was wondering if someone knows what might be going on.

Invalid identifier kills XSession startup

When I installed scm_breeze, my XSession stopped logging in properly (Ubuntu 10.04LTS/Bash 4.1.5). My .xsession-errors file reads below:

/etc/gdm/Xsession: Beginning session setup...
/home/jolivier/.scm_breeze/lib/git/aliases_and_bindings.sh: line 44: `_git_grs-_shortcut': not a valid identifier

By removing the scm_breeze call from my .bashrc, I can login normally again.

Curiously, if I re-enable scm_breeze after login, everything works fine. Indeed, the error doesn't even pop up when I open terminals or source ~/.scm_breeze/scm_breeze.sh.

git_status_shortcuts not working properly

First of all many thanks for scm_breeze! Really helps in my everyday work with git.

I have used it for a while and had no problems but today, suddenly, it stopped working properly. When I type:

gs

I don't see colored and numbered list but standard "git status" like:

# On branch working
# Your branch is ahead of 'origin/working' by 3594 commits.
#
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   abc
#   modified:   def
#   modified:   ghi

I tried reinstalling scm_breeze by:

~/.scm_breeze/install.sh

and I got:

== Added SCM Breeze to '~/.bashrc'
== Run 'source ~/.bashrc' or 'source ~/.zshrc' to load SCM Breeze into your current shell.

So I runned:

source ~/.bashrc

but problem is not solved.

Any help?

ls hangs on OSX Lion

Hi - Just installed current HEAD and now my 'ls' command just hangs... I'm on Lion, using scm_breeze with oh-my-zsh in Terminal.app. Not sure what other information to give as there are no errors, just hanging.

Keyboard expansion not working properly...

Under OS X 10.8 (Mountain Lion)...

Attempting to use the keyboard shortcuts in the following manner:

$ gs
...
$ 1 2 3 5 <CTRL-X>-C
$ git_add_and_commit1 2 3 5
zsh: correct 'git_add_and_commit1' to 'git_add_and_commit' [nyae]?

As you can see, it appears that scm_breeze is not putting a space after the function name and it's tripping-up ZSH.

local IFS="|" buggy and unnecessary

Setting IFS as a local seems broken in zsh ($e1 includes the entire |-separated string of file names and $e2 through $eN are empty) and should in any case be unnecessary. There are a couple of obvious solutions.

  1. Store the original value in a temp and reset:
oldIFS="$IFS"
# do stuff
IFS="$oldIFS"
  1. Set IFS only for the for loop. This seems to be the preferred idiom.
IFS="|" for file in $files; do
  # do stuff
done
  1. Use a bash or zsh array. For ZSH, that would be:
filesArray=("${(s/|/)files}")
for file in $filesArray; do
  # do stuff
done

-bash: [: 2: unary operator expected - OSX 10.7

I get this when I attempt to use for completion.

$ gba
* master
  remotes/ndbroadbent/master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
$ gf nd

If I stroke a to complete nd => ndbroadbent I get this output and it moves my cursor to the next line.

$ gf nd-bash: [: 2: unary operator expected

If I then press again

$ gf nd-bash: [: 2: unary operator expected
-bash: [: 2: unary operator expected

ndbroadbent   origin
$ gf nd
$ uname -a
Darwin ****** 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug  9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64 i386
$ bash --version
GNU bash, version 4.2.10(2)-release (i386-apple-darwin11.2.0)

I don't notice this problem on ubuntu 10.04

$ uname -a
Linux ****** 2.6.35.4-****** #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 GNU/Linux
$ bash --version
GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)

gd not working with numbers

Thanks for an awesome script! I was using this fine with bash, but I just switched to oh-my-zsh. When I run the gd command, I get the following error:

➤ Changes to be committed
#
#       modified: [1] Gemfile 
#
➤ Changes not staged for commit
#
#       modified: [2] Gemfile.lock 
#       modified: [3] app/models/user.rb 
#       modified: [4] config/initializers/devise.rb 

$ gd 2
fatal: ambiguous argument 'cd': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions

However, I can still do gd $e2 and ga 2 and those work fine. Any idea what might be going on?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.