GithubHelp home page GithubHelp logo

switchy.vim's Introduction

Switch to related files.

Usage: map switchy#switch() to something, for example:

nnoremap <silent> <Leader>a :call switchy#switch('tabedit', 'sbuf')<CR>

Or use a command if you prefer:

command! Switch call switchy#switch('split', 'sbuf')

The first function argument is the command to use when editing a file (e.g. edit, split, tabedit, sbuf, etc.), the second argument is the command to use when the buffer is already loaded. This is useful to switch to an existing split/tab instead of opening a new one (note you must have switchbuf set to useopen or usetab to switch to an already open window or tab, otherwise it will create a new window).

You can add your own callbacks with switchy#add(); see ftplugin/go.vim for an example.


Supported filetypes:

  • C: a.ca.h
  • Go: a.goa_test.go

Yeah, it's early days for this plugin. More filetypes soon™


Survey of existing methods:

  • a.vim: Too many commands, only supports C/C++ out of the box.

  • FSwitch: Too many commands, only supports C/C++ out of the box.

  • vim-altr: Doesn't load buffer if file doesn't exist, don't like the code (tried to patch this).

  • alternate-lite: Needs lh-vim-lib, too many commands.

  • unimpaired.vim: Kinda works, not really intended for this and can't create new file easily.

  • Manual:

    :e %<.c
    nnoremap <F4> :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
    

    It's okay, but not as fast as e.g. <Leader>a, also not flexible to multiple filetypes etc.

switchy.vim's People

Contributors

arp242 avatar whoissethdaniel avatar

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.