Решаем проблемы Visual Studio + Resharper + Vim с помощью AutoHotKey

Всем пользователям Visual Studio, активно использующих возможности ViEmu (или VsVim) и Resharper, и кому надоело отвлекаться на клавиши-стрелочки, делюсь своим скриптом (изначально делал для первых двух команд — стрелочки вверх и вниз для выбора элемента в списке подстановки).
Этот подход мне посоветовал James Kovacs (JetBrains, Inc)

; Control key ^
; Alt key !
; Shift key +
; Windows key #
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

; My code
!sc24:: Send, {Down} ; j
!sc25:: Send, {Up} ; k

;=============================
;Process Go to next member/tag
;=============================
$!#sc24::
Send, !{Down}
return
;=================================
;Process Go to previous member/tag
;=================================
$!#sc25::
Send, !{Up}
return
;==========================
;Process Move Code Up
;==========================
$^+!sc25::
Send, ^+!{Up}
return
;==========================
;Process Move Code Down
;==========================
$^+!sc24::
Send, ^+!{Down}
return
;==========================
;Process Go to next usage
;==========================
$+!sc24::
Send, ^!{Down}
return
;==========================
;Process Go to previous usage
;==========================
$+!sc25::
Send, ^!{Up}
return
;==========================
;Process Generate Code
;==========================
$!sc17::
Send, !{Insert}
return

capslock & sc24:: send, $+!{pgdn} ;Shift-Alt-J => Shift-Alt-PgDn: Resharper's "Goto Next Error In Solution"
capslock & sc25:: send, $+!{pgup} ;Shift-Alt-K => Shift-Alt-PgUp: Resharper's "Goto Previous Error In Solution"

capslock & sc16::
GetKeyState, state, shift, P
if state = D
send, +!{F11} ;Shift-Caps-U => Shift-Alt-F11: Resharper's "Highlight Usages"
else
send, +!{F12} ;Caps-U => Shift-Alt-F12: Resharper's "Goto Usage"
return

$^!sc24:: Send, ^!{PgDn} ;Ctrl-Alt-J => Ctrl-Alt-PgDn: Resharper's "Goto Next Occurence"
$^!sc25:: Send, ^!{PgUp} ;Ctrl-Alt-K => Ctrl-Alt-PgUp: Resharper's "Goto Previous Occurence"

Leave a Reply