diff options
| author | ryanss | 2015-02-21 16:20:44 -0500 |
|---|---|---|
| committer | ryanss | 2015-02-21 17:21:10 -0500 |
| commit | e4387a47276081ba1d514ce81e1ac8132ace2ba6 (patch) | |
| tree | 035f689e40d587668d66e3de96d18358271765d6 /ftplugin/hackernews.vim | |
| parent | 67a4d9db6193d11527ccc9c096a1778be74d52f5 (diff) | |
| download | vim-hn-e4387a47276081ba1d514ce81e1ac8132ace2ba6.tar.gz | |
Fix #28 Add Python3 support
Diffstat (limited to 'ftplugin/hackernews.vim')
| -rw-r--r-- | ftplugin/hackernews.vim | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ftplugin/hackernews.vim b/ftplugin/hackernews.vim index 7604ca5..86c3293 100644 --- a/ftplugin/hackernews.vim +++ b/ftplugin/hackernews.vim @@ -8,8 +8,12 @@ " Version: 0.1.1 -if !has('python') - echo "HackerNews.vim Error: Requires Vim compiled with +python" +if has('python') + command! -nargs=1 Python python <args> +elseif has('python3') + command! -nargs=1 Python python3 <args> +else + echo "HackerNews.vim Error: Requires Vim compiled with +python or +python3" finish endif @@ -19,10 +23,10 @@ endif " Import Python code -execute "python import sys" -execute "python sys.path.append(r'" . expand("<sfile>:p:h") . "')" +execute "Python import sys" +execute "Python sys.path.append(r'" . expand("<sfile>:p:h") . "')" -python << EOF +Python << EOF if 'hackernews' not in sys.modules: import hackernews else: @@ -32,14 +36,14 @@ EOF " Load front page -execute "python hackernews.main()" +execute "Python hackernews.main()" -noremap <buffer> o :python hackernews.link()<cr> -noremap <buffer> O :python hackernews.link(external=True)<cr> -noremap <buffer> gx :python hackernews.link(external=True)<cr> -noremap <buffer> u u:python hackernews.recall_pos()<cr> -noremap <buffer> <C-r> <C-r>:python hackernews.recall_pos()<cr> +noremap <buffer> o :Python hackernews.link()<cr> +noremap <buffer> O :Python hackernews.link(external=True)<cr> +noremap <buffer> gx :Python hackernews.link(external=True)<cr> +noremap <buffer> u u:Python hackernews.recall_pos()<cr> +noremap <buffer> <C-r> <C-r>:Python hackernews.recall_pos()<cr> " Helper motion to browse front page easier |
