New answers tagged

0

<ALT-$> [count] hi where [count] is a number the Alt key to enter commands while in insert mode while pressing the Alt key press "$" to go to end of line press [count] "h" to go left [count] times press i to go into insert mode


0

Using lua api (nvim) we can do: line, col = unpack(vim.api.nvim_win_get_cursor(0)) vim.cmd [[ normal 4X]] vim.cmd [[ normal u]] vim.api.nvim_win_set_cursor({0}, {line , col}) The first line saves line and column, the second line erases 4 chars, the third one gets back one action and the last one restores the line and cursor positions. Your question helped ...


2

There is no straightforward way to tell vim to land the cursor at a particular place in the cmdline during a map, but there are a number of workarounds. Direct positioning autocmd FileType cpp nnoremap <F4> :RunWithFile ~/Downloads/ > output.txt && cat output.txt<c-r>=setcmdpos(getcmdpos()-31)[1]<cr> You can use setcmdpos() to ...


1

Normally prefer :h ftplugin over autocmd FileType. If still want autocmd, at least, put it into augroup. Use :h map-<buffer> to define a local mapping. Otherwise it will affect all other buffers/windows too. Typing foo[cursor]bar is as simple as bar<C-B>foo.


1

One of most known plugins that does it -- vim-easymotion You might also check vim-sneak for a similar but a bit different approach to the problem.


Top 50 recent answers are included