Well, doing this in vimscript is not that hard. For example, the following command will do what you describe to the line your cursor is on:
:exec 'norm '.(&cc - strlen(getline('.'))).'A='
The way this works is it determines the length of the current line and subtracts that from the current value of 'colorcolumn'
. This evaluates to a string, and is executed as if you had typed it. For example, on a line with 10 characters, and with 'colorcolumn'
set to 80 this is equivalent to typing:
70A=
You can also be more specific about which line to do this to. For example, to do this to line 3:
:exec 'norm '.(&cc - strlen(getline(3))).'A='
Or the line that mark a
is on:
:exec 'norm '.(&cc - strlen(getline("'a"))).'A='
To wrap this up in a convenient mapping, I would recommend this:
function! Append(c)
exec 'norm '.(&cc - strlen(getline('.'))).'A'.nr2char(a:c)
endfunction
nnoremap <expr> m ':call Append('.getchar().")\<CR>"