[gnome-builder/wip/csoriano/operators: 1/2] source-vim: Make cw behaves like ce



commit 9094162c49516fb81d0de83e5430e8990b85305d
Author: Carlos Soriano <csoriano gnome org>
Date:   Fri Jan 30 15:50:23 2015 +0100

    source-vim: Make cw behaves like ce
    
    It is more convenient since when we want to change a word we want
    to substitute that word, not that word plus the spaces after it.
    
    It is how Vim behaves.

 src/vim/gb-source-vim.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/vim/gb-source-vim.c b/src/vim/gb-source-vim.c
index ff28e2d..e2e554a 100644
--- a/src/vim/gb-source-vim.c
+++ b/src/vim/gb-source-vim.c
@@ -4817,6 +4817,11 @@ gb_source_vim_cmd_change (GbSourceVim *vim,
     }
   else if (modifier != 'd')
     {
+      /* In Vim changing a word (cw) behaves like changing to end (ce) */
+      if (modifier == 'w')
+        modifier = 'e';
+      if (modifier == 'W')
+        modifier = 'E';
       /* cd should do nothing */
       gb_source_vim_cmd_delete (vim, count, modifier);
       gb_source_vim_set_mode (vim, GB_SOURCE_VIM_INSERT);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]