Sublime text 3(ST3) + Meld + Understand

0. 常用工具

 - Meld:比较工具

 - Understand:超级强大的源码分析工具 , Download for windows

1. Sublime text3 简介

  1) ST3虽然不像notepad++可以在sidebar上显示函数列表,但是可通过Ctrl+R查看 

 

  2) Ctrl+Shift+T可以打开之前关闭的tab页,这点同chrome是一样的

  3) ST3使用Ctrl+P搜索文件时,使用的是模糊匹配,不像SI必须顺次拼写正确才行

  4) 跳转至Caller的插件的功能还是依靠cscope

1.1 常用快捷键

Ctrl+shift+F 在文件夹内查找
Ctrl+P 多功能查找
       1、输入当前项目中的文件名,快速搜索文件
       2、输入@和关键字,查找文件中函数名
       3、输入:和数字,跳转到文件中该行代码
       4、输入#和关键字,查找变量名
Ctrl+G 打开搜索框,自动带:,输入数字跳转到该行代码
Ctrl+R 打开搜索框,自动带@,输入关键字,查找文件中的函数名
Ctrl+:打开搜索框,自动带#,输入关键字,查找文件中的变量名、属性名等
 

Ctrl+/ 注释或取消注释
Ctrl+Z 撤销
Ctrl+Y 恢复撤销
Ctrl+F2 设置书签
Ctrl+F 打开底部搜索框,在本文件内查找关键字
Esc    退出光标多行选择,退出搜索框,命令框等
 

Ctrl+Tab 按文件浏览过的顺序,切换当前窗口的标签页。
Ctrl+PageDown 向左切换当前窗口的标签页。
Ctrl+PageUp 向右切换当前窗口的标签页。
 

Alt+Shift+1 窗口分屏,恢复默认1屏(非小键盘的数字)
Alt+Shift+2 左右分屏-2列
Alt+Shift+3 左右分屏-3列
Alt+Shift+4 左右分屏-4列
Alt+Shift+5 等分4屏
Alt+Shift+8 垂直分屏-2屏
Alt+Shift+9 垂直分屏-3屏
Ctrl+K+B 开启/关闭侧边栏。
F11 全屏模式
Shift+F11 免打扰模式

 

2. 安装

  1) $ sudo add-apt-repository ppa:webupd8team/sublime-text-3 #添加sublime text 3的仓库

  2) $ sudo apt-get update  #更新软件库

  3) $ sudo apt-get install sublime-text-installer  #安装Sublime Text 3

  4) $ sudo apt-get install exuberant-ctags   # 安装ctags
  5) $ sudo apt-get install cscope                 # 安装cscope

3. 使用

  1) $subl    #启动
  2) Sublime Text3安装Package Control的超简单方法, 在View -> Show Console中执行:

import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf),'wb').write(urllib.request.urlopen('http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

  注:若无法成功执行以了操作,则进行:

   - 打开:Preferences > Package Settings > Package Control > Settings - User

   - 添加以下内容:

“channels”:
[
“http://cst.stu.126.net/u/json/cms/channel_v3.json”,
//“https://packagecontrol.io/channel_v3.json”,
//“https://web.archive.org/web/20160103232808/https://packagecontrol.io/channel_v3.json”,
//“https://gist.githubusercontent.com/nick1m/660ed046a096dae0b0ab/raw/e6e9e23a0bb48b44537f61025fbc359f8d586eb4/channel_v3.json”
]

  3) Preferences(设置)菜单中打开Package Control(插件管理器)->Install Packages,查找并安装ctags和cscope 
  4) cscope -Rbkq   #生成cscope.out, 建立cscope使用的索引文件
       在你需要浏览源码的根目录下(如你想用cscope看linux源码)使用下面命令:
                * #: cscope -Rbkq<回车>
         1. R 表示把所有子目录里的文件也建立索引
         2. b 表示cscope不启动自带的用户界面,而仅仅建立符号数据库
         3. q生成cscope.in.out和cscope.po.out文件,加快cscope的索引速度
         4. k在生成索引文件时,不搜索/usr/include目录

  5) Sublime 把 tab 转成 4 个空格:
      1> set tab to four spaces

           Preferences -> Settings-User

