How can I indent code in the Vim editor on Windows? - winapi

Duplicate:
How to indent a selection in gvim (win32)?
How do I indent multiple lines quickly in vi?
Using vim under linux I can indent a block of code using the VISUAL mode and pressing ">".
In vim under Windows this does not happen.
This is what happens:
Press V, the VIM enter in the VISUAL mode
Press 'Down', the VIM exit for the VISUAL mode. I can't select anything in VISUAL mode.
Alternatively, if I use the SELECT mode for selecting code the ">" does not indent it.

Haven't you keep mswin.vim ? If you want the same behaviour on both OSes, get rid of this file.

Ok, I got it. In Windows I should press Shift+Down to remain in the VISUAL mode.

If you use V (uppercase) you enter VISUAL LINE mode. For VISUAL mode you should use v (lowercase).
And if you use the standard movement keys (hjkl) everything works fine.
If you dislike the default movement keys, use these mappings:
:map <Up> k
:map <Down> j
:map <Left> h
:map <Right> l

Weird, I don't experience this behavior on Vim 7.1 on Win XP. Perhaps setting nocompatible will help you?

Related

Use ctrl-j and ctrl-k to navigate menus in Visual studio

I normally use vim, but sometimes it's convenient to use Visual Studio 19.
I'm trying to keep my keybindings as consistent as possible between the two.
In vim I use ctrl-p to open a file by typing its name. I switched visual studio to use the vscode keymap defaults to get this behavior (vscode also uses ctrl-p for searching by filename). However, when using the dropdown list for this search, I'd like to be able to highlight a different item by using ctl-j and ctrl-k to move up and down, similar to how fzf works in vim.
Is this a key binding I can set, and if so, what is it called?
I used AutoHotKey with this script
#NoEnv
#SingleInstance, force
#Warn
;#IfWinActive, ahk_exe devenv.exe
^h::Send {Left}
^j::Send {Down}
^k::Send {Up}
^l::Send {Right}
Capslock::Esc
;:#IfWinActive
if you want it only to happen when you have vs2019 up, then uncoment the #IfWinActive, by removing the ; , however, I want to be able to use the bindings whenever, not just in VS
You can compile the script and then put them into your start up by pressing Win-R to open the run command dialog, then entering in
shell:startup
and it will open an explorer window to your startup, just drop the exe in there afterwards, and it should start up every time.
you can also create hotkeys for doing other things, like added my VS path to my PATH environment variable, then had autohotkey assign Win-S to open up devenv.exe with this script.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %userprofile% ; Ensures a consistent starting directory.
#s::
Run, *RunAs devenv.exe
Return

Clearing the terminal in vs code without using ctrl C

I want to know how do I clear up my terminal in Vs code without using Ctrl C
and restarting my how program?
There is an unbound command:
workbench.action.terminal.clear
that will do what you want without terminating any running tasks/processes. You can set it to a keybinding of your choice if you search for it in the Keyboard Shortcuts. It appears to work when you have editor focus and not terminal focus.

SHIFT + ENTER VS2013

I'm trying to find anywhere that I can achieve this. I simply want to setup a macro like in sublime text or atom where I can hit shift+enter and it will go to the end of the line, add a semicolon, and bring me to the next line. I've just started C development and trying to use vs2013 and not having this is pretty much going to send me sprinting back to sublime text, intellisense isn't worth destroying my workflow.
I've tried: Tools > Options > Environment > Keyboard > Text Editor : Shift + Enter > Edit.Breakline As suggested by someone in a vs2010 thread but that proved fruitless.
Any assistance would be appreciated.
The command is Edit.LineOpenBelow. It's already assigned to Ctrl+Shift+Enter
I had the same issue, so I swapped the commands for Ctrl+Shift+Enter and Shift+Enter.
Shift+Enter is assigned to Edit.BreakLine by default.

Keyboard shortcut to switch between the code editor and ipython console using the Canopy

How can I create a keyboard shortcut to switch between the code editor and ipython console using the Canopy IDE?
I have tried writing a macro according to the documentation for code editing (http://docs.enthought.com/canopy/configure/editor-scripting-api.html#code-editor-scripting-commands) and the ipython pane scripting commands (http://docs.enthought.com/canopy/configure/ipython-scripting-api.html#ipython-pane-scripting-commands, but do not see a solution.
As an example, I have a macro that will execute the current line of code (without having to select it), but it would be nice to be able to switch the cursor back to the code editor after execution without touching the mouse/trackpad.
def run():
code_task = get_active_task()
code_editor = code_task.active_editor
cursor = code_editor.cursor
cursor.start_of_line()
cursor.next_line(select=True)
code_task.run_selection()
Using Canopy Version: 1.1.1 (64 bit) on Mac OS X 10.7.5
Thanks, great suggestion. Added to Canopy wish list. (You can use the keyboard shortcut Control+Tab to cycle among File Browser, Editor, and IPython, but this is not yet macro-able.)
(on Mac) -> Better Touch Tool. This is a macro that is only active while i'm in emacs, which does the following:
save the current buffer (set to F1 in my emacs)
cmd-tab to last other window (terminal)
'Up' arrow (to reload last compile/run cmd)
'Enter' key
cmd-tab to last other window (emacs), once process terminates
Has saved me thousands of keypresses today.

How can I use Alt as meta key in Windows for Emacs 23, especially M-x?

I tried to use Alt as meta key for the FSF Emacs 23 Windows version and for EmacsW32 but especially M-x (Alt-x) does not work.
Somehow I cannot use Alt as Meta key for Alt-x (M-x). I searched really hard and all I got is how to switch the meta key to Alt in w32-meta-style. Currently this variable has the value 'use Alt as Meta key'. I also tried all other values with no success. Furthermore I installed the unpatched version of emacs from http://ourcomments.org/Emacs/EmacsW32.html and the original binaries from gnu.org. All versions have the same problem.
Alt works as Meta, except for Alt-x (Meta-x).
My setup is as follows:
Windows 7 x64 Professional
German keyboard
This question is Windows specific as I have a working Ubuntu version of Emacs 23.
EDIT: It was Growl for Windows. It loads on start up and caputes all Alt-x inputs. So my solution was to just disable Growl as I do not need it anymore. Might be another App for you.
It should work out of the box. Does Alt+x work as M-x if you start Emacs with the -Q flag? That inhibits loading of your customizations, in case one of them is breaking M-x on Windows.
Also, Emacs only treats the left Alt key as Meta by default, the right Alt (AltGr), is used for entering special characters .
I don't know about w32-meta-style but did you set w32-alt-is-meta? See http://www.gnu.org/software/libtool/manual/emacs/Windows-Keyboard.html
The Growl hotkeys can be changed:
https://groups.google.com/forum/#!topic/growl-for-windows/luSpf9lQQRM
To disable the hotkeys, just remove the content of the 'value' tags.

Resources