Giter Club home page Giter Club logo

vim-ragtag's Introduction

ragtag.vim

A set of mappings for HTML, XML, PHP, ASP, eRuby, JSP, and more (formerly allml)

This plugin started out as a set of personal mappings, but there was enough enjoyment among those I shared it with for me to clean it up and release it.

Features

A huge variety of filetypes are supported: html, xhtml, wml, xml, xslt, xsd, jsp, php, aspperl, aspvbs, cf, mason, htmldjango, and eruby. (Let me know if I missed any). Some features take note of the filetype and adapt to it.

Maps for editing tags are provided. This includes a couple of "make last word into a tag pair" maps, a doctype map (inserts in XML), a "close last tag" map, and a few extra goodies.

For templating languages (ASP, PHP, etc.), there are maps for inserting template code. The maps are dependent on the filetype: in ASP, you get <% %> and <%= %>, in PHP, <?php ?> and <?php print ?>, etc. If said template language has a comment syntax, there is a map for it, otherwise, that map points to <!-- -->.

Maps for XML/HTML escaping and URL encoding have been moved to unimpaired.vim.

Enhances surround.vim.

Self-Promotion

Like ragtag.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. See :help license.

vim-ragtag's People

Contributors

anderslemke avatar blueyed avatar camthompson avatar cbartlett avatar chrisburnor avatar firedev avatar igbanam avatar jssee avatar markstory avatar myitcv avatar napcs avatar reentim avatar sassanh avatar sbl avatar tpope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vim-ragtag's Issues

vim-ragtag slows down :wq in terms of seconds

Hi, I started using vim-ragtag however as soon as I added it to my plugins I noticed that it slows down the :wq command in terms of seconds.

Not a big deal as I just load it when I need it, but are there some instructions executed when :wqing?

REQUEST: Adding HTML5 tags

It would be cool if you could add the followings for HTML5.

<!DOCTYPE html>
<meta charset=UTF-8 />

The problem will be if we should close the meta tag or not. (i.e., <meta charset=UTF-8>).

<Link> tag closing `Ctrl-x Ctrl-/` issue

Hello,

Interesting quirk I notice when using ragtag (for tag-closing) whilst coding up some React (with React-router).

For some reason closing <Link> tags does not work, basically the closing tag will be </> rather than </Link>.

Both words Link and link are problematic.

I stripped my vimrc right back and the issue remains. Link/link are the only words I've encountered that fail to close via Ctrl-x Ctrl-/. Link1, Foobar, Freddy are all fine, but Link seems to be a reserved word. Worth reporting here.

Side note, in React-router <Link> is an often used component.

Many thanks, this is an excellent plugin.

Minor new issue with eruby binding

Hello again, just a little thing I noticed after that last fix... (ref: #16)

It used to be that when using - you'd get <% ^ -%> with the cursor placed in the middle and a space on both sides. After this fix you get <%^ %> with the cursor on the left and two spaces to the right. I had that problem when I attempted to edit the plugin myself and couldn't figure out what was going on - hence why I came here :)

Anyway, no big deal - just curious if its an easy fix. Thanks again.

Change surrounding eRuby tags

Currently, ragtag + surround can add eRuby tags to a text object. For instance, pressing yss= surrounds a line with <%= ^ %>. However, something like cs=- doesn't work to change the surrounding eRuby tags. I'd expect that to remove the equals sign from the eRuby tag. It'd be great if this could happen.

Check for eruby file isn't correct enough

I have the *.html.erb and *.rhtml file formats set to html.eruby. Currently, - won't work as expected on these files. Please, apply this one-char change patch:

diff --git a/plugin/ragtag.vim b/plugin/ragtag.vim
index b27eb62..569030a 100644
--- a/plugin/ragtag.vim
+++ b/plugin/ragtag.vim
@@ -122,7 +122,7 @@ function! s:Init()
     imap      ] >O
   endif
   " <% %>
-  if &ft == "eruby"
+  if &ft =~ "eruby"
     inoremap   - <%-%>3hi
     inoremap   _ I<%A-%>Fs
   elseif &ft == "cf"

Thanks for RagTag!

Django Template Surroundings

