diff --git a/emacs.d/00-functions.el b/emacs.d/00-functions.el index 2b43d65..ff493f0 100644 --- a/emacs.d/00-functions.el +++ b/emacs.d/00-functions.el @@ -26,3 +26,11 @@ '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))) + +(defun c-toggle-header-source () + (interactive) + (let ((ext (file-name-extension (buffer-file-name))) + (noext (file-name-sans-extension (buffer-file-name)))) + (if (string= (substring ext 0 1) "c") + (find-file (concat noext ".h")) + (find-file (concat noext ".c"))))) diff --git a/emacs.d/20-c-mode.el b/emacs.d/20-c-mode.el new file mode 100644 index 0000000..2b05b94 --- /dev/null +++ b/emacs.d/20-c-mode.el @@ -0,0 +1,3 @@ +(add-hook 'c-mode-hook + (lambda () + (local-set-key [f11] 'c-toggle-header-source)))