1 / 20

Workstation Environments

Workstation Environments. changlp. Workstation Environments. Encoding 亂碼 Shell Efficiency Configuration Management. Encoding & Locale. Bug5 Big5 BBS, News ? 年遺毒 UTF-8 現代人專用編碼. Encoding – Migrate to UTF-8 (1/2). % export LC_ALL=zh_TW.UTF-8 % vim. Encoding – Migrate to UTF-8 (2/2).

ceri
Download Presentation

Workstation Environments

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Workstation Environments changlp

  2. Workstation Environments • Encoding • 亂碼 • Shell • Efficiency • Configuration • Management

  3. Encoding & Locale • Bug5Big5 • BBS, News • ?年遺毒 • UTF-8 • 現代人專用編碼

  4. Encoding – Migrate to UTF-8 (1/2) % export LC_ALL=zh_TW.UTF-8 % vim

  5. Encoding – Migrate to UTF-8 (2/2)

  6. Encoding – Big5 • BBS, News…

  7. Terminal Multiplexers • GNU Screen • sysutils/screen • sysutils/byobu • Tmux • sysutils/tmux

  8. Terminal Multiplexers – Encoding Conversion • Screen • encoding <code> • bind b encoding big5 • Tmux • No built-in conversion • chinese/bug5 • A Big5/GBK <-> UTF-8 translating layer in terminal • Better output for BBS ASCII arts

  9. VIM – Encoding • fileencoding (fenc) • Encoding of a file • fencs • encoding (enc) • Encoding of vim internal • Default: $env[LANG] • terminalencoding (tenc) • Encoding of terminal • Default: enc

  10. VIM – Encoding Vim internal Terminal Encoding Encoding File Encoding

  11. VIM – Encoding Conversion • Read a BIG5 file • Vim may guess the wrong encoding • :e ++enc=big5 • nnoremap <F5> <ESC>:e ++enc=big5<CR> (bind a key) • Convert to UTF-8 • Set fenc to UTF-8 and write fenc

  12. Configuration Management – Why? • We now have about 15 public workstations • FreeBSD, Linux, SunOS • Commands, environment differ on each OS • OS-based settings • Maintain only 1 instance of config across all machines • Host-base settings • Other generic settings • So…

  13. Configuration Management – Result? • 你的設定檔長這樣嗎?

  14. 真 ˙ Configuration Management • Good for maintenance • Categorize your configurations • Alias, completion… etc • Readability • Write once, use anywhere • Exceptions should be handled

  15. 真 ˙ Configuration Management (Cont.) • OS-based settings • Host-based settings if( -f $HOME/.csh/os/`uname -s`.cshrc ) then source $HOME/.csh/os/`uname -s`.cshrc endif if( -f $HOME/.csh/hosts/$HOST.cshrc ) then source $HOME/.csh/hosts/$HOST.cshrc endif

  16. 真 ˙ Configuration Management (Cont.) • Misc foreach src ($HOME/.csh/misc/*) if ( -f $src ) then source $src endif end

  17. VIM - Plugin • $HOME/.vim • after • autoload • plugin • … • Install a plugin • http://www.vim.org/scripts • Unzip to $HOME/.vim • Uninstall? • 硬碟很大沒在怕 (X) • Plugin 多才潮 (X) • 我哪知道裝了啥 (O)

  18. VIM – Plugin Management (1/2) • Pathogen • http://github.com/tpope/vim-pathogen • Runtime path manipulation • To install • Put pathogen.vim under $HOME/.vim/autoload • Put this in your start of .vimrc call pathogen#infect() syntax on filetype plugin indent on

  19. VIM – Plugin Management (2/2) • Each plugin get a subdir • Good for • Installing • Uninstalling • Updating • Plugin listing • A little painful while migrating

  20. VIM – Other Management Tools • Vim-addon-manager • https://github.com/MarcWeber/vim-addon-manager • Vimball • http://www.vim.org/scripts/script.php?script_id=1502

More Related