forked from FG42/FG42
1
0
Fork 0

buffers module added

This commit is contained in:
Sameer Rahmani 2017-08-15 17:44:17 +01:00
parent d88f79f339
commit 744e661cce
5 changed files with 60 additions and 34 deletions

View File

@ -230,7 +230,7 @@
'(shell-pop-shell-type (quote ("eshell" "*shell*" (lambda nil (eshell shell-pop-term-shell)))))
;;'(shell-pop-term-shell "/bin/zsh")
'(shell-pop-term-shell "eshell")
'(shell-pop-universal-key "M-`")
'(shell-pop-window-size 30)
'(shell-pop-full-span t)
'(shell-pop-window-position "full"))

View File

@ -0,0 +1,38 @@
;;; Buffers Module --- All the functions related to buffer management
;;; Commentary:
;;; Code:
(defvar *favorite-buffer* nil)
(defun switch-to-previous-buffer ()
"Switch to previously open buffer.
Repeated invocations toggle between the two most recently open buffers."
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
(defun switch-to-buffer-by-regex ()
"Switch to buffer which the name match the *favorite-buffer* regex."
(interactive)
(if *favorite-buffer*
(switch-to-buffer
(car (remove-if-not (apply-partially #'string-match-p *favorite-buffer*)
(buffer-list))))
(eshell)))
(defun switch-to-favorite-buffer ()
"Switch to *favorite-buffer* buffer with is variable assigned to each mode.
For exampe in clojure mode it would the name of repl buffer. The *favorite-buffer* value should be regex matching to the buffer name"
(interactive
(if *favorite-buffer*
(if (string-match *favorite-buffer* (buffer-name))
(switch-to-previous-buffer)
(switch-to-buffer-by-regex))
(if (string= (buffer-name) "*eshell*") (switch-to-previous-buffer) (eshell)))))
(provide 'extensions/editor/buffers)
;;; buffers.el ends here

View File

@ -1,3 +1,5 @@
(require 'extensions/editor/buffers)
;; Customizations --------------------------------------------
(defcustom fg42-todo-file "~/.TODO.org"
"Path to your TODO file. You can use a tramp address here as well."
@ -121,6 +123,10 @@
(global-set-key (kbd "\C-c m") 'menu-bar-mode)
(global-set-key (kbd "<f2>") 'goto-line)
(global-set-key (kbd "M-TAB") 'switch-to-previous-buffer)
(global-set-key (kbd "M-`") 'switch-to-favorite-buffer)
;; Don't allow tab as indent
(setq-default indent-tabs-mode nil)
@ -169,7 +175,7 @@
(global-set-key (kbd "C-c C-SPC ") 'mc/mark-all-like-this)
;; Reload FG42
(define-key global-map (kbd "<f5>") 'fg42-reload)
(define-key global-map (kbd "C-<f5>") 'fg42-reload)
;; Key Chord ------------------------------------------------
;; (require 'key-chord)

View File

@ -19,21 +19,11 @@
(lxdrive-minor-mode t)
(use-global-map lxdrive-mode-map))
(defun turn-off-and-ido-find-file ()
(interactive)
(turn-off-lxdrive)
(ido-find-file))
(defun turn-off-and-smex ()
(interactive)
(turn-off-lxdrive)
(smex))
(defun turn-off-and-swiper ()
(interactive)
(turn-off-lxdrive)
(swiper))
(defvar lxdrive-mode-map
(let ((map (make-sparse-keymap)))
;; Movement
@ -56,7 +46,6 @@
(define-key map (kbd "C-TAB") 'other-window)
;; Actions
(define-key map (kbd "b") 'ivy-switch-buffer)
(define-key map (kbd "RET") 'newline)
(define-key map (kbd "d") 'delete-char)
(define-key map (kbd "<backspace>") 'delete-backward-char)
@ -65,9 +54,8 @@
(define-key map (kbd "M-w") 'kill-ring-save)
(define-key map (kbd "h") 'kill-and-join-forward)
(define-key map (kbd "f") 'turn-off-and-ido-find-file)
(define-key map (kbd "g") 'keyboard-quit)
(define-key map (kbd "s") 'turn-off-and-swiper)
(define-key map (kbd "z") 'undo)
(define-key map (kbd "M-x") 'turn-off-and-smex)
@ -81,18 +69,13 @@
(define-minor-mode lxdrive-minor-mode
"A minor mode so that my key settings override annoying major modes."
:global t
:lighter " lx")
;; (defun my-minibuffer-setup-hook ()
;; (lxdrive-minor-mode 0))
;; (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
;;(lxdrive-minor-mode 1)
(global-set-key (kbd "ESC ESC") 'turn-on-lxdrive)
(global-set-key (kbd "M-SPC") 'turn-on-lxdrive)
(spaceline-toggle-lxdrive-on)
(provide 'extensions/editor/lxdrive-mode)
;;; lxdrive-mode ends here

View File

@ -1,5 +1,4 @@
;; Functions -----------------------------
;;;###autoload
(defun comment-dwim-line (&optional arg)
"Replacement for the comment-dwim command.