John Crepezzi's Vim

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Oh hey everybody so okay so that's going to be a little bit weird with the slides because apparently Apple doesn't like when you all tab out of slides but let's see what happens so my name is John I see John run is my kind of name everywhere it's on Twitter's on github if anyone I just give you a brief of what I am so currently I work at square I work at square here in New York I work typically on our Ruby applications but I also do a lot of work in JavaScript and a little bit of work in Java before that I had a company called Broad Street ads which was a start-up of mine before that I've worked at tumblr Brewster and patch I do a lot of work in Ruby I also was a core contributor for CodeIgniter which is a PHP framework so anyone that is more interested in that side of things I've done that too but the goal here is kind of just to say that like I've used them across a variety of different applications that a variety of different companies on a variety of different languages so I think it's good to start by talking I guess about like evolution of how I got to vim I think probably a lot of people's layout looks something similar to this there's a lie somewhere in here where there's a NetBeans or an eclipse but you don't have to talk about that so we start with like Pico if anyone is familiar with Pico Pico you might you might have called it nano nano was basically Kiko with syntax highlighting so if you just took syntax highlighting away from nano and imagine how great that would be that's what Pico was Pico is actually packaged alongside the thing called the pine email reader on early UNIX systems so like you really go far back you'll know about pika after that I became I guess an Emacs fanatic I don't know how often you guys hear this is this how many meetups have you had anyone anyone anyone No so you probably hear people coming from Emax a lot into them at least I hear it a lot it's where we have people divided between them and Emacs but mostly mostly them now but at some point I saw it as a strength that Emacs had things like snaked built into it for those of you that don't know and Emacs you can actually like play snake inside Emacs and I saw it as like a strength that this full-featured IDE could have features so powerful they could even play a game like like snake but over time I realized that Emacs is a bit clunky and too heavy for my purposes so I ended up switching the vim that was about five years ago and I haven't looked back since so even when people start going through I guess it was sublime and now it's what's the what's so atom right even in those I try them out I tried to install vim key bindings and I find myself going back pretty quickly imagine a lot of you do as well so what I'm going to try to do here is I'm going to try to talk about my vim setup to talk about a little bit of key mug stuff just because it intertwines really well let's get into it so let me just start by saying generally I'm a purist on a lot of things you're going to find throughout this presentation that I favor the default configuration for pretty much everything rather than trying to customize things but there are definitely situations where I go for plugins and I hope that I can outline the ones that I use for you so first I'm going to I'm going to go top-down from the things that are probably at least debatable to the things that are most debatable so the first one is the color schemes that I use you're probably familiar with both of these I hope the one on the right is kind of a typical vim color scheme I like it because it doesn't have too many colors doesn't have too little colors it's kind of just right in the middle and the one on the left has made kind of a big push over the past four years across a variety of different platforms for anyone that's not heard of that one it's a ultra readable color scheme called solarized there are two variants of it there's a dark berry and a light variant I find that I use the one on the right on pretty much everything I do unless the screen is really smaller the texture is small and which case I end up switching to the one on the left as it makes the text a bit clearer who sort of bundle or use this bundle I tend to call it bundler because it's it's kind of built after the idea of bundle in Ruby so for some reason I call it bundler or bundler so for those of you that haven't heard of it it's similar to pathogen if you've heard of that but it's essentially a package manager for vim plugins my MRC is the only file that I have so that's my everything of my vim configuration lives in one single file and the reason that that's able to happen is because I use a bundle so you can write any of these three lines and they would all mean the exact same thing in bundler and what they do is they just give you a quick sample so in each of these slots and I'll send these out later there's URLs at the bottom where you can go investigate these things and each one's getting a company kind of a quick little probably broke even foray into this world so what it lets you do if I open my bin want to see you can see that in my vim RC I've actually just got a bunch of these bundle commands and what they do is they reference gate repositories that have their could either be on github or any kind of git source but typically are on github and what you do is you run bundle install and it'll go through each of the dependencies and it'll install each of them so it's going quick this time because it's already been installed but if we take a quick look at the dot vim directory you can see that what it's actually done is essentially gone and checked out each of those repositories into my bump into this bundle directory that lives inside of MRC and then it's included that so this is nice for a few reasons one you don't have to make copies of every single file when you want to include it but I think even more importantly when updates come out to these plugins you get them for free just by running bundle install again and feel free good any if anyone has questions through any of this just place your hand the next part of my setup that I and first I'm going through just kind of general things I'll go to do plugins in a second the next part I set up I want to talk about this color column so who uses color columns two people use color columns I go back and forth on this and I'll show you quickly what a color column is and then I will show you an alternative to it that is also viable so if you see over to the right there the red line the red line exists at my 80 character column inside them I think generally it's good to stay within 80 or 120 characters so I put this here as a guide to myself I'm not afraid to go over it but I do mentally like curse myself a little bit internally when I cross this line so the way you get that is with these two lines here first you set the text width which can either be 80 or 120 or whatever you want to set it to I didn't go set the color column and you can also set the color color I don't remember the navy color column color something to some offset to the text width where you want to put this line so you can say that you want it plus 5 and that'll say I'm allowing myself to go over text clip by 5 and the reason for that is a text clipped has other meanings inside them like when do I wrap automatically the alternative here let me just show you what the alternative does so the alternative will do this typically that's what happens the alternative will color anything over 80 characters so the reason I go back and forth on which one I like here is that it's nice to have the color column but it's it's a little bit annoying to always see the line on the screen and you would actually think that these came in the other order that they actually did because the one that is more recent to the vim community as as of 7.3 it's actually color called color columns the new one so you have ever see someone with a bunch of lines on the screen they're using color column honestly my configuration goes back and forth between these two pretty often because I'm just not decided so like I said I do minimal remapping inside my vem RC file pretty much these are the only real appellants that I allow myself to do and they don't really count as remapping so all they do is they turn off the arrow keys so if it took me a while to get here I'm sure it takes everyone a while to get here but eventually you let go of them and just use you know J and K and H and L move around another policy of mine is splits all over or splits of overall so I use wits for pretty much everything I try to stay away from using tabs too much I find that it leads to confusion about what's currently open an editor especially since I you'll find don't use something like nerd tree to organize current open tabs it's an example of splits if anyone wants to know how to do these splits or doesn't know how to do these splits the way you can do it is you can colle in SP space and then a file name so if you're inside your edited pull in SP you can open two files like that and the other one is v split i know actually synchronize as they're open and you can do that as many times you want and then switch between them you can just ctrl W ctrl W go back and forth or ctrl W and a direction using your extender directional keys not the arrows obviously BIM standard directional keys JK HL okay so I try to divide my plugins in my FEM RC and in my thought process into two categories the ones that blend in and the ones that don't blend in so I mean I kind of attacked this in two pieces first I'm gonna talk about the ones that blend in what I mean by that is they just enhanced it in experience without letting you have to learn anything new and the second ones are the ones that don't blend in are the ones that require you to learn new keystrokes to learn new behaviors generally I like I said before try to stay away from type two but there are a few that I just can't live without sorry I am abusing them so we'll jump right in type one once the blend in that is not working sorry my direction with you said stop hurting and it is we hit escape a couple times escape was doing it before but even my arrow keys to move back and forth aren't working I might pull the projector for a second any other it is Freddie oh nothing there and I look Amanda can secrete amounts who still try and escape okay let's go to it so that can kill it and then hopefully restarted it again okay okay sorry for the brief interruption there okay so the first type of plug-in is ones that blend in the first one of these is bin trailing whitespace so whitespace really pisses me off when it's inside of my code so I try to avoid any kind of white space that can exist so if it what vim trailing whitespace does is when you're typing you can type this many spaces as you want but if you type the character and you type spaces and then you move to a different line it will actually highlight the trailing white spaces so it'll very easily point out like you've got trailing white spaces which you can go and sorry you can go and get just to get rid of the next one in the talked about is is match it so typically if you're writing Ruby code you can between the start and end blocks you can hit percent and you can move between the beginning of the Declaration and the end of the declaration which is super useful for a bunch of reasons one because it might be just useful to go to the end of the declaration the other one is you can combine it with something like v percent to move to the end of the Declaration and get the entire block this is something that you just kind of have to experiment with over time you might find more uses of this and this is not match at though this is just been what magic does is it adds a whole bunch of other semantics or sorry a whole bunch of other uses to the same so if you have some HTML actually will let you switch between matching tags this is typically not how vim works match it adds this behavior by expanding on what the percent operator can do the next we'll talk about is vim pasta so let's say I have a file it's got a class in it and it's got a method in it and now I want to go here and I want to hit ctrl P so typically what's going to happen with ctrl uppercase P is it's going to insert above my line and then put me at the beginning of the line what vim pasta does is it makes it so when I hit sorry ctrl o that it actually goes and indents it to the correct indentation based on the whatever the surrounding code is so this is nice because if you're ever used to hitting shift o and then hitting tab tab you won't ever have to do that again these kind of things I think should just be part of them the next one is fantastic so if you don't use some tastic you're probably really missing out so it's antastic does is to logically hook into different lint checkers so for different languages you can actually automatically lint check your code inside them this is something people with other editors or probably really used to but in vim you're not used to these niceties so some tastic gives you some of these you can so if I go here I take that you're going to get these warnings so it's going to tell you on the bottom here what the warning is so for this is saying that I have Mitch mismatched indentations because I've misspelled death and at the end that's going to say that it doesn't expect the key word end because it already got the end from flying for the other neat thing about this is that you can actually hook and custom sim tastic so this one here I'm hooking in our booboo cop rules Robocop is a link checker / style checker for Ruby double automatically correct you of things that even though the are proper Ruby probably aren't what you want to do so one example of that is maybe charleen commas group a cop doesn't like trailing commas so even though this is proper code I'm gonna get a warning saying that I should avoid a comma is the last element or the last item of an array also get a warning saying that this class has no documentation who use this super tab this one I couldn't use them if I didn't have this so so what's super tab will let you do is it'll do context-aware completions on your code so if I have a whole bunch of methods let's say I want to hear use something here I can just type capital S and hit tab and tab is all you have to do to complete the rest of the work and the cool thing is that super tab is context-aware so if notices that I'm using the every time that I call thing that sorry every time I call something there are certain methods that are like are called on something the class it will suggest those first in its list of suggestions because it knows that those are ones that I typically associate with something so superdad it's must-have now I'm going to talk a little bit about the second type of plugins that I use these are the ones that don't blend in so these probably be a little bit more interesting for anyone that is interested in that so the first one is called zoom Lin so how many times have you had two windows like this or maybe three windows like this and it becomes very confusing which file you're currently working on you want to see a little bit more to the file so you want to bring it into a new window but you don't want to lose the split so that you already have currently set up so what zoom win does is all you hit is you hit control o and it'll actually focus as if that one was maximized on the screen when we get control o you can make some edits you can do whatever you want when you get control again control W oh sorry it'll go back to the exact splits that you had before you zoom wind so it's just like as if you're maximizing that pain this makes it a lot more bearable to work with pains and this is why I say generally like splits everywhere is because if you use splits everywhere you're gonna run into the situation you need a way out of it zoom win is the way out of it for me next I'll talk about key comment so VIN doesn't provide a really handy way to do language agnostic comments that are kind of block aware coda where T comment fills that gap it gives you first the double dash the control double dash will give you a common and uncommon on a single thought or a single line and if you actually do a controlled - heat it'll take the entire method so this is really useful if you want to take an entire block and comment it it'll even do things like this it's smart about how it puts them back so if you do that it will comment it and it knows to not remove the comment in the way out unless you break it it knows to put everything back as I've had it been fugitive I saw you guys had Tim Tim Polk speaker so probably he told you about vim fugitive and if he didn't I will tell you that all right now so what vim fugitive is so you have a spec helper and I want to see inside this file for example what the get blame of this file is typically I would leave them go to the get blame but we've been fugitive I can just do G blame right here and it will actually give me a quick fix window with the get blame directly inside of it this is convenient for just lining it up against what you currently have you can also do other neat things like let's say add a line here and I put a all of you and I do AG gift will actually construct the dip just like this and you can see the one on the bottom and the one on the top and see how they differ if it wasn't so big the G diff will be even more useful if it's a bit smaller the GD feel actually placed the two side-by-side in vertical splits which is a little bit easier to see because it'll actually put these gray lines at the places where inserts happen on the other side so you get that nice lined up view just like you expect inside of something like C data or get K control P so how many times are you inside then and you want to take a file name that you know exists and you want to open it ctrl P is really useful for this so you can split it ctrl P and you start typing the name of the file in this case I know I want to open engine so I just type en and you see it's already got it there so if I hit enter it'll actually go open that file and you can do that you can also configure ctrl P to either use a most recently used or best match I use most recently used most often because it turns out in a larger code base I'm typically editing the same files over and over again so this makes it really easy to switch back and forth it even does things like notice what you have open and what you don't I didn't spark up this is a super special use than plugin that I keep around just goes like it so much so you want to write an HTML skeleton on a page and you know generally how you want it to look but you normally would end up copying and pasting a bunch or writing the exact same thing over and over again let's say you wanted to do an HTML bot with a body inside of it and you're using bootstrap so you want to contain your element you want to two rows on each of those rows you want three columns at medium it'll be it'll be four width and its small it'll be a twelve with and you're going to have three of those per row inside of each of those you want to put an anchor tag that says hello inside of it and inside of the anchor tag you want a responsive sponsor so basically that does is it takes exactly that type here and just push the whole thing out into the tree you can even climb back up the tree so if you say you want to go back up you can put something next to it and go a couple levels back up you can put two things side by side so next to the images if I wanted like a maybe a dip there I could have that too so it's just super easy for taking a layout that you know you want built and just making it happen I'm going to talk a little bit about the I and T mops and how I use them together so I guess for those of you that have used screen and the pasty mocks is a similar thing to screen and that it's a it's a terminal multiplexer I guess the name is more obvious in T months but what that means is essentially this it means that you can it means that you can have multiple panes open at once inside of a given window you can even have multiple windows so you think like bim's ability to split except built into something that can do things that aren't vim it can just be like anything the other neat thing that I use team-ups for often is that if you're actually SSH into the same Bob so you can pair over team-ups so you can actually move the cursor together both type and you'll both see it on the screens and it's much much faster than trying to pair over like a typical VNC session or something so we use it sometimes there's a clock up there I don't know why you'd ever want to clock you know sometimes I find myself doing it though so you have a team ops you typically open vim inside of two months I guess if you want a clock you can have a clock I don't know so here is another place that I enforce purity typically I'm not a fan of if anyone's seen the x-term integration that tip-ups has allows you to drive windows around and automatically get I guess free copying out of X term I'm not a fan I typically run these things fullscreen so I don't really have a use for like the whole dragon all that the other thing is that the X term integration gives you gives you the ability to easily lay out the panes but I'll show you in a second how I get around that and just like in vim use minimal remaps you only remap I use here I just started using like two days ago and what it does is it gives you a thin arrow keys inside of team-ups so you don't have to move your hand over two hours I also use a thing called T mocks in here so let me just show you briefly how the pain switching goes and I'll show you it did it again okay so what team-ups inator is if i open two panes or three panes team-ups actually has these things called layout two built into it so if I hit control B space this is one of the typical layouts this is one and you can actually cycle through these there's some pretty useful ones in fact my favorite one that I use every day is I don't know the number for it is this so I know on a larger screen what it'll do is it'll actually shrink the left column over and it'll heat the right column big so it's kind of like a master and then a child window and team-ups later lets you specify these layouts so here I want to create a window called editor with a layout called main vertical which is what that layout is called and inside of it I want vim and Earthsea which is a IRC client what this will do is it'll actually you type T maps in a text art project and it'll spin up a tea mug session that has exactly those commands started already so if you're not using something like like like a maybe like a why am i blanking on this a vagrant box or something for your development this is useful to kind of spin up an environment quickly that you use often even just the development environment you might have a front-end app and a web app and you wanna be able to quickly go into default editing session for both of those so this thing is great that's pretty much it on Team ox I don't do much other than just use it so that's pretty much it for my my configuration this is where you can find my files online they've been evolving over about five years so if you want to see back before I used wondaland it's just a whole bunch of files this is a good place to look and thank you for having me let's get to speak and if anyone has questions of course any questions sorry he said it again you know I wrote a few back in the day but I don't use any of them anymore I should mention this while I'm here so this is a square for anyone to see this I'm sure a lot of you have seen this square is a package called maximum awesome it's a team Oakes in vim integration that does it has a lot of plugins it's pretty opinionated but it does a lot of the things that I showed you here today and that's written it's where other questions you can't so for that I end up using act up in or you might use agin which is pretty much act up in but for silver surfer if you have two files open it's smart enough to between buffers autocomplete but it's not smart enough to pull out of the directory so basically like if you have one BIM session and it has that file somewhere opening it whether it's in the background in a different window and a different pain and different split and a different tab it'll still be able to order with it so it's basically searches through all the buffers that are currently open here's what no I don't on here okay if anyone's ever heard of hastin cinnamon or a spoon yeah basically the pastebin software there's also what's nice about it is you can actually copy in fire team Ansari as a bin buffer into a spin and then see it there so I don't know if that that's a good answer but any other questions like did anyone learn anything or did I just waste your time yeah cool well thank you again for happening and if anyone has any more questions
Info
Channel: thoughtbot
Views: 44,194
Rating: 4.7731571 out of 5
Keywords: thoughtbot, New York City (City/Town/Village), Vim (Software), Meetup (Website)
Id: BhwtnCaFTFk
Channel Id: undefined
Length: 30min 14sec (1814 seconds)
Published: Thu Nov 20 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.