我不认为这是可能的
gf
作为标准,但你总是可以做到:
" Mapping to make it easier to use - <C-R><C-W> inserts the Word under
" the cursor
nmap gx :call CustomGFOpen("<C-R><C-W>")<CR>
" The function that does the work
function! CustomGFOpen(cursor_word)
" The directory name (e.g. FILE_NAME) is passed as the parameter
let dirname = a:cursor_word
" This is a regular expression substitution to convert
" FILE_NAME to File_Name
let filename = substitute(a:cursor_word, '\(^\|_\)\@<=\([A-Z]\)\([A-Z]\+\)', '\=submatch(2) . tolower(submatch(3))', 'g')
" The extension
let extension = '.xml'
" Join the whole lot together to get FILE_NAME/File_Name.xml
let relative_path = dirname . '/' . filename . extension
" Open that file
exe 'e' relative_path
endfunction