Skip to content

Commit

Permalink
Add support for fossil branches
Browse files Browse the repository at this point in the history
Refs #21
  • Loading branch information
edkolev committed Oct 2, 2014
1 parent 74d4ed3 commit 91a33e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ let g:promptline_preset = {
" available slices:
"
" promptline#slices#cwd() - current dir, truncated to 3 dirs. To configure: promptline#slices#cwd({ 'dir_limit': 4 })
" promptline#slices#vcs_branch() - branch name only. by default only git branch is enabled. Use promptline#slices#vcs_branch({ 'hg': 1, 'svn': 1}) to enable check for svn and mercurial branches. Note that always checking if inside a branch slows down the prompt
" promptline#slices#vcs_branch() - branch name only. By default, only git branch is enabled. Use promptline#slices#vcs_branch({ 'hg': 1, 'svn': 1, 'fossil': 1}) to enable check for svn, mercurial and fossil branches. Note that always checking if inside a branch slows down the prompt
" promptline#slices#last_exit_code() - display exit code of last command if not zero
" promptline#slices#jobs() - display number of shell jobs if more than zero
" promptline#slices#battery() - display battery percentage (on OSX and linux) only if below 10%. Configure the threshold with promptline#slices#battery({ 'threshold': 25 })
Expand Down
14 changes: 14 additions & 0 deletions autoload/promptline/slices/vcs_branch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fun! promptline#slices#vcs_branch#function_body(options)
let git = get(a:options, 'git', 1)
let svn = get(a:options, 'svn', 0)
let hg = get(a:options, 'hg', 0)
let fossil = get(a:options, 'fossil', 0)

let lines = [
\'function __promptline_vcs_branch {',
Expand Down Expand Up @@ -62,6 +63,19 @@ fun! promptline#slices#vcs_branch#function_body(options)
\'']
endif

if fossil
let lines += [
\'',
\' # fossil',
\' if hash fossil 2>/dev/null; then',
\' if branch=$( fossil branch 2>/dev/null ); then',
\' branch=${branch##* }',
\' printf "%s" "${branch_symbol}${branch:-unknown}"',
\' return',
\' fi',
\' fi']
endif

let lines += [
\' return 1',
\'}']
Expand Down

0 comments on commit 91a33e2

Please sign in to comment.