0

I do not want to use the plugin "surround" (listed as /bundle/vim-surround) when I am using pathogen with vim for javascript files.

I currently have the following:

let g:pathogen_disabled = []

au FileType javascript call add(g:pathogen_disabled, 'vim-surround')

"Pathogen must be called before everything
call pathogen#infect()

Somehow I am still seeing the effects of surround. What's going on?

xjq233p_1
  • 7,810
  • 11
  • 61
  • 107
  • There are a couple of "lazy-loading" or "on-demand" plugins on vim.org. But I'm curious: Surround is a piece of art, why do you want to disable it? And why specifically in JS? – romainl Dec 24 '11 at 12:52
  • it annoys me when I am doing js code specifically. – xjq233p_1 Dec 25 '11 at 08:18
  • You are asking how to disable feature x when editing y, of course it means that feature x is somehow giving you troubles when editing y. That's kind of implied by how you phrased your question, the fact that you asked it here and the fact that you actually had this question in mind. But I'd like to know what "effects" of Surround you are seeing when working with JavaScript since this plugin is completely passive (only triggered when you actually want it), not filetype dependant and extremely useful in the context of programming. – romainl Dec 25 '11 at 08:41
  • well one of the main drawbacks I see using surround with js is that there's quite a bit of parenthesis in js hence the effects of surround is felt with much greater depth. I find myself constantly needing to `esc` to get out of context, skip those automatic parenthesis created by surround and then `insert` to continue editing. The problem is, sometimes, the content between the automatic closed by surround is too long for the plugin to realize I am still in the same continuous content, hence it's not able to disregard the "|}|)|> automatically created. I counted my typing as proof. – xjq233p_1 Dec 25 '11 at 09:16
  • 2
    You are confusing plugins: Surround is used to create/change/delete character pairs around existing content. It doesn't automatically close pairs at all. This is the job of another plugin like AutoClose or the myriad other solutions available. So the plugin you want to disable is not Surround. Depending on the plugin you actually use, it's possible that you can configure it to not work with JS. – romainl Dec 25 '11 at 12:06
  • Did you install one of those packages like Janus? Handpicking your plugins is soooo much more efficient. Anyway, if you actually use AutoClose you can create an `autocommand` that executes `AutoCloseOff` when editing JS. – romainl Dec 25 '11 at 12:14

1 Answers1

0

It doesn't seem to work here either. I've also tried with surround instead of vim-surround and with other random plugins without any success.

I suggest you raise an issue at Tim Pope's GitHub page.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • It's likely that it won't work with a `FileType` autocommand, because the plugins are being loaded after Vim has started up already. You could add it to `g:pathogen_disabled` by default, and then enable it using something like `TPlugin` (from https://github.com/tomtom/tplugin_vim) on demand (e.g. via some `au FileType *` autocommand, à la `au FileType * if &ft != 'javascript' | TPlugin foo | endif`. Or look into the plugins documentation to disable it temporarily, e.g. for the current buffer. – blueyed Jun 07 '14 at 15:40