Code Monkey home page Code Monkey logo

Comments (5)

ahw avatar ahw commented on July 20, 2024

Initial work pushed to development in 6363b5134ee92613cf13abf2f23c9379e035ce01. It has since been merged to master but remains an undocumented "hidden feature." Here's the commit message:

CreateNewVimHook command

First argument is an event type. This is tab-completed. Second (optional)
argument is a regex pattern. The plugin will build the actual matching
pattern as follows:

    let matchingPattern = '\v^' . YOUR_PATTERN . '$'

However, there still isn't a generalizable way of naming VimHook scripts
that are intended support arbitrary regex patterns outisde of the global-,
extension-, and filename-specific use cases. Currently, the CreateNewVimHook
command just names the hook file as it would any other filename-specific
hook file:

    FILENAME.vimhook.sh

Two problems with this:

1. The extension need not necessarily be ".sh"
2. Although this VimHook will trigger according to the arbitrary regex pattern
   passed to the CreateNewVimHook command, when the current Vim session is
   closed that information is lost. When a new Vim session is opened, the
   plugin will of course just assume that this is a filename-specific
   VimHook as its naming pattern indicates.

from vim-hooks.

ahw avatar ahw commented on July 20, 2024

Could possibly overcome this with #36.

from vim-hooks.

ahw avatar ahw commented on July 20, 2024

Would be nice if there were a variant on this command to add the vimhook.bufferoutput option key since I use that one a lot while building small programs from scratch.

from vim-hooks.

ahw avatar ahw commented on July 20, 2024

The more I consider this the more I'm leaning towards just creating a handful of convenience commands to cover the most common cases. Something like

  • CreateBabelHook
  • CreatePythonHook
  • CreateNodeHook
  • CreateRubyHook
  • etc.

It would be a lot more convenient for the user than having to remember the arguments to some generic hook-creating function. Of course they'd all just be thin wrappers for the generic version which a power user could invoke if they wanted. Something like

:CreateVimHook BufWritePost /usr/bin/python bufferoutput

from vim-hooks.

ahw avatar ahw commented on July 20, 2024

Could provide a second optional arg to provide the filename of the hook. If left off, the hook name will be what I'm using already: the-current-filename.eventname.vimhook.sh

from vim-hooks.

Related Issues (20)

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.