Coder Social home page Coder Social logo

h-east / vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vim/vim

20.0 3.0 0.0 131.29 MB

Vim-CLPUM

Home Page: http://h-east.github.io/vim/

License: Vim License

Makefile 3.04% NSIS 1.16% Shell 0.40% C 90.62% IDL 0.03% Awk 0.12% Perl 0.41% Batchfile 0.08% PostScript 0.41% Smalltalk 0.16% Emacs Lisp 0.19% NewLisp 0.24% Ruby 0.26% SystemVerilog 0.18% C++ 1.53% Module Management System 0.36% Python 0.33% XS 0.33% Objective-C 0.08% DIGITAL Command Language 0.07%

vim's Introduction

Vim The editor

Github Build status Appveyor Build status Cirrus Build Status Coverage Status Coverity Scan Debian CI Packages Fossies codespell report

If you find a bug or want to discuss the best way to add a new feature, please open an issue. If you have a question or want to discuss the best way to do something with Vim, you can use StackExchange or one of the Maillists.

What is Vim?

Vim is a greatly improved version of the good old UNIX editor Vi. Many new features have been added: multi-level undo, syntax highlighting, command line history, on-line help, spell checking, filename completion, block operations, script language, etc. There is also a Graphical User Interface (GUI) available. Still, Vi compatibility is maintained, those who have Vi "in the fingers" will feel at home. See runtime/doc/vi_diff.txt for differences with Vi.

This editor is very useful for editing programs and other plain text files. All commands are given with normal keyboard characters, so those who can type with ten fingers can work very fast. Additionally, function keys can be mapped to commands by the user, and the mouse can be used.

Vim runs under MS-Windows (7, 8, 10, 11), macOS, Haiku, VMS and almost all flavours of UNIX. Porting to other systems should not be very difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me/NT/2000/XP/Vista, Amiga DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.

For Vim9 script see README_VIM9.

Distribution

You can often use your favorite package manager to install Vim. On Mac and Linux a small version of Vim is pre-installed, you still need to install Vim if you want more features.

There are separate distributions for Unix, PC, Amiga and some other systems. This README.md file comes with the runtime archive. It includes the documentation, syntax files and other files that are used at runtime. To run Vim you must get either one of the binary archives or a source archive. Which one you need depends on the system you want to run it on and whether you want or must compile it yourself. Check https://www.vim.org/download.php for an overview of currently available distributions.

Some popular places to get the latest Vim:

Compiling

If you obtained a binary distribution you don't need to compile Vim. If you obtained a source distribution, all the stuff for compiling Vim is in the src directory. See src/INSTALL for instructions.

Installation

See one of these files for system-specific instructions. Either in the READMEdir directory (in the repository) or the top directory (if you unpack an archive):

README_ami.txt		Amiga
README_unix.txt		Unix
README_dos.txt		MS-DOS and MS-Windows
README_mac.txt		Macintosh
README_haiku.txt	Haiku
README_vms.txt		VMS

There are other README_*.txt files, depending on the distribution you used.

Documentation

The Vim tutor is a one hour training course for beginners. Often it can be started as vimtutor. See :help tutor for more information.

The best is to use :help in Vim. If you don't have an executable yet, read runtime/doc/help.txt. It contains pointers to the other documentation files. The User Manual reads like a book and is recommended to learn to use Vim. See :help user-manual.

Copying

Vim is Charityware. You can use and copy it as much as you like, but you are encouraged to make a donation to help orphans in Uganda. Please read the file runtime/doc/uganda.txt for details (do :help uganda inside Vim).

Summary of the license: There are no restrictions on using or distributing an unmodified copy of Vim. Parts of Vim may also be distributed, but the license text must always be included. For modified versions, a few restrictions apply. The license is GPL compatible, you may compile Vim with GPL libraries and distribute it.

Sponsoring

Fixing bugs and adding new features takes a lot of time and effort. To show your appreciation for the work and motivate developers to continue working on Vim please send a donation.

The money you donated will be mainly used to help children in Uganda. See runtime/doc/uganda.txt. But at the same time donations increase the development team motivation to keep working on Vim!

For the most recent information about sponsoring look on the Vim web site: https://www.vim.org/sponsor/

Contributing

If you would like to help make Vim better, see the CONTRIBUTING.md file.

Information

If you are on macOS, you can use MacVim.

The latest news about Vim can be found on the Vim home page: https://www.vim.org/

If you have problems, have a look at the Vim documentation or tips: https://www.vim.org/docs.php https://vim.fandom.com/wiki/Vim_Tips_Wiki

If you still have problems or any other questions, use one of the mailing lists to discuss them with Vim users and developers: https://www.vim.org/maillist.php

If nothing else works, report bugs directly to the vim-dev mailing list: <[email protected]>

Main author

Most of Vim was created by Bram Moolenaar <[email protected]> Bram-Moolenaar

Send any other comments, patches, flowers and suggestions to the vim-dev mailing list: <[email protected]>

This is README.md for version 9.1 of Vim: Vi IMproved.

vim's People

Contributors

amaanq avatar arp242 avatar azc100 avatar brammool avatar chrisbra avatar dkearns avatar dpelle avatar dundargoc avatar errael avatar freed-wu avatar gpanders avatar h-east avatar habamax avatar ichizok avatar jamessan avatar k-takata avatar lemonboy avatar luukvbaal avatar observeroftime avatar pheiduck avatar restorerz avatar seandewar avatar shane-xb-qian avatar shougo avatar ychin avatar yegappan avatar zdohnal avatar zeertzjq avatar zewpo avatar zzzyxwvut avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

vim's Issues

Long command-line and CLPUM is wrong

When command-line cursor position + complete item length > Columns in CLPUM, command-line and last line message become scramble.

How to reproduce:

  • Terminal size is 80x24.
  • Start Vim.
    $ ./vim -N -u NONE -c "set clpum ch=2"
  • input below.
    :set w
    (:set + 75 spaces + w)
  • Start CLPUM.
    <C-D>

Expected behaivior:

  • Command-line and last line message each appear.
    (Command-line maybe scrolled 1 up)

Actual behaivior:

  • It is scramble to display.

SEGV when using `<C-R>=`

SEGV occurs when using <C-R>= expansion.

[environment]
Vim 7.4.1832 on Ubuntu 16.04

[repro steps]

$ cat test.vim
if has('clpum')
  set wildmode=popup
  set wildmenu
endif
$ vim -Nu NONE -S test.vim

input keys,

:<C-R>=<CR><TAB>

and SEGV occurs.

[cause]

stacktrace.1 (when expansion)

#0  getcmdline (firstc=61, count=0, indent=0) at ex_getln.c:387
#1  0x000000000050c053 in get_expr_register () at ops.c:784
#2  0x00000000004897e5 in getcmdline (firstc=58, count=1, indent=0) at ex_getln.c:1454
#3  0x000000000048b05b in getexline (c=58, cookie=0x0, indent=0) at ex_getln.c:2497
#4  0x0000000000470d4c in do_cmdline (cmdline=0x0, fgetline=0x48b01e <getexline>, cookie=0x0, flags=0) at ex_docmd.c:1003
#5  0x0000000000503254 in nv_colon (cap=0x7fff060f2710) at normal.c:5320
#6  0x00000000004fc5ff in normal_cmd (oap=0x7fff060f27a0, toplevel=1) at normal.c:1149
#7  0x00000000005ec25c in main_loop (cmdwin=0, noexmode=0) at main.c:1359
#8  0x00000000005ebc4c in main (argc=7, argv=0x7fff060f2a88) at main.c:1051

stacktrace.2 (received SEGV)

#0  0x000000000048d962 in ExpandInit (xp=0x0) at ex_getln.c:4103
#1  0x0000000000475435 in set_one_cmd_context (xp=0x0, buff=0xc44940 "edit ") at ex_docmd.c:3422
#2  0x000000000048eacc in set_cmd_context (xp=0x0, str=0xc44940 "edit ", len=5, col=5) at ex_getln.c:4784
#3  0x0000000000496643 in clpum_complete (c=9) at ex_getln.c:8866
#4  0x00000000004889a7 in getcmdline (firstc=58, count=1, indent=0) at ex_getln.c:1102
#5  0x000000000048b05b in getexline (c=58, cookie=0x0, indent=0) at ex_getln.c:2497
#6  0x0000000000470d4c in do_cmdline (cmdline=0x0, fgetline=0x48b01e <getexline>, cookie=0x0, flags=0) at ex_docmd.c:1003
#7  0x0000000000503254 in nv_colon (cap=0x7fff060f2710) at normal.c:5320
#8  0x00000000004fc5ff in normal_cmd (oap=0x7fff060f27a0, toplevel=1) at normal.c:1149
#9  0x00000000005ec25c in main_loop (cmdwin=0, noexmode=0) at main.c:1359
#10 0x00000000005ebc4c in main (argc=7, argv=0x7fff060f2a88) at main.c:1051

