Kill magit buffers, change tab grouping when switching to project.

I also flicked global whitspace mode on and made an exception for company.
This commit is contained in:
tastytea 2019-03-21 07:42:33 +01:00
parent 7a9b4b8a90
commit 46d41a0f6d
2 changed files with 45 additions and 8 deletions

51
init.el
View File

@ -128,6 +128,9 @@
(global-set-key (kbd "C-<tab>") 'other-window)
;; Reduce whitespace around point to 0 or 1, according to context
(global-set-key (kbd "C-S-<delete>") 'fixup-whitespace)
;; Scroll without moving the cursor
(global-set-key (kbd "M-<down>") 'scroll-up-line)
(global-set-key (kbd "M-<up>") 'scroll-down-line)
;;;;;;;;;;;;;;;;;;;; Programming / RTags ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(unless slow-computer
@ -214,8 +217,17 @@
"cmake -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G 'Unix Makefiles' .."
projectile-project-compilation-cmd "cmake --build .")
(defun projectile-kill-buffers-and-change-tabbar-grouping ()
"Kill project buffers and change tabbar-ruler grouping to user-buffers."
(interactive)
(projectile-kill-buffers)
(tabbar-ruler-group-user-buffers))
:bind
("C-c p" . 'projectile-command-map)))
("C-c p" . 'projectile-command-map)
(:map projectile-command-map
("k" . 'projectile-kill-buffers-and-change-tabbar-grouping))
))
;; Debugger
(use-package realgud
@ -301,9 +313,20 @@
(unless slow-computer
(use-package git-commit))
(use-package magit
:config
(defun my-magit-kill-buffers ()
"Restore window configuration and kill all Magit buffers."
(interactive)
(let ((buffers (magit-mode-get-buffers)))
(magit-restore-window-configuration)
(mapc #'kill-buffer buffers)))
;; (bind-key "q" #'my-magit-kill-buffers magit-status-mode-map)
:bind
("C-x g" . magit-status)
("C-x M-g" . magit-dispatch))
("C-x M-g" . magit-dispatch)
(:map magit-status-mode-map
("q" . my-magit-kill-buffers)))
;; Draw line in column 80
(use-package fill-column-indicator
@ -340,7 +363,7 @@
(flx-ido-mode t)
(setq ido-enable-flex-matching t
ido-ignore-extensions t
ido-use-virtual-buffers t)) ; Keep log of recently opened files
ido-use-virtual-buffers t)) ; Keep history of recently opened buffers
;; Tab bar
(unless slow-computer
@ -353,7 +376,6 @@
;; (tabbar-ruler-group-buffer-groups) ; Group by file type
(tabbar-ruler-group-user-buffers) ; Group by frame
;; (mode-icons-mode 0) ; Disable modeline symbols
(setq tabbar-ruler-swap-faces nil) ; Swap tab colors
;; I have to define these 2 times, don't know why.
(set-face-attribute 'tabbar-selected nil
@ -366,6 +388,9 @@
:foreground "dark gray"
:family "Sans Serif"
:italic t)
(add-hook 'projectile-after-switch-project-hook ; Does not work under :hood
'tabbar-ruler-group-by-projectile-project)
:bind
("C-<prior>" . 'tabbar-ruler-tabbar-backward-tab)
("C-<next>" . 'tabbar-ruler-tabbar-forward-tab)
@ -380,14 +405,26 @@
:background "gray18"
:foreground "dark gray"
:family "Sans Serif"
:italic t))))
:italic t))
))
;; Keybinding for whitespace, don't visualise newlines
(use-package whitespace
:config
(delete 'newline-mark whitespace-style)
(global-whitespace-mode)
;; Don't show dots in company menu
(defun on-off-whitespace-before-company(command)
(when (string= "show" command)
(whitespace-mode -1))
(when (string= "hide" command)
(whitespace-mode t)))
(advice-add 'company-call-frontends
:before #'on-off-whitespace-before-company)
:bind
("C-x w" . 'whitespace-mode))
("C-x w" . 'whitespace-mode)
:custom-face
(whitespace-space ((nil :foreground "gray18"))))
;; Spell checking
(use-package flyspell
@ -439,7 +476,7 @@
:after nginx-mode
:config
:hook
(nginx-mode #'company-nginx-keywords))
(nginx-mode . company-nginx-keywords))
;;;;;;;;;;;;;;;;;;;; Server / Remote editing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Edit remote files

View File

@ -1,2 +1,2 @@
127.0.0.1:51313 12458
127.0.0.1:51313 9509
phahw2ohVoh0oopheish7IVie9desh8aequeenei3uo8wahShe%thuadaeNa4ieh