Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Vim thread, awesome!

What are some vim plugins that completely revolutionized your productivity? I'd love to know what you swear by. For me, the big language-agnostic ones were:

  • vundle - It's basically like Ruby's bundler, as in it uses a "Gemfile"-like directives to download your plugins automatically for you. I hear it's a step up from pathogen, which I haven't used myself.
  • ctrlp - I can't live without this any longer. Fuzzy searching is amazing and completely removes the need for any kind of folder navigation if your work is contained to one folder.
  • vimwiki - personal wiki written in markdown. Dump it in Dropbox and you have all your notes always available anywhere. I switched from OneNote/Evernote to this because I dislikep proprietary formats.
  • vim -commentary - language-agnostic commenting out of any block of code. Incredibly useful.
  • vim-textobj-user, vim-textobj-entire, vim-repeat - a few generic utilities that are pretty mandatory
  • vim-matchit - smart jumping between opening and closing tags with <C-5>, very useful in HTML editing
  • vim-coffee-script - amazing plugin for CoffeeScript editing. The live compiled CS code buffer is very nice.
  • vim-fireplace / paredit - Clojure specific, make developing Clojure without Emacs fairly tolerable.

In other news, tpope is God. I feel like I owe this guy a few thousands of hours of productivity.

Btw, OP, you really need to add Practical Vim to mandatory readings for anybody serious about vim. It's a fantastic resource written by a guy who knows his stuff. It's an entry-to-intermediate level book that should cover 95% of use cases out there.

DreadCthulhu fucked around with this message at 19:08 on Jun 4, 2013

Adbot
ADBOT LOVES YOU

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Dicky B posted:

I switched from Command-T to ctrlp for a while because I read somewhere that it's apparently faster, but whenever I try to use it in a large project it doesn't work properly and some files just don't show up at all.

Command-T is essentially the same but seems more robust in my experience, though you'll need to build vim with ruby support enabled.

I've had 0 problems with it in my experience, both as far as speed and functionality is concerned. I actually had the opposite experience with Command-T, it was super slow for me. Go figure.

With regards to files disappearing, watch out for newly added files to the folder tree, they don't automatically get added to the cache. Press F5 from within the ctrlp buffer to refresh the cache.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
What do you guys use for something like renaming a ubiquitous variable across an entire project? I know there's a way of telling vim to do a substitute with confirmation across all the open buffers. Would you use that or perhaps the shell instead?

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

astr0man posted:

Oh yeah, if any of you feel like owning a really :spergin: keyboard with vim commands instead of letters on it you can get the same one as me from wasd: http://www.wasdkeyboards.com/index.php/wasd-v1-custom-keyboard.html?kt=1&k=1&s=7cdc41a18e757810db84d26f5875626f

No Topre? I'm outta here :P

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Civil Twilight posted:

I use the Tomorrow Night color scheme just about everywhere I can.

Hmm that looks nice. I'm pretty used to earendel now though, but I gotta check yours out.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
What kind of text wrapping should I enable for markdown documents? I have the 80 characters cap for code, but it seems like it might be not ideal for a document like an essay. I'm all over the place with nowrap, textwrap, wrapmargin etc..

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
I guess colorschemes are extremely personal. I tried all the ones you guys shared here and I still can't find as good of a match as earendel. I like the mix of not-too-Christmasey colors, not too dark so I can actually see the text, and an overall warm feel to it thanks to the turquoise, the cinnamon browns, the pinks and grass greens for comments.

Some of the themes are ridiculous, comments so dark grey that I have to spend 2-3 seconds adjusting my eyes so I can read them. What the christ..

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Cat Plus Plus posted:

https://code.google.com/p/vimcolorschemetest is pretty helpful when picking a colour scheme.

drat, that's a great resource. Thanks.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

LaTex Fetish posted:

In case you guys didn't realize, or forgot, 7.3 has relative line numbering.

It's really useful for moving around with the movement keys and in visual mode. You don't have to count lines anymore, or move to the closest curly bracket to jump down.

Also, using 82gg or 98G to fix errors at a line still works. The relative line numbers are purely visual. Here's a snippet from my .vimrc about relative line numbers.

