How can I send a patch?

2008-11-06 Thread Roberto Miura Honji
I change something on vim code and some friends tell me that I would be send
this to development group. How can I send this?
The new function is:
 - Auto-complete using a tab key (like ctrl-p).
 - When the word have a '/' (linux separator of directories) auto-complete
like a file (ctrl-x ctrl-f).
 - When the list search is returned, the tab can be used to scroll through
the list.
 - when the previous char is space, tab, the cursor position is a col = 0 or
ctrl-x ctrl-i is typed, the char tab is insert normally)

I think that it's so cool to programmer that use the linux, actually
terminal linux.

The patch is:

diff -u src/edit.c edit.c
--- src/edit.c2008-08-06 09:51:17.0 -0300
+++ edit.c2008-11-06 20:34:46.0 -0200
@@ -165,6 +165,7 @@
 static int  ins_compl_use_match __ARGS((int c));
 static int  ins_complete __ARGS((int c));
 static int  quote_meta __ARGS((char_u *dest, char_u *str, int len));
+static int  complete_file();
 #endif /* FEAT_INS_EXPAND */

 #define BACKSPACE_CHAR1
@@ -1230,15 +1231,23 @@
 /* FALLTHROUGH */

 case TAB:/* TAB or Complete patterns along path */
+if ((ctrl_x_mode == CTRL_X_PATH_PATTERNS)
+|| (curwin->w_cursor.col == 0)
+|| (*(ml_get_cursor() - 1) == TAB
+|| (*(ml_get_cursor() - 1) == ' ' )))
+{
+inserted_space = FALSE;
+if (ins_tab())
+goto normalchar;/* insert TAB as a normal char */
+auto_format(FALSE, TRUE);
+break;
+}
+
 #if defined(FEAT_INS_EXPAND) && defined(FEAT_FIND_ID)
-if (ctrl_x_mode == CTRL_X_PATH_PATTERNS)
+if (complete_file())
+ctrl_x_mode = CTRL_X_FILES;
 goto docomplete;
 #endif
-inserted_space = FALSE;
-if (ins_tab())
-goto normalchar;/* insert TAB as a normal char */
-auto_format(FALSE, TRUE);
-break;

 case K_KENTER:/*  */
 c = CAR;
@@ -1433,6 +1442,25 @@
 }/* for (;;) */
 /* NOTREACHED */
 }
