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.c    2008-08-06 09:51:17.000000000 -0300
+++ edit.c    2008-11-06 20:34:46.000000000 -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_CHAR            1
@@ -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:    /* <Enter> */
         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
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui