Skip to main content
edited body
Source Link
mMontu
  • 6.7k
  • 22
  • 31

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.


Edit

okay, how to combine it with search and replace? Another autocmd after the search and replace one?

Vim documentation is very comprehensive and well-written, you should definitively try reading it.

If you are going to write autocmds themthen :help cmd-lines is a must read:

autocmd BufWritePre * %s/\v^\s+$//e | call setpos('.', getpos("''"))

You should also consider using autocmd groups, as explained in :help autocmd-groups.

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.


Edit

okay, how to combine it with search and replace? Another autocmd after the search and replace one?

Vim documentation is very comprehensive and well-written, you should definitively try reading it.

If you are going to write autocmds them :help cmd-lines is a must read:

autocmd BufWritePre * %s/\v^\s+$//e | call setpos('.', getpos("''"))

You should also consider using autocmd groups, as explained in :help autocmd-groups.

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.


Edit

okay, how to combine it with search and replace? Another autocmd after the search and replace one?

Vim documentation is very comprehensive and well-written, you should definitively try reading it.

If you are going to write autocmds then :help cmd-lines is a must read:

autocmd BufWritePre * %s/\v^\s+$//e | call setpos('.', getpos("''"))

You should also consider using autocmd groups, as explained in :help autocmd-groups.

added 595 characters in body
Source Link
mMontu
  • 6.7k
  • 22
  • 31

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.


Edit

okay, how to combine it with search and replace? Another autocmd after the search and replace one?

Vim documentation is very comprehensive and well-written, you should definitively try reading it.

If you are going to write autocmds them :help cmd-lines is a must read:

autocmd BufWritePre * %s/\v^\s+$//e | call setpos('.', getpos("''"))

You should also consider using autocmd groups, as explained in :help autocmd-groups.

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.


Edit

okay, how to combine it with search and replace? Another autocmd after the search and replace one?

Vim documentation is very comprehensive and well-written, you should definitively try reading it.

If you are going to write autocmds them :help cmd-lines is a must read:

autocmd BufWritePre * %s/\v^\s+$//e | call setpos('.', getpos("''"))

You should also consider using autocmd groups, as explained in :help autocmd-groups.

Source Link
mMontu
  • 6.7k
  • 22
  • 31

You could achieve '' on an autocmd using the following:

:call setpos('.', getpos("''"))

Check :help function-list for built-in functionality on VimL.