posva / vim-vue

Syntax Highlight for Vue.js components
MIT License
1.29k stars 103 forks source link

Autogenerated Marks #94

Closed asethwright closed 6 years ago

asethwright commented 6 years ago

Hi, this is a feature request. I'd be happy to submit a PR, but I'm not quite sure how to go about doing this in vimscript. If someone could point me to the right documentation I can take a look.

I think it would be great if you could autogenerate marks to go to the script, template and style sections. This way, when the file is opened, you could simply hit 't to go to template, 'c to go to style (css), or 's to go to script.

adriaanzon commented 6 years ago

I like the idea.

I once had the idea to create section mappings ([[, ]]). See http://learnvimscriptthehardway.stevelosh.com/chapters/50.html and http://learnvimscriptthehardway.stevelosh.com/chapters/51.html for what it is about. I think I'd prefer this option because it uses an existing Vim concept.

adriaanzon commented 6 years ago

I feel like this would fit better in a personal configuration.

Here is an example:

autocmd FileType vue call setpos("'s", [0, search('^<script', 'n'), 1, 0])
                  \| call setpos("'t", [0, search('^<template', 'n'), 1, 0])
                  \| call setpos("'c", [0, search('^<style', 'n'), 1, 0])