【问题标题】:vim's fuzzyfinder plugin opens file with name of the whole directoryvim的fuzzyfinder插件用整个目录的名字打开文件
【发布时间】:2018-01-28 18:53:39
【问题描述】:

我正在使用 vim 编辑器,我在使用从 here 获得的 FuzzyFinder 时遇到了一些问题。 所以我有一个项目叫

~/project/

在项目中,有一个

project/src/

project/build/

还有一个project/tags 文件。我用

创建了标签文件
cd project
ctags -R --extra=+f

为了使用fuzzyfinder,我打开了项目的一些源文件:

$ vim project/src/app/src/main.cpp

然后我尝试做一个模糊查找

:FufTaggedFile

在我的项目文件夹中的某处找到my_class.cpp。它是由fuzzyfinder 在src/myLibrary/src/my_class.cpp 找到的,但是当我按下回车键时,它会打开一个名为

的文件
src/myLibrary/src/my_class.cpp

进入目录

~/project/src/app/src/

但没有打开我希望他打开的文件:

~/project/myLibrary/src/my_class.cpp

你知道这里会出什么问题吗?

编辑

我的~/.vimrc

set nocompatible              " be iMproved, required                                                                                                                
filetype off                  " required                                                                                                                             

" set the runtime path to include Vundle and initialize                                                                                                              
set rtp+=~/.vim/bundle/Vundle.vim                                                                                                                                    
call vundle#begin()                                                                                                                                                  
" alternatively, pass a path where Vundle should install plugins                                                                                                     
"call vundle#begin('~/some/path/here')                                                                                                                               

" let Vundle manage Vundle, required                                                                                                                                 
Plugin 'VundleVim/Vundle.vim'                                                                                                                                        

" The following are examples of different formats supported.                                                                                                         
" Keep Plugin commands between vundle#begin/end.                                                                                                                     

" YouCompletMe for autocompletion                                                                                                                                    
Plugin 'https://github.com/Valloric/YouCompleteMe'                                                                                                                   

"Conque-GDB                                                                                                                                                          
Plugin 'vim-scripts/Conque-GDB'                                                                                                                                      

"FuzzyFinder                                                                                                                                                         
Plugin 'vim-scripts/FuzzyFinder'                                                                                                                                     

"AutoTag                                                                                                                                                             
Plugin 'https://github.com/craigemery/vim-autotag'                                                                                                                   

"vim airline                                                                                                                                                         
Plugin 'vim-airline/vim-airline'                                                                                                                                     
Plugin 'vim-airline/vim-airline-themes'                                                                                                                              

"solarized color theme                                                                                                                                               
"Plugin 'git://github.com/altercation/solarized.git'                                                                                                                 
"Bundle 'altercation/vim-colors-solarized'                                                                                                                           

" All of your Plugins must be added before the following line                                                                                                        
call vundle#end()            " required                                                                                                                              
filetype plugin indent on    " required                                                                                                                              
" To ignore plugin indent changes, instead use:                                                                                                                      
"filetype plugin on                                                                                                                                                  
"                                                                                                                                                                    
" Brief help                                                                                                                                                         
" :PluginList       - lists configured plugins                                                                                                                       
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache                                                                                            
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal                                                                         
"                                                                                                                                                                    
" see :h vundle for more details or wiki for FAQ                                                                                                                     
" Put your non-Plugin stuff after this line                                                                                                                          

"options for ConqueGdb                                                                                                                                               
"vem we close ConqueGdb, it also closes the split                                                                                                                    
let g:ConqueTerm_CloseOnEnd = 1                                                                                                                                      

"set the line number"                                                                                                                                                
set number                                                                                                                                                           

"hilight the word we search for with the / command                                                                                                                   
set hlsearch                                                                                                                                                         

"set relative numbering                                                                                                                                              
set relativenumber                                                                                                                                                   

"set the tags file                                                                                                                                                   
set tags=./tags;                                                                                                                                                     
"set tags=tags;                                                                                                                                                      

"remappings                                                                                                                                                          

"save with ctrl+s                                                                                                                                                    
noremap <silent> <C-S>          :update<CR>                                                                                                                          
vnoremap <silent> <C-S>         <C-C>:update<CR>                                                                                                                     
inoremap <silent> <C-S>         <C-O>:update<CR>                                                                                                                     

"dont allow the arrows for mooving                                                                                                                                   
noremap <Up> <NOP>                                                                                                                                                   
noremap <Down> <NOP>                                                                                                                                                 
noremap <Left> <NOP>                                                                                                                                                 
noremap <Right> <NOP>                                                                                                                                                

"automatic bracket seeting                                                                                                                                           
inoremap ( ()<Esc>i
"inoremap { {<cr>}<c-o>O                                                                                                                                             
inoremap [ []<Esc>i                                                                                                                                                  
inoremap < <><Esc>i                                                                                                                                                  
syntax on                                                                                                                                                            

"FuzzyFinder remappings                                                                                                                                              
noremap ,f :FufFileWithCurrentBufferDir<CR>                                                                                                                          
noremap ,b :FufBuffer<CR>                                                                                                                                            
noremap ,t :FufTaggedFile<CR>                                                                                                                                        

"go out of a parenthesis with ctrl+a                                                                                                                                 
inoremap <C-e> <C-o>A                                                                                                                                                

"no swap files                                                                                                                                                       
set noswapfile                                                                                                                                                       

"set term=screen-256color-bce                                                                                                                                        
"set t_Co=256                                                                                                                                                        


"set solarized theme in vim                                                                                                                                          
set background=dark                                                                                                                                                  
colorscheme solarized                                                                                                                                                

"set solarized theme for vim-airline                                                                                                                                 
let g:airline_theme='solarized'                                                                                                                                      

"Enable the list of buffers                                                                                                                                          
let g:airline#extensions#tabline#enabled = 1                                                                                                                         

" Show just the filename                                                                                                                                             
let g:airline#extensions#tabline#fnamemod = ':t'                                                                                                                     

"automatically change the current directory                                                                                                                          
"set autochdir                                                                                                                                                       
"set noautochdir 

【问题讨论】:

    标签: vim fuzzyfinder


    【解决方案1】:

    ~/project/src/app/src/myLibrary/src/my_class.cpp 可能已打开,因为它离您当前的位置较近。

    也许您打开了autochdir,或者有一个选项可以告诉您的插件在这种情况下如何表现?你应该阅读它的文档来确定。

    【讨论】:

    • 我检查了我没有 noautochdir。此外,尝试更改 tagrelative 选项,但这并没有改变任何东西。 :(
    • FuzzyFinder 选项,而不是 Vim 选项。
    • 我找不到能解决我的问题的 FuzzyFinder 选项。目前,我发现的唯一解决方法是将我的 vim 当前目录作为创建标记文件的目录。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-13
    • 2013-06-05
    相关资源
    最近更新 更多