<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mntnoe.com &#187; bookmarks</title>
	<atom:link href="http://mntnoe.com/tag/bookmarks/feed/" rel="self" type="application/rss+xml" />
	<link>http://mntnoe.com</link>
	<description></description>
	<lastBuildDate>Mon, 12 Sep 2011 07:19:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Navigation in Zsh</title>
		<link>http://mntnoe.com/2009/11/navigation-in-zsh/</link>
		<comments>http://mntnoe.com/2009/11/navigation-in-zsh/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 23:07:55 +0000</pubDate>
		<dc:creator>Mads Navntoft Noe</dc:creator>
				<category><![CDATA[Other Tips]]></category>
		<category><![CDATA[bookmarks]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://www.mntnoe.com/?p=53</guid>
		<description><![CDATA[One of the most useful features in Zsh is its support for user-defined widgets. These two commands will greatly speed up your directory navigation in Zsh: setopt autopushd go-up () { cd .. zle reset-prompt }; zle -N go-up go-to-previous () { popd zle reset-prompt }; zle -N go-to-previous bindkey '^[u' go-up bindkey '^[p' go-to-previous [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most useful features in Zsh is its support for user-defined widgets. These two commands will greatly speed up your directory navigation in Zsh:</p>
<pre>setopt autopushd

go-up () {
cd ..
zle reset-prompt
}; zle -N go-up

go-to-previous () {
popd
zle reset-prompt
}; zle -N go-to-previous

bindkey '^[u' go-up
bindkey '^[p' go-to-previous</pre>
<p>Now you can go up one level with Alt-U and go backwards in history with Alt-P. Also, this won't clutter your terminal with "cd .." lines, as the prompt line gets automagically updated. Similarly, you can add <em>bookmark</em>-like functionality with something like this:</p>
<pre>typeset -Ag bookmark

bookmark[1]="$HOME/work/project"
bookmark[2]="$HOME/work/project/src/foo/bar"
bookmark[3]="$HOME/work/project/test/foo/bar"
bookmark[4]="..."
bookmark[5]="..."
bookmark[6]="..."
bookmark[7]="..."
bookmark[8]="..."
bookmark[9]="..."
bookmark[0]="..."

go-to-bookmark () {
cd $bookmark[$KEYS[-1]]
zle reset-prompt
}; zle -N go-to-bookmark

bindkey '^[0' go-to-bookmark
bindkey '^[1' go-to-bookmark
bindkey '^[2' go-to-bookmark
bindkey '^[3' go-to-bookmark
bindkey '^[4' go-to-bookmark
bindkey '^[5' go-to-bookmark
bindkey '^[6' go-to-bookmark
bindkey '^[7' go-to-bookmark
bindkey '^[8' go-to-bookmark
bindkey '^[9' go-to-bookmark</pre>
<p>Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://mntnoe.com/2009/11/navigation-in-zsh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

