How do you copy text from a diagnostic float window in Neovim/Lunarvim? - neovim

I'm on Lunarvim and I can check the line diagnostic with gl.
But I don't know how to go there with the cursor and copy the text, the mouse doesn't work either.

It is likely that the diagnostic popup window is set to be non-focusable. So you can not move your cursor to the popup window and copy text. However, you can try command lua vim.diagnostic.setqflist(), which should populate your quickfix list with diagnostic and you can copy from there.

Related

How i can change highlighted area in VSCode after Shift+F12

I try to find hotkey which can help me to change selected area after shift+f12.Let's see example:
I selected this function and after it i click shift+f12 and watch this in special window:
And as you can see, the right side of this block is displayed - all the places where this function is found.
I want to know what hotkey I need to press to move to the area with the code and start editing it:
Please say me how i can make it without mouse:)
P.S. i'm using windows

Can I configure VS Code to disable Breakpoint by middle click?

I am switching from PyCharm to VS Codium. I want to be able to disable breakpoints by middle mouse click, like in pycharm.
Currently, I can disable a breakpoint by right click at breakpoint and select Disable Breakpoint:
Another way is to disable it in list in Breakpoints view.
But I want to be able to quickly enable/disable it by just clicking with mouse wheel (middle button). Is it possible to configure VS Code this way? Currently, when I middle click on breakpoint, this is ignored, and instead a text from selection clipboard is pasted (it is the default behavior in linux). Visual Studio Code version is 1.66.1.
There is no way at the moment to customize mouse click events. There are a few hardcoded options you can change in the settings, but it is extremely limited like pressing ctrl and the mouse wheel for zoom. As far as I am aware, disabling breakpoints is not among those options.
Check out: https://github.com/microsoft/vscode/issues/3130
I currently use the following workaround.
Remap the middle click to some button.
For wayland several utilities can be used for that. Let's take kbct.
Add such config (edit for your needs)
/etc/kbct/config.yml:
- keyboards: [ "Logitech MX Master" ]
keymap:
btn_middle: f15
Then start kbct.service.
Create the ruler script
Make the file choose_press.sh:
#!/bin/bash
class=$(xdotool getactivewindow getwindowclassname)
if [ "x$class" == "xVSCodium" ]; then
ydotool click 0xC1 # right click
sleep 0.2
ydotool key 107:1 107:0 28:1 28:0 # End, Enter
else
ydotool click 0xC2 # middle click
fi
Do not forget to add executable permissions.
Bind shortcut to the script
To assign a command to shortcut in KDE, go to System Settings -> Shortcuts -> Custom Shortcuts, right click, choose New -> Global Shortcut -> Command/URL. Go to Action tab and fill in the command. In this case it will be the path to choose_press.sh. Note: do not use ~ there.
And in Trigger tab assign the shortcut. In this case we use f15 (use some way to simulate it, if it is not presented on the keyboard).
Start VS Codium
Use vs codium in X11 mode. This is because I currently do not know how to get active window class in wayland.
Result
Now if you middle click in vscodium window, it will receive the sequence of input that leads to enabling/disabling breakpoint. In any other window, the middle click will behave as normal.
There is debug.enableOrDisableBreakpoint in codium, but toggling that with shortcut only works when the cursor is on the line with breakpoint. I did not found a way to move cursor to the line where you pressed (method to get the mouse over line?). So I made that complex thing with ydotool choose_press.sh.
I also tried to start stop kbct by window activation, but that is unfortunately broken in kde wayland currently.

See unsaved changes in vscode

