A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Perl web frameworks

navigation in vim

vi keybindings

Summary:
  • h - move left
  • l - move right
  • j - move down
  • k - move up
  • g, then j or k - move only one screen line (for long lines)
  • w - go forward one word
  • e - go to end of word
  • b - go to beginning of word
  • { - jump up to next blank line
  • } - jump down to next blank line
  • m? - set mark ? (where ? is a lowercase letter a-z)
  • '? - jump to mark ? (where ? is a-z) NOTE: This is a single quote mark followed by a lowercase letter

    My vim config

    Superceded by https://github.com/willsheppard/dotfiles/blob/master/.vimrc

    in ~/.vimrc:

    " TABS
    " make tabs 4 characters wide
    :set tabstop=4
    " make > and < keys shift by 4 characters
    :set shiftwidth=4
    " turn tabs into 4 spaces
    :set expandtab

    " automatically tab to the right place, after pressing enter                     
    :set autoindent

    " COLOURS
    " less bright colours
    :set background=light 
    " set colour of comments
    :highlight Comment ctermfg=Green

    " syncronise syntax highlighting properly
    :syntax on
    autocmd BufEnter * :syntax sync fromstart 
    " highlight terms for which you've searched
    :set hlsearch


    " SCRIPTS
    " allow Shift-K to look up stuff
    ":set keywordprg=/path/to/a/script




    " PLUGINS
    " For Taglist: http://vim-taglist.sourceforge.net/
    " Show name of current subroutine

    map q :TlistShowTag<Enter>
    " Show list of all subroutines

    nnoremap <silent> <tab> :TlistToggle<Enter>




    " Enable code folding for perl subroutines
    :let perl_fold=1
    " don't fold the whole package up, just subroutines (type zazO with cursor on the package name to unfold everything)
    ":set foldlevelstart=1
    " don't fold anything (type za while in a subroutine to fold it up)
    :set foldlevelstart=99




    " EXAMPLE of mapping a keypress to a sequence of other keypresses
    " map CTRL-E to end-of-line (while in insert mode)
    imap <C-e> <esc>$i<right>


    " Also set .vim/ftplugin/perl.vim to display the current Perl subroutine name in the status line



    " save local marks a-z for up to 100 files ('100), save global marks A-Z upon exit (f1)
    set viminfo='100,f1


    " don't clear the screen upon exiting vim
    set t_ti= t_te=

    " load custom filetypes
    :filetype on
    au BufNewFile,BufRead *.tt set filetype=html

    Insert non-printable characters in vi

    • Ctrl-V, then Ctrl-[X]
    Where [X] is A-F