当前位置:网站首页>提高效率的 5 个 GoLand 快捷键,你都知道吗?
提高效率的 5 个 GoLand 快捷键,你都知道吗?
2022-06-10 15:51:00 【JetBrains中国】

GoLand 为您可以在 IDE 中执行的操作提供了许多快捷键。不过,您不必为了提高效率而了解所有的这些快捷键。今天,我们将分享一些预定义的按键映射供您选择,并介绍几个必备快捷键用法。只需要记住这 5 个基本的快捷键操作,就能有事半功倍的效果。
除此之外,本周四 6 月 9 日晚 8 点,我们还将联手 GoCN 社区,带来关于《Go 语言的 netpoll 抽象与常见问题》的专题直播(戳活动介绍)。想要对 Go 语言的网络模型设计与原理有进一步探索的 Gopher 们,记得提前预约哦!
如何选择按键映射(Keymap)
我们首先选择正确的按键映射,以确保您能够更快适应。 默认情况下,GoLand 有多个可供选择的预定义按键映射:
基于您的环境(macOS 或 Windows/Linux)的按键映射。
对于在 IntelliJ IDEA 或任何其他基于 JetBrains IntelliJ 平台的 IDE 方面拥有经验并且在该 IDE 中使用过 IntelliJ/macOS 按键映射的用户,推荐使用 IntelliJ IDEA Classic 按键映射。
对于从其他代码编辑器迁移过来的用户,推荐使用 Emacs、Sublime Text 和 Sublime Text (macOS) 按键映射。
最后但同样重要的是,您可以随时在 Preferences/Settings | Keymap(偏好设置/设置 | 按键映射)中点击窗口顶部的 Get more keymaps(获取更多按键映射)来搜索替代按键映射。
在本文中,我们将介绍一些必备快捷键。虽然此处使用的所有按键组合均来自 macOS 和 Windows/Linux 的默认按键映射,但您依然可以在 Preferences/Settings | Keymap(偏好设置/设置 | 按键映射)中自定义您的按键映射配置。
Search Everywhere(随处搜索):
⇧⇧ / Shift+Shift
Search Everywhere(随处搜索)是一项多工具操作,可以帮助您查找任何文字内容! 源代码中的任何条目、数据库、操作、用户界面元素、插件、设置、Git 分支、提交、标记、消息等。

要缩小搜索范围,请按 ⇥/Tab 在选项卡之间导航,或点击窗口工具栏上的筛选器图标并选择适当的选项。

最后但同样重要的是,您可以在 Find Tool Window(查找工具窗口)的一个单独的选项卡中打开当前搜索结果并运行另一个查询。 只需点击 Search Everywhere(随处搜索)右侧的 Open in Find Window(在查找窗口中打开)图标即可。
Show Context Actions
(显示上下文操作):
⌥↵ / Alt+Enter
在编辑器中工作时,GoLand 会持续分析您的代码,寻找优化方式并检测潜在问题。 它涵盖各种不同的情况,从错误和警告到可以直接通过 Alt+Enter 应用的优化建议。

要查看可用意图操作的完整列表,请打开 IDE 设置并选择 Editor | Intentions(编辑器 | 意图)。 只需取消选中操作旁边的复选框,即可禁用目前不需要的任何操作。 此外,您可以随时按如下方式执行此操作:将文本光标放在代码上,按 ⌥↵/Alt+Enter,选择要禁用的操作,点击旁边的向右箭头,然后点击 Disable<intention action name>(禁用 <意图操作名称> )。

Refactor This(重构此):
⌃T/Ctrl+Alt+Shift+T
Refactor This(重构此)是 GoLand 中一个重构组合的关键,从 Rename(重命名)到 Move(移动)、ChangeSignature(更改签名)、Exract(提取)和 Introducemethod/type/interface(引入方法/类型/接口)、Inline(内联),以及用于从源代码中安全地移除文件的 Safe Delete(安全删除)重构。
这意味着您只需记住一个快捷键即可执行所有重构。 按 ⌃T / Ctrl+Alt+Shift+T 即可快速访问所选代码的可用重构列表。

Generate(生成):
⌘N/Alt+Insert
此热键会打开用于创建常用代码结构和重复元素的各种选项。 生成一个函数,该函数会创建结构类型的值、getter 和 setter、空测试文件,以及文件、软件包、函数和版权测试。 此外,它在几秒钟内即可实现界面中列出的所有方法。

Smart Code Completion
(智能代码补全):
⌃⇧Space/Ctrl+Shift+Space
代码补全可以减少您需要记住的东西,并帮助您避免拼写错误和其他常见错误。 当您开始在 GoLand 中输入代码时,Basic Code Completion(基本代码补全)会弹出并且在多数情况下会自动工作,而 Smart Code Completion(智能代码补全)则需要按 ⌃⇧Space/Ctrl+Shift+Space 来显式调用。GoLand 会为您提供适用于当前上下文的最相关符号列表。

更进一步
为了提高操作速度,您还可以下载 Key Promoter X 插件:https://plugins.jetbrains.com/plugin/9792-key-promoter-x
有了这个插件,每次您在 IDE 中将鼠标放在按钮上时,Key Promoter X 都会向您显示可以使用的键盘快捷键。它可以帮助您在工作时了解各种快捷键,并用击键代替繁琐的鼠标移动。
本博文英文原作者:Ekaterina Zharova

活 / 动 / 预 / 告
「JetBrains码上道」Go 专场直播
直播主题:
Go 语言的 netpoll 抽象与常见问题
直播时间:
2022 年 6 月 9 日 20:00
直播嘉宾:
曹春晖 (Xargin)、谢孟军 (Asta)、范圣佑

直播中还有抽奖送 GoLand 环节,记得赶紧预约!
关于 GoLand
GoLand 是对 JavaScript、TypeScript 和数据库提供扩展支持的跨平台 Go IDE。
GoLand 提供了一系列智能功能,如智能代码补全、一步撤销的安全重构、强大的内置调试器以及具有快速修复的实时错误检测。
扫码了解 GoLand
开启 30 天免费试用 »»»


戳「阅读原文」了解更多
本文分享自微信公众号 - JetBrains(JetBrainsChina)。
如有侵权,请联系 [email protected] 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。
边栏推荐
- Jerry's interface for obtaining ble broadcast package and profile data [chapter]
- AttributeError: module ‘gym. envs. Box2d 'has no attribute' lunarlander 'solution
- Technology sharing | quick intercom, global intercom
- Research Report on the application field of Chinese antirust oil market and the prospect planning of the 14th five year plan (2022-2028)
- 技术分享| 快对讲,全球对讲
- Investment prospect and development strategy planning of China's waste power generation equipment industry 2022-2028 Edition
- Why do I need a thread pool? What is pooling technology?
- 只有真正找到落地和实践元宇宙的正确方式,才能保证发展的行稳致远
- This paper introduces three feature selection methods in machine learning
- PV operation daily question - exam questions
猜你喜欢

Specific method of Modbus RTU communication between Velcro touch screen and delta inverter (picture and text)

Sorting of MapReduce cases

MM主要的表和主要字段_SAP刘梦_

Application of stop in screen program_ SAP LIUMENG_

Research Report on the development scale of Chinese sanatorium industry and the 14th five year plan (2022-2028)

Online document collaboration tool is the first step to improve work efficiency

Software College of Shandong University Project Training - Innovation Training - network security range experimental platform (16)

Middle office: Data middle office, business middle office, technology middle office, application middle office, AI middle office

Apache atlas quick start

Fosun Group hekaiduo: grow together with Alibaba cloud and help business innovation
随机推荐
Ar smart contact lens market prospect trends and development planning proposal report 2022-2028
Software College of Shandong University Project Training - Innovation Training - network security range experimental platform (16)
You have a ml.net quick reference manual to check!
Duyuan outdoor sprint to Shenzhen Stock Exchange: the annual revenue is 350million, and the color of Lin Xizhen family is obvious
Build a leading privacy computing scheme impulse online data interconnection platform and obtain Kunpeng validated certification
Exploration of kangaroo cloud data stack on spark SQL optimization based on CBO
Embedded development: five challenges in wireless update using MCU
Devops-3 cloud computing and cloud era operation and maintenance
The command set has reached strategic cooperation with Yingmin technology, and the domestic original Internet of things operating system has helped to make power detection "intelligent"
Introduction to postmangrpc function
Why do I need a thread pool? What is pooling technology?
Web2 到 Web3,意识形态也需要发生改变
Swift read userinfo of remote notification
嵌入式开发:使用MCU进行无线更新面临的5大挑战
Full array of arrays
PV operation daily question - Restaurant Service
测试用例常用方法和选择原则
Fiddler模拟低速网络环境
Meetup review how Devops & mlops solve the machine learning dilemma in enterprises?
Analysis report on market demand trend and sales strategy of global and Chinese automatic marshmallow machines (2022-2028)