Sometimes when closing vscode, or a tab therein, I get a dialogue asking "Do you want to save the changes you made to filename?" However, the unsaved edits are actually from a previous session that was closed without such a query, probably when turning off the computer, so I can't remember if it was meaningful edits, or maybe just an accidental key-press, like a shortcut gone wrong; and doing undo to revisit the last edits doesn't work either.
My question: How can I see the diff between the saved version of a file, and the version in the editor window? I think it would be nicest just to have a "show diff" option in the dialogue, but for now I'm also happy with a command line diff command.
I'm using ubuntu 20.04.
I'm using VSCode version 1.52.1 on MacOS and I had a similar problem that may not be the same problem, but I'm guessing it will work for you as well.
When you're in the Explorer view, in the upper left part of Explorer you have your "Open Editors." If that shows a dot to the left indicating that the buffer has changes in it, you can right click the file name and select "Compare with Saved." This will open another buffer to the side that will show you any unsaved changes.
To get rid of that window (it took me a bit to figure this out I'm sorry to say!), you can click the 'X' to the left of the extra buffer in "Open Editors."
Hope this works for you!
A few bright notes for the keyboard players out there:
The command you are asking about has a default shortcut. Unless you've applied a keyboard map extension, the Ctrl+Kd arpeggio opens the very same diff view between the active and saved versions of the current file. The default shortcut to close an editor tab (be it the diff or a file or anything at all) is Ctrl+W.
The command, like any command in VSCode, is also accessible via the Ctrl+Shift+P command dropdown (on Linux, F1 opens it too). Start typing e.g. compa sav (it saves your keyboard wear and tear to shorten words to a prefix which is unambiguous enough), and the list will shrink dynamically to just a few commands. Yours is File: Compare Active File with Saved. When it's close to the top enough, navigate the list of commands with the down arrow and execute it with Enter. As a bonus, you may click on the little gear to the right of the command currently highlighted in the list and redefine its shortcut, if you use it very often and prefer a chord shortcut to the default arpeggio one. Sorry, there does not seem to be a shortcut in lieu of the gear click. If there is, please let me know!
But if you really, really want to right-click on the filename in the Open Editors view of the Explorer sidebar, you can open that view directly with, you guessed it, a shortcut: Ctrl+Ke. And if you change your mind on a dime right at this moment, or realize that you in fact never had a mouse to do the right-click in the first place, use Shift+F10 to drop down the "right-click menu", properly called the context menu, which you navigate with arrows and execute with Enter (that's kinda a common theme, as you probably noticed). This works mostly anywhere the right-click does.
While in the Open Editors view, to switch to an editor file tab, move the selection to the desired file. Press Space to bring the file into view but stay in the Open Editors view, or Enter to bring the file into view and shift the keyboard focus to it. Pressing Ctrl+Shift+E brings focus back to the editor from any view in the Explorer sidebar. The same shortcut moves focus to the Explorer sidebar from the editor.
Happy ♬ k'boarding ♬!
ctrl+shift+P (or command+shift+P on mac) and fuzzy search for "compare changes with saved files"

Is there a command to move the current line to the top of the current window, similar to the Brief editor Ctrl-T?

Brief (if anyone remembers that far back) had a command (Ctrl-T) that recentered the window such that the current line moved to the top of the window. Ctrl-B recentered the window such that the current line moved to to the bottom of the window. Is there such a command in vscode?
If there is no command, is there an extension that provides that functionality?
I use vscode to write C# and C++ code.
Not exactly your request, but really close :
https://github.com/kaiwood/vscode-center-editor-window
You can centered your window with the shorcut ctr+L
There is a pull request to add an offset.
EDIT
Something that do exactly what you want :
https://github.com/pmattei/place-window-vscode

Sql server mouse cursor pointer does NOT automatically go to the end of the line

This is a plain usability issue I'm facing. Somehow the settings on my version changed and when I click on the query window, the mouse cursor pointer does NOT automatically go to the end of the line. It instead remains wherever I had clicked.
I have checked Options in Tools, but I cannot find where this feature can be reset.
Thanks!
You've got the virtual space option enabled in your settings.
On the menu bar, go to the Tools -> Options, and then pick Text Editor -> All Languages and uncheck the Enable virtual space option.
Take a look at this screenshot: