Coder Social home page Coder Social logo

sublime3_on_ubuntu's Introduction

sublime3_on_ubuntu

SublimeText3の設定手順を記録します s 環境:Ubuntu16.04, kernel:4.15.0-64-generic

  1. SublimeText3をインストール[1]

     wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
     echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
     sudo apt update
     sudo apt install sublime-text
    
  2. ポップアップを無効化[2]
    ※一回目だけ一瞬見える

    1. 必要なパッケージのインストール

       sudo apt install wmctrl
      
    2. 以下のスクリプトをクリップボードにコピー
      ※markdownコード挿入方法

       #!/usr/bin/python
       # -*- coding: utf-8 -*-
      
       import sublime_plugin
       import subprocess
       from time import sleep
       import sys
        
       cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
       log = lambda message: sys.stderr.write("Log: %s\n" % message)
        
       sublimeMainWindowTitle = " - Sublime Text (UNREGISTERED)"
        
       class LicenseWindowKiller(sublime_plugin.EventListener):
        
           def seek_n_close(self):
               sublimePid = int(cl("""wmctrl -lp | grep "%s" | awk '{print $3}'""" % sublimeMainWindowTitle).decode())
               if sublimePid:
                   sublimeMainWindowId = cl("""wmctrl -lp | grep "%s" | awk '{print $1}'""" % sublimeMainWindowTitle).decode()
                   sublimeSecondWindowId = cl("""wmctrl -lp | grep %s | awk '{ids[$1]++}{for (id in ids){if (id != "%s"){printf id}}}'""" % (sublimePid, sublimeMainWindowId)).decode()
                   if sublimeSecondWindowId:
                       sublimeSecondWindowTitle = cl("""wmctrl -lp | grep %s | awk '{print $5}'""" % sublimeSecondWindowId).decode()
                       if not sublimeSecondWindowTitle:
                           cl("wmctrl -i -c %s" % sublimeSecondWindowId)
                           return True
               return False
        
           def on_pre_save_async(self, *args):
               seek = True
               counter = 10
               while seek:
                   sleep(.5)
                   counter -= 1
                   if counter < 0:
                       seek = False
                   seek = not self.seek_n_close()
      
    3. SublimeText3のメニューバーから、 "Tools --> Developer --> New Plugin ...."

    4. さっきのスクリプトをペースト

    5. 適当なファイル名("disable_popup.py"など)で保存(保存場所は変えない)

    6. うまく行かない時

      • View > Show Consoleで以下コマンドを使用してエラーメッセージを見る

          view.run_command('disable_popup')
        
  3. 更新を無効化[3]

  4. 日本語インライン入力に対応[4][5]
    ※key bindingsにctrl+spaceを設定する際、ubuntuキーボードのtext entry変更のショートカットキーと重複していると無効になるので注意
    ※mozcでの日本語入力時、黒背景黒文字の非常に見えにくい表示になる
    ※英字入力・日本語入力の切り替えはubuntuのキーボード切り替えと独立しており、ubuntu側は英字入力にしている状態でないと正しく切り替わらない。結構混乱するので要解決
    ※変換候補のスクロールが出てこないので不便

  5. 選択部分の色変更
    SublimeMozcInputを導入した際、入力途中の文字が大概見難い(背景色「selection」、文字色不明)
    今回は適当にいい感じのtmThemeを持ってきて、「selection」の色を変更する。

    1. いい感じのtmTheme(Flatland)を導入[6]

    2. 上記でインストールしたパッケージを複製して名前を変更

      • Theme - Flatland.sublime-packageをコピー、パッケージ名を変更
        例:Theme - NyxFlatland.sublime-package
      • アーカイブマネージャを開き、パッケージ名を変更
        例:Flatland Dark.sublime-theme -> NyxFlatland Dark.sublime-theme
      • テーマファイル名も変更
        Flatland Dark.tmTheme -> NyxFlatland Dark.tmTheme
        Flatland Monokai.tmTheme -> NyxFlatland Monokai.tmTheme
    3. テーマファイルを編集し、選択部分の背景色「selection」を明るい灰色に変更[7]
      文字列検索で「selection」を探し、その下の行の色に関する数値を変更
      例:

       <key>selection</key>
       <string>#adadad</string>
      
       <key>selectionBorder</key>
       <string>#adadad</string>
      
       <key>findHighlight</key>
       <string>#ffe792</string>
      
       <key>inactiveSelection</key>
       <string>#545454</string>
      
  6. MarkDown編集機能(OmniMarkupPreviewerなど)[8]

  7. ConvertToUTF8[9]

  8. Theme - Afterglow[10]

<参考文献>
[1]https://qiita.com/riv/items/e8de0aa218d12429206a
[2]https://gist.github.com/egel/b7beba6f962110596660
[3]https://forum.sublimetext.com/t/solved-disable-update-available-pop-up/1381
[4]https://qiita.com/riv/items/e8de0aa218d12429206a
[5]http://yasuyuky.github.io/SublimeMozcInput/
[6]https://coliss.com/articles/build-websites/operation/work/sublime-text-themes-for-developer-2016.html [7]https://stackoverflow.com/questions/39262481/change-highlight-colour-in-sublime-text-3
[8]https://qiita.com/kouichi-c-nakamura/items/e2aa565ac4571d1a5ff5
[9]http://watarisein.hatenablog.com/entry/2014/12/15/212518
[10]https://gist.github.com/watari53/66e46d4a541f17a0169e

sublime3_on_ubuntu's People

Contributors

nyxrobotics avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.