sublime text 3 使用匯總 (包含ubuntu下 搜狗輸入)

原由是 想要用
{ "keys": [""], "command": "jump_back" },
{ "keys": [""], "command": "jump_forward" }html

下載安裝包和包管理器

官網下載debhtml5

$:~/Downloads$ sudo dpkg -i sublime-text_build-3065_amd64.deb

包管理器:http://jingyan.baidu.com/article/d3b74d64a302631f77e609fa.htmllinux

插件們

https://packagecontrol.io/installation
上面 能夠查到最新的插件們git

要說和 sublime text 2 最大的不一樣是 我沒法直接 在 package 下面找到插件們的安裝包了,因此裏面的配置要改起來很麻煩!!
st3 把 原來 放在 package 下面的安裝包都放到了 Install package下面,打成 zip的壓縮包了(要不要這麼做)chrome

能夠先裝一下 PackageResourceViewer 這個插件,用這個插件來修改以前在安裝包裏的文件了。
一旦這個安裝包中修改過的文件,都會出如今Package文件夾中,方便你下次修改。 (仍是比起以前的麻煩不少!!)ubuntu

看st2 文檔

其實這個上面快捷鍵理解比較全: http://docs.sublimetext.info/en/latest/file_management/file_management.htmlvim

markdown Preview
emmet
console.log snippet
Alignment
Bracket​Highlighter // 括號匹配 http://www.dbpoo.com/sublime-text3-brackethighlighter/
DocBlockr // 註釋函數代碼
html5
colorPicker
open in Browser: use chrome
clickable Url 在st3 下遇到問題,打開 st3 時已經打開的tab 頁面是沒有識別 url,若是要用須要從新打開(關閉tab: ctrl+w, 從新打開tab: ctrl+shift+t)
twig
inputHelper 安裝有時候會沒有反應,直接 去 ~/.config/st3/Package/ 下面git clone 的方式 手動安裝 不容易出錯. (最近sogou好像終於能夠很好的支持ubuntu了,能夠嘗試換用 sougou)sublime-text

新加

主要是 https://packagecontrol.io/browse/popular 又物色了幾個,還有一些是 只兼容 st2,須要替換下。markdown

All Autocomplete //對全部已打開的文檔進行補全 You just DO WHAT THE FUCK YOU WANT TO.
Color Highlighter st3能夠安裝。不過搭配 使用 colorPicker 在ubuntu下始終有點問題,不推薦
Block Cursor Everywhere vim 模式下的光標
Power​Cursors 嘗試一下
Sublimerge Pro 新版比較好一點,按 left 是 左邊的改,按 right 是 右邊的改, ctrl + enter 切換編輯模式,沒找到回退功能
Auto​File​Name 若是你在html頁面須要添加 一個圖片路徑,輸入了src以後他會爲你補全該文件夾下的文件名。
Goto-CSS-Declaration ubuntu 下面使用 win + left , right 還挺好用的。 但要打開 css文件
Vintageous 是 st3 下 vintage的擴展,不過由於涉及了太多的快捷鍵,最後沒有使用。
*主題自行選擇
我使用了 http://www.imjeff.cn/blog/146/ 裏面 soda 主題 搭配 monikai-extend + markdown-extend

Vintage

v模式下, 我禁用一些快捷鍵

u 和 U,想要用的時候能夠用 sublime 本身的 ctrl + kU 和 ctrl + kl 代替

// { "keys": ["u"], "command": "visual_lower_case",
    //     "context":
    //     [
    //         {"key": "setting.command_mode"},
    //         {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": false}
    //     ]
    // },

    // { "keys": ["U"], "command": "visual_upper_case",
    //     "context":
    //     [
    //         {"key": "setting.command_mode"},
    //         {"key": "selection_empty", "operator": "equal", "operand": false, "match_all": false}
    //     ]
    // },

    // { "keys": ["ctrl+u"], "command": "vi_scroll_lines",
    //     "args": {"forward": false},
    //     "context": [{"key": "setting.command_mode"}, {"key": "setting.vintage_ctrl_keys"}]
    // },

    // { "keys": ["ctrl+d"], "command": "vi_scroll_lines",
    //     "args": {"forward": true},
    //     "context": [{"key": "setting.command_mode"}, {"key": "setting.vintage_ctrl_keys"}]
    // },

setting

{
    "color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
    "detect_indentation": true,
    "font_size": 16,
    "highlight_line": true,
    "ignored_packages":
    [
        "Vintage"
    ],
    "tab_size": 4,
    "theme": "Soda Dark 3.sublime-theme",
    "translate_tabs_to_spaces": true,
    "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?,。:;‘’「」、?!¥…()—《》「」『』【】"
}

keymap

在 st3 下 alt來移動,明顯不如st2 靈敏

