Archive for the ‘Uncategorized’ Category

Vim Nano

Or, how to make vim behave a lot more like nano

My vimrc:

" backspace anything
set backspace=indent,eol,start

" indent plz
set autoindent

" I never liked vi
set nocompatible

" can haz shiny
syntax on
filetype plugin indent on

" +++ Make it obvious which mode we are in
set laststatus=2 " always show status line
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
highlight Comment ctermfg=lightblue
highlight StatusLine ctermfg=yellow ctermbg=red cterm=BOLD

" no wrapping plz
set nowrap

set insertmode

" mappings
inoremap <C-l> <C-o>
inoremap <C-o> <C-o>:w
inoremap <C-c> <C-o>:q!
inoremap <C-x> <C-o>:q<CR>
inoremap <C-w> <C-o>/
inoremap <C-k> <C-o>dd
inoremap <C-u> <C-o>P

" i like to paste
set pastetoggle=<F4>

This gives you some basic nano shortcuts, ^x to quit, ^o to write, ^w to search. It can do nano style cut/paste, but only with a single line (so far). Use ^l to type regular vim commands.

Hello world!

First (new) blog post, since I, em, lost the old blog. Will be putting up the more useful of the old posts and adding some new ones 🙂

Getting the multimedia keys to work

Today I decided to throw out my old dell keyboard and get a fancy new keyboard. I got a genius KKB-2050, which was fairly cheap. The keyboard has 12 multimedia keys along the top, which needless to say didn’t work. This is how I got them working.

Firstly, install lineakd, it’s in the fedora repo, so you can install it with yum. I tried to get some the graphical configuration working, but got nowhere. The config files looked easy enough to edit, so I quickly tried that approach.

Firstly, run lineakd -l to list the keyboards and find the one that matches yours closest. To generate the configuration file then run lineakd -c [keyboard-type] where keyboard type is the model number of the keyboard you chose from the lineak -l output.

That will generate a default blank config in (~/.lineak/lineakd.conf). I wanted a global configuration, so I moved this to /etc/lineak/lineakd.conf. (if you do this, make sure to chmod it 644 to make it world readable.

Run lineakd -vv from a terminal window, and check that your keys are correctly detected. If they were then proceed to editing the config file, if not try generate it again with a different keyboard type, or refer to the lineak website.

Open the lineakd.conf in a text editor, and you’ll see a list of actions that correspond to the keys on your keyboard. You can put any commands in there – you may want to refer to my config file at this time (read it here).

My keyboard also came with a sleep key, which by default was sleeping (and crashing my desktop). Needless to say, I wanted to disable this feature so my machine wouldn’t crash if someone accidentally hit the key. The solution was simple enough – telling the suspend button to do nothing in the gnome power configuration seemed to do it :)

Run lineakd from a terminal again (run it as you, not as root) and check that things are working. If they are all that’s left to do is run lineak when your x session starts (coming soon)