Questions tagged [mark]
Question about the navigation in a buffer via the marks mechanism and the general usage of marks.
60
questions
0
votes
0
answers
38
views
Can equalprg be configured to preserve the dot mark?
Vim has this nice built-in feature where it marks the last edited line with the '.' mark, so jumping to the '.' always goes to that line. But after invoking the equalprg, the '.' mark is always moved ...
1
vote
0
answers
24
views
Custom Jumplist Behavior
I enjoy using ctrl-i and ctrl-o to quickly jump back large distances in a file. I would enjoy if this functionality could be extended to the in-line motions such as f, F, w, b, ...
I understand that ...
1
vote
1
answer
32
views
Range marks aren't set in lua function called from keymap
I'm trying to insert a table of contents with an external process. Currently, I have this:
.config/nvim/after/ftplugin/markdown.lua
--- @param v boolean
local function toc(v)
if v then
vim.cmd([[...
0
votes
1
answer
109
views
Difference between backtick and single quote for marks
Section 3.10 told me that:
The command "'mark" (single quotation mark, or apostrophe) moves you to the
beginning of the line containing the mark. This differs from the "`mark"
...
1
vote
1
answer
103
views
Using marks in custom functions/plugins without changing user's marks
I am looking for a way to save and restore marks at the beginning and end of my custom Vimscript function. I am writing a plugin and I don't want my plugin to change any of the user's marks, so I ...
0
votes
0
answers
1k
views
Is there a way to have somewhat globally persistent marks?
Basically, I like marks.
I'd like to save/keep my marks either in the file, or as a project configuration, is there an extension or a way to do so?
I know that the project or file based settings are ...
1
vote
1
answer
46
views
Is there a way to make marks in color or at least visible?
Is there a way to make marks in color or at least visible?
Actually I need to put visible marks on the text (code) in Vim.
0
votes
1
answer
141
views
How to yank from EOL, including the last character?
In normal mode, I want to set a mark (ma) and then yank until the end of the line, including the last character ($ and y`a). But $ doesn't include the last character. What is the solution?
2
votes
1
answer
153
views
How to "Set previous context mark"?
From the vim manual:
m' or m` Set the previous context mark. This can be jumped to
with the "''" or "``" command (does not move the
cursor, this is ...
1
vote
1
answer
71
views
Organize :marks list?
Is there a way to organize / parse the :marks list? E.g. list them in the order they were created, rather than alphabetically. Or see which marks are associated with currently open buffers.
3
votes
1
answer
1k
views
Deleting between two marks (or, from the previous mark to the cursor)
I'm a long time vi/vim user from college days in the 90s, but never considered myself a power user. I'd like to improve at it and the other day I was staring at something in an Ansible playbook like ...
2
votes
2
answers
1k
views
Delete all marks except bookmarks in nvim
I use dashboard so I like my marks clean.
So I generally make many marks while working on something and then delete them all except the file bookmark in the end. Is there any way to delete all marks ...
0
votes
1
answer
135
views
Quickest Way To Fold Using Marks
I've found if do :set number, I can fold between specific lines x and y with xGzfyG or easier for me xggzfygg. That's great but it's a distraction to find the line numbers as is [visual]zf. I use ...
2
votes
1
answer
216
views
How to move marked line to current location
Say I put a mark down somewhere with ma. Then I jump somewhere else, GG3k. I want to move what's at my mark to the current line.
I could have just dd'd it if I'd had some forethought, but is it ...
0
votes
1
answer
88
views
Handling multifile projects using portable bookmarks
I am trying to manage multiple projects each with multiple files so:
project1
----src
file1.cpp, ..., file10.cpp
----include
incl1.h, ..., incl10....
1
vote
1
answer
44
views
Unmark as foldable
I have recently discovered that it is possible to visually select and mark that selection as foldable through zf. I tend to use zM & zR to toggle the whole foldable text. However, sometimes I want ...
0
votes
2
answers
88
views
How do I convert a file mark to a string?
If I for example create a mark inside the file ~/.vimrc with mV.
How do I convert the mark 'V to the path of the file the mark is in?
When I type :marks I can see a list of marks and the corresponding ...
0
votes
0
answers
243
views
How to get strings between `[ and `] in lua?
I'm trying to play around with text objects in lua, here's what I got:
https://learnvimscriptthehardway.stevelosh.com/chapters/33.html
On that webpage, I found that I can operate on the text send to ...
2
votes
1
answer
154
views
How to set more than 52 marks?
Possible marks are {a-zA-Z'}. Is there a mechanism to set more of them? The goal is to track certain (modifiable) lines and detect when they are deleted (e.g. with dd).
Background
I am building a UI ...
0
votes
1
answer
178
views
Visually selecting from mark to cursor
How can I visually select the area between a mark and the cursor?
According to
https://vim.fandom.com/wiki/Using_marks
I can yank this range by
y`a yank text to unnamed buffer from cursor to ...
1
vote
1
answer
163
views
Marks and insertions of lines
Assuming I have a line such as the following one:
XXXXXXXXXXXXXABCXXXXXXXXXXXXXXXXXABCXXXXXXXXX
mark a is at the first instance of ABC, mark b on the second one.
Now I run a macro on it, breaking the ...
0
votes
3
answers
651
views
Efficient copy->paste onto mark
I typically write all my software in the same way (omitting the TDD parts):
Iterate pseudo code until it is granular enough that each part can be written in, hopefully, under 20 minutes.
Implement ...
3
votes
2
answers
356
views
Get list of marks inside Vimscript
some time ago, I wrote a small plugin in vimscript that was using builtin function getmarklist. Recently I reinstalled Vim and was surprissed that this plugin no longer worked because Vim couldn't ...
3
votes
2
answers
314
views
Is it possible to list only my marks?
When I run :marks it lists all the marks including the standard Vim marks. This is somehow distracting.
Is there a way to list only my marks that I created using m-X for example?
3
votes
2
answers
562
views
Is it possible to enter visual mode without changing the last visual selection?
In a script, I want to delete a rectangular block of text. For example, I want to convert this:
ABCD
EFGH
IJKL
MNOP
into this:
ABCD
EH
IL
MNOP
One way to do this is with visual block mode. Move the ...
1
vote
1
answer
55
views
Do you know any plugins which allow marks to be longer than one char?
I'm looking for plugin which emulates marks behavior for longer key sequences. I want to be able to mark two distinct files with 3 char mappings and jump to files when sequence is typed. Do you know ...
1
vote
1
answer
530
views
Understanding a few of the preset marks
When doing :marks, there are a few marks that show up that I'm not quite sure what they do, even after reading the entry in the help section. For example, the following marks seem a bit obscure (at ...
1
vote
1
answer
3k
views
Understanding and navigating Mark / Mark not set
Sometimes I enter in characters and my screen shows "Mark not set", and it seems like I have to either press escape or q a bunch of times to get out of that 'mode'. So, related to this:
What does '...
0
votes
1
answer
114
views
VimScript - Save specific positions consistently even after buffer changes
I want to save multiple positions in vimscript, and make sure that they stay at the right place, even after the buffer changes
Here are the solutions I found so far, and why I want something else:
...
3
votes
1
answer
236
views
Is it possible to place marks at the end of a line?
Typical mark placement using m places the mark at the cursor. When the cursor is on the last character of a line, this means that jumping to that mark for the purpose of copying text starts the ...
2
votes
1
answer
371
views
Jump to where insert mode was entered?
`. seems to take me to where I last left insert mode, but I would like to jump to where my cursor was when I entered insert mode last.
How can I do that?
2
votes
4
answers
1k
views
Jump back to the position I started a search
I have a small question: let's suppose I'm at the beginning of line 10 and I search a term with the command /term_to_search and then I press <Enter> to start navigating search results with n or ...
0
votes
1
answer
269
views
marks between windows
If I make a mark ma in one split pane and then from another I try to jump to it 'a I can't.
I guess marks are stored per-buffer.
Can I store marks per-tab?
2
votes
1
answer
271
views
How to make mapping for any mark
I want to make a mapping that jumps to the file of a mark but on the last visited line. Ideally I would write something like this:
nnoremap z<mark> '<mark>`"
Where z is some command ...
4
votes
1
answer
709
views
Can I get a visual indicator when I drop a mark?
I like using marks, but I wouldn't mind having a visual indicator of some sort that maybe shows me "you've dropped mark x here", perhaps a letter in the gutter or some sort of line or character ...
1
vote
2
answers
559
views
undo mark overwrite [duplicate]
Sometimes I accidentally type ma instead of 'a and overwrite the mark I had at a instead of jumping there.
I know that by default vim has no way to undo an ma, but how can I add this functionality?
...
1
vote
1
answer
248
views
Can capitalized marks be saved in session INSTEAD of viminfo?
Marks are saved in .viminfo
I would like to have separate marks saved per session.
Is there an easy setting to make this switch? I know I could write some vimscript to save my session marks ...
0
votes
1
answer
79
views
Why doesn't the cursor return to its original position in this command to create a new line?
I added the following command to my .vimrc, which is designed to insert a blank line below the cursor
nnoremap <leader>o mzo<esc>`z
The sequence of this command is
mark the cursor ...
5
votes
1
answer
1k
views
difference between marks and tags?
Reading the manuals, seems to me that marks and tags are the same thing, only difference is that mark names can be [a-zA-Z] values, while tags can be alphanumeric. If I'm wrong, what is the difference ...
4
votes
2
answers
3k
views
Find only between marks
Suppose that I have marks 'a and 'b, and I want to search for all occurrences of foo between them.
The ex command
:'a,'bs/foo/bar
will replace only between 'a and 'b. Is there any command like
:'...
2
votes
1
answer
714
views
Go to the last cursor position using marks
I like to add marks for move across files but most of the time, I don't care about the line. I want to go on the last position of the cursor.
For example, I have this marks :
:marks
mark line col ...
0
votes
2
answers
776
views
Plugin vim-signature: How to change mark column character color?
Currently mark character is bright red as in below screenshot.
How to change it?
0
votes
1
answer
119
views
Plugin for showing marks by *highlighting entire line*, instead of using signcolumn?
I write code mostly on my laptop for portability. It's a small monitor, so plugins that use the "sign column" tend to take up too much space. For example, I have my Syntastic plugin configured to ...
4
votes
3
answers
9k
views
How do I delete a mark in current line?
Lets say I jump to mark with ]' and I want to remove it, how can I do it without typing :delmarks a?
3
votes
1
answer
3k
views
how to remap backtick mark with single-quote mark globally [duplicate]
I want to swap ' with ` for all combinations of commands in normal mode.
I have tried the following:
nnoremap ' `
nnoremap ` '
It works for commands like '', ``, but failed for d'', y'', etc.
...
2
votes
1
answer
902
views
marks with fullline visualization
There is any solution to highlight the entire line where a mark has been inserted (e.g. with command ma)?
The best could be to have marked each mark with a different color of choice.
Any idea?
...
1
vote
1
answer
204
views
Stop curly braces navigation from leaving marks
When using curly braces navigation, {, }, to move between paragraph, overwrites the "last jump" mark (the one accessible via ''). I would find it more useful if it left this mark untouched. Is there ...
2
votes
2
answers
368
views
Is it possible to use the :put Ex command using column numbers?
The documentation for :put says that the command accepts a line. That is, it puts the content after the line specified. Is it possible to put the content at a particular mark?
For example, say I am ...
2
votes
1
answer
104
views
Shortcut for applying a command between the last two marks
When I first started using Vim 10 years ago, I found myself typing
:'a,'fs/target/replacement/g
a lot. I was used to using 'a and 'f as my go-to marks. So I also had this in my .vimrc:
map qq :'a,'...
4
votes
1
answer
1k
views
What does `1 do?
I tried to set a mark using a digit: m1 and apparently that does not work, because later I typed `1 and I think it opened the last opened file or something else, I'm not sure.
What does m1 do?
Are ...