[
    { "keys": ["alt+q"], "command": "jump_back" },
    { "keys": ["alt+w"], "command": "jump_forward" },

    // PlainTasks
    { "keys": ["ctrl+shift+c"], "command": "plain_tasks_cancel", "context": [{"key": "selector", "operator": "equal", "operand": "text.todo" }] },
    { "keys": ["ctrl+shift+alt+a"], "command": "plain_tasks_archive","context": [{ "key": "selector", "operator": "equal", "operand": "text.todo" }] },

    // vim
    {   
        "keys": ["i","i"], "command": "exit_insert_mode",
        "context":
        [
            { "key": "setting.command_mode", "operand": false },
            { "key": "setting.is_widget", "operand": false }
        ]
    },

    // BracketHighlighter
    // Select text between brackets
    {
        "no_outside_adj": true,
        "keys": ["ctrl+shift+m"],
        "command": "bh_key",
        "args":
        {
            "lines" : true,
            "plugin":
            {
                "type": ["__all__"],
                "command": "bh_modules.bracketselect"
            }
        }
    },
    // Fold contents between brackets 
    // will conver system default
    {
        "keys": ["ctrl+shift+["],
        "command": "bh_key",
        "args":
        {
            "plugin": {
                "type": ["__all__"],
                "command" : "bh_modules.foldbracket"
            }
        }
    },


    // color picker
    { "keys": ["alt+c"], "command": "color_pick" },
    // click url
    { "keys": ["alt+u"], "command": "open_url" },

    // move cursor 
    // 上下移動 一行
    { "keys": ["ctrl+shift+alt+k"], "command": "swap_line_up" },
    { "keys": ["ctrl+shift+alt+j"], "command": "swap_line_down" },

    // 上下左右移動
    { "keys": ["alt+h"], "command": "move", "args": {"by": "characters", "forward": false} },
    { "keys": ["alt+l"], "command": "move", "args": {"by": "characters", "forward": true} },
    { "keys": ["alt+k"], "command": "move", "args": {"by": "lines", "forward": false} },
    { "keys": ["alt+j"], "command": "move", "args": {"by": "lines", "forward": true} },
    // 上下左右移動並選擇
    { "keys": ["alt+shift+h"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true} },
    { "keys": ["alt+shift+l"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true} },
    { "keys": ["alt+shift+k"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true} },
    { "keys": ["alt+shift+j"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true} },

    // 左右移動至上/下一個詞
    { "keys": ["alt+m"], "command": "move", "args": {"by": "words", "forward": false} },
    { "keys": ["alt+n"], "command": "move", "args": {"by": "words", "forward": true} },

    // 左右移動至上/下一個詞並選擇
    { "keys": ["shift+alt+m"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
    { "keys": ["shift+alt+n"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} },

    // 屏幕按行上/下滾動
    { "keys": ["ctrl+alt+k"], "command": "scroll_lines", "args": {"amount": 10.0 } },
    { "keys": ["ctrl+alt+j"], "command": "scroll_lines", "args": {"amount": -10.0 } },

    { "keys": ["alt+i"], "command": "move_to", "args": {"to": "bol", "extend": false} },
    { "keys": ["alt+o"], "command": "move_to", "args": {"to": "eol", "extend": false} },

    { "keys": ["shift+alt+i"], "command": "move_to", "args": {"to": "bol", "extend": true} },
    { "keys": ["shift+alt+o"], "command": "move_to", "args": {"to": "eol", "extend": true} },

    { "keys": ["ctrl+alt+i"], "command": "move_to", "args": {"to": "bof", "extend": false} },
    { "keys": ["ctrl+alt+o"], "command": "move_to", "args": {"to": "eof", "extend": false} },

    { "keys": ["shift+ctrl+alt+i"], "command": "move_to", "args": {"to": "bof", "extend": true} },
    { "keys": ["shift+ctrl+alt+o"], "command": "move_to", "args": {"to": "eof", "extend": true} },

    // 格式化
    { "keys": ["ctrl+="], "command": "reindent" }
]

ubuntu 下的搜狗輸入

飽受折磨,在sublime裏面輸入中文,隨着 國產linux系統的開發,中文輸入法已經能夠愈來愈好的支持 ubuntu了, 下面的內容摘自網絡。

http://jingyan.baidu.com/article/f3ad7d0ff8731609c3345b3b.html
http://jingyan.baidu.com/article/da1091fbd695e2027849d6f6.html

(在ubuntu12.04下測試經過)

在 ~ 目錄下 ,沒有的話新建 文件名:sublime_imfix.c
裏面的內容

#include <gtk/gtkimcontext.h>                                               
void gtk_im_context_set_client_window (GtkIMContext *context, GdkWindow *window)
{
    GtkIMContextClass *klass;
    g_return_if_fail (GTK_IS_IM_CONTEXT (context));
    klass = GTK_IM_CONTEXT_GET_CLASS (context);
    if (klass->set_client_window)
        klass->set_client_window (context, window);
    g_object_set_data(G_OBJECT(context),"window",window);

    if(!GDK_IS_WINDOW (window))
        return;
    int width = gdk_window_get_width(window);
    int height = gdk_window_get_height(window);
    if(width != 0 && height !=0)
        gtk_im_context_focus_in(context);
}

本身編譯共享庫,編譯前確保安裝瞭如下:

sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev

將sublime_imfix.c 編譯成共享庫libsublime-imfix.so,命令

cd ~
gcc -shared -o libsublime-imfix.so sublime_imfix.c  `pkg-config --libs --cflags gtk+-2.0` -fPIC

把編譯好的libsublime-imfix.so 複製到sublime_text_3安裝目錄下 大概是在 /opt/sublime-text/ 下

sudo mv libsublime-imfix.so /opt/sublime_text/

修改文件/usr/bin/subl的內容, 最後該文件 爲下面內容:

#!/bin/sh                                                                   
export LD_PRELOAD=/opt/sublime_text/libsublime-imfix.so 
exec /opt/sublime_text/sublime_text "$@"

此時,在命令中執行 subl 將可使用搜狗for linux的中文輸入.

相關文章
相關標籤/搜索