+/*
+ * This function return TRUE when TAB is going to complete a file type.
+ */
+static int
+complete_file()
+{
+char_u *line;
+colnr_T col = curwin->w_cursor.col;
+
+line = ml_get(curwin->w_cursor.lnum);
+
+while (line[col] != ' ' && col >= 0)
+{
+if (line[col] == '/')
+return TRUE;
+col = col-1;
+}
+return FALSE;
+}

 /*
  * Redraw for Insert mode.
@@ -2037,7 +2065,7 @@
 case CTRL_X_WHOLE_LINE:
 return (c == Ctrl_L || c == Ctrl_P || c == Ctrl_N);
 case CTRL_X_FILES:
-return (c == Ctrl_F || c == Ctrl_P || c == Ctrl_N);
+return (c == Ctrl_F || c == Ctrl_P || c == Ctrl_N || c == TAB);
 case CTRL_X_DICTIONARY:
 return (c == Ctrl_K || c == Ctrl_P || c == Ctrl_N);
 case CTRL_X_THESAURUS:
@@ -3534,7 +3562,7 @@
  * showing what mode we are in. */
 showmode();
 if ((ctrl_x_mode == 0 && c != Ctrl_N && c != Ctrl_P && c != Ctrl_R
- && !ins_compl_pum_key(c))
+ && !ins_compl_pum_key(c) && c != TAB)
 || ctrl_x_mode == CTRL_X_FINISHED)
 {
 /* Get here when we have finished typing a sequence of ^N and




-- 
--
Roberto Miura Honji
LAS - Laboratório de Administração e Segurança de Sistemas
Engenharia de Computação - 2006
Instituto de Computação - UNICAMP

email: [EMAIL PROTECTED] (principal)
email: [EMAIL PROTECTED]
msn:   [EMAIL PROTECTED]
---

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: How can I send a patch?

2008-11-06 Thread Tony Mechelynck

On 06/11/08 23:36, Roberto Miura Honji wrote:
> I change something on vim code and some friends tell me that I would be
> send this to development group. How can I send this?

You just did. Don't place your hopes too high, Bram has high standards 
on what is acceptable for mainline Vim.

> The new function is:
> - Auto-complete using a tab key (like ctrl-p).
> - When the word have a '/' (linux separator of directories)
> auto-complete like a file (ctrl-x ctrl-f).
> - When the list search is returned, the tab can be used to scroll
> through the list.
> - when the previous char is space, tab, the cursor position is a col = 0
> or ctrl-x ctrl-i is typed, the char tab is insert normally)
>
> I think that it's so cool to programmer that use the linux, actually
> terminal linux.
>
> The patch is:
[...]


Best regards,
Tony.
-- 
According to Kentucky state law, every person must take a bath at least
once a year.

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: How can I send a patch?

2008-11-06 Thread Roberto Miura Honji
I know that...
But it's só cool!! I'm a programmer and complete with a tab help me a lot :D

2008/11/7 Tony Mechelynck <[EMAIL PROTECTED]>

>
> On 06/11/08 23:36, Roberto Miura Honji wrote:
> > I change something on vim code and some friends tell me that I would be
> > send this to development group. How can I send this?
>
> You just did. Don't place your hopes too high, Bram has high standards
> on what is acceptable for mainline Vim.
>
> > The new function is:
> > - Auto-complete using a tab key (like ctrl-p).
> > - When the word have a '/' (linux separator of directories)
> > auto-complete like a file (ctrl-x ctrl-f).
> > - When the list search is returned, the tab can be used to scroll
> > through the list.
> > - when the previous char is space, tab, the cursor position is a col = 0
> > or ctrl-x ctrl-i is typed, the char tab is insert normally)
> >
> > I think that it's so cool to programmer that use the linux, actually
> > terminal linux.
> >
> > The patch is:
> [...]
>
>
> Best regards,
> Tony.
> --
> According to Kentucky state law, every person must take a bath at least
> once a year.
>
> >
>


-- 
--
Roberto Miura Honji
LAS - Laboratório de Administração e Segurança de Sistemas
Engenharia de Computação - 2006
Instituto de Computação - UNICAMP

email: [EMAIL PROTECTED] (principal)
email: [EMAIL PROTECTED]
msn:   [EMAIL PROTECTED]
---

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: How can I send a patch?

2008-11-06 Thread François Ingelrest

On Thu, Nov 6, 2008 at 23:36, Roberto Miura Honji <[EMAIL PROTECTED]> wrote:
>  - Auto-complete using a tab key (like ctrl-p).
>  - When the word have a '/' (linux separator of directories) auto-complete
> like a file (ctrl-x ctrl-f).
>  - When the list search is returned, the tab can be used to scroll through
> the list.
>  - when the previous char is space, tab, the cursor position is a col = 0 or
> ctrl-x ctrl-i is typed, the char tab is insert normally)

Maybe I didn't get what you mean, but 1, 3, and 4 can already be done
using the right mappings. I actually use something similar in my own
setup. Regarding 2, I think this should also be quite easy to do
without modifying Vim source code.

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: How can I send a patch?

2008-11-07 Thread David Fishburn

On Fri, Nov 7, 2008 at 2:19 AM, François Ingelrest
<[EMAIL PROTECTED]> wrote:
>
> On Thu, Nov 6, 2008 at 23:36, Roberto Miura Honji <[EMAIL PROTECTED]> wrote:
>>  - Auto-complete using a tab key (like ctrl-p).
>>  - When the word have a '/' (linux separator of directories) auto-complete
>> like a file (ctrl-x ctrl-f).
>>  - When the list search is returned, the tab can be used to scroll through
>> the list.
>>  - when the previous char is space, tab, the cursor position is a col = 0 or
>> ctrl-x ctrl-i is typed, the char tab is insert normally)
>
> Maybe I didn't get what you mean, but 1, 3, and 4 can already be done
> using the right mappings. I actually use something similar in my own
> setup. Regarding 2, I think this should also be quite easy to do
> without modifying Vim source code.

That is true and I have also installed some plugins to give me the
same functionality.

But, if this change is simple (I never look at the Vim code) it might
be worthwhile for the greater community.  Before I installed these
plugins I didn't know what Vim could do.  Those types of changes have
made it very useful and there are still many many Vim users which:
a) do not install plugins
b) are not allowed to install plugins
c) lack the experience to look for and install plugins to help them

These are useful features.

Having said that, I don't know if:
a) This would interfere with other features.
b) Whether we would then need some options to disable this which of
course Bram would kbosh.

Dave

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: How can I send a patch?

2008-11-08 Thread Bram Moolenaar


Roberto Miura Honji wrote:

> I change something on vim code and some friends tell me that I would be send
> this to development group. How can I send this?
> The new function is:
>  - Auto-complete using a tab key (like ctrl-p).
>  - When the word have a '/' (linux separator of directories) auto-complete
> like a file (ctrl-x ctrl-f).
>  - When the list search is returned, the tab can be used to scroll through
> the list.
>  - when the previous char is space, tab, the cursor position is a col = 0 or
> ctrl-x ctrl-i is typed, the char tab is insert normally)
> 
> I think that it's so cool to programmer that use the linux, actually
> terminal linux.
> 
> The patch is:

I have some trouble understanding how this works.  If it works like
CTRL-P, then why not use CTRL-P?  At least that avoids the problem that
someone wants to insert a Tab and gets completion instead.  Your
description sounds like it's a bit unpredictable.

The patch is hard-coding things that should be flexible.  For example,
in MS-Windows the path separator is a backslash.  And one should use
'isfname' to check if a character can be part of a file name.  The code
is also lacking support for multi-byte characters.  Still some work to
do!  But before you spend time on that, we need to find out if we really
want it to work this way.

-- 
Spam seems to be something useful to novices.  Later you realize that
it's a bunch of indigestable junk that only clogs your system.
Applies to both the food and the e-mail!

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: How can I send a patch?

2008-11-09 Thread Roberto Miura Honji
I will try to clear my words.
When tab is pressed in column 0 or in a new word, a character tab is
inserted. And when a Ctrl-x Ctrl-I is taped, a character tab is inserted too
(I changed this too).
I don't like to Ctrl-P because it's so slowed, a tab work better. I using a
linux terminal and the tab complete is so cool.

About the flexible, I think about this when I was working... But I didnt
know how do this. Anyway I can work more to put this.

2008/11/8 Bram Moolenaar <[EMAIL PROTECTED]>

>
> Roberto Miura Honji wrote:
>
> > I change something on vim code and some friends tell me that I would be
> send
> > this to development group. How can I send this?
> > The new function is:
> >  - Auto-complete using a tab key (like ctrl-p).
> >  - When the word have a '/' (linux separator of directories)
> auto-complete
> > like a file (ctrl-x ctrl-f).
> >  - When the list search is returned, the tab can be used to scroll
> through
> > the list.
> >  - when the previous char is space, tab, the cursor position is a col = 0
> or
> > ctrl-x ctrl-i is typed, the char tab is insert normally)
> >
> > I think that it's so cool to programmer that use the linux, actually
> > terminal linux.
> >
> > The patch is:
>
> I have some trouble understanding how this works.  If it works like
> CTRL-P, then why not use CTRL-P?  At least that avoids the problem that
> someone wants to insert a Tab and gets completion instead.  Your
> description sounds like it's a bit unpredictable.
>
> The patch is hard-coding things that should be flexible.  For example,
> in MS-Windows the path separator is a backslash.  And one should use
> 'isfname' to check if a character can be part of a file name.  The code
> is also lacking support for multi-byte characters.  Still some work to
> do!  But before you spend time on that, we need to find out if we really
> want it to work this way.
>
> --
> Spam seems to be something useful to novices.  Later you realize that
> it's a bunch of indigestable junk that only clogs your system.
> Applies to both the food and the e-mail!
>
>  /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net
> \\\
> ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/\\\
> \\\download, build and distribute -- http://www.A-A-P.org
>  ///
>  \\\help me help AIDS victims -- http://ICCF-Holland.org
>  ///
>



-- 
--
Roberto Miura Honji
LAS - Laboratório de Administração e Segurança de Sistemas
Engenharia de Computação - 2006
Instituto de Computação - UNICAMP

email: [EMAIL PROTECTED] (principal)
email: [EMAIL PROTECTED]
msn:   [EMAIL PROTECTED]
---

--~--~-~--~~~---~--~~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---