I am having some difficulty understanding how to use the template surroundings that RagTag provides with Django. I see a reference in the Vim Script itself to Django template specific surroundings (ie {{ foobar }} and {% foobar %}, but in practice, all the shortcuts I use (Ctrl-x _ Ctrl-x -, etc) just put {{ foobar }}. How do I get RagTag to put a {% foobar %} surrounding?

Support for markdown files

Since markdown can includes html, I was trying to use the CTRL + X SPACE, but it doesn't work, looking to the maps:

:imap <C-x>
i  <C-X>&        <Plug>ragtagXmlEncode
i  <C-X>%        <Plug>ragtagUrlEncode
i  <C-X>/        </<Plug>ragtagHtmlComplete
i  <C-X>H        <Plug>ragtagHtmlComplete
i  <C-X><CR>   & <CR><SNR>61_AlwaysEnd

My vim-fu is limited, so I don't understand how can I configure at least that mapping, or load the same ones that are loaded when the filetype is html. I see that s:Init() is loaded, but I don't understand how I can call that function from my vimrc :/.

CTRL-x + Does Weird Stuff

I have the 2.0 release of RagTag installed from vim.org. Everything seems to work except for CTRL-x +, which behaves like this:

foo

Cursor is right after "foo", I hit ctrl-x then + and get the following:

foo..".
<%= %>

Any idea why this would happen? I'm hoping you're not going to say it's an interaction with some other plugin I have installed.

PS, as I was typing up this description, I did a copy from Vim to GitHub, and that action somehow changed the result and made it more wonky (it seems whatever I copied to the register is being used by this command somehow):

foofoo..".
<%= %>
<%= %>

Using <?= ?> instead of <?php echo ?> in PHP

Hi. I'd like to use the shorter form, is there any way to change it without touching the plugin files? If not I'd like to suggest changing to the shorter form or having some way of easily switching between the two.

Using the short form is not longer an issue since PHP 5.4.0.

MacVim & C-X+

C-X+ combination doesn't properly work in MacVim 7.3 when I edit *.erb files. It adding system buffer content before <%= 'text here' %>.

Increase wait time between key presses to complete a sequence

I’d like to slightly increase the grace time between hitting a chord (say <C-X>) and the subsequent key press that completes the sequence. Tried increasing ttimeoutlen to no avail — ragtag’s mappings seem not to care about this setting.

How do I do it?

Add support for GSP - Groovy Server Pages

GSP is XML based, the same commenting style, but it accepts a colon to specify the namespace, for example: <g:createLink /> is a tag in the g namespace.

I was able to enable ragtag for gsp files (just adding to the list in the autocmd) and configure support for comments (alongside with xhtml, xml, etc), but couldn't understand where I could try to make the changes to accept the colon. Any tips?

Better support for django

Thanks for creating this useful extension.

There are some issues using it for django templates, suppose that I'm in the middle of a line containing this:

<div class="{% if some_conditions %}{{ some_class }}else

now I expect pressing <C-X>_ to make it:

<div class="{% if some_conditions %}{{ some_class }}{% else %}

but unfortunately currently it makes it:

{% <div class="{% if some_conditions %}{{ some_class }}else %}

it applies to other similar shortcuts like +, is it possible to fix it?
(this pattern of coding in django templates is pretty common and there are lots of code with this pattern in django admin templates for example)

Readme?

Is there a readme for this repository? It seems really useful, but I'm not sure how to use it!

<C-X>= leaves cursor in wrong location

Loving all your Vim plugins...they're making the transition from Textmate a bit easier. However, when using one of the eRuby mappings, there seems to be an issue.

Based on the docs, I'm expecting = to yield:

<%= ^ %>

Instead, the cursor is landing in the wrong spot:

<%= %^>

This essentially makes the mapping unusable for me, as I have to add a few extra keystrokes just to get the cursor to where I want it to be.

Thanks again for the amazingly useful plugins!

html mappings in javascript

I'm not sure if this is the right place for this, feel free to close it if not. But I've been wanting the and tag mappings in my coffeescript files. I guess I'd like either for them to be available by default or a way to force them regardless of file type. Let me know if I can help or am just being dumb.
Thanks.

Make Ctrl+V mappings optional

I've got Ctrl+V mapped to paste in GVim, so ragtag introduces an annoying delay. Can you make them optional using a setting or something? I'd be happy to provide a pull request, just let me know how you want it.

At the moment I can remove the mappings for most filetypes as follows:

silent! iunmap <C-v>%
silent! iunmap <C-v>&

But I wasn't able to do the same for HTML/XML filetypes with a FileType auto-command, since it seems to be executed before ragtag's mapping setup.

Not sure how to use ragtag

Sorry if my question is pretty basic, but I'm not very familiar with the keymap "lingo". How do I use ragtag to enclose an existing text in html comments?

Remove eruby trailing hyphens?

Hey Tim, I noticed you updated vim-rails with this fix recently. Any chance ragtag might get a similar update soon? Thanks, your work is greatly appreciated!

Add support for multiple filetypes

Since I am usually working on PHP with HTML snippets inside, I setup my filetype to php.html. Unfortunately, in this case, whenever I press = instead of adding I get <%= %>. I think that a good solution to this would be to check the filetype not directly against &ft (since it might be a composite filetype too), but against a substring of &ft. Check if there's a "." inside the filetype, and if so, then grab a substring until the ".". For example, if &ft=php.html, first pickup the first filetype until the dot (php in this case), and decide on the filetype based on that.
Thanks!

Wrong tag autocompletion

Having the following code (last line block represents the cursor):

<atag>

var arr = [];
for (var i=0; i<10000; i++) {
  arr.push(i);
}
▓ 

When pressing Ctrl-X, I expect the tag auto-completion to be </atag>, but instead it writes </10000>.

Closing a HTML tag in PHP inserts ^F

See the mapping at line 72, not sure what the function of the <C-F> is in there. For some reasion this gets inserted literally in PHP files, but not in HTML or ERB files. If I remove the <C-F> it seems to still work fine in all filetypes.

Spurious ^F appended to tag completions when in presence of vim-sleuth plugin.

Hello,

Playing with vim-sleuth today and I notice it effects vim-ragtag in a weird way.

The presence of vim-sleuth somehow results in tag-language completions, via Control-/, emitting an extra ^F character at the end of the completed closing tag.

Comment out vim-sleuth, no spurious ^F.

Happens for me on Linux & Mac with both Vim and Neovim via a minimal vimrc.

The issue may be over in vim-sleuth, not here in vim-ragtag. But it seemed more appropriate to report it here.

Many thanks.

ragtag + surround: "-" Replacement Not Working Properly

Hi,

I am using both the ragtag and surround plugin.

Today I tried the three replacements mentioned at the bottom of ragtag.doc.
They all work fine, except for this one:

Text: hello world
Command: yss-
Output: <% hello world -%> (please note the hyphen attached to the end tag)
Output should be <% hello world %>

I suppose this is a bug, so I wanted to let you know.

Stefan

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.