Skip to content

Zeroplex 生活隨筆

軟體開發、伺服器和生活瑣事

小 縮小字型大小。 中 重設字型大小。 大 放大字型大小。

月份: 2013 年 7 月

Disable New Line at End of File in Vim

Posted on 2013 年 7 月 11 日2021 年 3 月 12 日 By 日落 在〈Disable New Line at End of File in Vim〉中尚無留言

Vim 預設會在檔尾加上換行字元,原因是在 CLI 時 cat 檔案,顯示的結果比較好看。

檔尾有會行字元:

zero@dev$ cat eol.txt
content
zero@dev$

檔尾沒有換行字元:

zero@dev$ cat eol.txt
contentzero@dev$

雖然在檔尾加上換行字元顯示時較清楚,但某些程式裡面可能會造成問題 (像 PHP)。

在 .vimrc 中加入設定,讓 vim 不要在檔尾加上換行字元:

set noeol
set binary
Tags:Vim

Alias Command Contains Spaces in Bash

Posted on 2013 年 7 月 9 日2021 年 3 月 12 日 By 日落 在〈Alias Command Contains Spaces in Bash〉中尚無留言

.bashrc 下設定 command alias 的方法是:

alias svm='svn'   # 我常常手殘

不過假設要 alias 的指令包含空白,如「svn commit」要 alias 成「svn commit –editor-cmd vim」,就得靠自訂 function 了。

新增一個 function 蓋掉原本的 svn 指令,如果 svn 後接的參數是 commit,便加上 –editor-cmd:

svn(){
   if [[ $@ == commit ]]; then
      command svn commit --editor-cmd vim
   else
      command svn "$@"
   fi
}

不過 svn commit 有時還會有其他參數,像是檔案路徑等,所以這樣寫還是會發生意外。要把參數判斷要改,順便在執行指令的時候把參數也塞回去:

svn(){
   if [[ $@ == commit* ]] || [[ $@ == ci* ]]; then
      command svn "$@" --editor-cmd vim
   else
      command svn "$@"
   fi
}
Tags:Bash, Linux

Google Reader Bye

Posted on 2013 年 7 月 3 日2021 年 3 月 12 日 By 日落 在〈Google Reader Bye〉中尚無留言
Google Reader Bye

Google Reader 停止服務,這才發現 RSS Reader 在生活中也是不可或缺的一部分。

從收到停止服務的消息以後,開始尋覓還有什麼服務可以用。試了 Fleedly、Bloglines 等,最後還是選 The Old Reader,畢竟能留有原來的 rss 分類,快速鍵也和 Google Reader 一樣,不需要再花什麼時間去適應。

Tags:生活雜記

Firefox PPA on Ubuntu 12.04

Posted on 2013 年 7 月 1 日2021 年 3 月 12 日 By 日落 在〈Firefox PPA on Ubuntu 12.04〉中尚無留言

Mozilla 官方 PPA:

sudo add-apt-repository ppa:mozillateam/firefox-next
sudo aptitude update
sudo aptitude install firefox  # or aptitude update
Tags:Firefox, Ubuntu

其他

關於我  (About me)

  文章 RSS Feed

  留言 RSS Feed

Apache AWS Bash C/C++ Docker FreeBSD GCP Git Google Java JavaScript Laravel Linux Microsoft MSSQL MySQL Nginx PHP PHPUnit PostgreSQL Python Qt Ubuntu Unix Vim Web Windows WordPress XD 作業系統 分享 好站推薦 專題 攝影 新奇搞笑 新聞 旅遊 生活雜記 程式設計 網路架站 網頁設計 資訊學習 資訊安全 遊戲 音樂


創用 CC 授權條款
本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權.