关闭

sublime 中使用vim模式

标签: sublime编辑器vimsublime配置
296人阅读 评论(0) 收藏 举报
分类:

sublime 中使用vim模式

在sublime中编写代码时使用vim快捷键,编写非常方便,但是使用vim模式时,有部分快捷键会出现冲突,例如,常用的 ctrl + [ 快捷键,在vim中表示 Esc (退出插入模式), 而在sublime 中表示 incident, 容易给使用带来麻烦。 但是只要做稍微的修改,就能解决这种麻烦。

1. 修改seting

sublime ->preference->seting 添加修改
{
    "caret_extra_bottom": 1,
    "caret_extra_top": 1,
    "caret_extra_width": 2,
    "font_size": 11,
    "ignored_packages":
    [
    ],
    "vintage_ctrl_keys": true,
    "vintage_start_in_command_mode": true
}

其中, “vintage_ctrl_keys”: true 表示增加部分vim快捷键,”vintage_start_in_command_mode”: true 表示打开时直接进入vim 模式,tab采用4个空格。

2.修改退出插入模式快捷键

sublime->preference->key binding 添加修改

[
{ "keys": ["ctrl+]"], "command": "unbound" }, 
{ "keys": ["ctrl+["], "command": "unbound" },    
{ "keys": ["ctrl+["], "command": "exit_insert_mode",
    "context":
    [   
        { "key": "setting.command_mode", "operand": false },
        { "key": "setting.is_widget", "operand": false }
    ]
},

{ "keys": ["ctrl+["], "command": "hide_auto_complete", "context":
    [
        { "key": "auto_complete_visible", "operator": "equal", "operand": true }
    ]
},

{ "keys": ["ctrl+["], "command": "vi_cancel_current_action", "context":
    [
        { "key": "setting.command_mode" },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": false },
        { "key": "vi_has_input_state" }
    ]
},

{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} },
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false},
    "context":
    [
        { "key": "setting.tab_completion", "operator": "equal", "operand": true },
        { "key": "preceding_text", "operator": "not_regex_match", "operand": ".*\\b[0-9]+$", "match_all": true },
    ]
},
{ "keys": ["tab"], "command": "replace_completion_with_next_completion", "context":
    [
        { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
        { "key": "setting.tab_completion", "operator": "equal", "operand": true }
    ]
},
{ "keys": ["tab"], "command": "reindent", "context":
    [
        { "key": "setting.auto_indent", "operator": "equal", "operand": true },
        { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
        { "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true },
        { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }
    ]
},
{ "keys": ["tab"], "command": "indent", "context":
    [
        { "key": "text", "operator": "regex_contains", "operand": "\n" }
    ]
},
{ "keys": ["enter"], "command": "next_field", "context":
    [
        { "key": "has_next_field", "operator": "equal", "operand": true }
    ]
},
{ "keys": ["tab"], "command": "commit_completion", "context":
    [
        { "key": "auto_complete_visible" },
        { "key": "setting.auto_complete_commit_on_tab" }
    ]
},
]

其中才用 ctrl + [ 代替 esc, 采用 enter 跳跃到 nextfield

插件

  1. 通用
    FileDiffs
    GBK Support
    Gist 代码片段 http://www.jianshu.com/p/0db36a1ca8fa
    Git
    GitGutter
    Alignment 等于符号自动对齐
    AutoFileName 自动插入文件名
    BracketHighlighter 括号匹配高亮
    ColorPicker 颜色
    ConvertToUTF8
    Clipboard Manager 剪切板
    DocBlockr
    Package Control
    PackageResourceView
    SideBarEnhancements
    SublimeLinter
    Terminal
    Trimmer

  2. 前端开发
    Can I Use Css 语法检测
    CSScomb css排序
    Emmet
    JsFormat
    sublimelint
    javascript completions
    css3
    phpcs
    http://www.jianshu.com/p/edbc2a13494b

  3. C++
    参考http://blog.csdn.net/dc_726/article/details/45749805/
    SublimeCodeIntel (比较喜欢:C++ 再加一个sublimeclang,需要配置lib路径)
    配置:

sublimeclang配置

{
“show_output_panel”: false,
“dont_prepend_clang_includes”: true,
“inhibit_sublime_completions”: false,
“options”:
[
“-IC:\MinGW\include”,
“-IC:\MinGW\lib\gcc\mingw32\4.9.3\include”,
“-IC:\MinGW\lib\gcc\mingw32\4.9.3\include\c++”,
“-IC:\MinGW\lib\gcc\mingw32\4.9.3\include\c++\*”,
]
}

All autocomplete 可以不装
cscope
ctag
ctag 设置
{
“select_searched_symbol”: false
}
代码检测 sublime linter
使用说明

  1. python
    anaconda 相关配置
    关闭错误提示

  2. markdown
    Markdown Preview
    MarkdownEditing

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:4823次
    • 积分:319
    • 等级:
    • 排名:千里之外
    • 原创:26篇
    • 转载:12篇
    • 译文:0篇
    • 评论:0条