Giter VIP home page Giter VIP logo

ctrlsf.vim's Introduction

ctrlsf.vim

An ack/ag/pt/rg powered code search and view tool, takes advantage of Vim 8's power to support asynchronous searching, and lets you edit file in-place with Edit Mode.

Asynchronous Search

A demo shows how to search a word in an asynchronous way.

ctrlsf async_demo

Compact View

A demo shows compact view which looks more similar to Vim's quickfix windows.

ctrlsf compact_demo

Edit Mode

A demo shows how to rename a method named FocusWindow() to Focus() in multiple files, using vim-multiple-cursors.

ctrlsf_edit_demo

Table of Contents

Features

  • Search and display result in a user-friendly view with adjustable context.

  • Works in both asynchronous (for Vim 8.0.1039+ and NeoVim) and synchronous (for older version of Vim) manner.

  • Edit mode which is incredible useful when you are working on project-wide refactoring. (Inspired by vim-ags)

  • Preview mode for fast exploring.

  • Has two types of view. For both users who love a sublime-like, rich context result window, and users who feel more comfortable with good old quickfix window. (similar to ack.vim)

  • Various options for customized search, view and edition.

Installation

  1. Make sure you have ack, ag, pt or rg installed. (Note: currently only Ack2 is supported by plan)

  2. An easy way to install CtrlSF is using a package manager, like pathogen, vundle, neobundle or vim-plug.

    In vim-plug:

    Plug 'dyng/ctrlsf.vim'
  3. Read Quick Start for how to use.

Quick Start

  1. Run :CtrlSF [pattern], it will split a new window to show search result.

  2. If you are doing an asynchronous searching, you can explore and edit other files in the meanwhile, and can always press Ctrl-C to stop searching.

  3. In the result window, press Enter/o to open corresponding file, or press q to quit.

  4. Press p to explore file in a preview window if you only want a glance.

  5. You can edit search result as you like. Whenever you apply a change, you can save your change to actual file by :w.

  6. If you change your mind after saving, you can always undo it by pressing u and saving it again.

  7. :CtrlSFOpen can reopen CtrlSF window when you have closed CtrlSF window. It is free because it won't invoke a same but new search. A handy command :CtrlSFToggle is also available.

  8. If you prefer a quickfix-like result window, just try to press M in CtrlSF window.

Key Maps

In CtrlSF window:

  • Enter, o, double-click - Open corresponding file of current line in the window which CtrlSF is launched from.
  • <C-O> - Like Enter but open file in a horizontal split window.
  • t - Like Enter but open file in a new tab.
  • p - Like Enter but open file in a preview window.
  • P - Like Enter but open file in a preview window and switch focus to it.
  • O - Like Enter but always leave CtrlSF window opening.
  • T - Like t but focus CtrlSF window instead of new opened tab.
  • M - Switch result window between normal view and compact view.
  • q - Quit CtrlSF window.
  • <C-J> - Move cursor to next match.
  • <C-N> - Move cursor to next file's first match.
  • <C-K> - Move cursor to previous match.
  • <C-P> - Move cursor to previous file's first match.
  • <C-C> - Stop a background searching process.
  • <C-T> - (If you have fzf installed) Use fzf for faster navigation. In the fzf window, use <Enter> to focus specific match and <C-O> to open matched file.

In preview window:

  • q - Close preview window.

Some default defined keys may conflict with keys you have been used to when you are editing. But don't worry, you can customize your mapping by setting g:ctrlsf_mapping. :h g:ctrlsf_mapping for more information.

Use Your Own Map

CtrlSF provides many maps which you can use for quick accessing all features, here I will list some most useful ones.

  • <Plug>CtrlSFPrompt

    Input :CtrlSF in command line for you, just a handy shortcut.

  • <Plug>CtrlSFVwordPath

    Input :CtrlSF foo in command line where foo is the current visual selected word, waiting for further input.

  • <Plug>CtrlSFVwordExec

    Like <Plug>CtrlSFVwordPath, but execute it immediately.

  • <Plug>CtrlSFCwordPath

    Input :CtrlSF foo in command line where foo is word under the cursor.

  • <Plug>CtrlSFCCwordPath

    Like <Plug>CtrlSFCwordPath, but also add word boundary around searching word.

  • <Plug>CtrlSFPwordPath

    Input :CtrlSF foo in command line where foo is the last search pattern of vim.

