Ubuntu18.0.4下sublim text3的安裝使用全教程

一.安裝

1. 下載安裝包

點擊這裏下載

2. 安裝

進入到sublime-text_build-3083_amd64.deb路徑下
執行命令: $ sudo dpkg -i sublime-text_build-3083_amd64.deb

3. 取消提醒

打開軟件, 點擊右上角幫助, 在licen中輸入ke.y.txt的內容

二. 問題解決

4. 設置中文

點擊preference --> 第一個,瀏覽程序包---->進入.config/sublime-text-3/packages/
然後退回到.config/sublime-text-3/在進如installed Packages/路徑下,
將包Default.sublime-package進去, 如下圖
在這裏插入圖片描述

5. 中文輸入

首先安裝輸入法:
Ubuntu搜狗輸入法安裝全解

使用git工具下載github工具

$ sudo apt-get git
$ git clone https://github.com/lyfeyaj/sublime-text-imfix.git
$ cd sublime-text-imfix && ./sublime-imfix 

如果無法下載github, 可以下載下面的鏈接
sublime-text-imfix.git.zip
執行完上一步正常來講就已經成功了, 此時打開subl就可以輸入中文了

$ sudo cp ./lib/libsublime-imfix.so /opt/sublime_text_3/
$ subl /usr/bin/subl 
修改subl配置文件如下
#!/bin/sh
export LD_PRELOAD=/opt/sublime_text_3/libsublime-imfix.so
exec /opt/sublime_text/sublime_text "$@"
然後重啓就可使用了

6. 使用Package Control下載程序

點擊preference --> 瀏覽程序包
將壓縮包裏面的Package Control放到打開的目錄下
在這裏插入圖片描述然後就會發現界面preference 下拉中出現了Package Control
這個時候我們就能開始下載插件了

例如
Python的常見插件有
Anaconda
使用快捷鍵ctr+shift+P
等待輸入框輸入install
等待新輸入框輸入Anaconda
等待下載安裝完畢

anaconda快捷鍵

alt+ctr+Q等號對齊
alt+ctr+G函數跳轉定位

配置ctr+鼠標左鍵跳轉定位函數, 增加如下路徑文件

[
	{
		"button": "button1",
		"count": 1,
		"modifiers": ["ctrl"],
		"press_command": "drag_select",
		"command": "anaconda_goto"
	},
	{
		"button": "button2",
		"count": 1,
		"modifiers": ["ctrl"],
		"command": "jump_back"
	},
]

在這裏插入圖片描述### anaconda取消框框提示, usr-設置中添加
{ "anaconda_linting": false, }
在這裏插入圖片描述

7. 配置常用快捷鍵

preference–> 按鍵綁定-用戶

[
    {
         "keys": ["ctrl+alt+q"], 
        "command": "alignment"      
    },

    {
        "keys": ["f5"],
        "caption": "SublimeREPL:Python",
        "command": "run_existing_window_command", "args":
        {
            "id": "repl_python_run",
            "file": "config/Python/Main.sublime-menu"
        }
    },
    //自動提示代碼
    {
        "keys": ["ctrl+j"],
        "command": "code_intel_auto_complete"
    },
    //跳轉到函數定義
    {
        "keys": ["alt+right"],
        "command": "goto_python_definition"
    },
    //返回到跳轉位置
    {
        "keys": ["alt+left"],
        "command": "back_to_python_definition"
    },
    { "keys": ["enter"], "command": "auto_indent_tag", "context":
            [
                { "key": "setting.auto_indent", "operator": "equal", "operand": true },
                { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
                { "key": "selector", "operator": "equal", "operand": "punctuation.definition.tag.begin", "match_all": true },
                { "key": "preceding_text", "operator": "regex_contains", "operand": ">$", "match_all": true },
                { "key": "following_text", "operator": "regex_contains", "operand": "^</", "match_all": true },
            ]
    },
    {   //刪除當前行
        "keys" : ["ctrl+d"],
        "command" : "run_macro_file",
        "args" : {
            "file" : "res://Packages/Default/Delete Line.sublime-macro",
        }
    },
    {   //複製當前行
        "keys": ["ctrl+e"],
        "command": "duplicate_line",
    },
    {   //向上移動當前行
        "keys": ["alt+up"],
        "command": "swap_line_up"
    },
    {   //向上移動當前行
        "keys": ["alt+down"],
        "command": "swap_line_down"
    },
]

8. 取消更新

取消每次打開軟件更新提醒

preference–> 設置-用戶

{
	"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
	"font_size": 17,
	"ignored_packages":
	[
		"Vintage"
	],
	"update_check": false
}

9 創建Python編譯運行

工具–》 編譯系統–》 新建編譯系統–》
解釋: cmd是系統命令行
這個語句的含義就是在系統命令行鍵入
python3 當前文件

{
	"cmd": ["python3", "-u", "$file"]
}

在這裏插入圖片描述

10. 中文輸入法,退格鍵刪除不了拼音

首選項->設置用戶->打開設置json

在這裏插入圖片描述

11.tab轉換爲空格

首選項->設置

{
	"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
	"default_encoding": "UTF-8",
	"font_face": "Consolas",
	"font_size": 21,
	"ignored_packages":
	[
		"Vintage"
	],
	"show_encoding": true,
	"show_line_endings": true,
	"theme": "Default.sublime-theme",
	"update_check": false,
	"tab_size": 4, //設置4個
	"translate_tabs_to_spaces": true, //設置tab轉化爲空格
	"expand_tabs_on_save": true, //保存時自動轉換 
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章