Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
vim script to open related files
VimL
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
plugin
README.md

README.md

nextfile.vim

Vim script to open related files by command, or by keymap(i.e. \n or any)

Screen Shot

How it works

  • When initialized, set related files
  • In vim window, when NextFile() is called, by key mapping, n, is pressed

    • Get the current file name
    • Get the related files
    • Browse the related files and open in current, splitted, or vertically splitted window

Usage

  • \r to open related files
  • <Enter> to open a file
  • o to open in a split window
  • v to open in a vertically split window
  • NEW!! <Enter> on directory will list files in the directory

Installation

  • Download the following files into ~/.vim/plugin directory

    • nextfiles.vim
    • singular_expressions.txt
    • plural_expressions.txt
  • To your ~/.vimrc, add a keyboard map to call NextFiles() function

    • The following is my preference. \r to see related files
      nmap <Leader>r <ESC>:call NextFile()&l6;CR>
      
      Or, you may assign \n to see next file on the cursor
      nmap <Leader>n <ESC>:call NextFile()&l6;CR>
      
  • For Rails developers, there is pre-defined mapping like the following. You may want to change this. If so, you can re-define this in your .vimrc

    let g:nextFilesMap["Ruby On Rails"] = {
      \ "Ruby On Rails" : {
        \ "Controller" : { "expression" : "app/controllers/(.*)_controller.rb$", "transform" : "pluralize" },
        \ "Funtional Test" : { "expression" : "test/functional/(.*)_controller_test.rb$", "transform" : "pluralize" },
        \ "View" : { "expression" : "app/view/(.*)/", "transform" : "pluralize" },
        \ "Model" : { "expression" : "app/models/(.*).rb$", "transform" : "singularize" },
        \ "Unit Test" : { "expression" : "test/unit/(.*)_test.rb$", "transform" : "singularize" }
      \ }
    \ }
Something went wrong with that request. Please try again.