I am trying to combine several commands into a single mapping - (i) open a split window with a height of 15 lines, (ii) open an existing file in that window, (iii) move to the last line and char of that file, (iv) create a new blank line thereafter, (v) and enter insert mode.
This achieves (i) and (ii):
nnoremap <leader>n :15sp +$ $HOME/_notes/n0w<cr>
I've tried to extend upon it with:
nnoremap <leader>n :15sp +$A $HOME/path/to/file<cr>
nnoremap <leader>n :15sp +$ +A $HOME/path/to/file<cr>
nnoremap <leader>n :15sp +A +$ $HOME/path/to/file<cr>
nnoremap <leader>n :15sp +GA $HOME/path/to/file<cr>
which has given the respective results:
E464: ambiguous use of user-defined command +$A
+A $/HOME/path/to/file [NEW DIRECTORY]
+S $/HOME/path/to/file [NEW DIRECTORY]
E492: not an editor command
I've also tried similar variations with +startinsert
and +normal
but not getting the desired result.
Would greatly appreciate help.