Skip to content

Instantly share code, notes, and snippets.

View fuxialexander's full-sized avatar

Xi "Alexander" Fu fuxialexander

View GitHub Profile
@fuxialexander
fuxialexander / company-childframe.el
Last active March 12, 2021 15:59
company-childframe.el [adapted from @tumashu for mac os (GNU NS-port HEAD)]
;;; company-childframe.el --- Use a real ppup to show company candidates
;;; Commentary:
;;
;;; Code:
(require 'company)
(defvar company-childframe-child-frame nil)
tell application "Skim"
set thedoc to the front document
set anno to the active note of thedoc
set newtext to text of anno
set startpoint to (offset of "org-id:{" in newtext) + 8
set endpoint to (offset of "}:org-id" in newtext) - 1
if (startpoint - 8 is not equal to endpoint + 1) and (endpoint + 1 is not 0) then
set orgid to characters startpoint thru endpoint of newtext as string
do shell script "/usr/local/bin/emacsclient -n -e \"(progn (org-id-goto \\\"" & orgid & "\\\") (x-focus-frame (selected-frame)) (evil-exit-visual-state))\""
end if
@fuxialexander
fuxialexander / org-ref-skim.el
Last active April 6, 2023 11:48
Integration between Org-ref and Skim.app [Skim Annotation <-> Org Bidirectional Jump]
(setq org-capture-templates (quote (("SA" "Skim Annotation" entry
(file+function org-ref-bibliography-notes my-org-move-point-to-capture-skim-annotation)
"* %^{Logging for...} :skim_annotation:read:literature:
:PROPERTIES:
:Created: %U
:CITE: cite:%(my-as-get-skim-bibtex-key)
:SKIM_NOTE: %(my-org-mac-skim-get-page)
:SKIM_PAGE: %(my-as-get-skim-page)
:END:
%i
@fuxialexander
fuxialexander / counsel-company.el
Last active December 2, 2017 15:15
better counsel-company
;; author: @fuxialexander on github
;; 2017-12-02
(defvar company-candidates)
(defvar company-point)
(defvar company-common)
(declare-function company-complete "ext:company")
(declare-function company-mode "ext:company")
(declare-function company-complete-common "ext:company")
@fuxialexander
fuxialexander / my-org-refile-get-targets.el
Created August 18, 2017 17:17
Modify (org-refile-get-targets) for fontification
(defun org-refile-get-targets (&optional default-buffer)
"Produce a table with refile targets."
(let ((case-fold-search nil)
;; otherwise org confuses "TODO" as a kw and "Todo" as a word
(entries (or org-refile-targets '((nil . (:level . 1)))))
targets tgs files desc descre)
(message "Getting targets...")
(with-current-buffer (or default-buffer (current-buffer))
(dolist (entry entries)
(setq files (car entry) desc (cdr entry))
@fuxialexander
fuxialexander / karabiner.json
Last active September 15, 2017 05:52
Capslock to control; Right command to ESC + Hyper; Do not trigger Hyper-,/. (sysdiagnose)
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"rules": [
@fuxialexander
fuxialexander / Org-Tyme.el
Last active January 27, 2017 03:09
Config for communication between Org mode and Tyme 2
(defun applescript-quote-string (argument)
"Quote a string for passing as a string to AppleScript."
(if (or (not argument) (string-equal argument ""))
"\"\""
;; Quote using double quotes, but escape any existing quotes or
;; backslashes in the argument with backslashes.
(let ((result "")
(start 0)
end)
(save-match-data
@fuxialexander
fuxialexander / cVimrc
Last active January 31, 2016 07:12
cVimrc
set smoothscroll
let scrollduration=300
`emacs --daemon` to run in the background.
`emacsclient.emacs24 <filename/dirname>` to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
* Undo - `C-/`
* Redo - `C-?`
* Change case: 1. Camel Case : `M-c`
2. Upper Case : `M-u`
3. Lower Case : `M-l`
@fuxialexander
fuxialexander / tmux_local_install.sh
Last active October 4, 2015 08:22 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/.local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.0