Can't auto copy the mouse selection - vim

https://vim.fandom.com/wiki/Auto_copy_the_mouse_selection
I put this in my ~/.vimrc and my ~/.gvimrc.
set guioptions-=a
set guioptions-=A
set guioptions-=aA
Completely closed and reopened macvim and still, when selecting text with the mouse it is automatically copied. I don't want mouse select to copy at all.

Related

Vim - go to next match + change word + paste clipboard does not work

In my Vim, hitting cw (change word) and then command + v (MacOS paste shortcut) is able to replace the word on cursor to the clipboard copied one, but if I search some word then press n to go to the next match, and then do the same thing with cw then command + v, the copied one are not able to be pasted (it dose not show up) until I press ESC. It used to work normally.
What could be the possible cause of this?
It's caused by romainl/vim-cool, it used work without this issue, maybe because I changed vim config or installed some other new plugins that don't fit with it.

Excel freez pane and invisible gridlines settings are not saved

I have an excel file in which I want to freez the view to cell D5 and I want the grid lines to be invisible. Getting this done works fine, however, these settings get lost sporadically after saving and re-opening the file. The file is on a server and four people work on it. I trust them when they tell me that they did not change it back. Could some local setting do this automatically?
If you cannot save it, maybe you can run some code to set your settings every time you open the file.
The following code will show you how to Run a Macro Automatically.
Private Sub Workbook_Open()
ActiveWindow.DisplayGridlines = False
MsgBox "Hi dude! your settings were applied"
End Sub
That will eliminate the grid lines everytime you open the workbook.
I don't know what you mean by freezing D5 cell, but can use the macro recorder to get the code of what you record to then use it in your procedures.
You should have your button "record macro" (mine is in spanish "Grabar macro")
For the code to execute when the workbook opens you should name the procedureas told (Private Sub Workbook_Open()) and paste it in the "ThisWorkbook" module.
Hope it helps
It seems that the view seetings are saved with the window and new windows are initialized with grid and without freez pane. If the file is then saved with the new window open, all settings are lost (i.e. set to default).

Close userform with Esc without control_KeyPress() command for each control

In this answer, it's shown that Excel userforms can be closed with Esc by setting up a control_KeyPress() sub for each control that can take focus - Close userform with escape button
I've gotten this to work, but I have several menus, each with a number of controls. I tried putting this routine on just one button, but it's not always quick to tab/nav back to a specific button.
I'm looking for a way to make it so that I either
don't have to create control_KeyPress() subs for every control that can take focus
or, can achieve the same goal (closing the userform with esc) in a different way
Thanks!
My idea would be to create a command button on the form, set the cancel property to true AND set the width and height to 0. Add the following code to the not visible button.
Private Sub CommandButton1_Click()
Hide
End Sub
Leave the visible property on true
Create a small button, e.g. 6 x 6 so that it can be visible but unobtrusively positioned in one of the corners of the form. Making it this small stops the caption from being displayed and just leaves a neat, small square.
Create a button, (e.g. BTXX), and set:
Cancel = True so that pressing the escape key "presses" this button
TabStop = False so that tabbing through the form does not stop on the button
Caption = "Esc" as a reminder of what the button is for
In the onclick event use:
Private Sub BTXX_Click()
Unload Me
End Sub
In this example the escape button is "hidden" top-left on the form by setting Top=0 and Left=0. (See images below).
Userform
Properties
If you already have a button for closing the userform then you can simply set its cancel property to true. It is then triggered by pressing escape, remains clickable, keeps its accelerator and stays in the tab order. You can only have 1 button with Cancel=True and the property editor takes care of this automatically.

Excel Hyperlink - jump to cell and scroll window

I am working in excel and I want to make a Hyper Link from the top of the page to another location on the page.
I type in a box at the top, and then right link and go down to hyper link in the dropdown menu I click it and select the tab that says "In This Work Book" and change it to where I want it to go. So all this is good and all but my Question is:
Can I make a Hyper link to bring me to a cell and scroll the window so the selected cell is the first row, instead of being near the bottom of the window?
Example:
Hyper link: "Test" Located in Cell A,1
Location Of Hyper Link: A,210
Now instead of having it put A,210 at the very Bottom and show the cells above it, I want to to be at the top and show the cells below it.
Thanks for the help,
Add the following VBA code to your worksheet:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
ActiveWindow.ScrollRow = ActiveCell.Row
End Sub
By magic, when you click a link, that cell will be at the top. If you don't want this behavior for all links, you can test the Target address.
You will have to save the code as a xlsm file so that macros are enabled. Use Alt-F-11 to open the VBA editor so you can actually add the code (double click the worksheet in the left hand pane, then paste the above code in the window that opens).

vim pastes "9" after pressing the central button of the mouse

After selecting a piece of text from a web page with the mouse, I'm trying to paste it into a file opened with vim, but when I press the central button of my mouse it just pastes "9" (with or without insert mode activated).
This is the output of :reg:
--- Registers ---
"" 9
"0 9
"1 ^J
"- 9
"/ \s\+$
Press ENTER or type command to continue
Any idea what's going on here?
Create a file in your home directory called .vimrc with this content:
set mouse=r

Resources