For a full list of maps, please refer to the document.

I strongly recommend you should do some maps for a nicer user experience, because typing 8 characters for every single search is really boring and painful experience. Another reason is that one of the most useful feature 'Search Visual Selected Word' can be accessed by map only.

Example:

nmap     <C-F>f <Plug>CtrlSFPrompt
vmap     <C-F>f <Plug>CtrlSFVwordPath
vmap     <C-F>F <Plug>CtrlSFVwordExec
nmap     <C-F>n <Plug>CtrlSFCwordPath
nmap     <C-F>p <Plug>CtrlSFPwordPath
nnoremap <C-F>o :CtrlSFOpen<CR>
nnoremap <C-F>t :CtrlSFToggle<CR>
inoremap <C-F>t <Esc>:CtrlSFToggle<CR>

Edit Mode

  1. Edit mode is not really a 'mode'. You don't need to press any key to enter edit mode, just edit the result directly.

  2. When your editing is done, save it and CtrlSF will ask you for confirmation, 'y' or just enter will make CtrlSF apply those changes to actual files. (You can turn off confirmation by setting g:ctrlsf_confirm_save to 0)

  3. Undo is the same as regular editing. You just need to press 'u' and save again.

  4. Finally I recommend using vim-multiple-cursors together with edit mode.

Limitation

  • You can modify or delete lines but you can't insert. (If it turns out that inserting is really needed, I'll implement it later.)

  • If a file's content varies from last search, CtrlSF will refuse to write your changes to that file (for safety concern). As a rule of thumb, invoke a new search before editing, or just run :CtrlSFUpdate.

Arguments

CtrlSF has a lot of arguments you can use in search. Most arguments are similar to Ack/Ag's but not perfectly same. Here are some most frequently used arguments:

  • -R - Use regular expression pattern.
  • -I, -S - Search case-insensitively (-I) or case-sensitively (-S).
  • -C, -A, -B - Specify how many context lines to be printed, identical to their counterparts in Ag/Ack.
  • -W - Only match whole words.

Read :h ctrlsf-arguments for a full list of arguments.

Example

  • Search a regular expression pattern case-insensitively:

    :CtrlSF -R -I foo.*
  • Search a pattern that contains space:

    :CtrlSF 'def foo():'
  • Search a pattern with characters requiring escaping:

    :CtrlSF '"foobar"'
    " or
    :CtrlSF \"foobar\"

Tips

  • CtrlSF searches pattern literally by default, which is different from Ack/Ag. If you need to search a regular expression pattern, run :CtrlSF -R regex. If you dislike this default behavior, turn it off by let g:ctrlsf_regex_pattern = 1.

  • By default, CtrlSF use working directory as search path when no path is specified. But CtrlSF can also use project root as its path if you set g:ctrlsf_default_root to project, CtrlSF does this by searching VCS directory (.git, .hg, etc.) upward from current file. It is useful when you are working with files across multiple projects.

  • -filetype is useful when you only want to search in files of specific type. Read option --type in ack's manual for more information. Also, a shortcut -T is available.

  • If -filetype does not exactly match your need, there is an option -filematch with which you have more control on which files should be searched. -filematch accepts a pattern that only files match this pattern will be searched. Note the pattern is in syntax of your backend but not vim's. Also, a shortcut -G is available.

  • Running :CtrlSF without any argument or pattern will use word under cursor.

