Commits

Takeshi NISHIDA committed 3446e67

implemented one block delete

Comments (0)

Files changed (3)

         \   [ g:fuf_keyOpenTabpage   , 'onCr(' . s:OPEN_TYPE_TAB     . ', 0)' ],
         \   [ '<BS>'                 , 'onBs()'                               ],
         \   [ '<C-h>'                , 'onBs()'                               ],
+        \   [ '<C-w>'                , 'onDeleteWord()'                       ],
         \   [ g:fuf_keyPreview       , 'onPreviewBase(1)'                     ],
         \   [ g:fuf_keyNextMode      , 'onSwitchMode(+1)'                     ],
         \   [ g:fuf_keyPrevMode      , 'onSwitchMode(-1)'                     ],
 
 "
 function s:handlerBase.onBs()
+  call feedkeys((pumvisible() ? "\<C-e>\<BS>" : "\<BS>"), 'n')
+endfunction
+
+"
+function s:getLastBlockLength(pattern, patternIsPath)
+  let separatorPos = strridx(a:pattern, g:fuf_patternSeparator)
+  if separatorPos >= 0
+    return len(a:pattern) - separatorPos
+  endif
+  if a:patternIsPath && a:pattern =~# '[/\\].'
+    return len(matchstr(a:pattern, '[^/\\]*.$'))
+  endif
+  return len(a:pattern)
+endfunction
+
+"
+function s:handlerBase.onDeleteWord()
   let pattern = self.removePrompt(getline('.')[ : col('.') - 2])
-  if empty(pattern)
-    let numBs = 0
-  elseif !g:fuf_smartBs
-    let numBs = 1
-  elseif pattern[-len(g:fuf_patternSeparator) : ] ==# g:fuf_patternSeparator
-    let numBs = len(split(pattern, g:fuf_patternSeparator, 1)[-2])
-          \   + len(g:fuf_patternSeparator)
-  elseif self.targetsPath() && pattern[-1 : ] =~# '[/\\]'
-    let numBs = len(matchstr(pattern, '[^/\\]*.$'))
-  else
-    let numBs = 1
-  endif
+  let numBs = s:getLastBlockLength(pattern, 1)
   call feedkeys((pumvisible() ? "\<C-e>" : "") . repeat("\<BS>", numBs), 'n')
 endfunction
 
 
 補完メニューの最初のアイテムは自動的に選択状態になります。
 
+<C-w> で入力パターンからカーソル前の、ディレクトリ名などのひとかたまりを削除す
+ることができます。
+
 <C-s> (|g:fuf_keyPrevPattern|) と <C-^> (|g:fuf_keyNextPattern|) で、履歴から
 過去に入力したパターンを呼び出すことができます。
 
 
         See also: |fuf-search-patterns|
 
-                                                            *g:fuf_smartBs*  >
-  let g:fuf_smartBs = 1
-<
-        真なら、パス区切り文字の直後で <BS> を入力するとディレクトリ名1つ分を
-        削除し、|g:fuf_patternSeparator|の直後で <BS> を入力するとパターン1つ分
-        を削除します。
-
                                                         *g:fuf_reuseWindow*  >
   let g:fuf_reuseWindow = 1
 <
 
 The first item in the completion menu will be selected automatically.
 
+Typing <C-w> deletes one block of an entered pattern before the cursor, like a
+directory name.
+
 with <C-s> (|g:fuf_keyPrevPattern|) and <C-^> (|g:fuf_keyNextPattern|), You
 can recall patterns which have been entered before from history.
 
 
         See also: |fuf-search-patterns|
 
-                                                            *g:fuf_smartBs*  >
-  let g:fuf_smartBs = 1
-<
-        If non-zero, pressing <BS> after a path separator deletes one
-        directory name and pressing <BS> after |g:fuf_patternSeparator|
-        deletes one pattern.
-
                                                         *g:fuf_reuseWindow*  >
   let g:fuf_reuseWindow = 1
 <
   - Fixed a bug that FuzzyFinder caused reseting window layout.
   - Improved speed of changing buffers.
   - Improved the way to add modes.
+  - Removed g:fuf_smartBs option. Use <C-w> instead.
 
 3.5:
   - Added Line mode.
 
 2.3:
   - Added a key mapping to open items in a new tab page and
-    g:FuzzyFinderOptions.Base.key_open_tab opton.
+    g:FuzzyFinderOptions.Base.key_open_tab option.
   - Changed to show Fuzzyfinder window above last window even if 'splitbelow'
     was set.
   - Changed to set nocursorline and nocursorcolumn in Fuzzyfinder.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.