0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

In Visual mode with 'showcmd' display the number of bytes and characters.

This commit is contained in:
Bram Moolenaar 2010-07-17 12:47:16 +02:00
parent 11505dcd2b
commit f91787cb9a
9 changed files with 53 additions and 20 deletions

View File

@ -176,11 +176,11 @@ g:gnat.Make()
*g:gnat.Pretty()*
g:gnat.Pretty()
Calls|g:gnat.Pretty_Command|
Calls|g:gnat.Pretty_Program|
*g:gnat.Find()*
g:gnat.Find()
Calls|g:gnat.Find_Command|
Calls|g:gnat.Find_Program|
*g:gnat.Tags()*
g:gnat.Tags()
@ -237,8 +237,8 @@ DEC ADA OBJECT ~
*g:decada.Make()*
g:decada.Make() function
Calls|g:decada.Make_Command|and displays the result inside a
|quickfix| window.
Calls |g:decada.Make_Command| and displays the result inside a
|quickfix| window.
*g:decada.Unit_Name()*
g:decada.Unit_Name() function
@ -246,7 +246,7 @@ g:decada.Unit_Name() function
*g:decada.Make_Command*
g:decada.Make_Command string
External command used for|g:decadat.Make()| (|'makeprg'|).
External command used for |g:decada.Make()| (|'makeprg'|).
*g:decada.Error_Format*
g:decada.Error_Format| string
@ -406,15 +406,15 @@ makes no difference.
g:gnat object
Control object which manages GNAT compiles. The object
is created when the first Ada source code is loaded provided
that |g:ada_default_compiler|is set to 'gnat'. See|gnat_members|
for details.
that |g:ada_default_compiler|is set to 'gnat'. See
|gnat_members| for details.
*g:decada*
g:decada object
Control object which manages Dec Ada compiles. The object
is created when the first Ada source code is loaded provided
that |g:ada_default_compiler|is set to 'decada'. See
|decada_members|for details.
|decada_members| for details.
------------------------------------------------------------------------------
5.4 Constants ~

View File

@ -1,4 +1,4 @@
*sql.txt* For Vim version 7.3a. Last change: 2009 Nov 03
*ft_sql.txt* For Vim version 7.3a. Last change: 2009 Nov 03
by David Fishburn
@ -632,7 +632,7 @@ your |vimrc|: >
MYTABLENAME --> M
omni_sql_ignorecase
< - Default: Current setting for|ignorecase|
< - Default: Current setting for 'ignorecase'
- Valid settings are 0 or 1.
- When entering a few letters before initiating completion, the list
will be filtered to display only the entries which begin with the

View File

