How to Disable CTRL + K + D in Visual studio - visual-studio-2012

I have a requirement that i do not need to change a line of code in existing lines and when i do control K D it formats all the data and can see lots of changes in SVN so please i want to Disable CTRL + K + D in Visual studio,.

You can disable it in the Options:

Related

VIsual select to a specific character

I am working in vim. I have a piece text that looks like :
one = 24
two = 52
three = 56
four = 74
Is there a way to use visual select to yank and paste up to the equal to sign in each line ? I want an operation that leaves me with the following result :
one = 24
two = 52
three = 56
four = 74
one =
two =
three =
four =
My current solution is to copy the whole thing, then jump to the one = 24 line in what I copied and then record this macro : 0f=ld$j to #w and then repeat it three times with 3#w. Is there a way to do this using visual select and yank and paste ?
I tend to use :substitute for these things
" First I yank and paste, in normal mode
yapP
" Then I transform
gv " to reselect, while in normal mode
:s/=.*/=/ " that will actual display :'<,'>s/.....
The actual reselection part may need a little work depending on where the cleared snippet shall appear. May be something like yapo<esc>p:'[,']s/=.*/=/ + enter
You can visually select the lines to apply normal commands to them with :norm.
Thus, you could do:
ggVG:norm f=ld$
How about
:global /=/ copy $ | substitute /=\zs.*//
We use global to select the original lines, then copy them to the end $ and remove the parts after = with substitute.
You could use a mapping like this
vnoremap ,s y:let #"=system('sed -nE "s/=.*/=/p"',#")<cr>
When selecting now some lines in in visual mode, type ,s. This will put the desired modification into the " register and you can paste them now using p wherever you want.

Python -- Adding string to clipboard that will paste to Excel in proper format (i.e., separated into rows/columns)

