'cpoptions': Remove "j" flag

This commit is contained in:
David Bürgin
2015-05-01 15:25:48 +02:00
committed by Justin M. Keyes
parent 297973ab00
commit 44175224cc
6 changed files with 12 additions and 21 deletions

View File

@@ -147,8 +147,7 @@ These commands, except "gJ", insert one space in place of the <EOL> unless
there is trailing white space or the next line starts with a ')'. These there is trailing white space or the next line starts with a ')'. These
commands, except "gJ", delete any leading white space on the next line. If commands, except "gJ", delete any leading white space on the next line. If
the 'joinspaces' option is on, these commands insert two spaces after a '.', the 'joinspaces' option is on, these commands insert two spaces after a '.',
'!' or '?' (but if 'cpoptions' includes the 'j' flag, they insert two spaces '!' or '?'.
only after a '.').
The 'B' and 'M' flags in 'formatoptions' change the behavior for inserting The 'B' and 'M' flags in 'formatoptions' change the behavior for inserting
spaces before and after a multi-byte character |fo-table|. spaces before and after a multi-byte character |fo-table|.

View File

@@ -1779,9 +1779,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*cpo-I* *cpo-I*
I When moving the cursor up or down just after inserting I When moving the cursor up or down just after inserting
indent for 'autoindent', do not delete the indent. indent for 'autoindent', do not delete the indent.
*cpo-j*
j When joining lines, only add two spaces after a '.',
not after '!' or '?'. Also see 'joinspaces'.
*cpo-J* *cpo-J*
J A |sentence| has to be followed by two spaces after J A |sentence| has to be followed by two spaces after
the '.', '!' or '?'. A <Tab> is not recognized as the '.', '!' or '?'. A <Tab> is not recognized as
@@ -4024,7 +4021,6 @@ A jump table for the options with a short description can be found at |Q_op|.
'joinspaces' 'js' boolean (default on) 'joinspaces' 'js' boolean (default on)
global global
Insert two spaces after a '.', '?' and '!' with a join command. Insert two spaces after a '.', '?' and '!' with a join command.
When 'cpoptions' includes the 'j' flag, only do this after a '.'.
Otherwise only one space is inserted. Otherwise only one space is inserted.
*'key'* *'key'*

View File

@@ -3719,11 +3719,10 @@ static int ins_compl_get_exp(pos_T *ini)
/* IObuf =~ "\k.* ", thus len >= 2 */ /* IObuf =~ "\k.* ", thus len >= 2 */
if (p_js if (p_js
&& (IObuff[len - 2] == '.' && (IObuff[len - 2] == '.'
|| (vim_strchr(p_cpo, CPO_JOINSP) || IObuff[len - 2] == '?'
== NULL || IObuff[len - 2] == '!')) {
&& (IObuff[len - 2] == '?'
|| IObuff[len - 2] == '!'))))
IObuff[len++] = ' '; IObuff[len++] = ' ';
}
} }
/* copy as much as possible of the new word */ /* copy as much as possible of the new word */
if (tmp_ptr - ptr >= IOSIZE - len) if (tmp_ptr - ptr >= IOSIZE - len)

View File

@@ -3460,12 +3460,10 @@ int do_join(long count,
endcurr1 = endcurr2; endcurr1 = endcurr2;
else else
++spaces[t]; ++spaces[t];
/* extra space when 'joinspaces' set and line ends in '.' */ // Extra space when 'joinspaces' set and line ends in '.', '?', or '!'.
if ( p_js if (p_js && (endcurr1 == '.' || endcurr1 == '?' || endcurr1 == '!')) {
&& (endcurr1 == '.'
|| (vim_strchr(p_cpo, CPO_JOINSP) == NULL
&& (endcurr1 == '?' || endcurr1 == '!'))))
++spaces[t]; ++spaces[t];
}
} }
} }
currsize = (int)STRLEN(curr); currsize = (int)STRLEN(curr);

View File

@@ -97,7 +97,6 @@
#define CPO_FNAMEW 'F' /* set file name for ":w file" */ #define CPO_FNAMEW 'F' /* set file name for ":w file" */
#define CPO_INTMOD 'i' /* interrupt a read makes buffer modified */ #define CPO_INTMOD 'i' /* interrupt a read makes buffer modified */
#define CPO_INDENT 'I' /* remove auto-indent more often */ #define CPO_INDENT 'I' /* remove auto-indent more often */
#define CPO_JOINSP 'j' /* only use two spaces for join after '.' */
#define CPO_ENDOFSENT 'J' /* need two spaces to detect end of sentence */ #define CPO_ENDOFSENT 'J' /* need two spaces to detect end of sentence */
#define CPO_KEYCODE 'k' /* don't recognize raw key code in mappings */ #define CPO_KEYCODE 'k' /* don't recognize raw key code in mappings */
#define CPO_KOFFSET 'K' /* don't wait for key code in mappings */ #define CPO_KOFFSET 'K' /* don't wait for key code in mappings */
@@ -141,9 +140,9 @@
* cursor would not move */ * cursor would not move */
/* default values for Vim, Vi and POSIX */ /* default values for Vim, Vi and POSIX */
#define CPO_VIM "aABceFs" #define CPO_VIM "aABceFs"
#define CPO_VI "aAbBcCdDeEfFiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;" #define CPO_VI "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>;"
#define CPO_ALL \ #define CPO_ALL \
"aAbBcCdDeEfFiIjJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>#{|&/\\.;" "aAbBcCdDeEfFiIJkKlLmMnoOpPqrRsStuvWxXyZ$!%+<>#{|&/\\.;"
/* characters for p_ww option: */ /* characters for p_ww option: */
#define WW_ALL "bshl<>[],~" #define WW_ALL "bshl<>[],~"

View File

@@ -4335,10 +4335,10 @@ search_line:
/* IObuf =~ "\(\k\|\i\).* ", thus i >= 2*/ /* IObuf =~ "\(\k\|\i\).* ", thus i >= 2*/
if (p_js if (p_js
&& (IObuff[i-2] == '.' && (IObuff[i-2] == '.'
|| (vim_strchr(p_cpo, CPO_JOINSP) == NULL || IObuff[i-2] == '?'
&& (IObuff[i-2] == '?' || IObuff[i-2] == '!')) {
|| IObuff[i-2] == '!'))))
IObuff[i++] = ' '; IObuff[i++] = ' ';
}
} }
/* copy as much as possible of the new word */ /* copy as much as possible of the new word */
if (p - aux >= IOSIZE - i) if (p - aux >= IOSIZE - i)