Configuration

  • g:ctrlsf_auto_close defines if CtrlSF close itself when you are opening some file. By default, CtrlSF window will close automatically in normal view mode and keep open in compact view mode. You can customize the value as below:

    let g:ctrlsf_auto_close = {
        \ "normal" : 0,
        \ "compact": 0
        \}
  • g:ctrlsf_auto_focus defines how CtrlSF focuses result pane when working in async search mode. By default, CtrlSF will not focus at all, setting to start makes CtrlSF focus at search starting, setting to done makes CtrlSF focus at search is done, but only for immediately finished search. An additional duration_less_than is used to define max duration of a search can be focused for 'at done', which is an integer value of milliseconds.

    let g:ctrlsf_auto_focus = {
        \ "at": "start"
        \ }
    " or
    let g:ctrlsf_auto_focus = {
        \ "at": "done",
        \ "duration_less_than": 1000
        \ }
  • g:ctrlsf_auto_preview defines whether CtrlSF shows the preview window automatically while moving from match to match in the results pane. The default value is 0.

    let g:ctrlsf_auto_preview = 1
  • g:ctrlsf_case_sensitive defines default case-sensitivity in search. Possible values are yes, no and smart, smart works the same as it is in vim. The default value is smart.

    let g:ctrlsf_case_sensitive = 'no'
  • g:ctrlsf_context defines how many context lines will be printed. Please read ack's manual for acceptable format. The default value is -C 3, and you can set another value by

    let g:ctrlsf_context = '-B 5 -A 3'
  • g:ctrlsf_default_root defines how CtrlSF find search root when no explicit path is given. Two possible values are cwd and project. cwd means current working directory and project means project root. CtrlSF locates project root by searching VCS root (.git, .hg, .svn, etc.)

    let g:ctrlsf_default_root = 'project'
  • g:ctrlsf_default_view_mode defines default view mode which CtrlSF will use. Possible values are normal and compact. The default value is normal.

    let g:ctrlsf_default_view_mode = 'compact'
  • g:ctrlsf_extra_backend_args is a dictionary that defines extra arguments that will be passed literally to backend, especially useful when you have your favorite backend and need some backend-specific features. For example, using ptignore file for pt should be like

    let g:ctrlsf_extra_backend_args = {
        \ 'pt': '--home-ptignore'
        \ }
  • g:ctrlsf_extra_root_markers is a list contains custom root markers. For example, this option is set ['.root'], and there exists a file or directory /home/your/project/.root, then /home/your/project will be recognized as project root.

    let g:ctrlsf_extra_root_markers = ['.root']
  • g:ctrlsf_fold_result defines whether CtrlSF should fold result at first. Despite this option you can always fold or unfold manually by zc and zo.

    let g:ctrlsf_fold_result = 1
  • g:ctrlsf_mapping defines maps used in result window and preview window. Value of this option is a dictionary, where key is a method and value is a key for mapping. An empty value can disable that method. To specify additional keys to run after a method, use the extended form demonstrated below to specify a suffix. You can just define a subset of full dictionary, those not defined functionalities will use default key mapping.

    let g:ctrlsf_mapping = {
        \ "openb": { key: "O", suffix: "<C-w>p" },
        \ "next": "n",
        \ "prev": "N",
        \ }
  • g:ctrlsf_populate_qflist defines if CtrlSF will also feed quickfix and location list with search result. By default this feature is disabled but you can enable it by

    let g:ctrlsf_populate_qflist = 1
  • g:ctrlsf_regex_pattern defines CtrlSF using literal pattern or regular expression pattern as default. Default value is 0, which means literal pattern.

    let g:ctrlsf_regex_pattern = 1
  • g:ctrlsf_search_mode defines whether CtrlSF works in synchronous or asynchronous way. async is the recommendation for users who are using Vim 8.0+.

    let g:ctrlsf_search_mode = 'async'
  • g:ctrlsf_position defines where CtrlSf places its window in normal view mode. Possible values are left, left_local, right, right_local, top and bottom. If nothing specified, the default value is left.

    let g:ctrlsf_position = 'bottom'
  • g:ctrlsf_compact_position defines where CtrlSf places its window in compact view mode. Possible values are bottom_inside, bottom_outside, top_inside, and top_outside. If nothing specified, the default value is bottom_outside.

    let g:ctrlsf_compact_position = 'bottom_inside'
  • g:ctrlsf_winsize defines the width (if CtrlSF opens vertically) or height (if CtrlSF opens horizontally) of CtrlSF main window. You can specify it with percent value or absolute value.

    let g:ctrlsf_winsize = '30%'
    " or
    let g:ctrlsf_winsize = '100'

