imap imap imap imap imap :call home() imap imap imap imap =kill_line() cmap cmap cmap cmap cmap cmap cnoremap cnoremap cnoremap D: function! s:home() let start_col = col('.') normal! ^ if col('.') == start_col normal! 0 endif return '' endfunction function! s:kill_line() let [text_before_cursor, text_after_cursor] = s:split_line_text_at_cursor() if len(text_after_cursor) == 0 normal! J else call setline(line('.'), text_before_cursor) endif return '' endfunction function! s:split_line_text_at_cursor() let line_text = getline(line('.')) let text_after_cursor = line_text[col('.')-1 :] let text_before_cursor = (col('.') > 1) ? line_text[: col('.')-2] : '' return [text_before_cursor, text_after_cursor] endfunction function! s:toggle_quickfix() if empty(filter(getwininfo(), 'v:val.quickfix')) copen else cclose endif endfunction nnoremap c :call s:toggle_quickfix()