 Okie dokie so one question I get a lot actually I've been getting it for a while and I've still never done a video on it so now's the time one question I get a lot is how do you insert like special characters in Vim because that's something I need to do a lot and it's sometimes you know people who know different languages or just need to write things that you know have different characters for some reason they might need they often need to be able to insert characters that just aren't on on the keyboard now I do this really easily in Vim I have sort of it's not a script but a little Vim file that does this for me and it makes it very very easy so I'm gonna talk about that anyway so actually for those of you who have subscribed to the channel for any significant period know that my day job it actually has nothing to do with tech I'm actually a graduate student in linguistics and here you see the international phonetic alphabet which has a bunch of crazy characters on it these are I have to use these characters basically every day so I need to be able to insert them in documents and stuff like that now there are some people who waste a whole bunch of time using Microsoft Word select character thing or copying pasting them or something like that and that's all silly I'm gonna show you how to do it in Vim very very easily and additionally even if you're not using crazy characters you know there oftentimes you have lots of diacritics so like accent marks you know macrons the lines above or you know dots below or something like that here's an example document I wrote and I wrote it in Vim with a bunch of different characters and the anyway let's get into how how I actually do this so I'll show you how my setup sort of works but before I show you that I should say there is I don't use this but there is in Vim a default function for inserting some characters now it doesn't have everything but and I actually don't know that much about it like I just because I don't like the ergonomics of it but I'll show you how it works and that is the control K shortcut now whenever you type control K I just type control K and you'll see that my cursor is now a question mark now after you type that the next two characters you type will determine what character it inserts now I don't know many of these because I don't use it but if I type AE it'll give me the you know AE ligature character or I assume the same is true of OE or something like that now there are a bunch of weird combinational I can just okay that one's Japanese I didn't expect that but there are a bunch of random combinations you can play around with you you can look them up I'll just say I don't like this just because it involves pressing like especially when you're writing a language that has a bunch of these characters it's just sort of a pain to have to type control K control is just always a pain to touch one of the reasons I don't use emacs but anyway let me show you my setup I'm not going to show you the script that doesn't immediately I'm just going to show you how it works I have two things going for me one is a way of inserting these IPA characters and one is for putting diacritics on vowels or consonants or whatever let's talk about the diacritics first I have a little function that creates dead keys now normally you know if I type if I type characters they pretty much come out how I type them now I have a shortcut mapped and we turn my yeah I have a shortcut map to space base D and that turns on dead keys and what that means is when I type quotation mark and then a that actually produces an a with a you know acute accent or you know a grave accent is you know if you I put the the falling accent beforehand or I can have a macron or you know a dot under a character or something like that or a tilde you know lots of different stuff I actually forget all the stuff that I put in here but you know all most all of the diacritics I need I have with this dead keys function now a lot of times this can be a pain because if I'm writing you know something in quotation marks the dead keys can get in a way because they'll form characters I don't want them to form so I have a nice way of turning them off if I just press the same shortcut space base D it turns them off and now you know I'm back to normal so sometimes when I'm writing in a language that needs these characters I'll jump back and forth and it's again it's just space base D I don't have to leave the home row basically now writing IPA characters I'll go ahead and I'll show you the script that does this of course this is not if you're typing this in on Vim it's not gonna work yeah I'll show you how to make this work in a second I but all I have the same thing for IPA characters if I press space base I that activates IPA character shortcuts so all so for example if I want you know this symbol which is the symbol for the sound in G sound I type semicolon in G and that that comes up or if I want the bilabial trill which is like brah which some languages actually do have it is BB or something like so it's semicolon BB so I basically just have a bunch of mnemonics like there if you don't know this the symbols in the IPA that might be a little arcane but a bunch of you mnemonics for all the different sounds that you know I need a to type at a daily basis and anyway let me show you how how these scripts work oh I should say and to turn these off you can press space base I so you can easily toggle them off and on anyway let me show you how these work and there are two parts they are individual scripts and you have to call them in the VM RC or you well you could just put them directly in your VM RC but let me show you the scripts first I just put them in my VIM folder so basically how they work is so for the IPA script right here and the other one basically looks exactly the same but for the IPA script to make this I basically just copy and I just went to Wikipedia highlighted all of the IPA characters and pasted them in here and of course using an ice vim macro I put them all on an individual line or something like that now I took only the ones that I need daily and I created a mapping for each one of them so this function when I call this function IPA it maps all of these sequences so it maps in G to that character we saw before okay now that function maps them and there's another function that unmaps all of those macros and the function up here this thing toggle IPA that that just basically turns them off if they're on or on if they're off now I call that in my VM RC in the following way may scroll down to this I source the file wherever it is it happens to be in VIM Luke IPA and then I map in both normal mode and insert mode different commands that call the toggle IPA command so that that's basically how it works so whenever I press that keyboard shortcut it runs this function that either maps or unmaps the characters and I'll show you the other one as well the dead keys one which is pretty much the same stuff dead keys dead keys and in this one it's basically the same thing I have all the different like accented characters and what maps to them I have them all nice in grouped up you know gray vaccines umlauts macrons the dots underneath Tilda's stuff like that hot chicks or Karen is I always I think those are both acceptable terms for that but whatever so that's basically it if you want these files they're in the video description to a link you know it's a link it to my github or whatever but that's how I do it and of course you can take if you need to use IPA characters or if you need to use the you know dead keys you can of course just borrow these bindings put them in separate files call them in your VRC or put them directly in your VRC if you want I would put them in my VRC but my VRC and it's already like 200 something lines it's way too long it's just aesthetically I don't like long files but that's but that's basically it so that that's how I do it and like in practice like I don't really have to think about it I'm just writing I never have to like the mnemonics are very nice like I don't have to think about what I'm doing I just pretty much type in it you know it just works so that's about it and I will I will say just to be totally clear if you don't want the reason I have these as functions that you know toggling them off and on it's just because I want that ability if you want to always map some particular character to something you can you know let's say you always want you know quotation mark a to map to a with an acute accent on it if you want that you can just put that in your VRC just alone and that's gonna be that the only reason I have all this function stuff is I want to be able to turn them off but if there's a binding that you always want obviously you can just have it in your VRC so that's about it again check the video description for the files and hope you learned something or hope you have some ideas and see you guys next time