A full list of options can be found in :help ctrlsf-options.

For user comes from pre v1.0

Difference between v1.0 and pre-v1.0

There are many features and changes introduced in v1.0, but the most important difference is v1.0 breaks backward compatibility.

Where and why backward compatibility is given up?

CtrlSF is at first designed as a wrapper of ag/ack within vim, and the principle of interface design is sticking to the interface of ag/ack running upon shell. This fact lets user get access to all features of ag/ack, and it's easier to implement too. However I found it is not as useful as I thought, what's worse, this principle limits features I could add to CtrlSF and makes CtrlSF counter-intuitive sometimes.

So I want to change it.

Example:

Case-insensitive searching in pre-v1.0 CtrlSF is like this

CtrlSF -i foo

In v1.0, that will be replaced by

CtrlSF -ignorecase foo

For those most frequently used arguments, an upper case short version is available

CtrlSF -I foo

ctrlsf.vim's People

Contributors

akupila avatar baopham avatar chrisbra avatar christianrondeau avatar dasea avatar dyng avatar eugoss avatar gaving avatar hiberabyss avatar idanarye avatar isaac-pascual avatar jeetsukumaran avatar jesuiswk avatar kevinhwang91 avatar khingblue avatar mkitt avatar mukulgupta21 avatar nkgm avatar pavelvpv avatar shanesmith avatar smackesey avatar spacewander avatar subev avatar synic avatar unc0 avatar v-kolesnikov avatar vbwx avatar wsdjeg avatar yggdroot avatar zhyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ctrlsf.vim's Issues

:w ERROR

Error detected while processing function ctrlsf#Save..ctrlsf#edit#Save..144_Diff..144_DiffFile:
line 3:
E605: Exception not caught: InconsistentException
Error detected while processing function ctrlsf#Save..ctrlsf#edit#Save..144_Diff:
line 12:
E171: Missing :endif

ctrlsf.vim version:
➜ ctrlsf.vim git:(master) ✗ git branch -av

  • master 3a99228 Merge pull request #50 from dyng/hotfix/restoring-fixed-window-size

Incorrect complain about file has been changed since last search

Hi, this is a great plugin, but this error makes it not very usefull.

It is inside a git repository and I know for sure that file has not been modified since last search. Also running CtrlsfUpdate doesn't help since it shows exactly the same result and also editing and writing fails with the same error.

File ... has been changed since last search. Skip this file. Please run :CtrlsfUpdate to update your search result.
d since last search. Skip this file. Please run :CtrlsfUpdate to update your search result.
0 files are saved (1 skipped).

noremap <Plug> commands doesn't work?

There's probably some simple explanation because I don't understand vim mapping well enough but I was confused as to why I couldn't just do
nnoremap <C-F>f <Plug>CtrlSFPrompt
and expect that to work. I finally did what is said on the readme but found it confusing that I couldn't use the noremap versions.

preview window not compatible with NerdTree

The width of the NerdTree window will be minimized after pressing p in the CtrlSF window, and the NerdTree window will almost be invisible. The width of the NerdTree window will keep minimized even after closing the CtrlSF window.

The left window is the NerdTree window
image

Results opening in a horizontal split

Hi,

I'm not sure if this is a bug or a feature, but when I press <CR> to go to a file from CtrlSF results, it opens the file in a new horizontal split. I can't seem to find any option to customize this behavior. Is there a way to open the file without splitting?

-filetype filter

Im trying to do this

:CtrlSF -filetype js test

But I got this message:

