Wednesday, August 20, 2014

Using mid might surfing global dark style with keysnail hok

I found this midnight-surfing-global-dark-style for firefox, but when
I used keysnail plugin's hok(like hit a hint), I couldn't see the link
color because this style overrode the link's bg color.
So I attached another little CSS as Stylish CSS.

This is the code:

div#ksHintContainer span {
background-color: #87cefa !important
color: #000000 !important
}

Now my firefox's look became much better than before!

keysnail is addon that user can set favorite key style like Vim or
Emacs and you can choice or configure it and there are many plugin for
keysnail.


Monday, August 18, 2014

Combine helm-for-files and ghq in Emacs

I recently found ghq which can search specific repositories in terminal
and it was very convenience program for me, so I combined the ghq and
helm-for-files function to access any by one command in Emacs. Take a
look if you are interested!


what is ghq?

The ghq is a package that manage many repositories and treat them as
same list and it also manage repositories that specified in
.gitconfig. For example you can specify like this in .gitconfig:

[ghq]
root = ~/.ghq
root = ~/.gvm/pkgsets/go1.3rc1/global/src/
root = ~/work/

In this configuration, you can show directory from above set
repositories by ghq list command:

ghq list --full-path

Moreover, ghq is made of golang which has cross compile environment,
so if you build this program for Windows. You can use this on Windows
too.

If you wasn't emacs user, don't worry I know another usage of ghq.
See following link: https://github.com/peco/peco/wiki/Sample-Usage
You can search repositories in terminal by using peco.(I'm using this
way too)


what is helm(-for-files)?

It's known for convenient program in Emacs world to find out files
and There are many helm extensions too.
The helm-for-files function is it find out files from current
directory, recentf, current buffers and file cache and it can use many
candidates to search file and this function also add another source by
implementing it.(like I did)


Prerequisite

You need ghq, helm.el and helm-ghq.el.
To install ghq, type below command:

go get github.com/motemen/ghq

To install helm.el and helm-ghq, type M-x package-list-packages
command and then select those packages by i and x key.
I used helm-ghq package to get ghq's helm candidates and you can only
use helm with ghq candidates by this package.
If you can't install from melpa, try below code. It adds melpa
repository to search path.

(add-to-list 'package-archives '("melpa" .
"http://melpa.milkbox.net/packages/"))

Configuration

Put below codes to your .emacs or emacs's configuration file like
init.el after you installed ghq, helm.el and helm-ghq.

(require 'helm-files)

;; This is an optional advice, but if you feel helm-for-files is slow,
;; do this configuration.
(defadvice helm-for-files
(around helm-for-files-no-highlight activate)
"No highlight when using helm-for-files."
(let ((helm-mp-highlight-delay nil))
ad-do-it))

(defvar helm-source-my-ghq
`((name . "GHQ")
(init . (lambda () (require 'helm-ghq)))
(candidates . helm-ghq--list-candidates)
(match . helm-files-match-only-basename)
(filtered-candidate-transformer
. (lambda (candidates _source)
(cl-loop for i in candidates
if helm-ff-transformer-show-only-basename
collect (cons (helm-basename i) i)
else collect i)))
(keymap . ,helm-generic-files-map)
(help-message . helm-generic-file-help-message)
(mode-line . helm-generic-file-mode-line-string)
(action . ,(cdr (helm-get-actions-from-type
helm-source-locate))))
"Source for ghq.")

(defconst helm-for-files-preferred-list
'(helm-source-my-ghq
helm-source-buffers-list
helm-source-recentf
helm-source-file-cache
helm-source-files-in-current-dir
;; Comment out below sources which I don't use normally
;; helm-source-bookmarks
;; helm-source-locate
))

execute command

You can execute new helm-for-files command after load above
configuration.
You can call by M-x helm-for-files or keybind directly.


Sunday, July 27, 2014

First blog article

I started to write blog article by English from today and this is the first time. My purpose is improving my English skill. I thought I may keep motivation than writing English essay. I welcome that someone conform my wrong English because I'm still English learner:)