<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://slot1.images.wikia.nocookie.net/__cb62169/common/skins/common/feed.css?62169"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Vim Tips Wiki - New pages [en]</title>
		<link>http://vim.wikia.com/wiki/Special:NewPages</link>
		<description>From Vim Tips Wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.19.6</generator>
		<lastBuildDate>Wed, 22 May 2013 10:58:15 GMT</lastBuildDate>
		<item>
			<title>Python script utf8 encoding</title>
			<link>http://vim.wikia.com/wiki/Python_script_utf8_encoding</link>
			<guid isPermaLink="false">http://vim.wikia.com/wiki/Python_script_utf8_encoding</guid>
			<description>&lt;p&gt;82.66.217.91: Created page with &amp;quot;When doing python scripts with vim, one can encounter really easily the following error, when giving utf-8 encoded strings from python to vim:  &amp;lt;pre&amp;gt; :py print u'echo &amp;quot;\u2026&amp;quot;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When doing python scripts with vim, one can encounter really easily the following error, when giving utf-8 encoded strings from python to vim:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:py print u'echo &amp;quot;\u2026&amp;quot;'&lt;br /&gt;
Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;&amp;lt;string&amp;gt;&amp;quot;, line 1, in &amp;lt;module&amp;gt;&lt;br /&gt;
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in&lt;br /&gt;
position 6: ordinal not in range(128) &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From a [https://groups.google.com/forum/?fromgroups=#!searchin/vim_use/python$20utf-8/vim_use/XXVGOuPkszQ/K6LmCqM2GKAJ vim mailing list's post], a solution exists that just solves this issue:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
python &amp;lt;&amp;lt; EOS&lt;br /&gt;
uniStr = u&amp;quot;\u2026&amp;quot;&lt;br /&gt;
str = uniStr.encode( vim.eval(&amp;quot;&amp;amp;encoding&amp;quot;) )&lt;br /&gt;
print str&lt;br /&gt;
EOS &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or the following one liner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
:py print u&amp;quot;\u2026&amp;quot;.encode( vim.eval(&amp;quot;&amp;amp;encoding&amp;quot;) )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don't hesitate reading the whole thread to understand better how vim deals with encoding, and also read :he encoding&lt;br /&gt;
[[Category:Python]]&lt;br /&gt;
[[Category:Scripting]]&lt;br /&gt;
[[Category:Utf8]]&lt;/div&gt;</description>
			<pubDate>Sun, 17 Mar 2013 16:54:51 GMT</pubDate>			<dc:creator>82.66.217.91</dc:creator>			<comments>http://vim.wikia.com/wiki/Talk:Python_script_utf8_encoding</comments>		</item>
		<item>
			<title>Automatic session restore in git directories</title>
			<link>http://vim.wikia.com/wiki/Automatic_session_restore_in_git_directories</link>
			<guid isPermaLink="false">http://vim.wikia.com/wiki/Automatic_session_restore_in_git_directories</guid>
			<description>&lt;p&gt;131.181.251.21: Created page with &amp;quot;300px 300px  Daily I need to switch between different [http://git-scm.com/ git] projects. This script automatically...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Placeholder|video|right|300px]] [[File:Placeholder|right|300px]] &lt;br /&gt;
Daily I need to switch between different [http://git-scm.com/ git] projects. This script automatically saves vim sessions per git directory.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
* Starting vim with no filename argument in a git directory will load a previously stored session if one exists.&lt;br /&gt;
* Exiting vim (with no filename argument given at invocation) in a git directory will store the current session.&lt;br /&gt;
* Starting vim with a filename argument doesn't restore nor save a session.&lt;br /&gt;
&lt;br /&gt;
== Caveats ==&lt;br /&gt;
* &amp;lt;code&amp;gt;$HOME/.vim/sessions&amp;lt;/code&amp;gt; must exist.&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function! FindProjectName()&lt;br /&gt;
    let s:name = getcwd()&lt;br /&gt;
    if !isdirectory(&amp;quot;.git&amp;quot;)&lt;br /&gt;
        let s:name = substitute(finddir(&amp;quot;.git&amp;quot;, &amp;quot;.;&amp;quot;), &amp;quot;/.git&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    if s:name != &amp;quot;&amp;quot;&lt;br /&gt;
        let s:name = matchstr(s:name, &amp;quot;.*&amp;quot;, strridx(s:name, &amp;quot;/&amp;quot;) + 1)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return s:name&lt;br /&gt;
endfunction&lt;br /&gt;
&lt;br /&gt;
&amp;quot; Sessions only restored if we start vim without args.&lt;br /&gt;
function! RestoreSession(name)&lt;br /&gt;
    if a:name != &amp;quot;&amp;quot;&lt;br /&gt;
        if filereadable($HOME . &amp;quot;/.vim/sessions/&amp;quot; . a:name)&lt;br /&gt;
            execute 'source ' . $HOME . &amp;quot;/.vim/sessions/&amp;quot; . a:name&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
endfunction&lt;br /&gt;
&lt;br /&gt;
&amp;quot; Sessions only saved if we start vim without args.&lt;br /&gt;
function! SaveSession(name)&lt;br /&gt;
    if a:name != &amp;quot;&amp;quot;&lt;br /&gt;
        execute 'mksession! ' . $HOME . '/.vim/sessions/' . a:name&lt;br /&gt;
    end&lt;br /&gt;
endfunction&lt;br /&gt;
&lt;br /&gt;
&amp;quot;&lt;br /&gt;
&amp;quot; Restore and save sessions.&lt;br /&gt;
&amp;quot;&lt;br /&gt;
if argc() == 0&lt;br /&gt;
    autocmd VimEnter * call RestoreSession(FindProjectName())&lt;br /&gt;
    autocmd VimLeave * call SaveSession(FindProjectName())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</description>
			<pubDate>Tue, 05 Feb 2013 22:18:29 GMT</pubDate>			<dc:creator>131.181.251.21</dc:creator>			<comments>http://vim.wikia.com/wiki/Talk:Automatic_session_restore_in_git_directories</comments>		</item>
		<item>
			<title>Fast buffer navigation by buffer numbers</title>
			<link>http://vim.wikia.com/wiki/Fast_buffer_navigation_by_buffer_numbers</link>
			<guid isPermaLink="false">http://vim.wikia.com/wiki/Fast_buffer_navigation_by_buffer_numbers</guid>
			<description>&lt;p&gt;217.89.139.138: Created page with &amp;quot;300px 300px  If you ever become bored by using :b[N]&amp;lt;CR&amp;gt; to switch to the N-th buffer, try this: [N]C-^ in normal m...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Placeholder|video|right|300px]] [[File:Placeholder|right|300px]] &lt;br /&gt;
If you ever become bored by using :b[N]&amp;lt;CR&amp;gt; to switch to the N-th buffer, try this: [N]C-^ in normal mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;C-^&amp;gt; cannot only switch to the previous buffer, but also to all the other buffers, if you prefix the command with the buffer number. For example, instead of using :b1&amp;lt;CR&amp;gt; to switch to the first buffer, you can use 1&amp;lt;C-^&amp;gt; and save a lot of effort and frustration :-)&lt;br /&gt;
&lt;br /&gt;
Happy Hacking!&lt;/div&gt;</description>
			<pubDate>Tue, 05 Feb 2013 07:36:53 GMT</pubDate>			<dc:creator>217.89.139.138</dc:creator>			<comments>http://vim.wikia.com/wiki/Talk:Fast_buffer_navigation_by_buffer_numbers</comments>		</item>
	</channel>
</rss>