I want a command mapping to detect whether the current line is blank, and perform a different action for each case it detects: true of false. How do I do this?
It is not entirely clear when you say to "trigger some mapping"... Do you want to create a mapping with
nnoremap if current line is empty? I guess not. Or you want to have a mapping that does different things depending on whether current line is empty?
If so then there are many possibilities, for example:
func! DoSmth() if getline('.') =~ '^\s*$' echo 'Do something if empty line!' else echo 'Do something if NOT empty line!' endif endfunc nnoremap <space>a :call DoSmth()<CR>