8
votes
Accepted
Can I get a visual indicator when I drop a mark?
Is there a plugin or something for that that works well?
Why yes there is! I use kshenoy/vim-signature, and highly recommend it.
From the README:
vim-signature is a plugin to place, toggle and ...
7
votes
How do I delete a mark in current line?
I'm going to swim against the stream on this one.
Just don't worry about it.
Marks are pretty ephemeral and there are bunch of marks Vim automatically maintains like '[, '', and '. Humans are ...
6
votes
Accepted
Find only between marks
You can use \%>'m and \%<'m to match after and before a given mark, m.
/\%>'afoo\%<'b
For more helps see:
:h /\%'m
6
votes
Accepted
marks with fullline visualization
I created a plugin that I think does what you want.
If you want to change the colors that it uses simply define g:highlightMarks_colors in your vimrc as a list of colors (either names or RGB strings)....
6
votes
Jump back to the position I started a search
I do this by first creating a mark - for example, create a mark named "a" with ma in command mode – then search or move around the file however you want. Then go back to your mark with 'a.
6
votes
Accepted
How to move marked line to current location
The format for :m[ove] is
:[range]m[ove] {address}
Where the range is the line or lines you want to move and the address is the target. Note that the moved line(s) will actually be placed on the line ...
5
votes
Accepted
difference between marks and tags?
Both specify certain points in a file and give you commands to jump there and as such they are the same.
But marks are created by vim. Either explicitly by hand with m or automatically by vim (for ...
5
votes
Is it possible to have Vim displaying the list of available marks when using marks?
This does exactly what my original question was
""""""""""""""""""""""""""""
" Ranger style marks command
"
""""""""""""""""""""""""""""
function! Marks()
marks
echo('Mark: ')
" getchar()...
4
votes
Is it possible to have Vim displaying the list of available marks when using marks?
A variation on your own response is to install fzf.vim and then bind to :Marks, e.g.:
nnoremap ` :Marks<CR>
This has the benefit that it will show up in fzf's fuzzy search window.
(Caveat: It ...
4
votes
Accepted
Go to the last cursor position using marks
The mark " indicates the position of the cursor when you last exited a buffer. Using that...
Continue to use your cross-file marks but immediately follow with '" (or `" to restore the column as well ...
4
votes
Is it possible to place marks at the end of a line?
I found the answer here.
Another easy way is to just add v right after y, no setting or Visual
mode selection necessary.
`a"ryv`b
y`b yanks to mark b excluding the character under mark b, ...
4
votes
Accepted
Jump to where insert mode was entered?
If you haven't yanked or changed text since your last insertion, then you can use the `[ mark (see docs), which gets you back "to the first character of the previously changed or yanked text."
By the ...
4
votes
Accepted
Is it possible to list only my marks?
You can define a custom command like this, that will only show the lowercase marks a-z:
:com :MyMarks :sil! marks abcdefghijklmnopqrstuvwxyz
4
votes
Accepted
Deleting between two marks (or, from the previous mark to the cursor)
Using marks
To do this with marks, do the following:
Set your mark on the first ampersand: ma
Move to the echo command anyway you choose.
Delete from there back to the mark: d`a Make sure to use a ...
3
votes
Jump back to the position I started a search
Two options I can think of off the top of my head:
:[v]split, then search in only one window
:nnoremap / mz/; then `z should take you back. Only works for one search at a time (i.e. new searches ...
3
votes
How do I delete a mark in current line?
To delete a mark you can use :delmark it can be shortened to :delm.
If you really want something shorter you can map a function which asks for an input but it's not really a common practice to have a ...
3
votes
Accepted
how to remap backtick mark with single-quote mark globally
You used nnoremap which means the mapping will only work in normal mode. d and y leave you in operator pending mode. Adding the following should solve these cases:
onoremap ' `
onoremap ` '
I'm not ...
3
votes
Shortcut for applying a command between the last two marks
Using 2 marks to operate on the text between those lines is the 'vi'-compatible way of the more modern and (literally) visual way of operating in Vim (and probably why visual mode was invented in the ...
3
votes
Accepted
Understanding and navigating Mark / Mark not set
The ways to jump to a mark are
'm jump to line of mark m
`m jump to line and column of mark m
you can technically do :'m, since the range :'m is the line of mark m, and entering a range as an ex ...
3
votes
Accepted
Understanding a few of the preset marks
The marks 0-9 are the last 10 files you were editing. See :h viminfo-file-marks (took me a while to find the correct help subject).
'" : the cursor position when last exiting the current buffer (:h '"...
3
votes
Accepted
Efficient copy->paste onto mark
The ex commands :put and :delete both allow you to specify a line, so if you've already placed mark 'a on the line you want replaced, then you can execute the following after the copy:
:'apu
:'ad
or ...
3
votes
Efficient copy->paste onto mark
Alternative solution:
If you want to replace the text at the mark, you could just use
:norm!'aVp``
Or in one line with the copy:
:'<,'>y | norm!'aVp``
3
votes
Accepted
3
votes
Accepted
How to set more than 52 marks?
The number of marks is hard-coded in Vim, and you can't get any more
without modifying the source. – Martin Tournoij
However, an advanced alternative exists in form of :h textprop in Vim and :h api-...
3
votes
Accepted
Is there a way to make marks in color or at least visible?
I'm using the plugin vim-signature to see the marks in the margin:
3
votes
Accepted
Using marks in custom functions/plugins without changing user's marks
To get a list of all marks, you can use the getmarklist() Vimscript function. It allows to either return global marks (when no buffer argument is given) or return buffer specific marks when a bufnr ...
2
votes
How to search for lines matching current line in vim
http://vim.wikia.com/wiki/Searching_for_expressions_which_include_slashes points out that the search register can be set directly, like this:
:let @/='/abc/def/ghi/'
This allows search on the line ...
2
votes
Is it possible to have Vim displaying the list of available marks when using marks?
Below is an excerpt from my ~/.vimrc that contains the vimscript code I implemented by building upon the very good "no new mappings" idea from the already existing answer provided by @...
2
votes
Accepted
Plugin vim-signature: How to change mark column character color?
By default, the vim-signature plugin uses the SignatureMarkText highlighting group for its mark signs.
It's better to set the colour of this in your vimrc rather than editing the plugin's code (which ...
2
votes
Plugin vim-signature: How to change mark column character color?
Mark column is added by plugin: vim-signature.
Need to edit: $HOME/.vim/bundle/vim-signature/autoload/signature/utils.vim
Change 'SignatureMarkText' color.
Need to exit vim to see the change.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mark × 60vimscript × 6
cursor-movement × 5
neovim × 4
search × 4
key-bindings × 3
normal-mode × 3
cursor-motions × 3
vimrc × 2
command-line × 2
cut-copy-paste × 2
vim-windows × 2
visual-mode × 2
highlight × 2
folding × 2
navigation × 2
jumplist × 2
jump × 2
plugin × 2
autocmd × 1
save × 1
ex-mode × 1
tabbed-user-interface × 1
cursor × 1
tags × 1