Failed to call backend. Error messages: ag: unrecognized option `--js'^@Usage: ag [OPTIONS] PATTERN [PATH]^@^@Recursively search for PATTERN in PATH.^@Like grep or ack, but faster.^@^@Examp
le: ag -i foo /bar/^@^@Search options:^@^@--ackmate               Print results in AckMate-parseable format^@-a --all-types          Search all files (doesn't include hidden files^@
                or patterns from ignore files)^@-A --after [LINES]      Print lines before match (Default: 2)^@-B --before [LINES]     Print lines after match (Default: 2)^@--[no]break
        Print newlines between matches in different files^@                        (Enabled by default)^@--[no]color             Print color codes in results (Enabled by default)^@--color-l
ine-number     Color codes for line numbers (Default: 1;33)^@--color-match           Color codes for result match numbers (Default: 30;43)^@--color-path            Color codes for path name
s (Default: 1;32)^@--column                Print column numbers in results^@--line-numbers          Print line numbers even for streams^@-C --context [LINES]    Print lines before and after
 matches (Default: 2)^@-D --debug              Ridiculous debugging (probably not useful)^@--depth NUM             Search up to NUM directories deep (Default: 25)^@-f --follow             F
ollow symlinks^@--[no]group             Same as --[no]break --[no]heading^@-g PATTERN              Print filenames matching PATTERN^@-G, --file-search-regex PATTERN Limit search to filename
s matching PATTERN^@--[no]heading^@--hidden                Search hidden files (obeys .*ignore files)^@-i, --ignore-case       Match case insensitively^@--ignore PATTERN        Ignore files
/directories matching PATTERN^@                        (literal file/directory names also allowed)^@--ignore-dir NAME       Alias for --ignore for compatibility with ack.^@-l --files-with-m
atches Only print filenames that contain matches^@                        (don't print the matching lines)^@-L --files-without-matches^@                        Only print filenames that don
't contain matches^@-m --max-count NUM      Skip the rest of a file after NUM matches (Default: 10,000)^@--no-numbers            Don't show line numbers^@-p --path-to-agignore STRING^@
                   Use .agignore file at STRING^@--print-long-lines      Print matches on very long lines (Default: >2k characters)^@-Q --literal            Don't parse PATTERN as a regular
 expression^@-s --case-sensitive     Match case sensitively (Enabled by default)^@-S --smart-case         Match case insensitively unless PATTERN contains^@                        uppercase
 characters^@--search-binary         Search binary files for matches^@--stats                 Print stats (files scanned, time taken, etc.)^@-t --all-text           Search all text files (d
oesn't include hidden files)^@-u --unrestricted       Search all files (ignore .agignore, .gitignore, etc.;^@                        searches binary and hidden files as well)^@-U --skip-vcs
-ignores   Ignore VCS ignore files^@                        (.gitignore, .hgignore, .svnignore; still obey .agignore)^@-v --invert-match^@-w --word-regexp        Only match whole words^@-z
--search-zip         Search contents of compressed (e.g., gzip) files^@^@

outside neovim when I do:

ack --type=js test

it works perfect.

Please support adding all matches to the quickfixlist

As per the title. I really love the :CtrlSF functionality, but sometimes it would be handy, having all matches in the quickfixlist. This has the advantage of having a quick overview of how many matches there are and second, one could make use of a quickfixdo command (which hopefully will be a Vim builtin soon)

Ack2? or Ack1

Hi there,

I noticed that the repo you've linked in the README.md is to Ack1.0.
Currently that repo is no longer maintained and it directs you to use Ack2.

Does Ack2 work with this plugin?
Or should I just use Ag instead?

Please let me know, thanks :)

Highlight of words ending in ! or ?

Hi there!

First of all, thank you for the great plugin! I was trying to find an answer to this on my own, but I think I need help. In Ruby, a method name can end with ? or ! and when you do :CtrlSF email_confirmed? it's desirable for the highlighter to be aware of the ? or ! characters. However, currently it is not. It only highlights the email_confirmed although the search itself includes the question mark. Any ideas or suggestions?

segmentation fault

Hi,在mac下的itemr中使用vi编辑文件,使用:CtrlSF xxx后vi自动退出,并且提示segmentation fault: vim

Error running :CtrlSFOpen before :CtrlSF

Got these when running :CtrlSFOpen before :CtrlSF.

Error detected while processing function CtrlSF#OpenWindow..<SNR>87_OpenWindow..<SNR>87_HighlightMatch:
line    2:
E716: Key not present in Dictionary: ignorecase
E15: Invalid expression: s:ackprg_options['ignorecase'] ? '\c' : ''
line    3:
E121: Undefined variable: case
E116: Invalid arguments for function printf("/%s%s/", case, escape(s:ackprg_options['pattern'], '/'))
E15: Invalid expression: printf("/%s%s/", case, escape(s:ackprg_options['pattern'], '/'))
line    4:
E121: Undefined variable: pattern
E15: Invalid expression: 'match ctrlsfMatch ' . pattern

和 multiple cursor 冲突

function! Multiple_cursors_before()
    if exists(':NeoCompleteLock')==2
        exe 'NeoCompleteLock'
    endif
endfunction

function! Multiple_cursors_after()
    if exists(':NeoCompleteUnlock')==2
        exe 'NeoCompleteUnlock'
    endif
endfunction

为了使 multiple cursor 和 neocomplete 共存,我定义了上面两个函数(也是 multiple cursor 推荐的),然而这样做的结果是 ctrlsf 的快捷键都失效了,比如 p, <cr> 都无法打开。去掉正常。

CtrlSFVwordPath and CtrlSFVwordExec mappings are not working

Hi!
I am trying to get along with this useful plugin. But I cannot get working CtrlSFVwordPath and CtrlSFVwordExec mappings. I use key mappings from the doc. Also, I tried to play with them. But it does not help. I always get the following output and nothing happens:
:call feedkeys(":\<C-U>CtrlSF " . g:CtrlSFGetVisualSelection()."\r")

Can you please help me with this?

:%s/test/newtext/ corrupts filenames in editmode when path/filename include "test"...

I will try to simplify the example, if you run the following commands to create a test directory:

mkdir test
cd test
echo "testing\nlook text\nothertext\n" > test.txt
echo "testing\nlook text\nothertext\n" > look.txt
echo "testing\nlook text\nothertext\n" > other.txt

Then start vim, do a :CtrlSF test you will see the CtrlSF window pop up. If you then do a :%s/test/newtext/g the substitute is applied to the CtrlSF buffer and then :w fails with "CtrlSF's write buffer is corrupted. Note that you can't insert line/delete block/delete entire file in edit mode." because the substitute has changed the "text.txt" filename to newtext.txt in the buffer.

I am not sure how you can get around this, I just tested vim-ags and it seems like it avoids this somehow (the sub still happens in the filename shown in the buffer but does not actually break the :w action).

This may seem like a crazy/rare bug but in 20 minutes after switching from ags to CtrlSF to try it out I hit it 4 times doing function renames across a codebase where the function names were part of the path names or file names.

After open some files with 'O', it can not open again

Here's the error messages:

Error detected while processing BufEnter Auto commands for "*":
E344: Can't find directory "app/models" in cdpath
E472: Command failed

By the way, how to search a sentence which contains space?

Thanks for reading, your plugin helps me a lot, i love it.

是否可以提供在右侧窗口水平分屏打开的功能

重构代码时经常用到
单屏 -> 调用搜索 -> 在左侧窗口, 此时跳到左侧窗口, 选中一个, 更希望的是原先右侧窗口不动, 在其上方水平分屏打开选中位置所在文件, 修改完毕后退出 又回到搜索的左侧分屏, 便于快速重构代码

目前使用tab, 需要不停切换

感谢, 插件很强大:)

CtrlSF's write buffer is corrupted

When I try to edit the file which open by CtrlSF, I got a message says it's corrupted and I can not modify the file. What is happening to my CtrlSF

Make it working in visual mode

Does it possible to make it using visual selection instead of typing text to search in command mode?
In this case user can select text in question, press shortcut and make ctrlsf search for it.

honoring "set hidden"

let's say I have a file open. I invoke ctrlfs and open another file from the results. if the previous file is saved, the buffer is replaced with the new file. if it is not saved, the buffer is split and the selected file is displayed above the unsaved one.

this could be fine when vim is configured with "set nohidden", but when "set hidden" is set I find this behavior a bit annoying. could you please modify the plugin to always replace the buffer when "hidden" is set?

thanks!

Way to determine project root (e.g. .git)?

Just wondering if there is a way to use ctrlsf in a git project folder? I have autochdir on as I like to use splits and NerdTree to navigate to other files. Also with CtrlP I am used it automatically searching the entire project.

三个问题

  1. 搜索结果的窗口,最好也可以设置在下面
  2. windows下,文件结束符设置为dos时,搜索结果会显示讨厌的换行符,你懂是什么的
  3. 最好搜索的目录可以是项目的根目录,就像ctrlp一样,会默认**.git**作为根目录,或者自己设置一个标记。不支持项目搜索会有很大的局限性。毕竟当前目录可能没有多少文件

<Plug>CtrlSFPrompt ignores let g:ctrlsf_regex_pattern = 1

While setting the default search pattern to use regex with let g:ctrlsf_regex_pattern = 1
It is expected that <Plug>CtrlSFPrompt will result in:

:CtrlSF -R <awaiting input>

except it continues to return its regular :CtrlSF <awaiting input>

I realize that I can easily workaround this by mapping it like nnoremap <leader>F :CtrlSF -R
However I feel like the internal plugin mappings should be following its own conventions.

Please let me know.
Thanks

'wincmd w' throws a range error when preview window is open

    if a:mode == 1 && g:ctrlsf_auto_close
        let ctrlsf_winnr = s:FindCtrlsfWindow()
        if ctrlsf_winnr <= target_winnr
            let target_winnr -= 1
        endif
        call s:CloseWindow()
    endif

The target_winnr is incorrect as preview window will be closed together with origin ctrlsf window. In this case, let target_winnr -= 2 is correct.

Conflict

When I installed the airline and ctrlsf , vim become very slow start , and retrieved when using ctrlsf vim crash
I using MacOS(10.10.5) macvim(7.4.769)

唉,还是中文吧,感觉这句有点问题。。。
装了ctrlsf和airline之后,vim启动会变得很缓慢,而且使用ctrlsf检索的时候vim会呈现出假死状态
使用系统是MacOS(10.10.5)macvim(7.4.769)

Airline statusline funcref function warning.

Hi,

Every time I edit my .vimrc and save changes I get the following warning:
The airline statusline funcref function('CtrlSFStatusLine') has already been added.

As far as I understand it's not critical, right? But it's quite annoying. How can I fix it?
Thanks!

-filetype doesn't work

Tokens: ['-filetype', 'wrproject', 'TarExtr']
ParsedResult: {'pattern': 'TarExtr', 'filetype': 'wrproject'}
Options: {'pattern': 'TarExtr', 'filetype': 'wrproject', '_vimregex': '\V\CTarExtr', '_vimhlregex': '\V\C(^\d+:.*)@<=TarExtr'}
Tokens: ['-C', '3']
ParsedResult: {'context': 3}
ProjectRoot: .
ExecCommand: ag --context=3 --smart-case --literal --wrproject --noheading --nogroup --nocolor --nobreak 'TarExtr' /home/msvoboda/work/cots/LNX
Failed to call backend. Error messages: ag: unrecognized option '--wrproject'^@^@Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]^@^@ Recursively search for PATTERN in PATH.^@ Like grep or ack, but f
aster.^@^@example:^@ ag -i foo /bar/^@^@output Options:^@ --ackmate Print results in AckMate-parseable format^@ -A --after [LINES] Print lines after match (Default: 2)^@ -B --b
efore [LINES] Print lines before match (Default: 2)^@ --[no]break Print newlines between matches in different files^@ (Enabled by default)^@ -c --count
Only print the number of matches in each file.^@ (This often differs from the number of matching lines)^@ --[no]color Print color codes in results (Enab
led by default)^@ --color-line-number Color codes for line numbers (Default: 1;33)^@ --color-match Color codes for result match numbers (Default: 30;43)^@ --color-path Col
or codes for path names (Default: 1;32)^@ --column Print column numbers in results^@ --[no]filename Print file names (Enabled unless searching a single file)^@ -H --[no]hea
ding Print file names before each file's matches^@ (Enabled by default)^@ -C --context [LINES] Print lines before and after matches (Default: 2)^@ --[no]group
Same as --[no]break --[no]heading^@ -g PATTERN Print filenames matching PATTERN^@ -l --files-with-matches Only print filenames that contain matches^@
(don't print the matching lines)^@ -L --files-without-matches^@ Only print filenames that don't contain matches^@ --[no]numbers Print line numbers. Default is to
omit line numbers^@ when searching streams^@ -o --only-matching Prints only the matching part of the lines^@ --print-long-lines Print matches on very long lines (
Default: >2k characters)^@ --passthrough When searching a stream, print all lines even if they^@ don't match^@ --silent Suppress all log messages,
including errors^@ --stats Print stats (files scanned, time taken, etc.)^@ --vimgrep Print results like vim's :vimgrep /pattern/g would^@ (it
reports every match on the line)^@ -0 --null --print0 Separate filenames with null (for 'xargs -0')^@^@Search Options:^@ -a --all-types Search all files (doesn't include hidden files^
@ or patterns from ignore files)^@ -D --debug Ridiculous debugging (probably not useful)^@ --depth NUM Search up to NUM directories deep (Default:
25)^@ -f --follow Follow symlinks^@ -F --fixed-strings Alias for --literal for compatibility with grep^@ -G --file-search-regex PATTERN Limit search to filenames matching PATTERN
^@ --hidden Search hidden files (obeys .*ignore files)^@ -i --ignore-case Match case insensitively^@ --ignore PATTERN Ignore files/directories matching PATTERN^@
(literal file/directory names also allowed)^@ --ignore-dir NAME Alias for --ignore for compatibility with ack.^@ -m --max-count NUM Skip the rest of a file after NUM
matches (Default: 10,000)^@ --one-device Don't follow links to other devices.^@ -p --path-to-agignore STRING^@ Use .agignore file at STRING^@ -Q --literal
Don't parse PATTERN as a regular expression^@ -s --case-sensitive Match case sensitively^@ -S --smart-case Match case insensitively unless PATTERN contains^@
uppercase characters (Enabled by default)^@ --search-binary Search binary files for matches^@ -t --all-text Search all text files (doesn't include hidden files)^@ -u --unrest
ricted Search all files (ignore .agignore, .gitignore, etc.;^@ searches binary and hidden files as well)^@ -U --skip-vcs-ignores Ignore VCS ignore files^@
(.gitignore, .hgignore, .svnignore; still obey .agignore)^@ -v --invert-match^@ -w --word-regexp Only match whole words^@ -z --search-zip Search contents of compresse
d (e.g., gzip) files^@^@file Types:^@the search can be restricted to certain types of files. Example:^@ ag --html needle^@ - Searches for 'needle' in files with suffix .htm, .html, .shtml or .xhtml
.^@^@for a list of supported file types run:^@ ag --list-file-types^@^@

~ not working anymore

after update to latest version, ~ in folder doesn't work anymore, which is really annoying.

mapping not working

None of those key mapping works for me.
for example: nmap <C-F>f <Plug>CtrlSFPrompt
After pressing Ctrl-F f, but nothing happened, so weird.
The plugin can work by manually inputting ':CtrlSF xxx'

Env: Ubuntu 14.04 VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:59) Included patches: 1-52

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.