Changing the defaults with Vim 8

2016-07-24 Thread Bram Moolenaar

Vim has always been conservative about the default option values.
Without any .vimrc the default is 'compatible'.  That's nice for people
who rely on the old Vi.  But how many of these still exist?  I expect
nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.

What has stopped me from changing this is the unexpected change.  Many
users will notice that Vim suddenly behaves differently.  Some may be
upset.  The release of Vim 8.0 might be the best point in time to do
this.  If we do this.

Besides making 'nocompatible' the default, there are a few options that
should probably be on by default.  Currently these are in
$VIMRUNTIME/vimrc_example.vim.  Most of these only have a visual effect
or slightly change how editing works.  You will notice this right away.
The ones that have unexpected effects should be avoided.

If someone wants to start in the old way, the -C flag should be used:
vim -C

If someone wants to start with 'nocompatible', but not all of the new
option values, a .vimrc would be needed to change the settings.  This is
the most common and also most tricky part.  Assuming that the user will
want most of the new option values, but not all, he should be able to
revert to the old value. For options that is easy.  But including the
matchit plugin is not easy to revert.

What we can probably always do:

  set backspace=indent,eol,start
  set history=50" keep 50 lines of command line history
  set ruler " show the cursor position all the time
  set showcmd   " display incomplete commands
  set incsearch " do incremental searching

  " Don't use Ex mode, use Q for formatting
  map Q gq

  " In many terminal emulators the mouse works just fine, thus enable it.
  if has('mouse')
set mouse=a
  endif
  if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
let c_comment_strings=1
  endif

  if has("autocmd")
" Enable file type detection.
filetype plugin indent on
  
augroup vimrcEx
au!
  
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
  
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
  \ if line("'\"") >= 1 && line("'\"") <= line("$") |
  \   exe "normal! g`\"" |
  \ endif
  
augroup END
  else
set autoindent  " always set autoindenting on
  endif
  
  if has('langmap') && exists('+langnoremap')
set langnoremap
  endif


Probably not:

  " these two leave files behind
  set backup
  set undofile

  " may conflict with a user mapping
  inoremap  u

  " hard to revert
  if has('syntax') && has('eval')
packadd matchit
  endif

Comments?

-- 
TALL KNIGHT: When you have found the shrubbery, then you must cut down the
 mightiest tree in the forest ... with a herring.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread tyru
Hi Bram!

2016-07-24 22:02 GMT+09:00 Bram Moolenaar :
>
> Vim has always been conservative about the default option values.
> Without any .vimrc the default is 'compatible'.  That's nice for people
> who rely on the old Vi.  But how many of these still exist?  I expect
> nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.
>
> What has stopped me from changing this is the unexpected change.  Many
> users will notice that Vim suddenly behaves differently.  Some may be
> upset.  The release of Vim 8.0 might be the best point in time to do
> this.  If we do this.
>
> Besides making 'nocompatible' the default, there are a few options that
> should probably be on by default.  Currently these are in
> $VIMRUNTIME/vimrc_example.vim.  Most of these only have a visual effect
> or slightly change how editing works.  You will notice this right away.
> The ones that have unexpected effects should be avoided.
>
> If someone wants to start in the old way, the -C flag should be used:
> vim -C
>
> If someone wants to start with 'nocompatible', but not all of the new
> option values, a .vimrc would be needed to change the settings.  This is
> the most common and also most tricky part.  Assuming that the user will
> want most of the new option values, but not all, he should be able to
> revert to the old value. For options that is easy.  But including the
> matchit plugin is not easy to revert.
>
> What we can probably always do:
>
>   set backspace=indent,eol,start
>   set history=50" keep 50 lines of command line history
>   set ruler " show the cursor position all the time
>   set showcmd   " display incomplete commands
>   set incsearch " do incremental searching
>
>   " Don't use Ex mode, use Q for formatting
>   map Q gq
>
>   " In many terminal emulators the mouse works just fine, thus enable it.
>   if has('mouse')
> set mouse=a
>   endif
>   if &t_Co > 2 || has("gui_running")
> syntax on
> set hlsearch
> let c_comment_strings=1
>   endif
>
>   if has("autocmd")
> " Enable file type detection.
> filetype plugin indent on
>
> augroup vimrcEx
> au!
>
> " For all text files set 'textwidth' to 78 characters.
> autocmd FileType text setlocal textwidth=78
>
> " When editing a file, always jump to the last known cursor position.
> " Don't do it when the position is invalid or when inside an event handler
> " (happens when dropping a file on gvim).
> autocmd BufReadPost *
>   \ if line("'\"") >= 1 && line("'\"") <= line("$") |
>   \   exe "normal! g`\"" |
>   \ endif
>
> augroup END
>   else
> set autoindent  " always set autoindenting on
>   endif
>
>   if has('langmap') && exists('+langnoremap')
> set langnoremap
>   endif
>
>
> Probably not:
>
>   " these two leave files behind
>   set backup
>   set undofile
>
>   " may conflict with a user mapping
>   inoremap  u
>
>   " hard to revert
>   if has('syntax') && has('eval')
> packadd matchit
>   endif
>
> Comments?

I want to propose the following settings additionally.


set ambiwidth=double
set display=lastline
set formatoptions+=j
set nrformats-=octal

let s:is_win = has('win16') || has('win32') || has('win64') || has('win95')
let s:is_msys = has('win32unix') && !has('gui_running')

" Exit diff mode automatically {{{
" https://hail2u.net/blog/software/vim-turn-off-diff-mode-automatically.html

augroup vimrc-diff-autocommands
  autocmd!

  " Turn off diff mode automatically
  autocmd WinEnter *
  \ if (winnr('$') == 1) &&
  \(getbufvar(winbufnr(0), '&diff')) == 1 |
  \ diffoff   |
  \ endif
augroup END
" }}}

" Block cursor in MSYS2 console {{{
if s:is_msys
let &t_ti.="\e[1 q"
let &t_SI.="\e[5 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
endif
" }}}

" Input Method {{{
if has('multi_byte_ime') || has('xim')
" Set cursor color when IME is on.
highlight CursorIM guibg=Purple guifg=NONE
set iminsert=0 imsearch=0
endif
" }}}




>
> --
> TALL KNIGHT: When you have found the shrubbery, then you must cut down the
>  mightiest tree in the forest ... with a herring.
>  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "vim_dev" group.
> To unsubscribe from this group and st

Re: Changing the defaults with Vim 8

2016-07-24 Thread Nicola

On 2016-07-24 13:02:56 +, Bram Moolenaar said:


Vim has always been conservative about the default option values.
Without any .vimrc the default is 'compatible'.  That's nice for people
who rely on the old Vi.  But how many of these still exist?  I expect
nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.

What has stopped me from changing this is the unexpected change.  Many
users will notice that Vim suddenly behaves differently.  Some may be
upset.  The release of Vim 8.0 might be the best point in time to do
this.  If we do this.


Talking as someone who has been using Vim only for a couple of years and
who does not work with systems more than a decade old, I would welcome
such changes. And a major release obviously provides the best opportunity
for introducing backward-incompatible changes.

I agree with the defaults you are proposing. How about the following?

1) nnoremap Y y$

2) Make UTF8 the default encoding.



What we can probably always do:

  " In many terminal emulators the mouse works just fine, thus enable it.
  if has('mouse')
set mouse=a
  endif


I would also set ttymouse=sgr when possible (but I do not know all the 
implications).


Nicola


--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread lilydjwg
Hi,

On Sun, Jul 24, 2016 at 10:21:32PM +0900, tyru wrote:
> I want to propose the following settings additionally.
> 
> 
> set ambiwidth=double

Please don't do this for Linux terminals, at least when it doesn't work
well:

For the following text,

“test”
‘test’

gvim works well:
https://img.vim-cn.com/cb/1ef8cb00cb23be45a49ae2764a7c1531fb3cc0.png

But my terminal has some issue with the placement and highlighting:
https://img.vim-cn.com/92/c802187c35e82857c7c96311f9198b71a35a5c.png

The left quotes are placed too left, and the right half doesn't get
highlighted as expected.

When I delete the first t's, the display is wrong:
https://img.vim-cn.com/42/c990d919df4c568f1105063112d0569a7107da.png

This happens to me with both xterm and xfce4-terminal on Arch Linux.

Versions:

* xterm 325
* xfce4-terminal 0.6.3
* gvim 7.4.2098

It displays better with xterm -cjk_width, but there are still some issues:
https://img.vim-cn.com/d6/07e66736903fb6bb55c687237f94637765a77b.png

> set display=lastline
> set formatoptions+=j
> set nrformats-=octal
> [...]

-- 
Best regards,
lilydjwg

Linux Vim Python 我的博客:
http://lilydjwg.is-programmer.com/
-- 
A: Because it obfuscates the reading.
Q: Why is top posting so bad?

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.2099

2016-07-24 Thread Bram Moolenaar

Patch 7.4.2099
Problem:When a keymap is active only "(lang)" is displayed. (Ilya
Dogolazky)
Solution:   Show the keymap name. (Dmitri Vereshchagin, closes #933)
Files:  src/buffer.c, src/proto/screen.pro, src/screen.c


*** ../vim-7.4.2098/src/buffer.c2016-07-14 23:03:15.116509331 +0200
--- src/buffer.c2016-07-24 16:10:23.434267344 +0200
***
*** 4114,4120 
  
case STL_KEYMAP:
fillable = FALSE;
!   if (get_keymap_str(wp, tmp, TMPLEN))
str = tmp;
break;
case STL_PAGENUM:
--- 4114,4120 
  
case STL_KEYMAP:
fillable = FALSE;
!   if (get_keymap_str(wp, (char_u *)"<%s>", tmp, TMPLEN))
str = tmp;
break;
case STL_PAGENUM:
*** ../vim-7.4.2098/src/proto/screen.pro2016-04-02 19:39:11.781258089 
+0200
--- src/proto/screen.pro2016-07-24 16:10:23.434267344 +0200
***
*** 23,29 
  void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, 
int match, int showtail);
  void win_redr_status(win_T *wp);
  int stl_connected(win_T *wp);
! int get_keymap_str(win_T *wp, char_u *buf, int len);
  void screen_putchar(int c, int row, int col, int attr);
  void screen_getbytes(int row, int col, char_u *bytes, int *attrp);
  void screen_puts(char_u *text, int row, int col, int attr);
--- 23,29 
  void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, 
int match, int showtail);
  void win_redr_status(win_T *wp);
  int stl_connected(win_T *wp);
! int get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len);
  void screen_putchar(int c, int row, int col, int attr);
  void screen_getbytes(int row, int col, char_u *bytes, int *attrp);
  void screen_puts(char_u *text, int row, int col, int attr);
*** ../vim-7.4.2098/src/screen.c2016-07-10 23:16:05.112753072 +0200
--- src/screen.c2016-07-24 16:11:36.965532716 +0200
***
*** 6767,6773 
screen_fill(row, row + 1, len + W_WINCOL(wp),
this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr);
  
!   if (get_keymap_str(wp, NameBuff, MAXPATHL)
&& (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
   - 1 + W_WINCOL(wp)), attr);
--- 6767,6773 
screen_fill(row, row + 1, len + W_WINCOL(wp),
this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr);
  
!   if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL)
&& (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
   - 1 + W_WINCOL(wp)), attr);
***
*** 6862,6867 
--- 6862,6868 
  int
  get_keymap_str(
  win_T *wp,
+ char_u*fmt,   /* format string containing one %s item */
  char_u*buf,   /* buffer for the result */
  int   len)/* length of buffer */
  {
***
*** 6894,6902 
  #endif
p = (char_u *)"lang";
}
!   if ((int)(STRLEN(p) + 3) < len)
!   sprintf((char *)buf, "<%s>", p);
!   else
buf[0] = NUL;
  #ifdef FEAT_EVAL
vim_free(s);
--- 6895,6901 
  #endif
p = (char_u *)"lang";
}
!   if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1)
buf[0] = NUL;
  #ifdef FEAT_EVAL
vim_free(s);
***
*** 10166,10172 
MSG_PUTS_ATTR(_(" Arabic"), attr);
else
  # endif
!   MSG_PUTS_ATTR(_(" (lang)"), attr);
}
  #endif
if ((State & INSERT) && p_paste)
--- 10165,10173 
MSG_PUTS_ATTR(_(" Arabic"), attr);
else
  # endif
!   if (get_keymap_str(curwin, (char_u *)" (%s)",
!  NameBuff, MAXPATHL))
!   MSG_PUTS_ATTR(NameBuff, attr);
}
  #endif
if ((State & INSERT) && p_paste)
*** ../vim-7.4.2098/src/version.c   2016-07-23 22:04:30.004702632 +0200
--- src/version.c   2016-07-24 16:14:32.315783654 +0200
***
*** 760,761 
--- 760,763 
  {   /* Add new patch number below this line */
+ /**/
+ 2099,
  /**/

-- 
Q: How do you tell the difference between a female cat and a male cat?
A: You ask it a question and if HE answers, it's a male but, if SHE
   answers, it's a female.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\

[patch] fixed typos in vim/runtime/doc/version8.txt

2016-07-24 Thread Dominique Pellé
Hi

Attached patch fixes typos in changelog in version8.txt.
Those typos can't be fixed in "git log" but I think it's best
to fix them in version8.txt anyway.

Regards
Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt
index 22b15fd..aef04f1 100644
--- a/runtime/doc/version8.txt
+++ b/runtime/doc/version8.txt
@@ -638,7 +638,7 @@ Files:  src/search.c, src/testdir/test53.in, 
src/testdir/test53.ok
 Patch 7.4.051
 Problem:Syntax highlighting a Yaml file causes a crash. (Blake Preston)
 Solution:   Copy the pim structure before calling addstate() to avoid it
-   becoming invalide when the state list is reallocated.
+   becoming invalid when the state list is reallocated.
 Files: src/regexp_nfa.c
 
 Patch 7.4.052
@@ -828,7 +828,7 @@ Files:  src/Make_mvc.mak
 Patch 7.4.082
 Problem:Using "gf" in a changed buffer suggests adding "!", which is not
possible. (Tim Chase)
-Solution:   Pass a flag to check_changed() wether adding ! make sense.
+Solution:   Pass a flag to check_changed() whether adding ! make sense.
 Files: src/vim.h, src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/globals.h,
src/ex_cmds.c, src/ex_docmd.c
 
@@ -995,7 +995,7 @@ Solution:   Match with the colorscheme name. (Christian 
Brabandt)
 Files: runtime/doc/autocmd.txt, src/fileio.c, src/syntax.c
 
 Patch 7.4.110
-Problem:"gUgn" cannot be repeeated. (Dimitar Dimitrov)
+Problem:"gUgn" cannot be repeated. (Dimitar Dimitrov)
 Solution:   Don't put "gn" in a different order in the redo buffer.  Restore
'wrapscan' when the pattern isn't found. (Christian Wellenbrock)
 Files: src/normal.c, src/search.c, src/test53.in, src/test53.ok
@@ -1170,7 +1170,7 @@ Solution:   Fix the problems. (Ken Takata)
 Files: src/Make_bc5.mak, src/if_py_both.h, src/os_win32.c
 
 Patch 7.4.142 (after 7.4.137)
-Problem:On MS-Windows 8 IME input doen't work correctly.
+Problem:On MS-Windows 8 IME input doesn't work correctly.
 Solution:   Work around the problem. (Nobuhiro Takasaki)
 Files: src/os_win32.c
 
@@ -1186,7 +1186,7 @@ Files:src/os_mswin.c
 
 Patch 7.4.145
 Problem:getregtype() does not return zero for unknown register.
-Solution:   Adjust documention: return empty string for unknown register.
+Solution:   Adjust documentation: return empty string for unknown register.
Check the register name to be valid. (Yukihiro Nakadaira)
 Files: runtime/doc/eval.txt, src/ops.c
 
@@ -1711,7 +1711,7 @@ Files:src/ex_cmds.c, src/ex_docmd.c, 
src/proto/ex_docmd.pro
 
 Patch 7.4.233
 Problem:Escaping special characters for using "%" with a shell command is
-   inconsistant, parenthesis are escaped but spaces are not.
+   inconsistent, parentheses are escaped but spaces are not.
 Solution:   Only escape "!". (Gary Johnson)
 Files: src/ex_docmd.c
 
@@ -1890,7 +1890,7 @@ Solution:   Add line_lbr flag to regexec_nl().
 Files: src/regexp.c, src/regexp_nfa.c, src/regexp.h
 
 Patch 7.4.263
-Problem:GCC 4.8 compiler warning for hiding a declaration (Francois Gannaz)
+Problem:GCC 4.8 compiler warning for hiding a declaration (François Gannaz)
 Solution:   Remove the second declaration.
 Files: src/eval.c
 
@@ -2028,7 +2028,7 @@ Solution:   (Christian Brabandt)
 Files: src/misc1.c
 
 Patch 7.4.286
-Problem:Error messages are inconsistant. (ZyX)
+Problem:Error messages are inconsistent. (ZyX)
 Solution:   Change "Lists" to "list".
 Files: src/eval.c
 
@@ -,7 +,7 @@ Files:src/syntax.c
 
 Patch 7.4.319
 Problem:Crash when putting zero bytes on the clipboard.
-Solution:   Do not support the utf8_atom target when not using an Unicode
+Solution:   Do not support the utf8_atom target when not using a Unicode
encoding. (Naofumi Honda)
 Files: src/ui.c
 
@@ -2310,7 +2310,7 @@ Solution:   Put the function inside the #ifdef.
 Files: src/screen.c
 
 Patch 7.4.334 (after 7.4.330)
-Problem:Unitialized variables, causing some problems.
+Problem:Uninitialized variables, causing some problems.
 Solution:   Initialize the variables. (Dominique Pelle)
 Files: src/screen.c, src/window.c
 
@@ -2396,7 +2396,7 @@ Files:src/testdir/test55.in, src/testdir/test55.ok
 Patch 7.4.348
 Problem:When using "J1" in 'cinoptions' a line below a continuation line
gets too much indent.
-Solution:   Fix parenthesis in condition.
+Solution:   Fix parentheses in condition.

Re: Changing the defaults with Vim 8

2016-07-24 Thread Yegappan Lakshmanan
Hi,

On Sun, Jul 24, 2016 at 7:04 AM, lilydjwg  wrote:
> Hi,
>
> On Sun, Jul 24, 2016 at 10:21:32PM +0900, tyru wrote:
>> I want to propose the following settings additionally.
>>
>> 
>> set ambiwidth=double
>
> Please don't do this for Linux terminals, at least when it doesn't work
> well:
>

I agree.  This option should not be set to 'double' by default in the system
wide vimrc. I also ran into xterm screen refresh problems with this option.
I have set 'ambiwidth' to 'single' in .vimrc to avoid this problem.

- Yegappan

>
> For the following text,
>
> “test”
> ‘test’
>
> gvim works well:
> https://img.vim-cn.com/cb/1ef8cb00cb23be45a49ae2764a7c1531fb3cc0.png
>
> But my terminal has some issue with the placement and highlighting:
> https://img.vim-cn.com/92/c802187c35e82857c7c96311f9198b71a35a5c.png
>
> The left quotes are placed too left, and the right half doesn't get
> highlighted as expected.
>
> When I delete the first t's, the display is wrong:
> https://img.vim-cn.com/42/c990d919df4c568f1105063112d0569a7107da.png
>
> This happens to me with both xterm and xfce4-terminal on Arch Linux.
>
> Versions:
>
> * xterm 325
> * xfce4-terminal 0.6.3
> * gvim 7.4.2098
>
> It displays better with xterm -cjk_width, but there are still some issues:
> https://img.vim-cn.com/d6/07e66736903fb6bb55c687237f94637765a77b.png
>
>> set display=lastline
>> set formatoptions+=j
>> set nrformats-=octal
>> [...]
>
> --
> Best regards,
> lilydjwg
>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [patch] fixed typos in vim/runtime/doc/version8.txt

2016-07-24 Thread Ken Takata
Hi,

2016/7/24 Sun 23:26:50 UTC+9 Dominique Pelle wrote:
> Hi
> 
> Attached patch fixes typos in changelog in version8.txt.
> Those typos can't be fixed in "git log" but I think it's best
> to fix them in version8.txt anyway.
> 
> Regards
> Dominique

There are still more typos.
And contributor names were missing from some patches.

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent  5d5c195eacdba7dca005a9d4541ff67d59d69b8e

diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt
--- a/runtime/doc/version8.txt
+++ b/runtime/doc/version8.txt
@@ -523,7 +523,7 @@ Files:	src/diff.c
 
 Patch 7.4.032
 Problem:NFA engine does not match the NUL character. (Jonathon Merz)
-Solution:   Ues 0x0a instead of NUL. (Christian Brabandt)
+Solution:   Use 0x0a instead of NUL. (Christian Brabandt)
 Files:	src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
 
 Patch 7.4.033
@@ -566,7 +566,7 @@ Solution:   Ignore the error when locati
 Files:	src/normal.c, src/spell.c
 
 Patch 7.4.039
-Problem:MS-Windows: MSCV10 and earlier can't handle symlinks to a
+Problem:MS-Windows: MSVC10 and earlier can't handle symlinks to a
 	directory properly.
 Solution:   Add stat_symlink_aware() and wstat_symlink_aware(). (Ken Takata)
 Files:	src/os_mswin.c, src/os_win32.c, src/os_win32.h
@@ -1364,7 +1364,7 @@ Solution:   Check the platform, when the
 Files:	src/os_mswin.c, src/os_win32.c
 
 Patch 7.4.176
-Problem:Dictionary.update() thows an error when used without arguments.
+Problem:Dictionary.update() throws an error when used without arguments.
 	Python programmers don't expect that.
 Solution:   Make Dictionary.update() without arguments do nothing. (ZyX)
 Files:	src/if_py_both.h, src/testdir/test86.in, src/testdir/test87.in
@@ -1964,7 +1964,7 @@ Solution:   Also check the file size.
 Files:	src/fileio.c
 
 Patch 7.4.275
-Problem:When changing the type of a sign that hasn't been placed ther is
+Problem:When changing the type of a sign that hasn't been placed there is
 	no error message.
 Solution:   Add an error message. (Christian Brabandt)
 Files:	src/ex_cmds.c
@@ -2372,7 +2372,7 @@ Solution:   Fix off-by-one error.  (Ozak
 Files:	src/window.c
 
 Patch 7.4.344
-Problem:Unessecary initializations and other things related to
+Problem:Unnecessary initializations and other things related to
 	matchaddpos().
 Solution:   Code cleanup. (Alexey Radkov)
 Files:	runtime/doc/eval.txt, src/screen.c, src/window.c
@@ -2573,7 +2573,7 @@ Solution:   Compute the available room p
 Files:	src/window.c
 
 Patch 7.4.378
-Problem:Title of quickfist list is not kept for setqflist(list, 'r').
+Problem:Title of quickfix list is not kept for setqflist(list, 'r').
 Solution:   Keep the title.  Add a test. (Lcd)
 Files:	src/quickfix.c, src/testdir/Make_amiga.mak,
 	src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
@@ -3100,7 +3100,7 @@ Files:	src/gui_w32.c
 
 Patch 7.4.465 (after 7.4.016)
 Problem:Crash when expanding a very long string.
-Solution:   Use wsncpy() instead of wcscpy(). (Ken Takata)
+Solution:   Use wcsncpy() instead of wcscpy(). (Ken Takata)
 Files:	src/os_win32.c
 
 Patch 7.4.466 (after 7.4.460)
@@ -3555,7 +3555,7 @@ Files:	src/ex_docmd.c
 
 Patch 7.4.541
 Problem:Crash when doing a range assign.
-Solution:   Check for NULL poiter. (Yukihiro Nakadaira)
+Solution:   Check for NULL pointer. (Yukihiro Nakadaira)
 Files:	src/eval.c, src/testdir/test55.in, src/testdir/test55.ok
 
 Patch 7.4.542
@@ -3609,7 +3609,7 @@ Files:	src/Make_cyg_ming.mak
 
 Patch 7.4.549
 Problem:Function name not recognized correctly when inside a function.
-Solution:   Don't check for an alpha character.
+Solution:   Don't check for an alpha character. (Ozaki Kiichi)
 Files:	src/eval.c, src/testdir/test_nested_function.in,
 	src/testdir/test_nested_function.ok, src/testdir/Make_amiga.mak,
 	src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
@@ -5519,7 +5519,8 @@ Files:  src/misc1.c
 
 Patch 7.4.872
 Problem:Not using CI services available.
-Solution:   Add configuration files for travis and appveyor. (PR #401)
+Solution:   Add configuration files for travis and appveyor. (Ken Takata,
+vim-jp, PR #401)
 Files:  .travis.yml, appveyor.yml, Filelist
 
 Patch 7.4.873 (after 7.4.866)
@@ -5694,7 +5695,7 @@ Files:  src/os_win32.c
 
 Patch 7.4.903
 Problem:MS-Windows: When 'encoding' differs from the current code pag

Re: Changing the defaults with Vim 8

2016-07-24 Thread Michal Grochmal
Hi Bram,

> Vim has always been conservative about the default option values.
> Without any .vimrc the default is 'compatible'.  That's nice for people
> who rely on the old Vi.  But how many of these still exist?  I expect
> nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.
> 
> What has stopped me from changing this is the unexpected change.  Many
> users will notice that Vim suddenly behaves differently.  Some may be
> upset.  The release of Vim 8.0 might be the best point in time to do
> this.  If we do this.

I will argue that *almost all* Linux user will not see the change.  Once
upon a time I had an issue with nocp on my Arch Linux.  It turns out
that Arch does `set nocompatible' inside /etc/vimrc that comes with its
packages.

I have also tested on a modern Debian (Jessie) and a modern CentOS (7),
and both also perform `set nocompatible' inside the distributed Vim.

The only package that I found that sets `compatible' was Debian's
`vim-tiny'.  But even then, the package explicitly does `set compatible'
inside `/etc/vimrc'.  Therefore not even the users of that distribution
of Vim will notice.

(Compiling from source is another story, of course)

-- 
Mike Grochmal
key ID 0xC840C4F6

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.2100

2016-07-24 Thread Bram Moolenaar

Patch 7.4.2100
Problem:"cgn" and "dgn" do not work correctly with a single character
match and the replacement includes the searched pattern. (John
Beckett)
Solution:   If the match is found in the wrong column try in the next column.
Turn the test into new style. (Christian Brabandt)
Files:  src/search.c, src/testdir/Make_all.mak, src/Makefile,
src/testdir/test53.in, src/testdir/test53.ok,
src/testdir/test_gn.vim


*** ../vim-7.4.2099/src/search.c2016-04-21 09:06:54.479485966 +0200
--- src/search.c2016-07-24 17:21:02.648247925 +0200
***
*** 4719,4725 
  }
  
  /*
!  * Check if the pattern is one character or zero-width.
   * If move is TRUE, check from the beginning of the buffer, else from the
   * current cursor position.
   * Returns TRUE, FALSE or -1 for failure.
--- 4719,4725 
  }
  
  /*
!  * Check if the pattern is one character long or zero-width.
   * If move is TRUE, check from the beginning of the buffer, else from the
   * current cursor position.
   * Returns TRUE, FALSE or -1 for failure.
***
*** 4734,4743 
--- 4734,4748 
  int   save_called_emsg = called_emsg;
  int   flag = 0;
  
+ if (pattern == NULL)
+   pattern = spats[last_idx].pat;
+ 
  if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH,
  SEARCH_KEEP, ®match) == FAIL)
return -1;
  
+ /* init startcol correctly */
+ regmatch.startpos[0].col = -1;
  /* move to match */
  if (move)
clearpos(&pos)
***
*** 4748,4769 
flag = SEARCH_START;
  }
  
! if (searchit(curwin, curbuf, &pos, FORWARD, spats[last_idx].pat, 1,
  SEARCH_KEEP + flag, RE_SEARCH, 0, NULL) != FAIL)
  {
/* Zero-width pattern should match somewhere, then we can check if
 * start and end are in the same position. */
called_emsg = FALSE;
!   nmatched = vim_regexec_multi(®match, curwin, curbuf,
! pos.lnum, (colnr_T)0, NULL);
  
if (!called_emsg)
result = (nmatched != 0
&& regmatch.startpos[0].lnum == regmatch.endpos[0].lnum
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
! 
!   if (!result && inc(&pos) >= 0 && pos.col == regmatch.endpos[0].col)
!   result = TRUE;
  }
  
  called_emsg |= save_called_emsg;
--- 4753,4782 
flag = SEARCH_START;
  }
  
! if (searchit(curwin, curbuf, &pos, FORWARD, pattern, 1,
  SEARCH_KEEP + flag, RE_SEARCH, 0, NULL) != FAIL)
  {
/* Zero-width pattern should match somewhere, then we can check if
 * start and end are in the same position. */
called_emsg = FALSE;
!   do
!   {
!   regmatch.startpos[0].col++;
!   nmatched = vim_regexec_multi(®match, curwin, curbuf,
!   pos.lnum, regmatch.startpos[0].col, 
NULL);
!   if (!nmatched)
!   break;
!   } while (regmatch.startpos[0].col < pos.col);
  
if (!called_emsg)
+   {
result = (nmatched != 0
&& regmatch.startpos[0].lnum == regmatch.endpos[0].lnum
&& regmatch.startpos[0].col == regmatch.endpos[0].col);
!   /* one char width */
!   if (!result && inc(&pos) >= 0 && pos.col == regmatch.endpos[0].col)
!   result = TRUE;
!   }
  }
  
  called_emsg |= save_called_emsg;
*** ../vim-7.4.2099/src/testdir/Make_all.mak2016-07-23 22:04:30.000702667 
+0200
--- src/testdir/Make_all.mak2016-07-24 17:21:44.943839497 +0200
***
*** 171,176 
--- 171,177 
test_cscope.res \
test_digraph.res \
test_farsi.res \
+   test_gn.res \
test_hardcopy.res \
test_history.res \
test_increment.res \
*** ../vim-7.4.2099/src/Makefile2016-07-23 22:04:30.004702632 +0200
--- src/Makefile2016-07-24 17:25:07.969880015 +0200
***
*** 2076,2081 
--- 2076,2082 
test_filter_map \
test_fnamemodify \
test_glob2regpat \
+   test_gn \
test_goto \
test_hardcopy \
test_help_tagjump \
*** ../vim-7.4.2099/src/testdir/test53.in   2015-03-05 19:57:45.322721298 
+0100
--- src/testdir/test53.in   2016-07-24 17:21:02.648247925 +0200
***
*** 4,11 
  
  Also test match() and matchstr()
  
- Also test the gn command and repeating it.
- 
  STARTTEST
  :so small.vim
  /^start:/
--- 4,9 
***
*** 53,87 
  :put =match('abc', '\zs', 2, 1) " 2
  :put =match('abc', '\zs', 3, 1) " 3
  :put =match('abc', '\zs', 4, 1) " -1
- /^foobar
- gncsearchmatch /one\_s*two\_s
- :1
- gnd
- /[a]bcdx
- :1
- 2gnd/join
- /$
- 0gnd
- /\>\zs
- 0gnd/^
- g

Re: [patch] fixed typos in vim/runtime/doc/version8.txt

2016-07-24 Thread Bram Moolenaar

Dominique wrote:

> Attached patch fixes typos in changelog in version8.txt.
> Those typos can't be fixed in "git log" but I think it's best
> to fix them in version8.txt anyway.

Thanks.  Yes, one problem with version control is that you can't fix
mistakes.

-- 
TIM: To the north there lies a cave,  the cave of Caerbannog, wherein, carved
 in mystic runes, upon the very living rock, the last words of Olfin
 Bedwere of Rheged make plain the last resting place of the most Holy
 Grail.
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread Bram Moolenaar

Nicola wrote:

> On 2016-07-24 13:02:56 +, Bram Moolenaar said:
> 
> > Vim has always been conservative about the default option values.
> > Without any .vimrc the default is 'compatible'.  That's nice for people
> > who rely on the old Vi.  But how many of these still exist?  I expect
> > nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.
> > 
> > What has stopped me from changing this is the unexpected change.  Many
> > users will notice that Vim suddenly behaves differently.  Some may be
> > upset.  The release of Vim 8.0 might be the best point in time to do
> > this.  If we do this.
> 
> Talking as someone who has been using Vim only for a couple of years and
> who does not work with systems more than a decade old, I would welcome
> such changes. And a major release obviously provides the best opportunity
> for introducing backward-incompatible changes.
> 
> I agree with the defaults you are proposing. How about the following?
> 
> 1) nnoremap Y y$

Please, this was not an invitation for everybody to mention their
favorite adjustments.  In this case it's clear that most people,
including myself, expect Y to yank the current line.  Changing this is
clearly a personal preference, not something that will help all users.

> 2) Make UTF8 the default encoding.

That is something that could break things in weird ways.  Vim already
automatically sets 'encoding' to utf-8 in situations where it makes
sense.

> > What we can probably always do:
> > 
> >   " In many terminal emulators the mouse works just fine, thus enable it.
> >   if has('mouse')
> > set mouse=a
> >   endif
> 
> I would also set ttymouse=sgr when possible (but I do not know all the 
> implications).

This already happens when the required xterm version is detected.

-- 
   [Autumn changed into Winter ... Winter changed into Spring ...  Spring
   changed back into Autumn and Autumn gave Winter and Spring a miss and
   went straight on into Summer ...  Until one day ...]
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [patch] fixed typos in vim/runtime/doc/version8.txt

2016-07-24 Thread Ken Takata
Hi,

2016/7/25 Mon 0:28:14 UTC+9 Ken Takata wrote:
> Hi,
> 
> 2016/7/24 Sun 23:26:50 UTC+9 Dominique Pelle wrote:
> > Hi
> > 
> > Attached patch fixes typos in changelog in version8.txt.
> > Those typos can't be fixed in "git log" but I think it's best
> > to fix them in version8.txt anyway.
> > 
> > Regards
> > Dominique
> 
> There are still more typos.
> And contributor names were missing from some patches.

One more:

diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt
--- a/runtime/doc/version8.txt
+++ b/runtime/doc/version8.txt
@@ -11234,7 +11234,7 @@ Files:  runtime/doc/if_pyth.txt, src
 Patch 7.4.1844
 Problem:Using old function name in comment.  More functions should start
 with test_.
-Solution:   Rename function in comment. (Higashi Higashi) Rename
+Solution:   Rename function in comment. (Hirohito Higashi) Rename
 disable_char_avail_for_testing() to test_disable_char_avail().
 And alloc_fail() to test_alloc_fail().
 Files:  src/eval.c, src/getchar.c, src/testdir/runtest.vim,


Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent  5d5c195eacdba7dca005a9d4541ff67d59d69b8e

diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt
--- a/runtime/doc/version8.txt
+++ b/runtime/doc/version8.txt
@@ -523,7 +523,7 @@ Files:	src/diff.c
 
 Patch 7.4.032
 Problem:NFA engine does not match the NUL character. (Jonathon Merz)
-Solution:   Ues 0x0a instead of NUL. (Christian Brabandt)
+Solution:   Use 0x0a instead of NUL. (Christian Brabandt)
 Files:	src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
 
 Patch 7.4.033
@@ -566,7 +566,7 @@ Solution:   Ignore the error when locati
 Files:	src/normal.c, src/spell.c
 
 Patch 7.4.039
-Problem:MS-Windows: MSCV10 and earlier can't handle symlinks to a
+Problem:MS-Windows: MSVC10 and earlier can't handle symlinks to a
 	directory properly.
 Solution:   Add stat_symlink_aware() and wstat_symlink_aware(). (Ken Takata)
 Files:	src/os_mswin.c, src/os_win32.c, src/os_win32.h
@@ -1364,7 +1364,7 @@ Solution:   Check the platform, when the
 Files:	src/os_mswin.c, src/os_win32.c
 
 Patch 7.4.176
-Problem:Dictionary.update() thows an error when used without arguments.
+Problem:Dictionary.update() throws an error when used without arguments.
 	Python programmers don't expect that.
 Solution:   Make Dictionary.update() without arguments do nothing. (ZyX)
 Files:	src/if_py_both.h, src/testdir/test86.in, src/testdir/test87.in
@@ -1964,7 +1964,7 @@ Solution:   Also check the file size.
 Files:	src/fileio.c
 
 Patch 7.4.275
-Problem:When changing the type of a sign that hasn't been placed ther is
+Problem:When changing the type of a sign that hasn't been placed there is
 	no error message.
 Solution:   Add an error message. (Christian Brabandt)
 Files:	src/ex_cmds.c
@@ -2372,7 +2372,7 @@ Solution:   Fix off-by-one error.  (Ozak
 Files:	src/window.c
 
 Patch 7.4.344
-Problem:Unessecary initializations and other things related to
+Problem:Unnecessary initializations and other things related to
 	matchaddpos().
 Solution:   Code cleanup. (Alexey Radkov)
 Files:	runtime/doc/eval.txt, src/screen.c, src/window.c
@@ -2573,7 +2573,7 @@ Solution:   Compute the available room p
 Files:	src/window.c
 
 Patch 7.4.378
-Problem:Title of quickfist list is not kept for setqflist(list, 'r').
+Problem:Title of quickfix list is not kept for setqflist(list, 'r').
 Solution:   Keep the title.  Add a test. (Lcd)
 Files:	src/quickfix.c, src/testdir/Make_amiga.mak,
 	src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
@@ -3100,7 +3100,7 @@ Files:	src/gui_w32.c
 
 Patch 7.4.465 (after 7.4.016)
 Problem:Crash when expanding a very long string.
-Solution:   Use wsncpy() instead of wcscpy(). (Ken Takata)
+Solution:   Use wcsncpy() instead of wcscpy(). (Ken Takata)
 Files:	src/os_win32.c
 
 Patch 7.4.466 (after 7.4.460)
@@ -3555,7 +3555,7 @@ Files:	src/ex_docmd.c
 
 Patch 7.4.541
 Problem:Crash when doing a range assign.
-Solution:   Check for NULL poiter. (Yukihiro Nakadaira)
+Solution:   Check for NULL pointer. (Yukihiro Nakadaira)
 Files:	src/eval.c, src/testdir/test55.in, src/testdir/test55.ok
 
 Patch 7.4.542
@@ -3609,7 +3609,7 @@ Files:	src/Make_cyg_ming.mak
 
 Patch 7.4.549
 Problem:Function name not recognized correctly when inside a function.
-Solution:   Don't check for an alpha character.
+Solution:   Don't check for an al

Re: [patch] fixed typos in vim/runtime/doc/version8.txt

2016-07-24 Thread Bram Moolenaar

Ken Takata wrote:

> 2016/7/24 Sun 23:26:50 UTC+9 Dominique Pelle wrote:
> > Hi
> > 
> > Attached patch fixes typos in changelog in version8.txt.
> > Those typos can't be fixed in "git log" but I think it's best
> > to fix them in version8.txt anyway.
> > 
> > Regards
> > Dominique
> 
> There are still more typos.
> And contributor names were missing from some patches.

Thanks!

-- 
Save the plankton - eat a whale.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread Manuel Ortega
On Sun, Jul 24, 2016 at 9:02 AM, Bram Moolenaar  wrote:

>
> Vim has always been conservative about the default option values.
> Without any .vimrc the default is 'compatible'.  That's nice for people
> who rely on the old Vi.  But how many of these still exist?  I expect
> nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.
>
> What has stopped me from changing this is the unexpected change.  Many
> users will notice that Vim suddenly behaves differently.  Some may be
> upset.  The release of Vim 8.0 might be the best point in time to do
> this.  If we do this.
>
> Besides making 'nocompatible' the default, there are a few options that
> should probably be on by default.  Currently these are in
> $VIMRUNTIME/vimrc_example.vim.  Most of these only have a visual effect
> or slightly change how editing works.  You will notice this right away.
> The ones that have unexpected effects should be avoided.
>
> If someone wants to start in the old way, the -C flag should be used:
> vim -C
>
> If someone wants to start with 'nocompatible', but not all of the new
> option values, a .vimrc would be needed to change the settings.  This is
> the most common and also most tricky part.  Assuming that the user will
> want most of the new option values, but not all, he should be able to
> revert to the old value. For options that is easy.  But including the
> matchit plugin is not easy to revert.
>
> What we can probably always do:
>
>   set backspace=indent,eol,start
>   set history=50" keep 50 lines of command line history
>   set ruler " show the cursor position all the time
>   set showcmd   " display incomplete commands
>   set incsearch " do incremental searching
>

Please do not set &incsearch.  It's one of the more annoying things in all
of Vim, and very likely to bring an unexpected "what the heck?"

  " Don't use Ex mode, use Q for formatting
>   map Q gq
>
>   " In many terminal emulators the mouse works just fine, thus enable it.
>   if has('mouse')
> set mouse=a
>   endif
>   if &t_Co > 2 || has("gui_running")
> syntax on
> set hlsearch
> let c_comment_strings=1
>   endif
>
>   if has("autocmd")
> " Enable file type detection.
> filetype plugin indent on
>
> augroup vimrcEx
> au!
>
> " For all text files set 'textwidth' to 78 characters.
> autocmd FileType text setlocal textwidth=78
>
> " When editing a file, always jump to the last known cursor position.
> " Don't do it when the position is invalid or when inside an event
> handler
> " (happens when dropping a file on gvim).
> autocmd BufReadPost *
>   \ if line("'\"") >= 1 && line("'\"") <= line("$") |
>   \   exe "normal! g`\"" |
>   \ endif
>
> augroup END
>   else
> set autoindent  " always set autoindenting on
>   endif
>

I am very opposed to everything in the above augroup.  There is no reason
to foist this stuff on people just because "7" is changing to "8".   Also
that BufReadPost autocmd is not easily reversible for newbs, since it's not
a simple "set".

Please don't "setlocal" a &textwidth value for text files.  Don't mess with
this at all, but if you do, don't make it "setlocal".  It is extremely
annoying to have Vim sometimes hard-wrap lines and sometimes not, depending
on which kind of file you're in---unless one specifically authorized this
by purposely turning filetype plugins on or having a plugin/package that
does this for certain &filetype.

  if has('langmap') && exists('+langnoremap')
> set langnoremap
>   endif
>
>
> Probably not:
>
>   " these two leave files behind
>   set backup
>   set undofile
>
>   " may conflict with a user mapping
>   inoremap  u
>
>   " hard to revert
>   if has('syntax') && has('eval')
> packadd matchit
>   endif
>
> Comments?
>


Definitely not!  Especially "matchit", since it's hard to reverse.  I don't
want that thing.  &undofile will leave unexpected litter around, which is
ban enough; but since the litter will start with dots it will
unintentionally wind up making it into tarballs because people will forget
that such files are lurking.  Also, the "backup" related things will mess
up "creation date" in mac OS depending on how they're configured.
Currently the creation date is preserved on macOS by Vim's default settings.

I'm not in general opposed automatically to the idea of making a small
tweak or two for Vim 8, provided they won't affect too many people.  E.g.,
&nocompatible is probably OK.   But this proposal has too many of them, and
for no good reason.  Frankly, for no reason at all other than "they happen
to appear in an example of a vimrc".  Probably all that should happen is
that &nocompatible is the default.  Definitely add nothing that requires
more than  a simple "set" cmd to reverse, and nothing that affects the
filesystem.

-Manny

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you

Re: Changing the defaults with Vim 8

2016-07-24 Thread Manuel Ortega
On Sun, Jul 24, 2016 at 12:09 PM, Manuel Ortega 
wrote:

> On Sun, Jul 24, 2016 at 9:02 AM, Bram Moolenaar 
> wrote:
>
>>
>>
>> Probably not:
>>
>>   " these two leave files behind
>>   set backup
>>   set undofile
>>
>>   " may conflict with a user mapping
>>   inoremap  u
>>
>>   " hard to revert
>>   if has('syntax') && has('eval')
>> packadd matchit
>>   endif
>>
>> Comments?
>>
>
>
> Definitely not!  Especially "matchit", since it's hard to reverse.  I
> don't want that thing.  &undofile will leave unexpected litter around,
> which is ban enough; but since the litter will start with dots it will
> unintentionally wind up making it into tarballs because people will forget
> that such files are lurking.  Also, the "backup" related things will mess
> up "creation date" in mac OS depending on how they're configured.
> Currently the creation date is preserved on macOS by Vim's default settings.
>

Scratch what I said about creation-date on macOS.  By default that isn't
preserved.  (I mistakenly thought it was because setting &bkc will preserve
it, and the docs for &bkc say that it is on by default for "unix".
Apparently OS X doesn't count as "unix", because on OS X &bkc is set to
"auto".  Probably the docs should be corrected here.)

But add that setting &backup will leave litter around on the filesystem.
Please don't leave unexpected litter around on the filesystem.   Among
other things, such backup files are bound to unintentionally get captured
in tarballs.

-Manny

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread tyru
Hi Bram,

2016/07/25 0:33 "Bram Moolenaar" :
>
>
> Nicola wrote:
>
> > On 2016-07-24 13:02:56 +, Bram Moolenaar said:
> >
> > > Vim has always been conservative about the default option values.
> > > Without any .vimrc the default is 'compatible'.  That's nice for
people
> > > who rely on the old Vi.  But how many of these still exist?  I expect
> > > nearly all Vim users to want 'nocompatible', thus create a .vimrc
ASAP.
> > >
> > > What has stopped me from changing this is the unexpected change.  Many
> > > users will notice that Vim suddenly behaves differently.  Some may be
> > > upset.  The release of Vim 8.0 might be the best point in time to do
> > > this.  If we do this.
> >
> > Talking as someone who has been using Vim only for a couple of years and
> > who does not work with systems more than a decade old, I would welcome
> > such changes. And a major release obviously provides the best
opportunity
> > for introducing backward-incompatible changes.
> >
> > I agree with the defaults you are proposing. How about the following?
> >
> > 1) nnoremap Y y$
>
> Please, this was not an invitation for everybody to mention their
> favorite adjustments.

Sorry, it's too much.

so do you think this setting is also personal preference, not 'compatible'
one?

set display+=lastline

Any reason to not display long line instead of '@' ?
for speed?
is it really good default value for "normal user" ?

> In this case it's clear that most people,
> including myself, expect Y to yank the current line.  Changing this is
> clearly a personal preference, not something that will help all users.
>
> > 2) Make UTF8 the default encoding.
>
> That is something that could break things in weird ways.  Vim already
> automatically sets 'encoding' to utf-8 in situations where it makes
> sense.
>
> > > What we can probably always do:
> > >
> > >   " In many terminal emulators the mouse works just fine, thus enable
it.
> > >   if has('mouse')
> > > set mouse=a
> > >   endif
> >
> > I would also set ttymouse=sgr when possible (but I do not know all the
> > implications).
>
> This already happens when the required xterm version is detected.
>
> --
>[Autumn changed into Winter ... Winter changed into Spring ...
Spring
>changed back into Autumn and Autumn gave Winter and Spring a miss
and
>went straight on into Summer ...  Until one day ...]
>  "Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net
 \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
\\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org
///
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
"vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to vim_dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Use FOR_ALL macros for looping through windows/buffers/tab pages

2016-07-24 Thread Yegappan Lakshmanan
Hi,

There are several FOR_ALL macros defined in globals.h to loop through all
the buffers, windows and tab pages. These are not consistently used across
the code base. The attached patch fixes this.

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/buffer.c b/src/buffer.c
index 8590e2a..60fb67a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -105,7 +105,7 @@ open_buffer(
 * If we can't create one for the current buffer, take another buffer
 */
close_buffer(NULL, curbuf, 0, FALSE);
-   for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
+   FOR_ALL_BUFFERS(curbuf)
if (curbuf->b_ml.ml_mfp != NULL)
break;
/*
@@ -1284,7 +1284,7 @@ do_buffer(
 * If deleting the last (listed) buffer, make it empty.
 * The last (listed) buffer cannot be unloaded.
 */
-   for (bp = firstbuf; bp != NULL; bp = bp->b_next)
+   FOR_ALL_BUFFERS(bp)
if (bp->b_p_bl && bp != buf)
break;
if (bp == NULL && buf == curbuf)
@@ -1410,7 +1410,7 @@ do_buffer(
buf = bp;
if (buf == NULL)/* No loaded buffer, find listed one */
{
-   for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+   FOR_ALL_BUFFERS(buf)
if (buf->b_p_bl && buf != curbuf)
break;
}
@@ -2406,7 +2406,7 @@ buflist_findpat(
 #ifdef FEAT_WINDOWS
win_T   *wp;
 
-   for (wp = firstwin; wp != NULL; wp = wp->w_next)
+   FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
if (wp == NULL)
@@ -2508,7 +2508,7 @@ ExpandBufnames(
for (round = 1; round <= 2; ++round)
{
count = 0;
-   for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+   FOR_ALL_BUFFERS(buf)
{
if (!buf->b_p_bl)   /* skip unlisted buffers */
continue;
@@ -2734,7 +2734,7 @@ wininfo_other_tab_diff(wininfo_T *wip)
 
 if (wip->wi_opt.wo_diff)
 {
-   for (wp = firstwin; wp != NULL; wp = wp->w_next)
+   FOR_ALL_WINDOWS(wp)
/* return FALSE when it's a window in the current tab page, thus
 * the buffer was in diff mode here */
if (wip->wi_win == wp)
@@ -3153,7 +3153,7 @@ buflist_slash_adjust(void)
 {
 buf_T  *bp;
 
-for (bp = firstbuf; bp != NULL; bp = bp->b_next)
+FOR_ALL_BUFFERS(bp)
 {
if (bp->b_ffname != NULL)
slash_adjust(bp->b_ffname);
@@ -5083,7 +5083,7 @@ ex_buffer_all(exarg_T *eap)
 #endif
{
/* Check if this buffer already has a window */
-   for (wp = firstwin; wp != NULL; wp = wp->w_next)
+   FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
/* If the buffer already has a window, move it */
@@ -5461,7 +5461,7 @@ write_viminfo_bufferlist(FILE *fp)
 #endif
 
 fputs(_("\n# Buffer list:\n"), fp);
-for (buf = firstbuf; buf != NULL ; buf = buf->b_next)
+FOR_ALL_BUFFERS(buf)
 {
if (buf->b_fname == NULL
|| !buf->b_p_bl
@@ -5847,7 +5847,7 @@ buf_delete_all_signs(void)
 {
 buf_T  *buf;   /* buffer we are checking for signs */
 
-for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+FOR_ALL_BUFFERS(buf)
if (buf->b_signlist != NULL)
buf_delete_signs(buf);
 }
diff --git a/src/diff.c b/src/diff.c
index 287f434..35e37d7 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -65,7 +65,7 @@ diff_buf_delete(buf_T *buf)
 inti;
 tabpage_T  *tp;
 
-for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+FOR_ALL_TABPAGES(tp)
 {
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
@@ -92,7 +92,7 @@ diff_buf_adjust(win_T *win)
 {
/* When there is no window showing a diff for this buffer, remove
 * it from the diffs. */
-   for (wp = firstwin; wp != NULL; wp = wp->w_next)
+   FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == win->w_buffer && wp->w_p_diff)
break;
if (wp == NULL)
@@ -178,7 +178,7 @@ diff_invalidate(buf_T *buf)
 tabpage_T  *tp;
 inti;
 
-for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+FOR_ALL_TABPAGES(tp)
 {
i = diff_buf_idx_tp(buf, tp);
if (i != DB_COUNT)
@@ -204,7 +204,7 @@ diff

Re: Changing the defaults with Vim 8

2016-07-24 Thread Christian Brabandt

>   set backspace=indent,eol,start

+1

>   set history=50  " keep 50 lines of command line history

Why only 50?

And while we are it, increase the undolevels setting


>   set ruler   " show the cursor position all the time
>   set showcmd " display incomplete commands
>   set incsearch   " do incremental searching
>   " Don't use Ex mode, use Q for formatting
>   map Q gq
> 
>   " In many terminal emulators the mouse works just fine, thus enable it.
>   if has('mouse')
> set mouse=a
>   endif

don't care.

>   if &t_Co > 2 || has("gui_running")
> syntax on
> set hlsearch

please no hlsearch. That is most often annoying.

>   if has("autocmd")
> " Enable file type detection.
> filetype plugin indent on

+1

>   
> augroup vimrcEx
> au!
>   
> " For all text files set 'textwidth' to 78 characters.
> autocmd FileType text setlocal textwidth=78

Isn't text a fallback, that is used, when no other type is found? I 
wouldn't set this one then.

> " When editing a file, always jump to the last known cursor position.
> " Don't do it when the position is invalid or when inside an event handler
> " (happens when dropping a file on gvim).
> autocmd BufReadPost *
>   \ if line("'\"") >= 1 && line("'\"") <= line("$") |
>   \   exe "normal! g`\"" |
>   \ endif

+1 

> Probably not:
> 
>   " these two leave files behind
>   set backup
>   set undofile
> 
>   " may conflict with a user mapping
>   inoremap  u
> 
>   " hard to revert
>   if has('syntax') && has('eval')
> packadd matchit
>   endif

+1 for not setting those. although I would still make  in insert 
mode undoable.

some more I would set, the mentioned
:set display+=lastline
:set nrformat-=octal (often does unexpected things, when the user does 
not expect it)

and possibly also:
:set laststatus=2

Best,
Christian
-- 
Charade

Das Erste, das ist immer,
Und wenn auch die Welt vergeht;
Das Zweite ist man und bleibt man,
Wenn man zu lesen versteht.

-- Heinrich Heine

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread Bram Moolenaar

Tyru wrote:

> so do you think this setting is also personal preference, not 'compatible'
> one?
> 
> set display+=lastline
> 
> Any reason to not display long line instead of '@' ?
> for speed?
> is it really good default value for "normal user" ?

I'm not sure if I am a good example, but I don't use that.  I don't
often have text with long lines and it's nice to easily see the last
line is incomplete.  It's one of those things that make the editor feel
like Vi.

-- 
My girlfriend told me I should be more affectionate.
So I got TWO girlfriends.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Use FOR_ALL macros for looping through windows/buffers/tab pages

2016-07-24 Thread Bram Moolenaar

Yegappan wrote:

> There are several FOR_ALL macros defined in globals.h to loop through all
> the buffers, windows and tab pages. These are not consistently used across
> the code base. The attached patch fixes this.

Thanks.  The idea of these macros was to use them to avoid #ifdef in
many places.  But I suppose they can also be used where an #ifdef isn't
needed.

-- 
If "R" is Reverse, how come "D" is FORWARD?

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Got E121: Undefined variable in lambda function

2016-07-24 Thread Ken Takata
Hi,

2016/7/22 Fri 22:29:33 UTC+9 Ken Takata wrote:
> Hi ZyX,
> 
> 2016/7/22 Fri 20:15:33 UTC+9 ZyX wrote:
> > >> I was wrong regarding the consequences and why you should alter the
> > >> GC: it is not memory leak because cycle is not GC’d. It is *crash*
> > >> because Vim does not know that dictionary is referenced:
> > >>
> > >> ```VimL
> > >> function F()
> > >> let d = {}
> > >> return {-> d}
> > >> endfunction
> > >> let L = F()
> > >> call garbagecollect(1)
> > >> call feedkeys(":echo L()\n", 'n')
> > >> ```
> > >>
> > >> Save to `test.vim` and run as `vim -u NONE -i NONE -N -S test.vim`.
> > >> When I use it in Vim with optimizations it crashes immediately:
> 
> Yes, I also noticed this. I tested with the following script:
> 
>   function! Test_lambda_closure()
> function! s:foo()
>   let x = [0]
>   return {-> [execute("let x[0] += 1"), x[0]][-1]}
> endfunction
>   
> let l:F = s:foo()
> call test_garbagecollect_now()
> call assert_equal(1, l:F())
> call assert_equal(2, l:F())
> call assert_equal(3, l:F())
> call assert_equal(4, l:F())
>   endfunction
> 
> I have updated the patch:
> https://bitbucket.org/k_takata/vim-ktakata-mq/src/52c8d4fd0af2dd8bd2c79204dbbedd9ded874439/lambda-update.patch?at=default
> 
> Now it deals with GC. Also add some tests, reduce memory when local variables
> or arguments are not used.

I have slightly updated the tests:
https://bitbucket.org/k_takata/vim-ktakata-mq/src/5f8f4f212a09b1fa58a939f34559c7b3c88bb616/lambda-update.patch?at=default

It seems work well. BTW, I'm thinking the implementation again.
I thought that capture by value is easier to implement, but it is harder to
apply to normal functions inside a function. Capture by reference seems easier
to apply to normal functions.

I read the comment for mattn's implementation by Bram again:

> In the implementation it seems the dictionary storing the function-local
> variables is kept for a very long time. This relies on the garbage
> collector. It's better to use reference counting to be able to free the
> dictionary as soon as it's unused.
> 
> Also, the lambda always keeps the function-local variable dict, even
> when it's not actually used. That makes lambdas a expensive.
> It would be better to explicitly state the lambda is using its context.
> Then we can also do that with ":function", so that we are not forced to
> use a lambda if we want a closure.

Checking if a lambda is a closure is now available with my patch.
So I tried to implement reference counting based on mattn's patch.
Unfortunately it doesn't work well yet. I need help for this.
https://bitbucket.org/k_takata/vim-ktakata-mq/src/5f8f4f212a09b1fa58a939f34559c7b3c88bb616/lambda-capture_by_reference-temp.patch?at=default
(This patch should be applied after the above patch (lambda-update.patch).)
Test_circular_reference() in test_lambda.vim doesn't work well.

Which is better, capture by value or by reference?

Regards,
Ken Takata

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Changing the defaults with Vim 8

2016-07-24 Thread Bram Moolenaar

Christian Brabandt wrote:

> >   set backspace=indent,eol,start
> 
> +1
> 
> >   set history=50" keep 50 lines of command line history
> 
> Why only 50?

Good point, the Vim default already is 50.  That changed a while back.
How about 200?

> And while we are it, increase the undolevels setting

The default already is 1000.  A higher value is mainly useful in
combination with 'undofile', but we don't want to set that.

> >   set ruler " show the cursor position all the time
> >   set showcmd   " display incomplete commands
> >   set incsearch " do incremental searching
> >   " Don't use Ex mode, use Q for formatting
> >   map Q gq
> > 
> >   " In many terminal emulators the mouse works just fine, thus enable it.
> >   if has('mouse')
> > set mouse=a
> >   endif
> 
> don't care.
> 
> >   if &t_Co > 2 || has("gui_running")
> > syntax on
> > set hlsearch
> 
> please no hlsearch. That is most often annoying.

Well, I find it useful.  But I suppose that's more a personal
preference.

> >   if has("autocmd")
> > " Enable file type detection.
> > filetype plugin indent on
> 
> +1
> 
> >   
> > augroup vimrcEx
> > au!
> >   
> > " For all text files set 'textwidth' to 78 characters.
> > autocmd FileType text setlocal textwidth=78
> 
> Isn't text a fallback, that is used, when no other type is found? I 
> wouldn't set this one then.

No, but it can trigger quite often.  I suppose this is too arbitrary.

> 
> > " When editing a file, always jump to the last known cursor position.
> > " Don't do it when the position is invalid or when inside an event 
> > handler
> > " (happens when dropping a file on gvim).
> > autocmd BufReadPost *
> >   \ if line("'\"") >= 1 && line("'\"") <= line("$") |
> >   \   exe "normal! g`\"" |
> >   \ endif
> 
> +1 
> 
> > Probably not:
> > 
> >   " these two leave files behind
> >   set backup
> >   set undofile
> > 
> >   " may conflict with a user mapping
> >   inoremap  u
> > 
> >   " hard to revert
> >   if has('syntax') && has('eval')
> > packadd matchit
> >   endif
> 
> +1 for not setting those. although I would still make  in insert 
> mode undoable.

OK.

> some more I would set, the mentioned
> :set display+=lastline

As mentioned, I don't use it myself, I expect long time Vi/Vim users to
be surprised if this changes.

> :set nrformat-=octal (often does unexpected things, when the user does 
> not expect it)

OK.

> and possibly also:
> :set laststatus=2

That takes an extra line from the screen.  I suppose it's useful if you
have a plugin for a super status line.

-- 
The Law of VIM:
For each member b of the possible behaviour space B of program P, there exists
a finite time t before which at least one user u in the total user space U of
program P will request b becomes a member of the allowed behaviour space B'
(B' <= B).
In other words: Sooner or later everyone wants everything as an option.
-- Vince Negri

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Patch 7.4.2101

2016-07-24 Thread Bram Moolenaar

Patch 7.4.2101
Problem:Looping over windows, buffers and tab pages is inconsistant.
Solution:   Use FOR_ALL_ macros everywhere. (Yegappan Lakshmanan)
Files:  src/buffer.c, src/diff.c, src/edit.c, src/eval.c, src/evalfunc.c,
src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/fileio.c,
src/globals.h, src/gui.c, src/gui_mac.c, src/if_lua.c,
src/if_mzsch.c, src/if_perl.xs, src/if_ruby.c, src/if_tcl.c,
src/main.c, src/mark.c, src/memfile.c, src/memline.c, src/misc1.c,
src/move.c, src/netbeans.c, src/normal.c, src/option.c,
src/quickfix.c, src/screen.c, src/spell.c, src/term.c,
src/window.c, src/workshop.c


*** ../vim-7.4.2100/src/buffer.c2016-07-24 16:17:55.749759245 +0200
--- src/buffer.c2016-07-24 21:51:19.884109062 +0200
***
*** 105,111 
 * If we can't create one for the current buffer, take another buffer
 */
close_buffer(NULL, curbuf, 0, FALSE);
!   for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
if (curbuf->b_ml.ml_mfp != NULL)
break;
/*
--- 105,111 
 * If we can't create one for the current buffer, take another buffer
 */
close_buffer(NULL, curbuf, 0, FALSE);
!   FOR_ALL_BUFFERS(curbuf)
if (curbuf->b_ml.ml_mfp != NULL)
break;
/*
***
*** 1284,1290 
 * If deleting the last (listed) buffer, make it empty.
 * The last (listed) buffer cannot be unloaded.
 */
!   for (bp = firstbuf; bp != NULL; bp = bp->b_next)
if (bp->b_p_bl && bp != buf)
break;
if (bp == NULL && buf == curbuf)
--- 1284,1290 
 * If deleting the last (listed) buffer, make it empty.
 * The last (listed) buffer cannot be unloaded.
 */
!   FOR_ALL_BUFFERS(bp)
if (bp->b_p_bl && bp != buf)
break;
if (bp == NULL && buf == curbuf)
***
*** 1410,1416 
buf = bp;
if (buf == NULL)/* No loaded buffer, find listed one */
{
!   for (buf = firstbuf; buf != NULL; buf = buf->b_next)
if (buf->b_p_bl && buf != curbuf)
break;
}
--- 1410,1416 
buf = bp;
if (buf == NULL)/* No loaded buffer, find listed one */
{
!   FOR_ALL_BUFFERS(buf)
if (buf->b_p_bl && buf != curbuf)
break;
}
***
*** 2406,2412 
  #ifdef FEAT_WINDOWS
win_T   *wp;
  
!   for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == buf)
break;
if (wp == NULL)
--- 2406,2412 
  #ifdef FEAT_WINDOWS
win_T   *wp;
  
!   FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
break;
if (wp == NULL)
***
*** 2508,2514 
for (round = 1; round <= 2; ++round)
{
count = 0;
!   for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{
if (!buf->b_p_bl)   /* skip unlisted buffers */
continue;
--- 2508,2514 
for (round = 1; round <= 2; ++round)
{
count = 0;
!   FOR_ALL_BUFFERS(buf)
{
if (!buf->b_p_bl)   /* skip unlisted buffers */
continue;
***
*** 2734,2740 
  
  if (wip->wi_opt.wo_diff)
  {
!   for (wp = firstwin; wp != NULL; wp = wp->w_next)
/* return FALSE when it's a window in the current tab page, thus
 * the buffer was in diff mode here */
if (wip->wi_win == wp)
--- 2734,2740 
  
  if (wip->wi_opt.wo_diff)
  {
!   FOR_ALL_WINDOWS(wp)
/* return FALSE when it's a window in the current tab page, thus
 * the buffer was in diff mode here */
if (wip->wi_win == wp)
***
*** 3153,3159 
  {
  buf_T *bp;
  
! for (bp = firstbuf; bp != NULL; bp = bp->b_next)
  {
if (bp->b_ffname != NULL)
slash_adjust(bp->b_ffname);
--- 3153,3159 
  {
  buf_T *bp;
  
! FOR_ALL_BUFFERS(bp)
  {
if (bp->b_ffname != NULL)
slash_adjust(bp->b_ffname);
***
*** 5083,5089 
  #endif
{
/* Check if this buffer already has a window */
!   for (wp = firstwin; wp != NULL; wp = wp->w_next)
if (wp->w_buffer == buf)
break;
/* If the buffer already has a window, move it */
--- 5083,5089 
  #endif
{
/* Check if this buffer alread

Re: Changing the defaults with Vim 8

2016-07-24 Thread Ingo Karkat
Manuel Ortega  wrote:
> On Sun, Jul 24, 2016 at 9:02 AM, Bram Moolenaar  wrote:
> > " For all text files set 'textwidth' to 78 characters.
> > autocmd FileType text setlocal textwidth=78
> Please don't "setlocal" a &textwidth value for text files.  Don't mess
> with this at all, but if you do, don't make it "setlocal".  It is
> extremely annoying to have Vim sometimes hard-wrap lines and sometimes
> not, depending on which kind of file you're in---unless one specifically
> authorized this by purposely turning filetype plugins on or having a
> plugin/package that does this for certain &filetype.

Using :autocmd FileType sets a bad precedent: this doesn't scale (one
autocmd per filetype and setting is too much and bloats the .vimrc), and
Vim has a much better mechanism for filetype-specific settings:
ftplugins (with :filetype plugin on). This way, the change is also
undone (through b:undo_ftplugin), if the user manually changes the
filetype.

With regards to the 'textwidth' setting: I would recommend to leave this
out, as there's no generally accepted notion of a "text" file;
hard-wrapping may be desired or not, so it's best to leave this up to
the user.

-- regards, ingo

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Patch 7.4.2102

2016-07-24 Thread Bram Moolenaar

Patch 7.4.2102 (after 7.4.2101)
Problem:Tiny build with GUI fails.
Solution:   Revert one FOR_ALL_ change.
Files:  src/gui.c


*** ../vim-7.4.2101/src/gui.c   2016-07-24 21:58:39.704057634 +0200
--- src/gui.c   2016-07-24 22:22:54.802631965 +0200
***
*** 4166,4172 
  /* avoid that moving components around generates events */
  ++hold_gui_events;
  
! FOR_ALL_WINDOWS(wp)
  {
if (wp->w_buffer == NULL)   /* just in case */
continue;
--- 4166,4172 
  /* avoid that moving components around generates events */
  ++hold_gui_events;
  
! for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
  {
if (wp->w_buffer == NULL)   /* just in case */
continue;
*** ../vim-7.4.2101/src/version.c   2016-07-24 21:58:39.720057487 +0200
--- src/version.c   2016-07-24 22:24:22.025828318 +0200
***
*** 760,761 
--- 760,763 
  {   /* Add new patch number below this line */
+ /**/
+ 2102,
  /**/

-- 
If cars evolved at the same rate as computers have, they'd cost five euro, 
run for a year on a couple of liters of petrol, and explode once a day.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


tests fail when run with valgrind

2016-07-24 Thread Dominique Pellé
Hi

Using vim-7.4.2100 (and earlier), I see that all tests
pass on Linux x86_64. However, if I I enable valgrind
in src/testdir/Makefile, then tests fail:

$ make test
...
VIMRUNTIME=../../runtime; export VIMRUNTIME; valgrind --tool=memcheck
--leak-check=yes --num-callers=25 --log-file=valgrind.test_alot ../vim
-f  -u unix.vim -U NONE --noplugin --not-a-term -u NONE -U NONE -S
runtest.vim test_alot.vim


>From test_arglist.vim:
Executing Test_argadd()
Executing Test_argc()
Executing Test_argdelete()
Executing Test_argedit()
Executing Test_argidx()
Executing Test_arglistid()
Executing Test_argpos()
Executing Test_argument()
Executing Test_argv()
Executing Test_zero_argadd()
Executed 10 tests

>From test_assert.vim:
Executing Test_assert_equal()
Executing Test_assert_exception()
Executing Test_assert_fail_fails()
Executing Test_assert_false()
Executing Test_assert_inrange()
Executing Test_assert_notequal()
Executing Test_assert_true()
Executing Test_compare_fail()
Executing Test_match()
Executing Test_notmatch()
Executing Test_user_is_happy()
Executing Test_wrong_error_type()
Executed 12 tests

>From test_backspace_opt.vim:
Executing Test_backspace_option()
Executed 1 test

>From test_cdo.vim:
Executing Test_cdo()
Executing Test_ldo()
Executed 2 tests

>From test_channel.vim:
Executing Test_call()
Executing Test_channel_handler()
Executing Test_close_callback()
Executing Test_close_handle()
Executing Test_close_lambda()
Executing Test_close_partial()
Executing Test_collapse_buffers()
Executing Test_communicate()
Executing Test_connect_waittime()
Executing Test_exit_callback()
Executing Test_job_start_invalid()
Executing Test_nl_err_to_out_pipe()
Executing Test_nl_pipe()
Executing Test_nl_read_file()
Executing Test_nl_write_both_file()
Executing Test_nl_write_err_file()
Executing Test_nl_write_out_file()
Executing Test_open_delay()
Executing Test_open_fail()
Executing Test_out_cb()
Executing Test_out_cb_lambda()
Executing Test_out_close_cb()
Executing Test_partial_in_channel_cycle()
Executing Test_pipe_both_to_buffer()
Executing Test_pipe_err_to_buffer_name()
Executing Test_pipe_err_to_buffer_name_nomod()
Executing Test_pipe_err_to_buffer_nr()
Executing Test_pipe_from_buffer_name()
Executing Test_pipe_from_buffer_nr()
Executing Test_pipe_io_one_buffer()
Executing Test_pipe_io_two_buffers()
Executing Test_pipe_null()
Executing Test_pipe_to_buffer_json()
Executing Test_pipe_to_buffer_name()
Executing Test_pipe_to_buffer_name_nomod()
Executing Test_pipe_to_buffer_nr()
Executing Test_pipe_to_buffer_raw()
Executing Test_pipe_to_nameless_buffer()
Executing Test_raw_one_time_callback()
Executing Test_raw_pipe()
Executing Test_read_in_close_cb()
Executing Test_reuse_channel()
Executing Test_server_crash()
Executing Test_two_channels()
Executing Test_unlet_handle()
Executing Test_using_freed_memory()
Executing Test_zero_reply()
Executed 47 tests

>From test_cmdline.vim:
Executing Test_complete_list()
Executing Test_complete_tab()
Executing Test_complete_wildmenu()
Executing Test_getcompletion()
Executed 4 tests

>From test_cscope.vim:
Executing Test_cscopequickfix()
Executed 1 test

>From test_digraph.vim:
Executing Test_digraph_cmndline()
Executing Test_digraphs()
Executing Test_digraphs_option()
Executing Test_digraphs_output()
Executing Test_loadkeymap()
Executed 5 tests

>From test_farsi.vim:
Executing Test_farsi_map()
Executing Test_farsi_toggle()
Executed 2 tests

>From test_gn.vim:
Executing Test_gn_command()
Executed 1 test

>From test_hardcopy.vim:
Executing Test_printheader_parsing()
Executing Test_printmbfont_parsing()
Executing Test_printoptions_parsing()
Executing Test_with_syntax()
Executed 4 tests

>From test_history.vim:
Executing Test_History()
Executed 1 test

>From test_increment.vim:
Executing Test_normal_increment_01()
Executing Test_normal_increment_02()
Executing Test_normal_increment_03()
Executing Test_visual_increment_01()
Executing Test_visual_increment_02()
Executing Test_visual_increment_03()
Executing Test_visual_increment_04()
Executing Test_visual_increment_05()
Executing Test_visual_increment_06()
Executing Test_visual_increment_07()
Executing Test_visual_increment_08()
Executing Test_visual_increment_09()
Executing Test_visual_increment_10()
Executing Test_visual_increment_11()
Executing Test_visual_increment_12()
Executing Test_visual_increment_13()
Executing Test_visual_increment_14()
Executing Test_visual_increment_15()
Executing Test_visual_increment_16()
Executing Test_visual_increment_17()
Executing Test_visual_increment_18()
Executing Test_visual_increment_19()
Executing Test_visual_increment_20()
Executing Test_visual_increment_21()
Executing Test_visual_increment_22()
Executing Test_visual_increment_23()
Executing Test_visual_increment_24()
Executing Test_visual_increment_25()
Executing Test_visual_increment_26()
Executing Test_visual_increment_27()
Executing Test_visual_increment_28()
Executing Test_visual_increment_29()
Executing Test_visual_increment_30()
Executing Test_vi

Re: tests fail when run with valgrind

2016-07-24 Thread Bram Moolenaar

Dominique wrote:

> Using vim-7.4.2100 (and earlier), I see that all tests
> pass on Linux x86_64. However, if I I enable valgrind
> in src/testdir/Makefile, then tests fail:
> 
> $ make test
> ...
> VIMRUNTIME=../../runtime; export VIMRUNTIME; valgrind --tool=memcheck
> --leak-check=yes --num-callers=25 --log-file=valgrind.test_alot ../vim
> -f  -u unix.vim -U NONE --noplugin --not-a-term -u NONE -U NONE -S
> runtest.vim test_alot.vim

[...]

> From test_netbeans.vim:
> Executing Test_nb_basic()
> Flaky test failed, running it again
> Executing Test_nb_basic()
> Executing Test_nb_file_auth()
> Executed 3 tests
> 1 FAILED:
> Found errors in Test_nb_basic():
> function 
> RunTheTest[9]..Test_nb_basic[2]..4_run_server[1]..RunServer[21]..Nb_basic
> line 11: Expected 2 but got 130
> function 
> RunTheTest[9]..Test_nb_basic[2]..4_run_server[1]..RunServer[21]..Nb_basic
> line 12: Expected 20 but got 2
> function 
> RunTheTest[9]..Test_nb_basic[2]..4_run_server[1]..RunServer[21]..Nb_basic
> line 23: Expected '0:disconnect=1' but got '0:disconnect=0'

I have seen this before, I suspect there is a race condition.

> Test results:
> test61 FAILED

This test is time sensitive.  Perhaps it can be fixed by using
test_settime().

> The test failure looks 100% reproducible with valgrind enabled.
> 
> Besides the test failure, several testdir/valgrind.* files
> show memory leaks, despite having built Vim with
> -DEXIT_FREE. For example, in valgrind.test_alot, I see:

test_alot is a collection of tests.  Can you run them separately to
isolate the one(s) that causes the leak?


-- 
TIM:   That is not an ordinary rabbit ... 'tis the most foul cruel and
   bad-tempered thing you ever set eyes on.
ROBIN: You tit.  I soiled my armour I was so scared!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


configure losing gtk

2016-07-24 Thread toothpik
after this latest round of updates configure is no longer able to
successfully detect my gtk2 support -- why would that change?

I don't want to lose gui so I'm going to be stuck at 7.4.2098 until I
get this figured out

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: quickfix information

2016-07-24 Thread Yegappan Lakshmanan
Hi,

On Mon, Jul 18, 2016 at 2:11 PM, Bram Moolenaar  wrote:
>
> The number of commands and functions for quickfix functionality keeps
> growing.  It would be good to reduce this a bit.
>
> getqflist() currently does not take an argument.  It could use an
> argument to specify what to get, instead of the whole list.
> So how about passing a dictionary?  One of the items could be to get the
> aux data instead of the list of errors.
>
> For setqflist() it's a bit more tricky, since it already has a second
> "action" argument.  But we can add the dictionary as the third argument.
>
> Perhaps getting and setting the quickfix title would also fit in here?
> And it allows for the filtering that we had a patch for?
> Would be good to get an overview before making more changes.
>

I am attaching a patch to enhance the getqflist/getloclist() functions to
return the title string and the setqflist()/setloclist() functions to set
the title string.

After this patch is incorporated, it will be easy to add the additional
items (e.g. context, items, number, stack, etc.).

The getqflist/setqflist functions now accept an optional dictionary
parameter. The dictionary parameter specifies which items to get or set.
If the {dict} argument is specified, then the getqflist function returns a
dictionary.

- Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7b421aa..794a169 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2079,11 +2079,11 @@ getftime({fname})   Number  last 
modification time of file
 getftype({fname})  String  description of type of file {fname}
 getline({lnum})String  line {lnum} of current buffer
 getline({lnum}, {end}) Listlines {lnum} to {end} of current buffer
-getloclist({nr})   Listlist of location list items
+getloclist({nr}[, {what}]) Listlist of location list items
 getmatches()   Listlist of current matches
 getpid()   Number  process ID of Vim
 getpos({expr}) Listposition of cursor, mark, etc.
-getqflist()Listlist of quickfix items
+getqflist([{what}])Listlist of quickfix items
 getreg([{regname} [, 1 [, {list}]]])
String or List   contents of register
 getregtype([{regname}])String  type of register
@@ -2238,11 +2238,12 @@ setcharsearch({dict})   Dictset character 
search from {dict}
 setcmdpos({pos})   Number  set cursor position in command-line
 setfperm({fname}, {mode})  Number  set {fname} file permissions to {mode}
 setline({lnum}, {line})Number  set line {lnum} to {line}
-setloclist({nr}, {list}[, {action}])
+setloclist({nr}, {list}[, {action}[, {what}]])
Number  modify location list using {list}
 setmatches({list}) Number  restore a list of matches
 setpos({expr}, {list}) Number  set the {expr} position to {list}
-setqflist({list}[, {action}])  Number  modify quickfix list using {list}
+setqflist({list}[, {action}[, {what}]])
+   Number  modify quickfix list using {list}
 setreg({n}, {v}[, {opt}])  Number  set register to value and type
 settabvar({nr}, {varname}, {val}) none set {varname} in tab page {nr} to {val}
 settabwinvar({tabnr}, {winnr}, {varname}, {val})
@@ -4275,7 +4276,7 @@ getline({lnum} [, {end}])
 
 <  To get lines from another buffer see |getbufline()|
 
-getloclist({nr})   *getloclist()*
+getloclist({nr},[, {what}])*getloclist()*
Returns a list with all the entries in the location list for
window {nr}.  {nr} can be the window number or the window ID.
When {nr} is zero the current window is used.
@@ -4284,6 +4285,10 @@ getloclist({nr}) 
*getloclist()*
returned.  For an invalid window number {nr}, an empty list is
returned. Otherwise, same as |getqflist()|.
 
+   If the optional {what} dictionary argument is supplied, then
+   returns the items listed in {what} as a dictionary. Refer to
+   |getqflist()| for the supported keys in {what}.
+
 getmatches()   *getmatches()*
Returns a |List| with all matches previously defined by
|matchadd

Re: tests fail when run with valgrind

2016-07-24 Thread Dominique Pellé
Bram Moolenaar wrote:

>> Besides the test failure, several testdir/valgrind.* files
>> show memory leaks, despite having built Vim with
>> -DEXIT_FREE. For example, in valgrind.test_alot, I see:
>
> test_alot is a collection of tests.  Can you run them separately to
> isolate the one(s) that causes the leak?

I have not spent a lot of time on this yet. I'll spend more time later.
But this is enough to reproduce leaks (vim built with -DEXITFREE):

# Build vim with -DEXITFREE...
$ git diff Makefile
diff --git a/src/Makefile b/src/Makefile
index 001f87a..21fef20 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -667,7 +667,7 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS)
 # Configuration is in the .ccmalloc or ~/.ccmalloc file.
 # Doesn't work very well, since memory linked to from global variables
 # (in libraries) is also marked as leaked memory.
-#LEAK_CFLAGS = -DEXITFREE
+LEAK_CFLAGS = -DEXITFREE
 #LEAK_LIBS = -lccmalloc

 #



$ ./configure --with-features=huge --enable-gui=none
$ make
$ cd src/testdir
$ valgrind --leak-check=yes ../vim -u NONE -N \
   -S test_partial.vim -c 'call Test_job_start_fails()' -c q 2> log

And log file contains:

==6856== Memcheck, a memory error detector
==6856== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6856== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==6856== Command: ../vim -u NONE -N -S test_partial.vim -c call\
Test_job_start_fails() -c q
==6856==
==6857==
==6857== HEAP SUMMARY:
==6857== in use at exit: 350,433 bytes in 1,828 blocks
==6857==   total heap usage: 7,668 allocs, 5,840 frees, 844,057 bytes allocated
==6857==
==6857== 99 bytes in 19 blocks are possibly lost in loss record 249 of 379
==6857==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6857==by 0x4C1E2B: lalloc (misc2.c:920)
==6857==by 0x4C26CD: alloc (misc2.c:818)
==6857==by 0x4C26CD: vim_strsave (misc2.c:1256)
==6857==by 0x57AD1B: get_function_args (userfunc.c:207)
==6857==by 0x57DC42: ex_function (userfunc.c:1865)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x45C281: do_source (ex_cmds2.c:3975)
==6857==by 0x45CCEB: cmd_source (ex_cmds2.c:3588)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x408571: exe_commands (main.c:2893)
==6857==by 0x408571: main (main.c:778)
==6857==
==6857== 192 bytes in 8 blocks are possibly lost in loss record 281 of 379
==6857==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6857==by 0x4C1E2B: lalloc (misc2.c:920)
==6857==by 0x4C2F43: alloc (misc2.c:818)
==6857==by 0x4C2F43: ga_grow (misc2.c:2009)
==6857==by 0x57AD07: get_function_args (userfunc.c:201)
==6857==by 0x57DC42: ex_function (userfunc.c:1865)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x45C281: do_source (ex_cmds2.c:3975)
==6857==by 0x45CCEB: cmd_source (ex_cmds2.c:3588)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x408571: exe_commands (main.c:2893)
==6857==by 0x408571: main (main.c:778)
==6857==
==6857== 216 bytes in 9 blocks are possibly lost in loss record 287 of 379
==6857==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6857==by 0x4C1E2B: lalloc (misc2.c:920)
==6857==by 0x4C2F43: alloc (misc2.c:818)
==6857==by 0x4C2F43: ga_grow (misc2.c:2009)
==6857==by 0x57DF1A: ex_function (userfunc.c:2047)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x45C281: do_source (ex_cmds2.c:3975)
==6857==by 0x45CCEB: cmd_source (ex_cmds2.c:3588)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x408571: exe_commands (main.c:2893)
==6857==by 0x408571: main (main.c:778)
==6857==
==6857== 2,448 bytes in 19 blocks are possibly lost in loss record 350 of 379
==6857==at 0x4C2CE8E: realloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==6857==by 0x4C2EF0: ga_grow (misc2.c:2009)
==6857==by 0x57DF1A: ex_function (userfunc.c:2047)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x45C281: do_source (ex_cmds2.c:3975)
==6857==by 0x45CCEB: cmd_source (ex_cmds2.c:3588)
==6857==by 0x467D0C: do_one_cmd (ex_docmd.c:2925)
==6857==by 0x467D0C: do_cmdline (ex_docmd.c:1110)
==6857==by 0x408571: exe_commands (main.c:2893)
==6857==by 0x408571: main (main.c:778)
==6857==
==6857== 6,752 bytes in 29 blocks are possibly lost in loss record 365 of 379
==6857==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgprel

Re: Changing the defaults with Vim 8

2016-07-24 Thread Gary Johnson
On 2016-07-24, Bram Moolenaar wrote:
> Vim has always been conservative about the default option values.
> Without any .vimrc the default is 'compatible'.  That's nice for people
> who rely on the old Vi.  But how many of these still exist?  I expect
> nearly all Vim users to want 'nocompatible', thus create a .vimrc ASAP.
> 
> What has stopped me from changing this is the unexpected change.  Many
> users will notice that Vim suddenly behaves differently.  Some may be
> upset.  The release of Vim 8.0 might be the best point in time to do
> this.  If we do this.
> 
> Besides making 'nocompatible' the default, there are a few options that
> should probably be on by default.  Currently these are in
> $VIMRUNTIME/vimrc_example.vim.  Most of these only have a visual effect
> or slightly change how editing works.  You will notice this right away.
> The ones that have unexpected effects should be avoided.
> 
> If someone wants to start in the old way, the -C flag should be used:
> vim -C
> 
> If someone wants to start with 'nocompatible', but not all of the new
> option values, a .vimrc would be needed to change the settings.  This is
> the most common and also most tricky part.  Assuming that the user will
> want most of the new option values, but not all, he should be able to
> revert to the old value. For options that is easy.  But including the
> matchit plugin is not easy to revert.
> 
> What we can probably always do:

[...]

> Comments?

I think that for all the reasons you have given over the years,
changing the default behavior or default option values is a bad
idea.

I'm not sure what problem you're trying to solve.

Experienced users of Vim have already tweaked their vimrc files with
their preferred settings.  Changing the defaults is not going to
help them.

The Windows installer already creates a default system _vimrc in
$VIM which is used until a user creates their own ~/_vimrc.  The
system _vimrc could be changed to use whatever options values you
think would be better.  New users will get the new option values.
Existing users will keep their existing option values.

Linux users usually start with the Vim package for their
distribution.  Fedora-derived distributions and Ubuntu-derived
distributions at least provide system vimrc files with the option
values those package maintainers think are best.  So those users
already get "better" initial option values.

Many Linux users build their own Vim.  These users are usually
experienced enough to have a vimrc that sets their preferred option
values.  For those users that are not so experienced, you could
change "make install" to look for ~/.vim/vimrc, and if it doesn't
already exist, create one that has your idea of better initial
settings.

I understand that Vim could be made more useful and appealing to new
users with different default settings, but putting those settings in
a configuration file (such as $VIM/_vimrc on Windows or $VIM/vimrc
on Unix if not already present) could solve that problem without
changing the actual default settings or breaking existing users'
expectations or configurations.

Regards,
Gary

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.