A Small Vim Setup for Web Development
Feb. 17, 2022
Feb. 17, 2022
A Nice .vimrc File
I try to encourage all my students to at least learn enough vim to be able to use it in a pinch, and I love it when some of them actually take to it. In my AP Computer Science Princples class this year, students need to submit a PDF file with the source code to a program they wrote, complete with line numbers, and it would be helpful to have color syntax highlighting as well. Here is a .vimrc file that I've found most helpful:
" .vimrc " " Last modified 17 February 2022 by Jeff Elkner " " Turn on syntax highlighting and autoindenting syntax enable filetype indent on " set autoindent width to 2 spaces (see " http://www.vim.org/tips/tip.php?tip_id=83) set et set sw=2 set smarttab set background=dark " turn on spell checking set spell " turn on print options for line numbering in pdf " NOTE: insert ^L in the document for page break set printoptions=syntax:y,number:y,wrap:y,formfeed:y map <f9> :hardcopy > output.ps <CR>
Mapping CapsLock to Escape on Peppermint OS 10 and Linux Mint Xfce 20.02
If you're going to use vim, it is really helpful to be able to map the CapsLock key to Escape. I use many different GNU/Linux distributions and desktop environments. On GNOME or KDE based environments it is easy to do this, but on lighter weight desktops like XFCE it is not.
Back in September of 2018 I made a post titled Swapping ESC and Caps Lock on Bodhi Linux that described a way to set this up. I've since decided that having two Escape keys is a better idea, and I found using this .Xmodmap does the trick:
-*- coding: utf-8 -*- ! 2014-09-10 ! make caps lock do escape ! from http://xahlee.info/ ! keycode 9 = Escape NoSymbol Escape ! keycode 66 = Caps_Lock NoSymbol Caps_Lock clear Lock keycode 66 = Escape NoSymbol Escape
I've tested this on both Peppermint OS 10 and Linux Mint Xfce 20.02, and it works great.
Mapping CapsLock to Escape on Peppermint OS 11
Using .Xmodpad does not work on what may become my newest favorite distro, Peppermint OS 11, so I had to look for an alternative approach for that. I found one in a blog post by Alison Rowland. Here is what you do:
From the start menu, find Settings -> Session and Startup.
Locate the Application Autostart tab (the 2nd from the left) and click the + button in the lower left.
Add the following in the text entry next to the Command: label:
xmodmap -e "clear Lock" -e "keysym Caps_Lock = Escape"
You can put whatever you like under Name: and leave the Description: blank. Keep Trigger: set to: on login.
Click OK and then Close and your CapsLock key will now be an Escape key the next time you login.