Today I discussed wonders of explicit failure handling in Go with a young trainee and once again I heard »it is so much typing over and over«. An argument I never really understood because I use vim so any repeatable thing soon ends under ab or in snippets directory. Something pico editor likely lacks. So we need to show youngs and less experienced that there is no problem with 'too much typing'. Sometimes it is just with right editor-fu.
I urge power users of other editors under other OSes to share their wisdom how to *in simple(st) way* configure given vanilla (as fresh installed on an OS) editor to get abbreviation or keychord expanded to »if err != nil{}«. Vim/Linux. " double quotation char is a vim script comment Write a single line into ${HOME}/.vim/after/ftplugin/go.vim [1] [2] " in insert mode type iferr then press tab or space. ab iferr if err != nil {<CR><CR>}<UP> Alternate versions: " type ONE rarely used character (≠ here, AltGr-1 usually) " then press tab or space. Press ctrl-v after ≠ to suppress " ab expanding. ab ≠ if err != nil {<CR><CR>}<UP> " V3: type one chord for rarely used character (≠ here [3]) then " immediately type handling code (go fmt will add the tab later ;). inoremap <special> <unique> ≠ if err != nil {<CR><CR>}<UP> " V3 has the least possibility to interfere with fancy complete and " autoformat plugins ab versions. [1] Linux. Vanilla 7.3+ vim. Vim-go plugin users do not whine bout 'too-much' [2] Make sure the "filetype plugin on" line is in your .vimrc. (default on most linux distros.) -- Wojciech S. Czarnecki << ^oo^ >> OHIR-RIPE -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.