 If I had to choose, I would say that Vim is probably my favorite application on Linux. It's the one that I spend a lot of my time in, and that's probably always been the case, but for the last couple of weeks it's been even more true, because about two weeks ago I decided I was going to move all of my writing from LibreOffice into Vim. Now, for those of you who don't know, my main job, my daily gig, is that I edit a historical magazine. I used to be mostly a writer, and now I spend most of my days editing other people's junk. That means that most of my time is actually spent in Google Docs, but for those brief times that I can go through and do my own writing or whatever, I want to be in Vim. Like I said, I used to use LibreOffice, but I really like Vim, and I wanted to just see if I could use Vim as my actual text editor. Now, out of the box, Vim is not the most friendly to actual writing. It does really well as a code editor, like out of the box. There's not a lot you have to do, enable syntax, and you're pretty much ready to go. Now, obviously you can make it a lot better, but out of the box it's a much better code editor than it is at editing a 10,000-word document. It just is. Now, there are several things you can do, and what I wanted to do today was share with you several tips that I've learned over the last two weeks that has made them better for writing. So that's what we're going to do. Let's go ahead and jump in. Here we are in just a regular boilerplate document. It's lower than some stuff. Don't worry about the words, it doesn't matter. And ignore the underlying stuff, I'll talk about that in a few minutes. The first tip I have for you is that one of the biggest things I have a problem with is that I get distracted very easily. I get, I like shiny things, and if I get distracted by something shiny or interesting, my intention is diverted. It's just the nature of the way I work. So something that would help me with that when I'm writing is a distraction-free writing environment. And while it's better to have a third-party tool that will actually close off your browser so that you can't go to YouTube or Facebook or whatever, when you're in a writing tool, you want it to be as distraction-free as possible. Now, there's not a ton of them that's going to distract you. It's not like LibreOffice where there's tons of buttons all over the place, but it can get more distraction-free than this. And that's where Goyo and Limelight come in. So if you have Goyo and Limelight installed, their plugins, you can enter Goyo mode with a key binding, and this is Goyo. Now, it doesn't look exactly like this unless you also have Limelight installed. So Goyo just takes all the text and puts it in the center. So this would be your distraction-free mode. Now, what Limelight does, and you can see it right on screen, is that it highlights the paragraph or line that the cursor is on. So if I move to the next line, it highlights the next line. If I go to the next line, it highlights the next line. And all the lines that aren't, that don't have the cursor in them, are kind of shaded in the background. So that your focus is only on the place where your cursor is. And that's really helpful because it just kind of focuses your attention on wherever you're working. That's Goyo and Limelight. Those are probably my two favorite them plugins, honestly. They're the ones that I've been using the most lately for this, at least. And it's just made my writing at least a little bit more enjoyable and allowed me to focus just a little bit more. I still get distracted by YouTube. It doesn't help with that, unfortunately. So let's go ahead and move on to the next one. So the next one is that I highly encourage you, if you're going to do this, to write everything in Markdown. Because if you write things in Markdown, it allows you to add text effects to your writing. So for example, you can do things like this. If you do hashtag, hashtag, headline, that's a H2 tag. So it would allow you to add things like chapter markers if you're writing a novel or something or whatever. I mean, you can go through and do that. You can also go through and do bold. So that'd be star, star, bold, star, star. Or asterisks, I guess is what you'd say. And then italics is one asterisk and then italic. And then another asterisk. I can't say that word. It's just beyond me. I can't say it. Anyways, that'd be bold and italic. You can also do things like lists. So that'd be just one star. And then it would allow you to do another one. So list and then list and then list. You can also add images if you wanted to. Now, obviously it's not going to show an image in the terminal, but you could add an image here. If you wanted to, you could also add links. That's possible. There's a ton of stuff you can do with Markdown that you wouldn't be able to do if you weren't going to use Markdown. Now, by default, Vim does have some Markdown highlighting. It's not perfect. So what I did is went through and installed a Markdown syntax plugin called Vim-Markdown. So you can go through and install that. I'll leave a link to that in the video description along with the other plugins that I've talked about. And that'll go through and make sure that all of your Markdown has highlighting that Vim by default doesn't always catch. Vim Markdown also goes through, as you saw above, is it goes through and adds that extra star whenever you're in a list mode. So it just will continue to do that until you exit it. Also go through and translate your stuff all automatically to both. So once I leave this, or I guess in this case, it's italics, which is funny. If you leave this, it'll not show the stars, right? It'll not show the asterisks. And same thing for the italics and bold, obviously both of those do the exact same thing. That's really cool, so that your documents don't get messy. They don't have just a ton of asterisks and all that stuff just piling up on top of each other. It just appears bold or italics. So that is Markdown. I highly recommend you do that. It will also allow you to use tools like Pandoc to translate this text into another format. And it makes it easier for other formats to realize kind of what you're doing so that you can have chapter markers or whatever you need to do. Markdown helps a lot with that. So I haven't actually got into that yet. I haven't started using Pandoc. I've just been uploading the Markdown stuff to where I need to upload it to. But I plan on doing some more research into Pandoc and also LaTeX. I don't think I'm gonna need LaTeX. I think that's just more of a scientific tool than what I need, but I could be wrong. I don't actually know anything about it. So Markdown is probably the thing I've been spending most of my time refamiliarizing myself with because I learned Markdown in college. And believe it or not, I've been out of college now for 11 years. So it's been a long time since I learned Markdown. So I've had to go through and try to refamiliarize myself with it. That's why I keep messing up the two stars versus one star thing. And I know I keep calling them stars. I know that's not what they're called. I can't say the other word. It's just beyond me. Anyways, so that is the second tip. The third one is something that I found I really need. Now, I know there are ways to go through and set it up so that you can navigate this as a paragraph so that I could go through and go down instead of when I go down to the next thing, it goes down to the next line, which cause technically these are just two lines instead of 20 lines, which is what they look like, right? These are just two lines of them. That's how them treats them. So I know that there are ways where I can treat this as six lines and then use the VIM keys to just go down. I know there's even built-in bindings for that stuff. I just haven't learned them yet. But sometimes you need to go to the next sentence or the previous sentence. Now, obviously you can go forward and back words. You can go forward and back letters. Those things everybody's familiar with who uses VIM. But if you're going to be writing sentences a lot, you need to be able to jump through sentences really quick. So if you use the parentheses, you can go forward and backward sentence. So the closed parentheses goes forward in time or forward in your document by sentences. So here I am jumping between sentences forward. The open parentheses goes backwards. And that has proven really, really useful. Once I decide to go through and learn what it is that I need to do in order to go down actual lines instead of VIM lines, maybe this won't be as useful. But for now, when I have a whole paragraph of text, which is actually just a line in VIM, going through and using the parentheses to jump back and forth between sentences is much easier than using the VIM keys to go letter by letter. You know what I mean? So that is, the next one on the list is that you should turn spell checking on and you should learn how to use it. So in order to turn spell checking on, you need to go into your VIM RC or if you're using NVIM, you need to go into your init.vim. So we're going to go into my NVIM folder and we're going to VIM into init.vim. And then I'm gonna go into the general section. And what you need to do in order to turn spell check on is this line right here. So you need to set space spell, space spell lang equals EN under store US. Now you can go through and change what language that is if you speak a different language. So for me, I'm speaking American. So that's the one that I need. If you, I believe VIM supports pretty much any language that the Linux system does, but I could be wrong about that. I'm completely naive when it comes to other languages other than Spanish. So I know you could go through and do Spanish. I know there's Italian. I know there's French. So there's obviously a lot of languages that you can use. But anyways, you just turn that on and then you reload your VIM RC file or your init.vim. In my case, it's space S in order to reload the configuration file. And then when you're back here in your document and you've loaded up your document again, you'll have to reload any documents you had open. But you'll see that there's a whole bunch of words here that are underlined. That's not normal. That just means that these lines aren't in the English dictionary. I'm pretty sure they're Latin words obviously, but that just means that they're not in the English dictionary. So if you have a misspelling, let's just choose a word here at random and you want to correct it. Let's just say you want to correct it. So if we hit Z equals, then we'll go through and give us a list of what it thinks that word should be. And if you wanted to change it, you just hit the number that you want to replace it with and hit enter and it will replace that word with the word that you selected. If it's not in the list that they give you, just hit enter and go through and retype the word. You can move back and forth between misspelling. So let's say you're all done writing your document and you want to go through and do a final spell check and you have several misspelled words. In order to go back and forth between misspelled words, you use bracket S, S, so bracket S, so that's gonna be open bracket S goes backwards. As you can see, I'm going backwards between misspelled words. Now, this doesn't look like much because every word here is misspelled. But if you had just a few misspelled words, it actually jumped forward faster, or backwards faster in your document. Now, in order to go the other direction, you need to use the other bracket and then S. So that goes backwards and forwards between misspelled words. And then if you wanted, again, if you wanted to change that word, if you wanted to see the suggestions for that particular word, Z equals will give you the suggestions that them has for you. You can then select the one that is correct if it's there and enter and it will replace it. So that is spell checking. And honestly, it's not the best spell checker in the world, but it's way better than nothing. So it's not gonna catch everything. I highly recommend you go through and actually proofread your stuff. But I mean, that's basic simple writing stuff. So I mean, I assume you're gonna do that anyways. So don't assume that it's perfect, but it still is going to catch the obvious stuff, which is better than nothing. Now, one last thing on this. Let's just say you have a word that you happen to know is correct. Like you know it's spelled right, but Vim thinks that it's not. So let's just say for, I mean, just for example, let's just say that this word here is spelled correctly, but it says it's not spelled correctly. You can go through and add this to your dictionary using ZG and it'll add that to your dictionary so that it knows now not to add that to your misspelled words. And that's also really helpful because a lot of times you write words that aren't in the English dictionary, or in this dictionary at least, and you need to add those things, specifically things like names. So that's really helpful. So that is spelling. Okay, so the last one is equally important for me. Now, a lot of times back when I was freelancing, I had to know the exact word count of the document that I was doing. Not only did I need to submit a certain amount of words because I had got paid by the word, but also because I wanted to keep track of how close I was to whatever my writing goal was. And the thing about Vim is that it does have built in word count ability. So you can go through and hit G, control G, and down here at the bottom, if you can see this, it'll actually tell you how many words there are in your documents. In this case, there's 1,700 and 13. But that's a pain in the butt, right? You don't want to have to go through and do G, control G all the time. Now you can go through and rebind that to it. So it's just a letter if you want to. Or if you use something like airline, you can go through and eventually, screen key will get out of here, right? It'll actually step here longer now because I pressed the key. There it goes. Anyways, down here at the bottom, you'll see I actually have the word count. Now let me look at the camera, make sure that you can actually see this. Now you should be able to still see this. Down here at the bottom, underneath my face, you'll see it says it has 1,713 words. Now that's not something that happens by default. It doesn't happen by magic. You have to go through and actually set that up. So if we go to a different tag here where we had, oh, that's the wrong one. Here, there we go. That's the right tag. When you use as many workspaces as I do, sometimes you get lost. It's just the nature of the beast. Anyways, what you want to do if you want word count in your airline bar, you can go through and add these two lines here, which I will also include in the video description. So basically what this does is it enables the word count and then it also tells them what documents it should display word count for. Because when you're doing a coding document or you're writing a shell script or something, you don't need a word count. So that's just superfluous information. So you don't want that to happen. So you just want to go through and do it for certain types of files. So in this case, it does help mark down org mode, I guess is what that is, text, ASCII docs, text, mail. And I added VimWiki because VimWiki will actually is kind of stupid. If you have VimWiki installed, I love VimWiki. It's great, but it controls every markdown document you ever do. It just does by default. I don't know if there's a way to turn that off. I haven't actually looked into it, but if you just have a regular markdown document, it assumes you want to use VimWiki in order to edit it. It's a pan-ass sometimes because it handles things weird and it's not exact markdown. So it doesn't work well sometimes. It's weird. Anyways, because of that, I had to use add VimWiki to this list in order for the word count to actually show up in my actual markdown documents. Again, weird, but it's just something that I had to do. So then I just went through and saved this, reloaded the init.vim, and then it went through and added the word count to my airline status bar at the bottom. Now, if you know how to configure airline, you can go through and move that wherever you want. It's also or should at least be possible for you to do this. If you don't use airline, I'm just not sure how you'd go about doing it. But it should be possible if you're interested in doing that or you can just use the G control G thing that I showed you earlier. So that is how to get word counts. So there's another tip for you, but it doesn't work for me. I've been trying to get it to work and I don't know why it doesn't work. Maybe it doesn't work in NVim. Maybe it doesn't work because I have a conflicting key binding somewhere. I don't know. But supposedly you can go through and move up and down through pages using page up and page down. It does not work for me. And I'm not sure why, but if you have a ton of text, like say 50,000 words or something, you have just page up to page and page of text, you can go through and do like 10 page down and it should go through and jump 10 pages down. Like I said, it does not work for me. I've been trying for a while to get it to work. I don't know why it doesn't work. I've looked it up a little bit. I haven't spent a lot of time on it, but supposedly that works. Like I said, maybe it just doesn't work in NVim. Some things don't. It's just the nature of having two different programs that are basically the same, but not exactly the same. So that is the last tip I have for you. Now, as I said at the beginning of the video, I'm just getting started on this journey. There's gonna be many more tips like this that I'm going to learn over the next few months as I dedicate myself to spending more and more time in NVim and actually using it as a writing tool. I'm sure there's a lot more things. Like there's that one thing that I really wanna do is go through and make it so that when I use the Vim keys, instead of going down like whole lines, it'll actually treat a paragraph like those are separate lines. I know there's a key binding to do it. I just don't remember it. It's just the nature of NVim. There's so many key bindings. There's no way I'm gonna remember all of them, but that one is definitely going to be useful because I do with paragraphs all the time, obviously, and being able to just navigate through them in actual lines instead of jumping between paragraphs with the Vim keys is gonna be much better. So that's something that's gotten going to have to learn. There's several other things that I wanna do. There's a plugin called Vim Pencil that I've installed. I haven't played around much with it yet. It has a lot to do with them with warping and stuff like that. I didn't go through warping. I actually probably should go through and make a whole video on Vim Pencil, but that's something that's really important because by default, you're just gonna have them wrapping your text, or not wrapping your text at all. It's just gonna go off into one infinite line with wrapping and set up. I can actually show you this real quick. You'll want this line right here in order to have wrapping turned on now. There's two different types of wrapping called soft wrap and hard wrap. I'm not sure what the difference is, quite honestly, to be honest with you. This is just what I looked up and this just seems to work for me. And that's one of those things that Vim Pencil seems to take care of, the difference between hard wrapping and soft wrapping. It's just something else that I'm gonna have to learn. There are also other plugins that I'm playing around with things like Vim Language Tool that's supposed to check for grammar. Supposedly that's really good. And I told you about the Vim Markdown. The other thing that I would highly recommend you do is install a plugin called Vim Last Place. Now this plugin will basically do what it says on the 10. It will go through and remember the last place in the document you were at the last save. So let's say you're doing a big edit or you're writing a lot of stuff and you save it and you close Vim for whatever reason. The next time you open it up, your cursor will be in the same spot. Otherwise, it'll be at the top. And that would really suck if you're in the middle of a document and not necessarily at the end. And you just have to go back through and find your place. So use Vim Last Place and it'll remember your position. Now you can go through and do that with Vim Script if you wanted to. I know that's possible, but I just prefer to use the plugin. It's just the easy way out. So those are my tips that I know right now. And like I said, there's gonna be more because I'm gonna be diving into this quite a lot. So that is it for this video. If you have comments about what we were talking about today, you can leave those in the comments section below. You can follow me on Twitter at the Linuxcast. You can support me on Patreon at patreon.com slash linuxcast. Before I go, I'd like to take a moment to thank my current patrons. Today, Devin, Chris, East Coast Web, Gentius, Funti, Petroco, Primus, Marcus, Meglin, Jack, Knitul, Steve, A, Mitchell, Arts Center, Amityus, Merrant, Camp Drashville, J-Dog, the MSDs, Rock, Peter, and Chrisible. Thanks everybody for watching. I'll see you next time.