Skip to content

Instantly share code, notes, and snippets.

@zarkzork
Created August 12, 2012 14:04
Show Gist options
  • Save zarkzork/3332000 to your computer and use it in GitHub Desktop.
Save zarkzork/3332000 to your computer and use it in GitHub Desktop.
some shit
(defun next-same-indentation ()
(interactive)
(let ((target-indentation (current-indentation)))
(while (progn
(next-line)
(/= target-indentation (current-indentation))))))
(defun previous-same-indentation ()
(interactive)
(let ((target-indentation (current-indentation)))
(while (progn
(previous-line)
(/= target-indentation (current-indentation))))))
(global-set-key "\C-cn" 'next-same-indentation)
(global-set-key "\C-c\C-n" 'next-same-indentation)
(global-set-key "\C-cp" 'previous-same-indentation)
(global-set-key "\C-c\C-p" 'previous-same-indentation)
;; custom keys to increase/decrease selective display for buffer.
(setq current-nesting-step 2)
(setq current-nesting-level 0)
(make-variable-buffer-local 'current-nesting-level)
(defun increase-nesting-level ()
(interactive)
(setq current-nesting-level (+ current-nesting-level current-nesting-step))
(set-selective-display current-nesting-level))
(defun decrease-nesting-level ()
(interactive)
(if (> current-nesting-level 0)
(setq current-nesting-level (- current-nesting-level current-nesting-step)))
(set-selective-display current-nesting-level))-
(global-set-key "\C-x+" 'increase-nesting-level)
(global-set-key "\C-x-" 'decrease-nesting-level)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment