GithubHelp home page GithubHelp logo

pyvim's Introduction

pyvim

An implementation of Vim in Python

pip install pyvim

Issues, questions, wishes, comments, feedback, remarks? Please create a GitHub issue, I appreciate it.

Build Status

Installation

Simply install pyvim using pip:

pip install pyvim

It is a good idea to add the following to your ~/.bashrc if you really want to use it:

alias vi=pyvim
export EDITOR=pyvim

The good things

The editor is written completely in Python. (There are no C extensions). This makes development a lot faster. It's easy to prototype and integrate new features.

We have already many nice things, for instance:

  • Syntax highlighting of files, using the Pygments lexers.
  • Horizontal and vertical splits, as well as tab pages. (Similar to Vim.)
  • All of the functionality of prompt_toolkit. This includes a lot of Vi key bindings, it's platform independent and runs on every Python version from python 2.6 up to 3.4. It also runs on Pypy with a noticeable performance boost.
  • Several :set ... commands have been implemented, like incsearch, number, ignorecase, wildmenu, expandtab, hlsearch, ruler, paste and tabstop.
  • Other working commands: vsplit, tabnew, only, badd, and many others.
  • For Python source code, auto completion uses the amazing Jedi library, and code checking in done (asynchronously) through Pyflakes.
  • Colorschemes can be changed at runtime.

Further, when the project develops, it should also become possible to write extensions in Python, and use Python as a scripting language. (Instead of vimscript, for instance.)

We can also do some cool stuff. Like for instance running the editor on the Python asyncio event loop and having other coroutines interact with the editor.

Some more screenshots

Editing its own source code:

Window layouts (horizontal and vertical splits + tab pages.)

Pyflakes for Python code checking and Jedi for autocompletion:

Other colorschemes:

Chinese and Japanese input (double width characters):

Configuring pyvim

It is possible to create a .pyvimrc file for a custom configuration. Have a look at this example: pyvimrc

Limitations

Compared to Vi Improved, Pyvim is still less powerful in many aspects.

  • prompt_toolkit does not (or not yet) allow buffers to have an individual cursor when buffers are opened in several windows. Currently, this results in some unexpected behaviour, when a file is displayed in two windows at the same time. (The cursor could be displayed in the wrong window and other windows will sometimes scroll along when the cursor moves.) This has to be fixed in the future.
  • The data structure for a buffer is extremely simple. (Right now, it's just a Python string, and an integer for the cursor position.) This works extremely well for development and quickly prototyping of new features, but it comes with a performance penalty. Depending on the system, when a file has above a thousand lines and syntax highlighting is enabled, editing will become noticeable slower. (The bottleneck is probably the BufferControl code, which on every key press tries to reflow the text and calls pygments for highlighting. And this is Python code looping through single characters.)
  • A lot of nice Vim features, like line folding, macros, etcetera are not yet implemented.
  • Windows support is not that nice. It works, but could be improved. (I think most Windows users are not that interested in this project, but prove me wrong.)

Roadmap

There is no roadmap. I mostly implement the stuff which I need or interests me, or which gives me the opportunity to learn. But feel free to create a GitHub issue to request a new feature. Pull requests are also welcome. (Maybe create an issue first to discuss it, if you're unsure whether I'll merge it.)

Maybe some day we will have a better data structure (Rope), that makes it possible to open really large files. (With good algorithms, Python does not have to be slower than C code.)

Maybe we will also have line folding and probably block editing. Maybe some day we will have a built-in Python debugger or mouse support. We'll see. :)

Testing

To run all tests, install pytest:

pip install pytest

And then run from root pyvim directory:

py.test

To test pyvim against all supported python versions, install tox:

pip install tox

And then run from root pyvim directory:

tox

You need to have installed all the supported versions of python in order to run tox command successfully.

Why did I create Pyvim?

There are several reasons.

The main reason is maybe because it was a small step after I created the Python prompt-toolkit library. That is a library which is actually only a simply pure Python readline replacement, but with some nice additions like syntax highlighting and multiline editing. It was never intended to be a toolkit for full-screen terminal applications, but at some point I realised that everything we need for an editor was in there and I liked to challenge its design. So, I started an editor and the first proof of concept was literally just a few hundred lines of code, but it was already a working editor.

The creation of pyvim will make sure that we have a solid architecture for prompt-toolkit, but it also aims to demonstrate the flexibility of the library. When it makes sense, features of pyvim will move back to prompt-toolkit, which in turn also results in a better Python REPL. (see ptpython, an alternative REPL.)

Above all, it is really fun to create an editor.

Alternatives

Certainly have a look at the alternatives:

Q & A:

Q

Do you use curses?

A

No, it uses only prompt-toolkit.

Thanks

  • To Vi Improved, by Bram Moolenaar. For the inspiration.
  • To Jedi, pyflakes and the docopt Python libraries.
  • To the Python wcwidth port of Jeff Quast for support of double width characters.
  • To Guido van Rossum, for creating Python.

pyvim's People

Contributors

bobotig avatar cosven avatar davidbrochart avatar finnoleary avatar gbin avatar jdtemplet avatar jonathanslenders avatar kyleterry avatar lieryan avatar lowks avatar lunemec avatar maome avatar sanketdg avatar thuibr avatar timgates42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyvim's Issues

Mouse scrolling not working properly

In vim when you want mouse scrolling to scroll instead of just moving your cursor, you set in your .vimrc these:

set mouse=a
set ttymouse=xterm2

I tried to set these options in pyvim, but there are none. They should either be options, or enabled by default.

Ctrl-d causes delete instead of page-down

On Mac OS X using iTerm2

Ctrl-u causes half page-up as expected, whereas ctrl-d causes deletion of the character under the cursor instead of page-down as expected

Why are most of vim's shortcuts in prompt-toolkit?

I was trying to add some shortcuts, but I was wondering where are most shortcuts for pyvim. I found them all in python-prompt-toolkit, why is that? You want to provide vim-like shortcuts to all who use prompt-toolkit?

please also make pyvim as python executable module, which can be started as: "python -m pyvim"

after installation we need to type pyvim to run it, which is fine.

please pyvim be also made a executable module , such that we can run it using

    python -m pyvim

It will be useful when there are multiple installation of python on the system - such as python3.3 ,python3.4 ,python 3.5 , and i want to install it in particular python and launch it from there as:

    mypip3.4 install pyvim     #this is already do-able,obviously
    mypython3.4 -m pyvim    #this needs t be supported

feature - visual indent to stay selected

I have some vim plugin for this functionality - when you select some code and use < and > to move its indent, it stays selected. This is awesome feature and should be by default (in vim).

pyvim failed

hello
i had install pyvim with no error, but when execute pyvim it can't running it says
ereo@orangestar:~/Software/pyvim$ pyvim
Traceback (most recent call last):
File "/usr/local/bin/pyvim", line 9, in
load_entry_point('pyvim==0.0.2', 'console_scripts', 'pyvim')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 521, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2632, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2312, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2318, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "build/bdist.linux-x86_64/egg/pyvim/entry_points/run_pyvim.py", line 17, in
File "build/bdist.linux-x86_64/egg/pyvim/editor.py", line 27, in
File "build/bdist.linux-x86_64/egg/pyvim/layout.py", line 17, in
ImportError: No module named reactive

did i do something wrong? missing module?

regards

Not working with PyPy3

Installed pyvim with pypy -m pip install pyvim, launching with C:\PyPy3\bin\pyvim.exe, getting this error:

Fatal error in launcher: Job information querying failed

Using PyPy3 2.4.0 (32 bit).

Visual inside word and () not working

In vim, when you press viw it select visual inside word and selects entire word. Now in pyvim it only selects from current cursor position.

Also vi) or vi( visual inside () is not working.

Visual around also is not working. va( va) vaw ... visual around () or visual around word.

.pyvimrc example throws errors

Traceback (most recent call last):
File "/Users/lillian/Documents/Projects/feeder/fbase/lib/python2.7/site-packages/pyvim/rc_file.py", line 52, in run_rc_file
namespace'configure'
File "/Users/lillian/.pyvimrc", line 33, in configure
self.display_unprintable_characters = True
NameError: global name 'self' is not defined

Press ENTER to continue...

pyvim installed in virtualenvvia pip on OS X 10.10.3 and python 2.7.6
.pyvimrc saved direct from site, no edits.

Syntax checking is not working

When I create file with obvious syntax error, or bad import or other such thing, nothing happens. No errors, no warnings. Even after :w save still nothing. I installed pyflakes again with pip install pyflakes --upgrade, but I still have this issue. Any ideas?

feature - ctrlp plugin like functionality

I'm using ctrlp plugin, it basically scans the file and directory structure and provides smart file completion - file search. Sublime editor has similar feature. This is also super handy feature.

:q not closing editor, ZZ not working as well

I've noticed that ":q" causes (even on not changed file) to say "1 more file to edit" and editor will not close. ZZ does nothing, it should be equivalent to ":q".

Also ":bd" should close a split window (":q" should too).

Buffer indexing has wrong order

In vim when you open another buffer, it has current buffer number + 1. Now in pyvim it has buffer 0. Try openning one file, it gets buffer id 0. Open another file, and that now has also buffer id 0, but the previous opened file has buffer id 1. It should be indexed from buffer 1 up. First file gets buffer 1, another file gets buffer 2 .. etc. ..

Basic fuctions such as Insert not working

I'm having a hard time getting pyvim to do basic things such as allow me to type in the document. Hitting insert sill sometimes go to -- INSERT -- and hitting it again will not take me to --REPLACE --. Also I'm not able to leave the PyVim help, :q replies "No write since last change (add ! to override) but :q! replies "2 more files to edit".

Is the application just not ready for normal use yet? The screenshots look so good :/

pytest instead of unittest

I suggest py.test instead of unittest for testing. I've been using pytest for large project for about half a year now and it is much better. And there is still time to switch with only one test :)

No Jedi completion

Not getting Jedi completion in Python source files. Tried enabling it with ':set jedi' at the Vim command prompt and also using the example file. Installed pyvim in a virtualenv under Python 2.7.9 on Debian. The jedi module did get installed by pip and imports OK in a Python prompt.

All else works great. Must be doing something wrong ...

UnicodeEncodeError: 'ascii' codec can't encode characters in position 2435-2442: ordinal not in range(128)

File "/usr/local/bin/pyvim", line 11, in (60,1) - 25%
sys.exit(run())
File "/usr/local/lib/python2.7/site-packages/pyvim/entry_points/run_pyvim.py", line 48, in run
editor.run()
File "/usr/local/lib/python2.7/site-packages/pyvim/editor.py", line 288, in run
self.cli.read_input(reset_current_buffer=False)
File "/usr/local/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 325, in read_input
self.renderer.reset()
File "/usr/local/lib/python2.7/site-packages/prompt_toolkit/renderer.py", line 211, in reset
self.output.flush()
File "/usr/local/lib/python2.7/site-packages/prompt_toolkit/terminal/vt100_output.py", line 166, in flush
self.stdout.write(data)

Potential Bug: Green text becoming invisible

I wrote a simple python Hello World program.
Then out of curiosity I just added about 200 empty lines after it. And then deleted them.
To my surprise now every time I try to write the print statement (that should appear in green color) the print keyword becomes invisible.
Even after restarting PyVim and my system, it does not revert to the original.

Note:
In the screenshot given below, the first line has been highlighted in visual mode and the second line has the cursor on the letter 'p'.

screenshot from 2015-05-01 20 20 57

This may be a minor color bug or it may be a specific case of a more general issue. Will try to research on its effects.

PS: I am a student and a novice to OSS. Kindly please tell me if I do something wrong to help me learn. :)

vi or vim clone?

README.rst says "A Vi clone in Python" but other text hint at it being a vim clone. Is this a vi or vim clone? I guess it's a typo in the README

setup.py install fails

Installing went fine, this however occurs when trying to run pyvim:

Traceback (most recent call last):            
  File "/usr/bin/pyvim", line 9, in <module>
    load_entry_point('pyvim==0.0.4', 'console_scripts', 'pyvim')()
  File "/usr/lib/python3.4/site-packages/pyvim-0.0.4-py3.4.egg/pyvim/entry_points/run_pyvim.py", line 34, in run
  File "/usr/lib/python3.4/site-packages/pyvim-0.0.4-py3.4.egg/pyvim/editor.py", line 92, in __init__
  File "/usr/lib/python3.4/site-packages/pyvim-0.0.4-py3.4.egg/pyvim/editor.py", line 177, in _create_application
TypeError: __init__() got an unexpected keyword argument 'get_style'

Am I missing something?

Split windows scroll together

When you :split or :vsplit the same file and scroll in one of them, both splits get scrolled. This should not happen.

pyvim with pypy will not run

pypy seems to be missing some built-in packages and will not run:

pypy pyvim/entry_points/run_pyvim.py

Traceback (most recent call last):
  File "app_main.py", line 75, in run_toplevel
  File "pyvim/entry_points/run_pyvim.py", line 14, in <module>
    import docopt
ImportError: No module named docopt

I wanted to try pypy because python seems to be a bit laggy.

PEP 8 check

I'm not exactly sure how the pyflakes works with files, but I'm missing the ability to see pep8 warnings and other in small horizontal split below the open file. This is extremely handy feature.

Substitute not working

4.2 Substitute                      *:substitute*
                            *:s* *:su*
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]
            For each line in [range] replace a match of {pattern}
            with {string}.
            For the {pattern} see |pattern|.
            {string} can be a literal string, or something
            special; see |sub-replace-special|.
            When [range] and [count] are omitted, replace in the
            current line only.
            When [count] is given, replace in [count] lines,
            starting with the last line in [range].  When [range]
            is omitted start in the current line.
            Also see |cmdline-ranges|.
            See |:s_flags| for [flags].

This is functionality for search and replace %s/search/replace/g

                            *:s_flags*
The flags that you can use for the substitute commands:

[&] Must be the first one: Keep the flags from the previous substitute
    command.  Examples: >
        :&&
        :s/this/that/&
<   Note that `:s` and `:&` don't keep the flags.
    {not in Vi}

[c] Confirm each substitution.  Vim highlights the matching string (with
    |hl-IncSearch|).  You can type:             *:s_c*
        'y'     to substitute this match
        'l'     to substitute this match and then quit ("last")
        'n'     to skip this match
        <Esc>   to quit substituting
        'a'     to substitute this and all remaining matches {not in Vi}
        'q'     to quit substituting {not in Vi}
        CTRL-E  to scroll the screen up {not in Vi, not available when
            compiled without the |+insert_expand| feature}
        CTRL-Y  to scroll the screen down {not in Vi, not available when
            compiled without the |+insert_expand| feature}
    If the 'edcompatible' option is on, Vim remembers the [c] flag and
    toggles it each time you use it, but resets it when you give a new
    search pattern.
    {not in Vi: highlighting of the match, other responses than 'y' or 'n'}

[e]     When the search pattern fails, do not issue an error message and, in
    particular, continue in maps as if no error occurred.  This is most
    useful to prevent the "No match" error from breaking a mapping.  Vim
    does not suppress the following error messages, however:
        Regular expressions can't be delimited by letters
        \ should be followed by /, ? or &
        No previous substitute regular expression
        Trailing characters
        Interrupted
    {not in Vi}

[g] Replace all occurrences in the line.  Without this argument,
    replacement occurs only for the first occurrence in each line.  If
    the 'edcompatible' option is on, Vim remembers this flag and toggles
    it each time you use it, but resets it when you give a new search
    pattern.  If the 'gdefault' option is on, this flag is on by default
    and the [g] argument switches it off.

[i] Ignore case for the pattern.  The 'ignorecase' and 'smartcase' options
    are not used.
    {not in Vi}

[I] Don't ignore case for the pattern.  The 'ignorecase' and 'smartcase'
    options are not used.
    {not in Vi}

[n] Report the number of matches, do not actually substitute.  The [c]
    flag is ignored.  The matches are reported as if 'report' is zero.
    Useful to |count-items|.
    If \= |sub-replace-expression| is used, the expression will be
    evaluated in the |sandbox| at every match.

[p] Print the line containing the last substitute.

[#] Like [p] and prepend the line number.

[l] Like [p] but print the text like |:list|.

[r] Only useful in combination with `:&` or `:s` without arguments.  `:&r`
    works the same way as `:~`:  When the search pattern is empty, use the
    previously used search pattern instead of the search pattern from the
    last substitute or `:global`.  If the last command that did a search
    was a substitute or `:global`, there is no effect.  If the last
    command was a search command such as "/", use the pattern from that
    command.
    For `:s` with an argument this already happens: >
        :s/blue/red/
        /green
        :s//red/   or  :~   or  :&r
<   The last commands will replace "green" with "red". >
        :s/blue/red/
        /green
        :&
<   The last command will replace "blue" with "red".
    {not in Vi}

Note that there is no flag to change the "magicness" of the pattern.  A
different command is used instead, or you can use |/\v| and friends.  The
reason is that the flags can only be found by skipping the pattern, and in
order to skip the pattern the "magicness" must be known.  Catch 22!

If the {pattern} for the substitute command is empty, the command uses the
pattern from the last substitute or `:global` command.  If there is none, but
there is a previous search pattern, that one is used.  With the [r] flag, the
command uses the pattern from the last substitute, `:global`, or search
command.

If the {string} is omitted the substitute is done as if it's empty.  Thus the
matched pattern is deleted.  The separator after {pattern} can also be left
out then.  Example: >
    :%s/TESTING
This deletes "TESTING" from all lines, but only one per line.

For compatibility with Vi these two exceptions are allowed:
"\/{string}/" and "\?{string}?" do the same as "//{string}/r".
"\&{string}&" does the same as "//{string}/".
                            *E146*
Instead of the '/' which surrounds the pattern and replacement string, you
can use any other single-byte character, but not an alphanumeric character,
'\', '"' or '|'.  This is useful if you want to include a '/' in the search
pattern or replacement string.  Example: >
    :s+/+//+

For the definition of a pattern, see |pattern|.  In Visual block mode, use
|/\%V| in the pattern to have the substitute work in the block only.
Otherwise it works on whole lines anyway.

                    *sub-replace-special* *:s\=*
When the {string} starts with "\=" it is evaluated as an expression, see
|sub-replace-expression|.  You can use that for complex replacement or special
characters.

Otherwise these characters in {string} have a special meaning:
                                *:s%*
When {string} is equal to "%" and '/' is included with the 'cpoptions' option,
then the {string} of the previous substitute command is used, see |cpo-/|

magic   nomagic   action    ~
  &   \&      replaced with the whole matched pattern        *s/\&*
 \&    &      replaced with &
      \0      replaced with the whole matched pattern      *\0* *s/\0*
      \1      replaced with the matched pattern in the first
          pair of ()                         *s/\1*
      \2      replaced with the matched pattern in the second
          pair of ()                         *s/\2*
      ..      ..                             *s/\3*
      \9      replaced with the matched pattern in the ninth
          pair of ()                         *s/\9*
  ~   \~      replaced with the {string} of the previous
          substitute                         *s~*
 \~    ~      replaced with ~                    *s/\~*
      \u      next character made uppercase              *s/\u*
      \U      following characters made uppercase, until \E      *s/\U*
      \l      next character made lowercase              *s/\l*
      \L      following characters made lowercase, until \E      *s/\L*
      \e      end of \u, \U, \l and \L (NOTE: not <Esc>!)        *s/\e*
      \E      end of \u, \U, \l and \L               *s/\E*
      <CR>    split line in two at this point
          (Type the <CR> as CTRL-V <Enter>)          *s<CR>*
      \r      idem                           *s/\r*
      \<CR>   insert a carriage-return (CTRL-M)
          (Type the <CR> as CTRL-V <Enter>)          *s/\<CR>*
      \n      insert a <NL> (<NUL> in the file)
          (does NOT break the line)              *s/\n*
      \b      insert a <BS>                      *s/\b*
      \t      insert a <Tab>                     *s/\t*
      \\      insert a single backslash              *s/\\*
      \x      where x is any character not mentioned above:
          Reserved for future expansion

The special meaning is also used inside the third argument {sub} of
the |substitute()| function with the following exceptions:
  - A % inserts a percent literally without regard to 'cpoptions'.
  - magic is always set without regard to 'magic'.
  - A ~ inserts a tilde literally.
  - <CR> and \r inserts a carriage-return (CTRL-M).
  - \<CR> does not have a special meaning. it's just one of \x.

Examples: >
  :s/a\|b/xxx\0xxx/g         modifies "a b"      to "xxxaxxx xxxbxxx"
  :s/\([abc]\)\([efg]\)/\2\1/g   modifies "af fa bg" to "fa fa gb"
  :s/abcde/abc^Mde/      modifies "abcde"    to "abc", "de" (two lines)
  :s/$/\^M/          modifies "abcde"    to "abcde^M"
  :s/\w\+/\u\0/g         modifies "bla bla"  to "Bla Bla"
  :s/\w\+/\L\u/g         modifies "BLA bla"  to "Bla Bla"

Note: "\L\u" can be used to capitalize the first letter of a word.  This is
not compatible with Vi and older versions of Vim, where the "\u" would cancel
out the "\L". Same for "\U\l".

Note: In previous versions CTRL-V was handled in a special way.  Since this is
not Vi compatible, this was removed.  Use a backslash instead.

command     text    result ~
:s/aa/a^Ma/ aa  a<line-break>a
:s/aa/a\^Ma/    aa  a^Ma
:s/aa/a\\^Ma/   aa  a\<line-break>a

(you need to type CTRL-V <CR> to get a ^M here)

The numbering of "\1", "\2" etc. is done based on which "\(" comes first in
the pattern (going left to right).  When a parentheses group matches several
times, the last one will be used for "\1", "\2", etc.  Example: >
  :s/\(\(a[a-d] \)*\)/\2/      modifies "aa ab x" to "ab x"

When using parentheses in combination with '|', like in \([ab]\)\|\([cd]\),
either the first or second pattern in parentheses did not match, so either
\1 or \2 is empty.  Example: >
  :s/\([ab]\)\|\([cd]\)/\1x/g   modifies "a b c d"  to "ax bx x x"
<

Substitute with an expression           *sub-replace-expression*
                        *sub-replace-\=* *s/\=*
When the substitute string starts with "\=" the remainder is interpreted as an
expression.  This does not work recursively: a |substitute()| function inside
the expression cannot use "\=" for the substitute string.

The special meaning for characters as mentioned at |sub-replace-special| does
not apply except for "<CR>".  A <NL> character is used as a line break, you
can get one with a double-quote string: "\n".  Prepend a backslash to get a
real <NL> character (which will be a NUL in the file).

The "\=" notation can also be used inside the third argument {sub} of
|substitute()| function.  In this case, the special meaning for characters as
mentioned at |sub-replace-special| does not apply at all. Especially, <CR> and
<NL> are interpreted not as a line break but as a carriage-return and a
new-line respectively.

When the result is a |List| then the items are joined with separating line
breaks.  Thus each item becomes a line, except that they can contain line
breaks themselves.

The whole matched text can be accessed with "submatch(0)".  The text matched
with the first pair of () with "submatch(1)".  Likewise for further
sub-matches in ().

Be careful: The separation character must not appear in the expression!
Consider using a character like "@" or ":".  There is no problem if the result
of the expression contains the separation character.

Examples: >
    :s@\n@\="\r" . expand("$HOME") . "\r"@
This replaces an end-of-line with a new line containing the value of $HOME. >

    s/E/\="\<Char-0x20ac>"/g
This replaces each 'E' character with a euro sign.  Read more in |<Char->|.

zt and zb not working

I don't know if these controls are not supposed to work but as 'zz' works it seems incomplete to leave out 'zt' and 'zb'. Does this work for you? Is it actually a bug?

:q does not always work

You know the joke about vim being so popular because it's impossible to quit..?

If I start pyvim without any arguments and open a file with :e some-file, then if I try to quit vim with :q, I see the message "1 more files to edit", and nothing else happens. I have to use :q! or :qa to quit.

Instead, if I start pyvim like pyvim some-file, then :q works fine.

Keep up the good work!

Meaningful example screenshot for CJK characters

The screenshot in README for Chinese input displays weird Chinese characters, at least it's not Simplified Chinese nor Traditional Chinese. It might send a misleading signal to Chinese developers that pyvim display Chinese characters in gibberish.

I suggest using following text (Simplified Chinese) in the screenshot:

pyvim 是 Vi 的 Python 克隆版。目前本项目正处于开发阶段,但已基本可用。如果你有任何的疑惑或者发现了任何 bug,请通过 GitHub Issues 反馈。

Which means:

pyvim is a Vi clone in Python. It's under development but it's certainly usable. If you have any questions or find any bug, please feedback in GitHub Issues.

Ctrl+t does strange things

I'm not sure what is supposed to do, but when you apply it on line that has correct indent:

def _(attr):

it creates:

de f_(attr):

I'm not sure if this is desired behavior.

NerdTree like filesystem browser

I'm using vim for my programming at work and NerdTree is big part of this. Without it it feels like being without hand.

This is a feature request for something similar.

Pyflakes working strangely

When I open pyvim/commands/commands.py and goto line 357 (@cmd) it says pep warning (same way my vim does) but the code is not highlighted. The message is only displayed when you have cursor over the code. This seems strange.

Visual select behaves strangely

Goto pyvim/commands/grammar.py:34
Take cursor to column 41, press v and try to select the line to the beggining with b.
It de-selects the last >!?) characters and when you yank them, they're not there. This is not the first time I noticed this, this happens in other files too.

screenshot from 2015-05-01 20 11 48

switching between splits not working

Vim has shortcut for switching between vertical and horizontal splits:

ctrl+h/l or ctrl+left/right
ctrl+j/k or ctrl+up/down

These seem to be missing.

Named yank buffers not working

Named buffers are not working: shortcuts "3y - yank selected into buffer number 3 .. instead of numbers it can contain also letters "ay (yank buffer a). You paste this with "3p or "ap.

                            *v_y*
{Visual}["x]y       Yank the highlighted text [into register x] (for
            {Visual} see |Visual-mode|).  {not in Vi}

                            *v_Y*
{Visual}["x]Y       Yank the highlighted lines [into register x] (for
            {Visual} see |Visual-mode|).  {not in Vi}

Function names in pyvim/commands/commands.py

Aside from pep8 screaming of redefining of the same function name all the time, wouldn't there be upside to naming those functions for debugging purposes? Now when you'd print COMMANDS_TO_HANDLERS dict, you'd only get {'shortcut': <function _ 0x...>} and there is no telling them apart. While now this is OK, you can find the function by the @cmd decorator, when there is a ton of shortcuts, it'd be much better to have those functions with name.

If you agree, I'll send pull request with renaming.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.