add socks proxy, finish helm-org-agenda-files-headings
This commit is contained in:
parent
80c953e1bb
commit
1ba00b695c
@ -818,7 +818,8 @@ The current directory is assumed to be the project's root otherwise."
|
|||||||
:bind (("M-y" . helm-show-kill-ring)
|
:bind (("M-y" . helm-show-kill-ring)
|
||||||
("M-x" . helm-M-x)
|
("M-x" . helm-M-x)
|
||||||
("C-x C-i" . helm-imenu)
|
("C-x C-i" . helm-imenu)
|
||||||
("C-h a" . helm-apropos))
|
("C-h a" . helm-apropos)
|
||||||
|
("C-c C-h" . helm-org-agenda-files-headings))
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
(require 'helm)
|
(require 'helm)
|
||||||
@ -1240,8 +1241,7 @@ The current directory is assumed to be the project's root otherwise."
|
|||||||
(if (eq appropriate-theme current-theme)
|
(if (eq appropriate-theme current-theme)
|
||||||
nil
|
nil
|
||||||
(progn
|
(progn
|
||||||
(disable-all-themes)
|
(disable-and-load-theme appropriate-theme t)
|
||||||
(load-theme appropriate-theme t)
|
|
||||||
(setq current-theme appropriate-theme)))))
|
(setq current-theme appropriate-theme)))))
|
||||||
|
|
||||||
(defun disable-all-themes ()
|
(defun disable-all-themes ()
|
||||||
|
@ -1,27 +1,37 @@
|
|||||||
(defun helm-org-agenda-files-headlines (&optional min-depth max-depth)
|
(defun helm-org-agenda-files-headings (&optional min-depth max-depth)
|
||||||
(interactive)
|
(interactive)
|
||||||
(helm :sources (helm-source-org-headlines-for-files org-agenda-files)))
|
(helm :sources (helm-source-org-headings-for-files org-agenda-files min-depth max-depth)))
|
||||||
|
|
||||||
(defun helm-org-goto-marker (marker)
|
(defun helm-org-goto-marker (marker)
|
||||||
(switch-to-buffer (marker-buffer marker))
|
(switch-to-buffer (marker-buffer marker))
|
||||||
(goto-char (marker-position marker))
|
(goto-char (marker-position marker))
|
||||||
(org-show-entry))
|
(org-show-entry))
|
||||||
|
|
||||||
|
(defun helm-source-org-headings-for-files (filenames &optional min-depth max-depth)
|
||||||
(defun helm-source-org-headlines-for-files (filenames &optional min-depth max-depth)
|
|
||||||
(unless min-depth (setq min-depth 1))
|
(unless min-depth (setq min-depth 1))
|
||||||
(unless max-depth (setq max-depth 8))
|
(unless max-depth (setq max-depth 8))
|
||||||
(helm-build-sync-source "Org Headlines"
|
(helm-build-sync-source "Org Headings"
|
||||||
:candidates (helm-org-get-candidates filenames min-depth max-depth)
|
:candidates (helm-org-get-candidates filenames min-depth max-depth)
|
||||||
:action 'helm-org-goto-marker
|
:action 'helm-org-goto-marker
|
||||||
:action-transformer
|
:action-transformer
|
||||||
(lambda (actions candidate)
|
(lambda (actions candidate)
|
||||||
'(("Go to line" . helm-org-goto-marker)
|
'(("Go to line" . helm-org-goto-marker)
|
||||||
("Refile to this headline" . helm-org-headline-refile)
|
("Refile to this heading" . helm-org-heading-refile)
|
||||||
("Insert link to this headline"
|
("Insert link to this heading"
|
||||||
. helm-org-headline-insert-link-to-headline)))))
|
. helm-org-insert-link-to-heading-at-marker)))))
|
||||||
|
|
||||||
(defun helm-org-headline-refile (marker)
|
(defun helm-org-insert-link-to-heading-at-marker (marker)
|
||||||
|
(with-current-buffer (marker-buffer marker)
|
||||||
|
(goto-char (marker-position marker))
|
||||||
|
(let ((heading-name (nth 4 (org-heading-components)))
|
||||||
|
(file-name buffer-file-name))
|
||||||
|
(message heading-name)
|
||||||
|
(message file-name)
|
||||||
|
(with-helm-current-buffer
|
||||||
|
(org-insert-link
|
||||||
|
file-name (concat "file:" file-name "::*"heading-name))))))
|
||||||
|
|
||||||
|
(defun helm-org-heading-refile (marker)
|
||||||
(with-helm-current-buffer
|
(with-helm-current-buffer
|
||||||
(org-cut-subtree))
|
(org-cut-subtree))
|
||||||
(let ((target-level (with-current-buffer (marker-buffer marker)
|
(let ((target-level (with-current-buffer (marker-buffer marker)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
shell_contains () {
|
function shell_contains () {
|
||||||
local e
|
local e
|
||||||
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
|
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
|
||||||
return 1
|
return 1
|
||||||
@ -284,3 +284,8 @@ function timestamp {
|
|||||||
function parse_timestamp {
|
function parse_timestamp {
|
||||||
date -d "@$1"
|
date -d "@$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refresh_config {
|
||||||
|
source ~/.zshenv
|
||||||
|
source ~/.zshrc
|
||||||
|
}
|
||||||
|
@ -144,3 +144,26 @@ function set_application_for_file_extension() {
|
|||||||
function reload_preferences {
|
function reload_preferences {
|
||||||
killall -u $(whoami) cfprefsd
|
killall -u $(whoami) cfprefsd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disable_proxy(){
|
||||||
|
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
|
||||||
|
sudo networksetup -setsocksfirewallproxystate Ethernet off
|
||||||
|
echo "SOCKS proxy disabled."
|
||||||
|
}
|
||||||
|
|
||||||
|
function socks_proxy {
|
||||||
|
disable_proxy(){
|
||||||
|
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
|
||||||
|
sudo networksetup -setsocksfirewallproxystate Ethernet off
|
||||||
|
echo "SOCKS proxy disabled."
|
||||||
|
}
|
||||||
|
trap disable_proxy EXIT
|
||||||
|
sudo networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 9999
|
||||||
|
sudo networksetup -setsocksfirewallproxy Ethernet 127.0.0.1 9999
|
||||||
|
sudo networksetup -setsocksfirewallproxystate Wi-Fi on
|
||||||
|
sudo networksetup -setsocksfirewallproxystate Ethernet on
|
||||||
|
echo "SOCKS proxy enabled."
|
||||||
|
echo "Tunneling..."
|
||||||
|
echo "$@"
|
||||||
|
ssh -CND 9999 "$@"
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user