It nests getcmdline, so clpum_compl_xp points NULL when entering clpum_complete.

getcmdline              # L383: set clpum_compl_xp to &xpc
__get_expr_register
____getcmdline          # L383: set clpum_compl_xp to &xpc
                        # and L2218: set clpum_compl_xp to NULL
__clpum_complete        # clpum_compl_xp is NULL

When stop CLPUM, characters are deleted under the cursor until the end of the command-line.

How to reproduce:

  • Start pure Vim with enable clpum.
    $ vim -N -u NONE -c "set clpum"
  • Input below.
    :abcde<C-B>set w
  • Start CLPUM and insert second item.
    <Tab><Tab>
  • Stop CLPUM and go back to the originally typed text.
    <C-E>

Expected behavior:

  • The following characters are displayed on the command line. (| is cursor)
    :set w|abcde

Actual behavior:

  • Displayed this. Where is abcde gone?
    :set w|

popup menu inside terminal window is not cleared when closed

Hi!
Thanks for making this patch, I hope it gets included in Vim.

When popup menu is overlapping terminal window it is not cleared when closed. The issue and a fix are both related to vim#2908

diff --git a/src/clpum.c b/src/clpum.c
index 22ec3a487..c8b7025e2 100644
--- a/src/clpum.c
+++ b/src/clpum.c
@@ -394,7 +394,7 @@ clpum_undisplay(void)
     //FreeWild(clpum_size, clpum_array);
     clpum_array = NULL;
     //clpum_size = -1;
-    redraw_all_later(SOME_VALID);
+    redraw_all_later(NOT_VALID);
 #ifdef FEAT_WINDOWS
     redraw_tabline = TRUE;
 #endif

A match item is inserted when option 'clcot' not set.

How to reproduce:

  • Start pure Vim with some options.
    $vim -Nu NONE -c "set wmnu wim=popup"
  • clpum triggerd.
    :set <TAB>

Expected behavior:

A popup menu is displayed and command-line stay :set. Because option clcot default value is "menuone,noinsert".

Actual behavior:

A popup menu is displayed and command-line completed to :set all. Unexpected completion.

CLPUM flickers

How to reproduce:

$ vim -N -u NONE -c "set clpum"
:set <C-D>
Continue to press the <C-D>.

Vim is crashed if input() was called with complete functions

input() 関数を第3引数つき(補完つき)で呼び出すと、補完を開始したタイミングで落ちます。

Environment

  • Windows 10 64bit
  • MINGW64 でビルド

How to reproduce

gvim -N -u NONE または vim -N -u NONE

で起動した後、
以下のスクリプトを読み込みます(cmdlineから入力しても再現可能)

set wildmenu wildmode=popup
call input('', '', 'option')

<TAB> を何度か叩きます。

filename/menu name completion issue happen, when "set wmnu wim=popup clcot=menu,noinsert" and type <RIGHT>

Step to reproduce:

in Vim clone directory (:cd vim/src)

  1. Start pure Vim and some options.
    $ vim -Nu NONE -c "set wmnu wim=popup clcot=menu,noinsert"
  2. Start filename completion and select "testdir/" by up/down cursor key.
    :cd <TAB>↑↑↑↑
  3. Type right cursor key and select "testdir/pythonx/" by up/down cursor key.
    →↓↓↓↓
  4. Type right cursor key.

Expect behavior:

  • Popup is undisplayed.

Actual behavior:

  • Previous popup was displayed.

CLPUM is not triggered by <TAB> key.

https://groups.google.com/d/msg/vim_dev/E3zq6C_b23k/sEmckDA9AwAJ

Now behavior:

- When 'clpum' option is on.
  - `<TAB>` behavior:
    When not started CLPUM, conform to 'wildmenu' and 'wildmode'. 
    When started CLPUM, Use the next match.  This match replaces the previous one.

  - `<C-D>` behavior:
    When not started CLPUM, CLPUM is triggered.  
    When started CLPUM, Use the next match.  This match replaces the previous one.

I'll change to the following behavior.

- When 'clpum' option is on.
  - `<TAB>` and `<C-D>` behavior:
    When not started CLPUM, CLPUM is triggered.  
    When started CLPUM, Use the next match.  This match replaces the previous one.

cannot accept selection when popup menu is not visible

With the following settings:

  set wildmode=popup
  set wildmenu
  set clcompleteopt=menu

Enter:

  • :colorsch
  • Press <tab>
  • Press <c-y>
  • Instead of accepting selection ^Y is inserted.

The following is what fixed it for me.

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 6b19c8c8c..0673418b6 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -8969,8 +8969,7 @@ clpum_compl_prep(int c)
 	     * the selection without inserting anything.  When
 	     * clpum_compl_enter_selects is set the Enter key does the same. */
 	    if ((c == Ctrl_Y || (clpum_compl_enter_selects
-				   && (c == CAR || c == K_KENTER || c == NL)))
-		    && clpum_visible())
+				   && (c == CAR || c == K_KENTER || c == NL))))
 		retval = TRUE;
 
 	    /* CTRL-E means completion is Ended, go back to the typed text. */

The first item is not inserted to command-line

Problem

The first item bar is selected in completion menu, but not inserted to command-line
when pressing <Tab> to complete file paths.

820374ec9ac22beedc04a531637fc0c5

Steps to reproduce

set wildmode=popup
set wildmenu
set clpumheight=40
$ ls -1 tmp
bar
baz
foo
  1. vim --clean -S clpum.vim
  2. :e tmp/<Tab>

It shows bar, baz, foo in completion menu, and the first item bar is selected.
But bar is not inserted to command-line.
So the next <Tab> selects and inserts the second item baz not the first item bar.

CLPUM doesn't appear if some options are set

&conceallevel > 0 の状態で cursorline, cursorcolumn, relativenumber のいずれかを設定すると、
<C-D> で CLPUM が表示されないことがあります。

[repro steps]

vimrc:

if exists('+clpum')
    set clpum
    set clpumheight=40
    set clcompleteopt+=noinsert
endif
set cole=1 cul
vim -u vimrc -N
:set <C-D>

expected: CLPUM が表示される
actual: CLPUM が表示されない

内部的には処理が実行されているので、<C-N> 等で候補選択すると CLPUM が表示されます。

[investigation]

vim/src/main.c

Line 1196 in 60422e6

conceal_update_lines = TRUE;

&conceallevel > 0 のとき conceal_update_lines = TRUE

vim/src/main.c

Line 1299 in 60422e6

curwin->w_valid &= ~VALID_CROW;

で、curwin->w_valid &= ~VALID_CROW となる

vim/src/move.c

Line 970 in 60422e6

if (!(curwin->w_valid & VALID_CROW))

vim/src/move.c

Line 795 in 60422e6

redraw_for_cursorline(curwin);

そのため、CLPUM 実行時に curs_columns > curs_rows > redraw_for_cursorline と呼ばれ、

vim/src/move.c

Line 145 in 60422e6

redraw_win_later(wp, SOME_VALID);

ここで、cursorline, relativenumber がセットされていると redraw_win_later(wp, SOME_VALID) が呼ばれるため、この後の再描画で CLPUM が消去されてしまいます。

[solution proposal]

vim/src/move.c

Line 142 in 60422e6

&& !pum_visible()

vim/src/move.c

Line 824 in 60422e6

&& !pum_visible()

vim/src/move.c

Line 1197 in 60422e6

&& !pum_visible()

上記箇所の判定に && !clpum_visible() を追加することで領域の再描画を回避できました。

Shift-Tab does not show popup

Problem

With vim --clean, Shift-Tab in command-line completes the last filename.
I want clpum to show popup even when pressing Shift-Tab.

502aebc532f9f3182cda6fa98806e370

Sorry, I tried this only in CUI Vim.

Steps to reproduce

vimrc

set wildmode=popup
set wildmenu
set clpumheight=40
  1. vim --clean -S clpum.vim
  2. :e <S-Tab>

It does not show popup.
It works the same as plain vim behavior.

Environment

WSL Debian 9.5
Microsoft Windows 10 Pro 64bit 10.0.17134

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.