code:
set relativenumber

" Always show line numbers, but only in current window.
:au WinEnter * :setlocal relativenumber
:au WinLeave * :setlocal norelativenumber

" Absolute Line Numbers in Insert Mode
:au InsertEnter * :set number
:au InsertLeave * :set relativenumber

Argh fine, I'll finally give this a longer try. I was aware of this, but was too lazy to get used to it. Thanks for nudging again.

EDIT: actually, this doesn't seem to work if I open a file with gvim and then open another file with ctrl-p. I have to create a new split for that to kick in. Does WinEnter not trigger with ctrl-p? Actually it might be just me with a plugin conflict somewhere overriding relativenumber.

I managed to force it to work as intended with au BufNewFile, BufRead * setl , but I feel like this is the nuclear option that I shouldn't be exercising.

DreadCthulhu fucked around with this message at 01:03 on Jun 18, 2013

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Jabor posted:

You should use BufEnter if you want to do something when you enter a different buffer. WinEnter, as the name implies, only fires when you switch windows.

That's good, sounds simpler. Thanks!

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!

Funnehman posted:

e: Also really a big fan of nerdcommenter and once you get used to the kind of weird way vim-surround works, it's pretty fantastic, especially if you have to do some HTML or something.

Any idea how that compares to our Messiah tpope's vim-commentary? I've been using it very successfully for years, but would love to find out if there's something out there that's 10x better.

Unrelated note: is there a popular plugin out there for tidying a buffer in vim? For example, sometime I'll paste some optimized CSS into a buffer and will want to make it readable. Is there a simple and properly working tool for this in vim?

DreadCthulhu fucked around with this message at 20:13 on Jun 24, 2013

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Just stumbled upon the native option to turn on column and line highlighting. It's super obnoxious, I'm finally in full Christmas tree mode.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Anybody here got experience with writing syntax highlighting rules in vim? Do you know if when you use the "region" rule, whatever is matched by start= can no longer be highlighted by the rest of the rules, especially if you use hs=e? I'm probably brainfarting super hard here, but say I have:

code:
(defn hello-world
  "Description of
   this function"
  (println "hello world"))
And I'd like the description to be marked as of type myComment. Here are a couple of options I tried:

code:
syntax match myComment"(defn\s\+\S\+\_s\+\zs\"\_.\{-}\""
syntax region myComment start=/(defn\s\+\S\+\_s\+"/hs=e,rs=e,ms=e end=/"$/
syntax region myComment start=/(defn\s\+\S\+\_s\+\zs"/ end=/"$/
The first regex works fine when doing a search in vim (set hlsearch proves the match is correct throughout the file), but does jack poo poo for highlighting.
The second and third regex do the highlighting successfully, BUT then defn loses its original special keyword syntax highlighting which was there before, thus not really doing its job. Is there a way to make both happen or am I stuck?

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Need a recommendation for convenient bindings for quickfix list commands. Mostly open, close, next, previous etc. What do you guys use?

Been playing with Ack.vim + AG and would love to make that navigation snappier.

Experimenting with the following:

code:
nnoremap <silent> [c :cprev<CR>
nnoremap <silent> ]c :cnext<CR>
nnoremap <silent> [C :cfirst<CR>
nnoremap <silent> ]C :clast<CR>
and this plugin for toggling the lists.

DreadCthulhu fucked around with this message at 01:56 on Aug 18, 2013

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Oh man that's got a LOT of stuff in it, I'll have to do some cherry picking.

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Just wanted to re-emphasize how amazing that PragProg book for Vim is. If you don't know where to start or where to go, seriously consider checking it out. Just finished reading it after over a year, and I still need to go back and review a lot of its tricks.

Adbot
ADBOT LOVES YOU

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Something totally awesome I just discovered, not sure how I lived without this:

Want to work on two or more repos in one vim? Open a new tab with :tabnew, :lcd %repo_path% and now all the windows spawned in that new tab will inherit the same :pwd and you can CTRL-P your worries away. For bonus points, if you already have a tab with a bunch of open windows whose pwd is all over the place, just :windo lcd %repo_path% and you're golden.

  • Locked thread