Skip to content

Instantly share code, notes, and snippets.

@c02y
c02y / config.fish
Last active March 8, 2019 08:00
config.fish
1. there are two gitsh in config.fish, delete the second one
2. abbr gitpl 'git pull -v'
3. abbr gitpu 'git push -v'
4. delete z.fish and zz.fish
5. clean config.fish
6. remove stow in ~/.local/bin, it depends on other libs, and find a binary/script replacement
7. replace grep -w with extra space, since -w doesn't parse `-` like t-xa
set -gx Z_PATH ~/.config/fish/functions/
if test -e $Z_PATH/z.lua
@c02y
c02y / gist:56c0c4303f125a700026b043b4898094
Last active March 1, 2019 10:20
about flyspell of Emacs
~/anaconda3/share/emacs/26.1/lisp/textmodes/flyspell*
condai conda-forge hunspell
;; spell check
;; find aspell and hunspell automatically
(cond
;; try hunspell at first
;; if hunspell does NOT exist, use aspell
;; Using hunspell may produce the "Error enabling Flyspell mode: (stringp nil)" problem
@c02y
c02y / .condarc
Created March 1, 2019 06:44
~/.condarc
channels:
- ripl-org
- lebedov
- conda-forge
- defaults
@c02y
c02y / config.fish
Created March 1, 2019 06:01
conda tip
# After install package using `conda install -c CHANNEL PKG`, you have to manually
# conda config --add channels your_new_channel, or these packages won't be updateed when `condau`
@c02y
c02y / config.fish
Created February 28, 2019 13:01
update elpac function
function elpac -d 'print old packages in .emacs.d/elpa/, with any command, it will clean old ones'
set -l elpa_path ~/.emacs.d/elpa
# ls contains color which will affect the $pkg string, * part means only directories
for pkg in (command ls $elpa_path)
if echo $pkg | grep -q '[0-9]' # check if pkg $contains version number, $status = 0
set -l pkg_ver (echo $pkg | sed 's!.*-!!')
set -l pkg_name (echo $pkg | sed 's/[0-9.]*$//g')
set pkg_com (echo $pkg_name(echo $pkg_ver | cut -c1))
if test (command ls $elpa_path | grep "^$pkg_com" | wc -l) -gt 1
@c02y
c02y / init.el
Last active February 28, 2019 05:50
projectile prefix, helm-pydoc
make projectile/helm-projectile prefix key work
(define-key projectile-mode-map (kbd "C-c C-p") 'projectile-command-map)
install helm-pydoc package
(with-eval-after-load "python"
(define-key python-mode-map (kbd "C-c D") 'helm-pydoc))
change
helm-moccur-auto-update-on-resume 'noask
to
change
Plugin 'gmarik/Vundle.vim'
to
Plugin 'VundleVim/Vundle.vim'
" this fix the errors(like Error detected while processing function) when using VundleInstall/Update
set shell=/bin/bash
Plugin 'liuchengxu/vim-which-key'
nnoremap <silent> <leader> :WhichKey '<leader>'<CR>
@c02y
c02y / config.fish
Last active February 28, 2019 08:14
alias to abbr, and tweak function fu
0. abbr lesst 'less ~/.tmux.conf'
0.1 abbr lessf 'less ~/.config/fish/config.fish'
0.2 abbr lesse 'less ~/.emacs.d/init.el'
1. replace alias to abbr
1.1 exclute such as rg, ls, ll, lla, lah, rm, cp, mv, du, less, wget, emx, time, ping, find
fine they will be used in other functions
2. delete $argv[1] part in m* abbrs
3. delete t-c* abbrs
4. make abbr containing abbr to function
5. set -gx FISH_CONFIG_PATH ~/.config/fish/config.fish
@c02y
c02y / config.fish
Last active February 27, 2019 10:13
z.lua and fzf for fish
# find
alias find 'find -L' # make find follow symlink dir/file by default
function f -d 'find the files by name, if no argv is passed, use the current dir'
find $argv[1] -name "*$argv[2]*"
end
function fl -d 'find a file using fzf and view it using less'
if fzfp # fzf exists, $status = 0
less (find $argv[1] -name "*$argv[2]*" | fzf)
else
find $argv[1] -name "*$argv[2]*"
@c02y
c02y / manga.sh
Last active February 1, 2019 11:36
manga rename/archive tool
#!/bin/bash
idx=1 # stop flag
result_dir="result"
create(){
# input the info
read -e -p "The prefix of result archive: " prefix
result_prefix="$result_dir"/"$prefix"
read -e -p "The stop value: " stop # do actions every stop