← Back to Upcase

Plugins


(Upcase ) #1
Plugins Now that you have a solid understanding of core Vim functionality and behavior, as well as how to configure Vim to your liking, it's time to kick things up a notch with plugins. Plugins are packages of Vim config code that can add functio...
This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/onramp-to-vim-plugins

(Sam Lindstrom) #2

Great video guys. This series has been the most enjoyable and useful resource I’ve found in getting vim up to my standard level of productivity.

That said, Silver Searcher and Ag.vim have been quite slow for me, and I suspect it’s a config issue. Has anyone else experienced this problem? If so, some advice would be much appreciated. Here’s my current setup


(Andy Waite) #3

How is the performance compared to running ag on the command line?


(Sam Lindstrom) #4

Performance appears to be quicker on the command line, especially when compared with using Ag in conjunction with CtrlP. I searched a directory of over 16k files in under a second via the command line method, but haven’t gotten that kind of speed searching through MacVim, or with CtrlP.


(Hassan Khalid) #5

Nice series, thanks @christoomey and @benorenstein! I’ve moved away from Rubymine and sublime for about 4 months to a point where vim is the only editor i use. However the one thing i do miss from Rubymine was the interpreted auto-complete it offers. It’s well described here http://stackoverflow.com/questions/26914063/migrating-to-vim-from-rubymine-interpreted-auto-completion. I have been using YouCompleteMe, as I do like the fact that it auto prompt, but i feel it doesn’t offer the same or similar suggestions as rubymine. Maybe I have installed YouCompleteMe wrong? do you have any suggestions on auto complete functionality in vim that addresses the question above?


(Chris Toomey) #6

Hello @hass_isnull, unfortunately this is one area where Vim will fall a bit behind a focused tool like RubyMine. RubyMine is an amazing tool specifically designed to have enhanced static analysis that helps with things like completion. Vim focuses on being the best text editor, rather than being the best for a specific language, and that is a trade off I’m happy it makes.

All that said, here are a few resources that can point you in the direction of the sort of functionality you are missing in Vim:


(evan-) #7

Is Vim-Tmux-Runner being used in the above video when the two of you are demonstrating Vim-Rails?


(Chris Toomey) #8

Hi @evan1, I don’t believe tmux runner is being used in this video. @benorenstein was driving and he is not a tmux runner user. Is there a particular part that caught your attention?


(evan-) #9

Ah, thanks for clearing that up. The way Ben was able to call tests was similar to what you did with Vim-Tmux-Runner in the Configuration video on the Tmux Trail, that was why I was asking.

I need a way to quickly run tests and view output, and now it seems I have two viable paths that fit the bill. :smile:


(Chris Toomey) #10

Yep, @benorenstein uses vim-dispatch with tmux for test running, and I use Vim-Tmux-Runner. Pros and cons to each, but either is a great addition to your workflow.


(David) #11

Awesome episode! I’ve been using vim almost exclusively since starting this series and though I feel like I’m mostly over the productivity hurdle there were some features of my old editor-that-shall-not-be-named that I missed and this episode really addressed some of those pain points, especially fuzzy finding. Thanks again!


(Kira McLean) #12

In my vim in insert mode the cursor will seemingly randomly jump to the beginning of the line as I type. Is this an issue with my configuration or is it normal? I ask because I’ve tried turning plugins on and off and toggling just about every setting in my vimrc and can’t find the offending line. Just wondering if anyone else out there has seen a similar issue.


(Geoff Harcourt) #13

@kiramclean is this happening mid-way through an insertion in Insert Mode? Or is it happening sometimes right as you enter Insert Mode? I wonder if you might typing I instead of i (which would insert at the start of the indentation rather than current cursor position)?

I’m trying to think of what would cause Vim with an empty vimrc to jump to the beginning of the line.


(Kira McLean) #14

It was happening mid-way through the lines in insert mode. I just emptied out my vimrc completely and I’ve ben adding one line back at a time as I need them… sort of annoying because it slows down my workflow but I’m hoping after a week of coding I’ll have everything back the way I need minus the offending line. Bummer. That’s what I get for trying to configure vim in one day I guess.


(Geoff Harcourt) #15

Having recently hosed my vim configuration in another way recently, you can try adding half the config back at a time instead of one line, which will get you to the offender faster. (If one half contains the problem, cut that half in half, etc.)

Keeping your vimrc in Git and tracking changes can seem like overkill, but it does help you jump back to times when you knew your settings were still OK.

Let me know when you figure out what the cause is, I’m very curious about what it could be.


(Justin Black) #16

Just thought I’d put a note here since you guys don’t suggest something like nerdtree I’ll post the single most benefit ( for me ) to using it.

That is, like ctrlp, you don’t have to think about how you want any particular file to be opened before hand as with :e .
with :e, I have to decide if I want it in a split or a tab before I enter. At least as far as I can tell, it replaces an entire buffer – so, it can have undesired side affects.

Where as with nerdtree, I can find a file, hit i to split it or hit T to open it in a tab. Works especially well ( again, for me ), when I map my :NERDTreeToggle to k That way it’s never always taking up a lot of space unless I absolutely need it to be, and it’s mapped where it’s easy for me to reach ( despite not being able to use homerow like a normal person… )]

I’ll also note a downside to it, is that if i :e somefile.txt, in order for it to show up i have to refresh the nerdtree window. ( -r for full refresh or -R for root directory only )

Also, a downside to ctrl-p with cache turned off, is if you’re in a larger project, it takes forever to load every time.


(Chris Toomey) #17

Hey @ch0ke, thanks for sharing. NERDTree is great (and an impressive feat of Vimscript engineering), but I personally no longer use it. Between CtrlP and vim-vinegar (a minimal file explorer plugin) I find I don’t need NERDTree. That said, if you’re looking for a project explorer, NERDTree is a great choice.


(Justin Black) #18

@chistoomey that makes a lot of sense actually. I looked at vim-vinegar, and with that you really wouldn’t need NerdTree at all. I may, overtime move over to something like vinegar, but even that has it’s use timeline. I mostly see project explorers in vim, as an easier way to navigate larger projects.

ie: We have one project with 400 models, a lot more tests, a bunch of controllers, libraries, etc that we’ve written. Using ctrlp in this, with the cache shut off ( as in your videos ), it re-indexes it every time which takes upwards of a minute - which renders it virtually useless in my opinion – so it really only excels in normal sized projects since it indexes every time you hit ctrl-p.

Anyway, enjoying the videos – and making the switch from my IDE ( RubyMine and PhpStorm ) to vim. Setup my dotfiles as well: https://github.com/ch0ke/dotfiles


(Andy Waite) #19

@ch0ke: Have you tried this configuration from the thoughbot dotilfes? For me, it’s near-instant, even on large projects.


(MrNagoo) #20

I do not think I have an .agignore file, am I supposed to create it? Also, while using CtrlP, every time I create a file ctrlP can’t find it. I thought the no cache option would make it search fresh?
Here is my .vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" Plugins
Plugin 'vim-scripts/ReplaceWithRegister'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tpope/vim-rails'
Plugin 'vim-ruby/vim-ruby'
Plugin 'tpope/vim-surround'
Plugin 'rking/ag.vim'
Plugin 'thoughtbot/vim-rspec'

call vundle#end()            " required
filetype plugin indent on    " required

imap jj <esc>
nmap <C-u> :split<cr>
imap <C-a> <esc>

let g:ctrlp_user_command = 'ag %s -l --hidden --nocolor -g ""'
let g:crtlp_use_caching = 0

set number
set tabstop=2
set shiftwidth=2
set expandtab