{
	"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
	"font_size": 12,
	"ignored_packages":
	[
		"Markdown",
		"Vintage"
	],
	"tab_size": 4,
	"translate_tabs_to_spaces": true,
	"trim_trailing_white_space_on_save": true,
	"update_check": false,
	"file_exclude_patterns": [".tags", ".tags_sorted_by_file", ".gemtags",".so",".a"],
}

 


         再敲 tab 的时候就自动换成空格了
    2> replace tab with four spaces
         如果想把已经写入当前文件的 tab 都转成空格
         Ctrl +` 呼出 Console
         >>> view.run_command('expand_tabs')

 

 

  6) CTags Key配置 (Preferences->Package Setting->CTags->Key Bindings-> User)       

[
    {
        "command": "navigate_to_definition",
        "keys": ["alt+="]
    },
    {
        "command": "jump_back",
        "keys": ["alt+,"]
    },
    {
        "command": "jump_forward",
        "keys": ["alt+."]
    },
    {
        "command": "rebuild_tags",
        "keys": ["ctrl+e"]
    },
]

  7) CTags Setting

 

      设置"command": "/usr/bin/ctags",

      设置"autocomplete": true,

   8) 不能安装插件的问题 

   Package Settings -> Package Control -> Settins-User

{
	"bootstrapped": true,
	"debug": true,
	"installed_packages":
	[
		"Package Control"
	],
	"downloader_precedence":
	{
		"linux": [ "curl", "urllib",    "wget" ],
		"osx": [ "curl", "urllib" ],
		"windows": [ "wininet" ]
	},
}

   9) CScope配置       

 

{
    // All options in here can also be specified in your user settings
    // with the prefix "CscopeSublime_".
    // For example if you have
    //
    // {
    //     "CscopeSublime_display_outline": false
    // }
    //
    // in your user settings, this will override the settings specified
    // in this file.

    // Whether or not to draw an outline around the matched symbol in the lookup results
    "display_outline": true,

    // Whether to prompt the user to edit/confirm the symbol before searching
    "prompt_before_searching": false,

    // The "cscope" program executable name. If needed, you can change this
    // in your user settings to be the full path to the cscope executable.
    // If you leave this as the default (just "cscope"), then your system
    // $PATH (or %PATH% for Windows users) will be searched.
    //
    // Linux and OS X example: "executable": "/usr/bin/cscope"
    // Windows example:        "executable": "C:\\cscope\\cscope.exe"
    "executable": "/usr/bin/cscope"

    // A location for the cscope database - this will be used in preference to any 'found' database
    //"database_location": "D:\\Program Files\\cscope\\cscope.out"
    //"database_location": "/home/fw/work/blob/cscope.out"
}

4. 安装插件

1) Alignment:”=”号对齐

2) BracketHighlighter:代码匹配,可匹配[], (), {}, “”, ”, ,高亮标记,便于查看起始和结束标记

3) CTags

4) DocBlockr:生成优美注释,标准的注释,包括函数名、参数、返回值等,并以多行显示,手动写比较麻烦;使用:输入/*、/**然后回车

5) SublimeLinter

6) SublimeLinter-clang

7) SublimeCodeIntel

8)SideBarEnhancements:侧栏右键功能增强

9) Emmet:自动补全

10)Git:git管理,插件基本上实现了git的所有功能

11)AutoFileName:快捷输入文件名;自动完成文件名的输入,如图片选取;输入”/”即可看到相对于本项目文件夹的其他文件

12)Nodejs:node代码提示

 

13)FileDiffs:

 

功能:强大的比较代码不同工具

简介:比较当前文件与选中的代码、剪切板中代码、另一文件、未保存文件之间的差别。可配置为显示差别在外部比较工具,精确到行。

使用:右键标签页,出现FileDiffs Menu或者Diff with Tab…选择对应文件比较即可

 

5.注册码

 Sublime Text3 注册码激活码

参考:

1)Ubuntu SSR

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(常用工具)