1. 程式人生 > >ubuntu16.04程式設計軟體之工具類

ubuntu16.04程式設計軟體之工具類

zsh

安裝zsh

+ zsh 相容bash
+ zsh 官網:Zsh
+ 檢視CentOS已安裝的shell

cat /etc/shells

正常結果應該是這樣的:

/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh

+ 檢視當前的shell

echo $SHELL
  • 更新軟體源
sudo apt-get install update
  • 安裝zsh
sudo apt-get install zsh

安裝oh-my-zsh

保證已經安裝好git和wget

wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

完成後將shell設定為zsh模式

sudo chsh -s /bin/zsh

重啟或登出下就OK了

配置zsh

zsh檔案的位置為: ~/.zshrc,每一項配置在檔案中有詳細的解釋。

  • 修改主題:
ZSH_THEME=”ys”
  • 新增外掛
plugins=(git autojump)

目前用到的自定義配置不多,更改配置後需要重啟終端。

外掛推薦

  • 強力跳轉:autojump
sudo apt-get install autojump

然後編輯~/.zshrc,plugins=(git autojump)

  • 強力自動補全
1.下載 http://mimosa-pudica.net/zsh-incremental.html 的incr-0.2.zsh 
2.把incr-0.2.zsh放到新建的~/.oh-my-zsh/plugins/incr目錄下 
3.chmod 777 incr-0.2.zsh給予其777許可權 
4.編輯~/.zshrc,插入source ~/.oh-my-zsh/plugins/incr/incr-0.2.zsh
  • wd
簡單地講就是給指定目錄對映一個全域性的名字,以後方便直接跳轉到這個目錄,比如:
編輯配置檔案,新增上 wd 的名字:vim /root/.zshrc
我常去目錄:/opt/setups,每次進入該目錄下都需要這樣:cd /opt/setups
現在用 wd 給他對映一個快捷方式:cd /opt/setups ; wd add setups
以後我在任何目錄下只要執行:wd setups 就自動跑到 /opt/setups 目錄下了
外掛官網:https://github.com/mfaerevaag/wd

+ zsh-syntax-highlighting

這個外掛會對終端命令高亮顯示,比如正確的拼寫會是綠色標識,否則是紅色,另外對於一些shell輸出語句也會有高亮顯示,算是不錯的輔助外掛
外掛官網:https://github.com/zsh-users/zsh-syntax-highlighting
安裝,複製該命令:'git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting'
編輯:vim ~/.zshrc,找到這一行,後括號裡面的後面新增:plugins=( 前面的一些外掛名稱 zsh-syntax-highlighting)
重新整理下配置:source ~/.zshrc

主題 

  • oh-my-zsh 的主題列表介紹(還是太長了):https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
  • 我們看下安裝 oh-my-zsh 的時候,自帶有多少個:ls -l /root/.oh-my-zsh/themes |grep "^-"|wc -l,我這邊得到的結果是:140
    推薦(排名有先後):
ys
agnoster
avit
blinks

其他

  • 呃,這個其實可以不用講的,你自己用的時候你自己會發現的,各種便捷,特別是用 Tab 多的人一定會有各種驚喜的。
  • 使用 ctrl-r 來搜尋命令歷史記錄。按完此快捷鍵後,可以輸入關鍵命令詞語,如果歷史記錄有含有此詞語會顯示出來。
  • 命令別名:
    在命令列中輸入 alias 可以檢視已經有的命令別名
    自己新增一些別名,編輯檔案:vim ~/.zshrc,在檔案加入下面格式的命令,比如以下是網友提供的一些思路:
alias cls='clear'
alias ll='ls -l'
alias la='ls -a'
alias grep="grep --color=auto"
alias -s html='vim'   # 在命令列直接輸入字尾為 html 的檔名,會在 Vim 中開啟
alias -s rb='vim'     # 在命令列直接輸入 ruby 檔案,會在 Vim 中開啟
alias -s py='vim'      # 在命令列直接輸入 python 檔案,會用 vim 中開啟,以下類似
alias -s js='vim'
alias -s c='vim'
alias -s java='vim'
alias -s txt='vim'
alias -s gz='tar -xzvf' # 在命令列直接輸入字尾為 gz 的檔名,會自動解壓開啟
alias -s tgz='tar -xzvf'
alias -s zip='unzip'
alias -s bz2='tar -xjvf'
  • 我們現在增加系統變數在:/etc/profile 後,輸入命令:source /etc/profile 之後,重啟伺服器發現剛剛的系統變數現在沒效果。解決辦法:vim ~/.zshrc,在該配置檔案裡面增加一行:source /etc/profile,然後重新整理 zsh 的配置:source ~/.zshrc。

參考


teminator

terminator 安裝

sudo apt-get install terminator

常用快捷鍵

Ctrl+Alt+T 新建視窗
Ctrl+Shift+T 新建標籤頁
Ctrl+Shift+O (水平分割視窗)
Ctrl+Shift+E(垂直分割視窗)
Alt+Up (切換視窗)
Alt+Down
Alt+Left
Alt+Right

配置

為了讓terminator更加美觀

  • 修改terminator的config檔案
    ~/.config/terminator/config
    將以下內容替換掉原來的內容
[global_config]
  focus = system
  suppress_multiple_term_dialog = True
  tab_position = bottom
  title_transmit_bg_color = "#d30102"
  window_state = maximise
[keybindings]
[layouts]
  [[default]]
    [[[child1]]]
      parent = window0
      type = Terminal
    [[[window0]]]
      parent = ""
      type = Window
[plugins]
[profiles]
  [[default]]
    background_color = "#002b36"
    background_darkness = 0.92
    background_image = None
    background_type = transparent
    cursor_color = "#eee8d5"
    font = Monospace 11
    foreground_color = "#e6e0da"
    icon_bell = False
    palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#586e75:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
    split_to_group = True

參考

Solarized-Dark theme configuration in Terminator – Diwakar Moturu – Medium