sorin-ionescu / prezto Goto Github PK
View Code? Open in Web Editor NEWThe configuration framework for Zsh
License: MIT License
The configuration framework for Zsh
License: MIT License
Integrating it (#52) is more trouble that it is worth.
Having to check if a $keyinfo
entry is not empty makes keyboard.zsh very hard to read. While $keyinfo
's $terminfo
entries must be checked Control, Escape, and Meta do not, and they are only checked for consistency. Consider removing these checks for readability.
None
Since .git is a file, instead of a directory, that points to the .git directory in submodules, certain status indicators fail to show.
None
Adding a few general guidelines should help to increase quality for future pull requests without taxing the core developers. I would like to add the following guideline to the wiki page on contributing:
Authors should check that their omodules still function properly when loaded alone, eg:
zstyle ':omz:module' enable 'my_module'
Inexperience developers may assume that modules like the core meta-module would be present and unmodified in all systems, leading to modules that depend on one another. The above wording removes any ambiguity and is a useful sanity test.
Tmux will cause kernel panics on Mac OS X in both Terminal and iTerm.
Interval Since Last Panic Report: 739334 sec
Panics Since Last Report: 1
Anonymous UUID: F2556F53-B2DE-4804-AC23-2ACD87FFBEAE
Mon Mar 26 09:13:58 2012
panic(cpu 0 caller 0x33c798): "Negative open count?"@/SourceCache/xnu/xnu-1699.24.23/bsd/miscfs/specfs/spec_vnops.c:1368
Backtrace (CPU 0), Frame : Return Address (4 potential args on stack)
0x1533ce8 : 0x22032e (0x6ad91c 0x1533d08 0x229f00 0x0)
0x1533d18 : 0x33c798 (0x6c9804 0x2000 0x1533d48 0x33f00d)
0x1533d48 : 0x340381 (0x1533da8 0x1533d70 0x1533d70 0x1533d70)
0x1533d88 : 0x32b6dc (0x1533da8 0x0 0x1533da8 0x5455190)
0x1533dc8 : 0x30b07c (0x5455158 0x30 0x638d74c 0x5455158)
0x1533e18 : 0x30adaf (0x5455190 0x5455158 0x14 0x6bf0ab)
0x1533e58 : 0x30c2e4 (0x0 0x1 0x1533e98 0x5455158)
0x1533e78 : 0x31dfc2 (0x5455158 0x1 0x1533f00 0x0)
0x1533e98 : 0x327379 (0x1533ea8 0x689a404 0x821580 0x5455158)
0x1533ec8 : 0x563388 (0x5455158 0x1 0x1533f00 0x225e5a)
0x1533f18 : 0x23c038 (0x68718c8 0x1 0x68718c8 0x7c64000)
0x1533f38 : 0x23c52c (0x7c6429c 0x0 0x1 0x7c64000)
0x1533f58 : 0x23c5d1 (0x7c642b8 0x7c64000 0x7c6429c 0x7c64000)
0x1533f78 : 0x21d970 (0x1 0x5842994 0x638d690 0x0)
0x1533fa8 : 0x2cd0f2 (0xffffffff 0x1 0x82ea98 0x1533fe0)
0x1533fc8 : 0x2e3e04 (0x0 0x0 0x10 0x5842990)
BSD process name corresponding to current thread: tmux
Mac OS version:
11D50b
More information:
I cannot in good conscience promote the use of Tmux. Perhaps Tmux works well on Linux, but on Mac OS X, it is rubbish. I will not have something in OMZ that crashes systems, any system.
With history-substring-search enabled, url-quote-magic doesn't work, as demonstrated by pasting http://example.com/foo?bar=baz
into it.
which url-quote-magic
returns
url-quote-magic () {
# undefined
builtin autoload -XUz
}
I'm using zsh 4.3.17 (x86_64-unknown-linux-gnu)
on Debian testing.
I like to see a directory's contents when I "cd":
function cd () {
builtin cd "$*" && ls # List directory contents after cd
}
alias cd='nocorrect cd'
Is this something that might be useful as an option in zshrc, so others could make use of it? I'm sure I can't be the only one that would find this useful.
The idea behind placing a theme and dependencies self-contained under its own directory in /themes/theme_name
came from seeing broken themes in OMZ v1.0 due to missing scripts. Usually, the missing dependency was a battery charge script written in Python, probably copied from a blog post, and modified for different outputs. For an example, see #8.
It seemed a good idea at the time; however, promptinit
requires that themes be placed in the functions path $fpath
, and placing non Zsh scripts in said path is not an optimal solution. They show up in the autoload
completion, for example.
In my ongoing effort to create a fully modular OMZ, see #23, I came to the conclusion that theme setup files should be placed under a prompt
module, for example, /modules/prompt/functions/prompt_sorin_setup
.
Additionally, there is no need for 10 different battery scripts that get the same information but have different output formatting. We can have one script, written in Zsh, and style its output with zstyle
in a hardware
module. Themes that wish to show hardware information in the prompt can omodload hardware
to use it.
I have written a battery function as a proof of concept that could be in such a hardware
module.
omodload spectrum
zmodload zsh/mathfunc
function battery-charge {
local bar_length
local color
local empty_char
local fill_char
local hide_at
local high_charge_color
local low_charge_color
local medium_charge_color
zstyle -s 'omz:module:hardware:battery' fill-char 'fill_char' ||
fill_char='▪'
zstyle -s 'omz:module:hardware:battery' empty-char 'empty_char' ||
empty_char='▫'
zstyle -s 'omz:module:hardware:battery' high-charge-color 'high_charge_color' ||
high_charge_color="$FG[green]"
zstyle -s 'omz:module:hardware:battery' medium-charge-color 'medium_charge_color' ||
medium_charge_color="$FG[yellow]"
zstyle -s 'omz:module:hardware:battery' low-charge-color 'low_charge_color' ||
low_charge_color="$FG[red]"
zstyle -s 'omz:module:hardware:battery' bar-length 'bar_length' ||
bar_length=10
zstyle -s 'omz:module:hardware:battery' hide-at 'hide_at' ||
hide_at=101
case "$OSTYPE" in
(darwin*)
charge=$(
pmset -g batt |
awk '/InternalBattery-0/ { print $2 }' |
awk -F % '{ print $1 }'
)
;;
(linux*)
charge=$(
acpi -b |
awk '/Battery 0:/ { print $4 }' |
awk -F % '{ print $1 }'
)
;;
(freebsd*)
charge=$(acpiconf -i 0)
;;
(*)
print "$0: operating system not supported: $OSTYPE" >&2
;;
esac
if (( charge < hide_at )); then
filled=$(( ceil(charge / 100.0 * bar_length) ))
empty=$(( floor(bar_length - filled) ))
meter="${$(printf "%${filled}s" "")// /${fill_char}}"
meter+="${$(printf "%${empty}s" "")// /${empty_char}}"
if (( charge >= 60.0 )); then
color="$high_charge_color"
elif (( charge >= 40.0 )); then
color="$medium_charge_color"
else
color="$low_charge_color"
fi
print "${color}${meter}${FG[none]}"
fi
}
battery-charge "$@"
They key bindings are defined in mostly lowercase, while bindkey -L
lists them in mostly uppercase. This is confusing when trying to debug.
This problem is specific to my Ubuntu 10.04.3 virtual machine (or it is so far anyways).
I've run into an issue where using tab to complete the path to an object I'm performing an operation on with git (such as git diff/git add/git rm), my whole terminal dies when it starts completing the last part of the path. So, for example:
~> cd Repositories/test_project/sub_dir <- (works fine)
sub_dir> git diff example.txt <- (works fine)
~> git diff Repositories/test_project/sub_dir/example.txt <- (crashes terminal when attempting completion of example.txt)
I'm not entirely sure what the cause would be, or I'd attempt to fix it before posting here, but until I can get some more time I'm just going to report it for now. Just for the record, I don't recall this happening on my macbook running 10.7, so this seems to be specific to my Ubuntu instance.
Theme authors may wish to have the vi command mode indicator in PROMPT instead of RPROMPT to not be covered by a long command.
As the title says, doing prompt -l
lists way more themes than are available inside .oh-my-zsh/themes/
.
When I run this command I get the following output:
linduxed minimal nicoulaj sorin steeef adam1 adam2 bart bigfade clint elite2 elite fade fire off oliver pws redhat suse walters zefram
The theme in the front (linduxed) is the only one that apart from the original ones (minimal, nicoulaj, sorin, steeef) that actually has a directory in themes/
.
When I type paths, for example, /Users/paul/Dev
and press <tab>
, autocomplete adds ...
(/Users/paul/Dev...
) and hangs sometimes.
With OMZ 2.0 a ton of new things have been added, it would be awesome to be able to document some parts of it with a wiki.
For example, I'll be glad to add some information on the git-plugin and how it works/should be used when you want to create your theme.
This way you don't have to read the source code to understand what to need to do.
And it could help to solve some other issues such as #25
Was that a warning to find bugs or is that the intended behavior?
I'm just wondering if push-line-or-edit
was actively rejected when selecting default bindings, or if it was simply overlooked. This is one of the few bindings I actually use pretty regularly, although not regularly enough to care much about what key it's assigned to, so long as it's a Control-key sequence. In my new setup, I'm opting for C-l
, clobbering the existing clear-screen
binding, since "L" makes me think "line", and clear-screen
isn't something I need frequently enough to need a binding for (and I can just type clear
.)
Any thoughts?
None
As I port my old configuration to OMZ-Sorin, I'm having some trouble with less
and more
: my mouse scrollwheel doesn't work in either. It works OK in Vim, though. I'm guessing this is something in terminal.zsh
, but I don't really know what to look for.
A compromise has been reached.
The Contribute section should have instructions on how to submit pull requests.
While for control, it is not necessary escape and meta bindings should have both lower and upper case keys bound.
Change every instance of:
[[ -n "$keyinfo[Escape]" ]] && \
bindkey -M emacs "$keyinfo[Escape]b" emacs-backward-word
To:
[[ -n "$keyinfo[Escape]" ]] && \
for key in "$keyinfo[Escape]"{B,b}; \
bindkey -M emacs "$key" emacs-backward-word
Before everybody forget about this issue (mostly discussed on the commit related to it):
sorin-ionescu/oh-my-zsh@9c611ce
Here is the original issue fixed by the said commit (#45)
Some documentation on the subject:
For Mac Users:
If you're on Mac OS, with iTerm2 or Terminal.app, by default your terminal type will be xterm-256color
.
In Terminfo, the setting for kbs
is ^H
*, this mean that with this terminal, BackSpace is expected to send ^H
.
For some reason, iTerm2 and Terminal.app don't send the correct code when you type backspace, ie ^?
instead of ^H
.
You can check that by typing ^V
followed by backspace.
To fix this, you have to ask to iTerm2 or Terminal.app to send ^H
when you hit backspace.
Beware, iTerm2 users, if you do a ^Backspace
, you will send ^?
(even if you've set "Delete key sends ^H
)!
Notes:
infocmp xterm-256color | grep kbs
It seems that it's slow on compinit / compaudit. Also this (slow loading) occurs only sometimes.
Have you or your distribution added massive completions?
No, i'm using sorin-omz and hadn't touched completions.
num calls time self name
-----------------------------------------------------------------------------------
1) 2 3366.81 1683.40 94.68% 3366.81 1683.40 94.68% compaudit
2) 1 3480.64 3480.64 97.88% 113.84 113.84 3.20% compinit
-----------------------------------------------------------------------------------
2) 1 3480.64 3480.64 97.88% 113.84 113.84 3.20% compinit
1/2 3366.81 3366.81 94.68% 0.83 0.83 compaudit [1]
-----------------------------------------------------------------------------------
1/2 3366.81 3366.81 94.68% 0.83 0.83 compinit [2]
1/2 3365.98 3365.98 94.66% 3365.98 3365.98 compaudit [1]
1) 2 3366.81 1683.40 94.68% 3366.81 1683.40 94.68% compaudit
1/2 3365.98 3365.98 94.66% 3365.98 3365.98 compaudit [1]
Append the current parrent process paths to the path arrays without incurring duplicate entries.
There is a lot of duplication in keyboard.zsh. We should try to remove it. Is emacs in vi command mode the easiest way to use the vi insert mode?
When I start automatically tmux I get this message.
After a small hunt, it seems that it comes from tmux new-session -d -s "$tmux_session" "$SHELL -l"
in the tmux plugin, in particular the "$SHELL -l"
part (it's not just the -l
option, it's the entire argument).
I'm not sure that's important to force the shell like this, I removed it and it still works.
On first run, the Git plugin downloads the Git completion from Zsh HEAD and caches it. See plugins/git/completion.zsh. This overrides the Zsh installed completion, which is useful whenever the HEAD completion has fixed bugs or new features, but at any time, the HEAD completion may introduce bugs or no longer work with older Zsh versions.
Perhaps it is best to remove completion.zsh and let users have the newest Git completion whenever they upgrade Zsh.
The Zsh man page says to declare functions with either the function
keyword or the special syntax foo() {}
, but not combine them.
I suspect that the special syntax was added to appease C programmers. However, you can't declare multiple functions with the same body with foo() bar() {}
nor foo bar {}
.
function foo {}
is the best way to declare functions because wether you declare one or many with the same body (function foo bar {}
), the syntax is consistent.
The following should do the trick.
psub '((function)?\s+)([\w-]+)\s*\(\s*\)\s*{' 'function $3 {' **/*~completions/*(.N)
trash **/*.(orig|rej)(N)
There is a lot to document on the git plugin.
Here is what I have so far :
https://github.com/ColinHebert/prezto/tree/git-readme/modules/git
On some systems it's possible to use the git-branch
command instead of git branch
(this applies to every git command).
In the git plugin, there is a function named git-branch which returns the current branch. This function can interfere with the expected git-branch
executable.
Currently the git-plugin doesn't use this function. Unless there is a specific need for this function, it could be easily removed.
Even if this function can be useful, it would be easier to maintain it as an alias to git symbolic-ref HEAD 2>/dev/null
named git-current-branch
.
One should not have to edit the main init.zsh to load these things.
Hi Everyone,
Running ls (GNU coreutils) 5.97 on centos 5.4
ls does not have the option '--group directories-first'
Whenever I type 'ls' 'ls -al' etc, I get:
ls: unrecognized option --group-directories-first' Try
ls --help' for more information.
A version check on ls is probably called for.
Thanks!
Remove
zstyle ':omz:plugin:git:prompt' clean 'clean'
zstyle ':omz:plugin:git:prompt' dirty 'dirty:%D'
in favour of
zstyle ':omz:plugin:git:prompt' dirty '%(D.clean.dirty:%D)'
This will free up %C
to be used for a higher purpose.
The tmux or the screen plugin (with autoload enabled) is executed after most of the OMZ script; once executed, it starts a new shell (Zsh shell); so, it runs the OMZ script once again.
Hi,
First of all, thanks sorin for the huge work you are doing on omz, appreciated :)
Got one repo that doesn't show information on prompt.
(of course the most complex one I work on 10h/day)
Strangely, it happens with sorin theme, not steeef one.
Looked a bit into zsh vcs_info man and themes code, without finding a clue.
Any idea of what could cause this or how i could diagnose/fix this?
Since history-substring-search has diverged a little bit from upstream, we might as well convert it fully.
I'd like to suggest that the "utility" functions be moved into a plugin, so that it's not mandatory to have those functions in the namespace. I tend to either write my own set of utility functions or write proper scripts as needed. The built-in utilities are interesting to read for reference, but I don't think I'd ever actually remember to use them.
In the emacs key map, the user can enter the vi command mode key map with C-X C-V
. Why? I have no idea.
There are two options. Option one is to disable the key map. When the prompt no longer works as it should, it violates the principle of least surprise. Emacs users may not recognise that they have entered in vi command mode key map and not know to press i
to return to emacs key map.
The main
key map also has a binding to enter vi command mode. However, we are only concerned with emacs and vi.
Option two is to move the vi command mode indicator functions outside of the *vi if statement` and have them working universally.
Thoughts?
I have a need to prepend to the /usr/local/share/python
to the $PATH
as required to use the Hombrew'd Python (see this wiki entry). This will be needed by anyone using a Homebrew'd Python.
I figure there are two different solutions:
A) a hook could be added e.g. zstyle ':omz:path' prepend '/usr/local/share/python'
B) roll this into the Python module, but thought it might be too environment specific
As you can tell I've just started using this fork, so excuse the numerous issues and pull requests.
It's not working here.
It gives the following error: Could not open a connection to your authentication agent.
I'm using upstream ssh-agent right now, and it works.
Is there a reason to not support upstream entry point for plugins?
As in "${0:h}/plugins/$plugin/$plugin.plugin.zsh"
, or maybe even "${0:h}/plugins/$plugin/$plugin.zsh"
.
It would make life easier in importing upstream or external plugins in your own fork, for instance I had to create a symlink to add zsh-syntax-highlighting and hence making the tree dirty, which isn't really fun, and I don't want to fork that just to create a symlink for the submodule.
By the way, great work, really.
My life became significantly easier the day I added this to my zsh setup:
# Insert "sudo " at the beginning of the line
function prepend-sudo {
if [[ $BUFFER != "sudo "* ]]; then
BUFFER="sudo $BUFFER"; CURSOR+=5
fi
}
zle -N prepend-sudo
[[ -n "$keyinfo[Control]" ]] && \
bindkey "$keyinfo[Control]s" prepend-sudo
C-s
is currently already assigned to history-incremental-pattern-search-forward
, but I'm going to clobber it in my setup.
I'm submitting this in case you can think of a way to fit this in neatly without pushing something else out that someone might find useful.
The behaviour of vi-backward-delete-char
(bound to backspace in Vi mode) is not to delete past the point where insert mode was last entered. This is really weird. Example:
$ echo helo
Press <ESC>, then hh
to move to the "l", and then press l
to add another. If you use backspace now, you can remove the "l" you just entered, but you can't go beyond that.
Vim doesn't do this, although it does seem to do it in vi-compatibility mode, so I guess the original Vi did in fact do this craziness. Regardless, I can't imagine that anyone would really want this behaviour.
In my setup, I've rebound ^?
to backward-delete-char
, which behaves more normally.
Unfortunately, $keyinfo[Backspace]
returns C-h
in Konsole (but ^?
in the Linux framebuffer), so using keyinfo
isn't currently reliable for setting this binding.
history-substring-search
should do its own bindings, which it partially does.
Is there any way to use my own theme without touching ~/.oh-my-zsh
repo?
None
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.