I've seen a few answers to this problem, but in VBA and C#---nothing in python.
In python 3, I'm trying to do the following:
Assign a variable a string of values with appropriate "excel" format
Have this variable then copied to the clipboard
Then the user should be able to manually CTRL+V (paste) this string into excel and have it separate into the correct row/column placements.
I'm using both tkinter and openpyxl for my project and through testing I've gotten some results, but it is not what I want. The closest that I've gotten is below.
# If I first go into excel,
# and copy a few columns within a single row with different data in them,
# then I run the following code:
import tkinter as tk
root = tk.Tk()
paste = root.clipboard_get()
print(paste)
# Then I manually copy the print output to the clipboard,
# and then go back to excel and paste,
# excel gives the following warning message:
# "The data you're pasting isn't the same size as your selection. do you want to paste anyways?"
# And after pressing OK, it seems as though the data is pasted properly.
This is OK, and the print(paste) string might help me create the appropriate format for the initial variable of strings that I want to generate, but I need a solution that will not cause Excel to make this warning sign pop up every time.
If anyone can provide some insight into this, I would greatly appreciate it. Also, the solution needs to be via python not through modifications to Excel. Secondly, the solution is not about appending/writing the data directly to Excel (via Openpyxl, etc) but about getting the data to the clipboard in the appropriate format (I'm using Excel 2016).
Thanks!!
Edit:
I have also tried using the "ctypes solution" presented here by user kichik.
To make this solution easier to work with, I downloaded an app called "InsideClipboard" which lets me easily see the format ID of each types of formats that the clipboard "copies" data in.
Using kichik's ctype solution, I checked to see if manually copying the print output of the different formats stored in the clipboard would let me manually CTRL+V to Excel in the original format, but this failed. The original "copy" was of multiple columns of strings in a single rows of strings from Excel, and the manual "paste" of the individual formats back into excel kept all the strings into a single cell (with the exception of HTML Format that created multiple rows of data--also wrong). The different formats included CF_LOCALE (16), CF_TEXT (1), CF_OEMTEXT (7), CF_UNICODETEXT (13), AND HTML Format (49384).
So, still: no solution.
Edit2:
I realized that I could create strings in python with actual tabs pressed in between the string, instead of using \t, and it worked to create a single string that would place the data into different columns of a single row when pasted into Excel.
Also, I realized that if I CTRL+V directly into Excel (not on the Row heading), on the actual row in which I want to paste the data, I no longer get the Excel "warning message". So, using this work around might work. If no one has any input, then this simple approach might be good enough.
However, I would like to be able to simply click on the row heading instead of the first relevant row cell to paste the data without the Excel warning popup. Ideas are still welcome, and it would be best to have it all done via python (without modifications to Excel as the app may be run on different Windows OS PCs).
So: possible simple solution, but not perfect.
Edit3:
So I've worked out a solution based on Edit2. The Excel "warning" popup still happens if Excel is opened as an app on the working computer; however, if the Excel file is opened and editable via an online processor, then the user can highlight the row heading and paste without generating the Excel "warning" popup. This works in my specific case, although the better solution would be to have the copied data not generate the Excel "warning" popup in any situation. Regardless, if no one knows how to prevent the Excel warning popup through python alone, then I can still work with this method.
Here's my solution (note that the spaces in the long string are actually 'tabs'):
import pyperclip
# t variables are defined prior to the below code
# note: the " " parts in the data string are actually tabs
data = t1 + " " + t2 + " " + " " + t3 + " " + t4 + " " + t5 + " " + t6 + " " + t7 + " " + " " + "t8" + " " + " " + " " + " " + " " + " " + t9 + " " + t10 + " " + t11 + " " + t12 + " " + " " + " " + " " + " " + " " + t13
pyperclip.copy(data)
print("clipboard:", data)
# now manually pressing CTRL+V while inside Excel (online processor) will
# paste the various t variables in the appropriate cells designated by
# the " " tabs in between. Of note, this works for columns of a single
# row as I didn't need multiple rows of data for my task.
Below is code to create a 5 row by 3 column grid of Entries in tkinter. Pressing the copy button copies the content of the Entries as a tab / newline separated string to the clipboard which can then be pasted into excel.
import tkinter as tk
from tkinter import ttk
ROWS = 5
COLS = 3
root = tk.Tk()
rows = [] # Container for Entry widgets.
# Create and grid the Entry widgets.
for row in range( ROWS ):
temp = []
for col in range( COLS ):
temp.append( ttk.Entry(root, width = 10 ))
temp[-1].grid( row = row, column = col )
rows.append( temp )
def entries_to_lists( rows ):
list_out = []
for row in rows:
temp = []
for col in row:
temp.append( col.get() )
list_out.append( temp )
return list_out
def string_out( rows ):
""" Prepares a '\t', '\n' separated string to send to the clipboard. """
out = []
for row in rows:
out.append( '\t'.join( row )) # Use '\t' (tab) as column seperator.
return '\n'.join(out) # Use '\n' (newline) as row seperator.
def do_copy():
data = entries_to_lists( rows )
root.clipboard_clear()
root.clipboard_append( string_out( data )) # Paste string to the clipboard
root.update() # The string stays on the clipboard after the window is closed
ttk.Button( text = " Copy ", command= do_copy ).grid( column = 1 )
# Button to trigger the copy action.
root.title("Copy to Excel Test")
root.geometry("400x200+10+10")
root.mainloop()
This copied into Excel 2013 in Windows 10 with no warning messages.
string_out will generate a suitable string from any list of lists of strings, a 2d list.

NeoMutt: How to Edit To/Subject/CC Fields in Vim?

When I'm composing mail in mutt the default keybindings for editing fields such as to,subject, and cc is to open a one-line input at the bottom of the window.
However, if I've made a mistake, or am trying to edit a long list of emails, this single line editor is not useful.
So, while I like having this as the default behaviour, I would like to know how I can also open and edit these fields in a vim window.
Set this inside your .muttrc and you are able to edit the mail header like From:, To:, Cc:, Bcc:, Subject: and so on while editing the message.
set edit_headers = yes`
You can add the following mappings to have Ctrl open Vim:
macro index,pager \Cr "<enter-command>set edit_headers = yes<enter><reply>"
macro index,pager \CR "<enter-command>set edit_headers = yes<enter><group-reply>"
macro index,pager \CL "<enter-command>set edit_headers = yes<enter><list-reply>"
# macro index,pager \Cm "<enter-command>set edit_headers = yes<enter><enter-command>set autoedit = yes<enter><mail>"
I've commented out the last one messed with my mapping to open a message from the index in Vim (l does a preview):
macro index l "<enter-command>set pager=<enter><enter-command>set pager_index_lines=20<enter><display-message>"
macro index <Return> "<enter-command>set pager=nvim<enter><enter-command>unset prompt_after<enter><display-message>"
I've also tweaked the init.vim to streamline the process of adding addresses a bit with:
" abook syntax highlighting
Plug 'paniash/abook.vim', { 'branch': 'main'}
" open abook addressbook in a horizontal split
nnoremap <leader>ca <C-w>s:e ~/.abook/addressbook<CR>
" paste and format abook entry in header
nnoremap <leader>ci pdddws"<Esc>A"<Esc>j0dws<<Esc>A><Esc>kJkJjddk$
So now you can <leader>ca to open abook's addressbook in a horizontal split, search for the email you want, copy the whole entry with yap and paste and format it in the message header using <leader>ci.

Multi Clicks With the Same Keyboard Shortcuts to Run a Ahk Script

I want to do Multi Clicks with the same Keyboard Shortcuts to Run a Ahk Script.
I now in Autohotkey Languages, you can write a code that can execute a part of Code, if a certain Keyboard Shortcut combination is pressed.
But i want on my Windows System, to Click a count of the same keystroke combinations to execute a part of Code.
The pros are: you do not have to move your fingers to a other place on that keyboard, Click it again and it will run a other Code. (this will improve my keyboard Movements and i have more options to do keystrokes.)
Example:
Click - Ctrl + (1x)c - to CopyText
DoubleClick - Ctrl + (2x)c - to CopyText + GoogleSearch
multiClick - Ctrl + (5x)c - ?
If you look to this Example Script then you can see what i mean.
(note - Hotkey > [^cc::] or hotkeystring > [:*:^cc::]- this does not work, is there another way to solved this)
; [+ = Shift] [! = Alt] [^ = Ctrl] [# = Win]
#SingleInstance force
;MultiClicks the Same Keyboard Shortcuts to Run a Ahk Script
;Click Ctrl + c to [copy text]
^c::
send ^c
;msgbox script1
return
;DoubleClick Ctrl + (2x)c [copy text] + [do a google search]
^cc::
send ^c
sleep 200
run https://www.google.com/?q=%clipboard%
;msgbox script2
return
;MultiClicks Ctrl + (5x)c to run script5
^ccccc::
;?
;msgbox script5
return
esc::exitapp
^c::
{
count++
SetTimer, actions, 400 ;время за которое нужно нажать комбинацию
}
return
actions:
{
if (count = 1)
{
msgbox CTRL+C
}
else if (count = 2)
{
msgbox CTRL+CС
}
else if (count = 5)
{
msgbox CTRL+CСССС
}
count := 0
}

Use VIM Visual Block to concatenate blocks

I try to use VIM build my SQL query by concatenate block of strings. For example, I have the following strings in three tabs in VIM:
# block one
where c = '123'
where c = '2345'
...
# block two
set b = 12
set b = 345
...
# block three
update myTable set a = 'abc',
update myTable set a = '23423',
...
each block contains 100 lines (fragments of SQL query). I would like to concatenate those blocks in to one complete SQL query: block one + block two + block three (100 lines) like this:
# sql queries
update myTable set a = 'abc', set b = 12 where c = '123'
update myTable set a = '23423', set b = 345 where c = '2345'
...
Just ignore the first line #..., it is just for explanation. I think that Visual Block can be used do that:
Yank all the lines in tab "block two";
Paste buffer to tab "block three" at the beginning;
Yank all the lines in tab "block one";
Paste the buffer to tab "block three" at the beginning.
However, I tried to the tip in Visual Block Mode(first two y and p examples), I could not get my expected result. The paste does not concatenate the buffer strings to the block. Not sure what I did wrong. Or any other alternative ways?
I recently ran across a VimCasts episode that describes how to do editing in visual block mode. Check out the video, I believe he describes what you want.
Did you try Visual-blockwise (ctrl-v)? They have to be the same width lines, but it works.
# Yank the lines from the other file
gg V G
# Add whitespace to the end
:%s/$/ /
# Select the whitespace at the end of the other file, and paste it
gg $ ctrl-v $ p
You may have to make a few changes, but hopefully it gave you some ideas at least.

Resources