Pretty much the subject line says it all. I just want to be able to turn off the line, undisplay it. I don't want to delete the line or the tag reference to the line. I want to use a checkbutton and once the line is drawn, done through a database, I want to be able to turn on and off the line with the checkbutton, without having to replace the tag in the line list everytime I turn the line back on, err in that case I would have to redraw the line from scratch. How do I turn I line off? I haven't tried but I don't think the disable feature is for the this purpose.
You can use the canvas's .itemconfig() method to switch your line between state=HIDDEN and state=NORMAL.
Related
I'm using VIM version 8.2
When I'm on the line above the very long line, it appears as if there is no line below it. (Refer Below Image)
But as soon as I move down, I get to see everything in that line. (Refer Below Image)
Is there a way to make the very long line appear whithout having the cursor on it?
You can set display+=truncate or set display+=lastline, which tell Vim to display the last line but put ### in the first or last column to indicate the rest is not displayed.
Also see https://vim.fandom.com/wiki/Working_with_long_lines
Question
When buffer contents have changed how do I know if a line, having say a line no of 100, has shifted to line no 104?
Note: Content of the line may change so can't track the line using search patterns.
Hacky Solution
I was thinking using the TextChanged* events along with the current cursor position and change in the total number of lines will help. But this seems like it could lead to an incorrect answer.
Context
I'm trying to create a plugin as a wrapper around vim's tags functionality.
The issue is: if a tag was inserted at line 100 and 4 lines were added above it, the tag points to an incorrect location, i.e. line 100, whereas it should be 104.
How do I calculate this difference of 4?
Solutions that apply to both vim and neovim would be appreciated.
My problem is a code editing problem in Sublime text. After I delete some line, I want to carry whole code below in that line to one line above. Right now I am doing this via deleting the line manually. Are there any shortcuts that I can do it easily?
What I want to remove:
What I want to achieve via shortcuts:
Let's say I have the following three lines and cursor is where ▐ is:
1. This is a slightly longer line.▐I want to delete this and the next line.
2. This is a shorter line
3. This is the third line
I want to delete the rest of the line from the cursor and line 2, so I do vjd, but that leaves my text like:
# This is a slightly longer line.# This is the third line
This is because when selecting text in visual mode, vim selects an additional virtual character at the end of the line. I've played around with virtualedit but that didn't seem to help.
Any clues on how I can get the original behavior that I wanted?
Try three keystrokes - sh-d, sh-j, sh-d
shift-d (delete to end-of-line)
shift-j (merge next line with this)
shift-d (delete the merged, i.e., second line
That will do the trick for you.
That's because if you don't have virtualedit set, vjd will delete everything including the new line character. So you just have to do vjhd instead, to keep the new line intact.
Otherwise with virtualedit=all, I don't face this problem.
In vim I want to visually make transparent the space I have to write a text in markdown. I use hard wrapping with textwidth=79. I know by some calculation that I'll have 20 lines for a chapter for example. So, what I do is inserting 20 empty lines to get a visual feeling for what I can write. After writing some lines, I manually delete the number of lines already written from the empty lines, so that the visual impression still is correct.
What I want to do, is to automate this deletion process. That means I want vim to automatically remove one line below the last written line if this line is empty and after vim automatically started a new line because I reached 79 characters in the line before. How can I do this?
I know that there are autocommands in vim but I haven't found an <event> that fits to the action: after vim automatically hard wraps a line / reached new line in insert (or however you would like to describe it)
I don't think there's an event for that particular action but there's a buffer-local option called formatexpr that gq & co will use, if set. So you can write a function that inspects any placeholder whitespace, if existing. That function can call the text format command gqq to maintain original feel (+ the cursor movement to the new, empty line).