@ -594,7 +594,7 @@ otherwise you would not be able to use those commands anymore. Here are a few
suggestions:
- Function keys <F2>, <F3>, etc.. Also the shifted function keys <S-F1>,
<S-F2>, etc. Note that <F1> is already used for the help command.
- Meta-keys (with the ALT key pressed). Depending on your keybord accented
- Meta-keys (with the ALT key pressed). Depending on your keyboard accented
characters may be used as well. |:map-alt-keys|
- Use the '_' or ',' character and then any other character. The "_" and ","
commands do exist in Vim (see |_| and |,|), but you probably never use them.
@ -767,7 +767,7 @@ g@{motion} Call the function set by the 'operatorfunc' option.
The function is called with one String argument:
"line" {motion} was |linewise|
"char" {motion} was |characterwise|
"block" {motion} was |blockwise-visual||
"block" {motion} was |blockwise-visual|
Although "block" would rarely appear, since it can
only result from Visual mode where "g@" is not useful.
{not available when compiled without the +eval

View File

@ -6065,6 +6065,8 @@ A jump table for the options with a short description can be found at |Q_op|.
option off if your terminal is slow.
In Visual mode the size of the selected area is shown:
- When selecting characters within a line, the number of characters.
If the number of bytes is different it is also displayed: "2-6"
means two characters and six bytes.
- When selecting more than one line, the number of lines.
- When selecting a block, the size in screen characters:
{lines}x{columns}.

View File

@ -639,7 +639,7 @@ You can now compare files in 4 ways: >
DEC C uses many identifiers with '$' in them. This is not allowed in ANSI C,
and Vim recognises the '$' as the end of the identifier. You can change this
with the |iskeyword|command.
with the 'iskeyword' option.
Add this command to your .vimrc file: >
autocmd FileType c,cpp,cs set iskeyword+=$

View File

@ -5638,6 +5638,7 @@ ft-xml-omni insert.txt /*ft-xml-omni*
ft-xml-syntax syntax.txt /*ft-xml-syntax*
ft-xpm-syntax syntax.txt /*ft-xpm-syntax*
ft_ada.txt ft_ada.txt /*ft_ada.txt*
ft_sql.txt ft_sql.txt /*ft_sql.txt*
ftdetect filetype.txt /*ftdetect*
ftp pi_netrw.txt /*ftp*
ftplugin usr_41.txt /*ftplugin*
@ -7504,7 +7505,6 @@ sql-object-motions ft_sql.txt /*sql-object-motions*
sql-predefined-objects ft_sql.txt /*sql-predefined-objects*
sql-type-default ft_sql.txt /*sql-type-default*
sql-types ft_sql.txt /*sql-types*
sql.txt ft_sql.txt /*sql.txt*
sql.vim syntax.txt /*sql.vim*
sqlanywhere ft_sql.txt /*sqlanywhere*
sqlanywhere.vim syntax.txt /*sqlanywhere.vim*

View File

@ -1155,7 +1155,7 @@ More patches:
- Patch for adding "space" item in 'listchars'. (Jérémie Roquet, 2009 Oct 29,
Docs patch Oct 30)
- Patch for supporting #rrggbb in color terminals. (Matt Wozniski)
Where is a recent version of this patch?
Where is a recent version of this patch? Or use CSApprox plugin?
- Replace ccomplete.vim by cppcomplete.vim from www.vim.org? script 1520 by
Vissale Neang. (Martin Stubenschrott) Asked Vissale to make the scripts
more friendly for the Vim distribution.
@ -3013,7 +3013,7 @@ Tags:
8 For 'tags' wildcard in the file name is not supported, only in the path.
This is due to it using |file-searching|. Suboptimal solution would be to
make the filename or the whole option use |wildcards| globing, better
would be to merge the 2 kinds of globing. originall (Erik Falor, 2008
would be to merge the 2 kinds of globing. originally (Erik Falor, 2008
April 18), updated (Ian Kelling, 2008 July 4)
8 Use a mechanism similar to omni completion to figure out the kind of tab
for CTRL-] and jump to the appropriate matching tag (if there are

View File

@ -294,7 +294,7 @@ N *+cmdline_compl* command line completion |cmdline-completion|
N *+cmdline_hist* command line history |cmdline-history|
N *+cmdline_info* |'showcmd'| and |'ruler'|
N *+comments* |'comments'| support
m *+conceal* "conceal" support, see ||conceal|| |:syn-conceal| etc.
m *+conceal* "conceal" support, see |conceal| |:syn-conceal| etc.
N *+cryptv* encryption support |encryption|
B *+cscope* |cscope| support
m *+cursorbind* |'cursorbind'| support

View File

@ -3756,9 +3756,40 @@ clear_showcmd()
else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum)
sprintf((char *)showcmd_buf, "%ld", lines);
else
sprintf((char *)showcmd_buf, "%ld", (long)(cursor_bot
? curwin->w_cursor.col - VIsual.col
: VIsual.col - curwin->w_cursor.col) + (*p_sel != 'e'));
{
char_u *s, *e;
int l;
int bytes = 0;
int chars = 0;
if (cursor_bot)
{
s = ml_get_pos(&VIsual);
e = ml_get_cursor();
}
else
{
s = ml_get_cursor();
e = ml_get_pos(&VIsual);
}
while ((*p_sel != 'e') ? s <= e : s < e)
{
l = (*mb_ptr2len)(s);
if (l == 0)
{
++bytes;
++chars;
break; /* end of line */
}
bytes += l;
++chars;
s += l;
}
if (bytes == chars)
sprintf((char *)showcmd_buf, "%d", chars);
else
sprintf((char *)showcmd_buf, "%d-%d", chars, bytes);
}
showcmd_buf[SHOWCMD_COLS] = NUL; /* truncate */
showcmd_visual = TRUE;
}