簡體   English   中英

如何在 Visual Studio Community 2022 中自定義“刪除行”熱鍵的功能?

[英]How to customize functionality of "Delete Line" hotkey in Visual Studio Community 2022?

在我使用的大多數 IDE 中,包括 VS Code,“Edit.LineDelete”鍵盤快捷鍵刪除該行並嘗試將 cursor 保留在下一行的同一位置。 例如,此快捷鍵在 VS Code 中為 Ctrl+Shift+K,在 IntelliJ 中為 Ctrl+Y,並執行以下操作:

// I've used a pipe here to represent the cursor movement... 

/* BEFORE line delete */ 
        {
            ... 
            int foo = 0; |
            foo++; 
        }
/* AFTER line delete */ 
        {
            ... 
            int foo = 0;  
            foo++;|
        }

但是,Visual Studio Community Edition(2017 年和 2022 年)似乎有一種獨特的處理方式。 它沒有嘗試將 cursor 保留在同一個 position 中,而是立即將 cursor 發送到行的最開頭(甚至在制表符空格之前)。 請參閱以下內容:

/* AFTER line delete on Visual Studio Community */ 
        {
            ... 
            int foo = 0;  
|           foo++;
        }

這對我來說非常煩人,因為它需要額外的工作(鼠標或 End 鍵)才能將 cursor 返回到有用的位置。 我什至不確定為什么他們會在 VS Code 而不是 VS Community Edition 中使它很好地工作。

有沒有辦法更改此功能以反映 VS Code 或 IntelliJ 中的行為? 我不知道對宏有任何內置支持,僅僅為了這個變化而獲得擴展似乎有點過分了。 我錯過了什么嗎?

注意: 這里提出了類似的問題,但我希望做完全相反的事情。

默認快捷鍵是Ctrl + Shift + L參見: https://visualstudio.microsoft.com/keyboard-shortcuts.pdf

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM