Add Linux config (mainly for Arch)

This commit is contained in:
Henrik Lissner 2016-10-02 23:29:51 +02:00
parent 0d1fb1132c
commit 65da0e0a9e
2 changed files with 47 additions and 15 deletions

View file

@ -1,14 +1,45 @@
;;; core-os-linux.el --- Debian-specific settings ;;; core-os-linux.el --- Debian-specific settings
;; Treat clipboard input as UTF-8 string first; compound text next, etc. (defun doom-open-with (command &rest args)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) "Open PATH in APP-NAME, using xdg-open."
(defun doom-open-with (&optional app-name path)
(interactive) (interactive)
(error "Not yet implemented")) (unless args
(setq args (f-full (s-replace "'" "\\'"
(or path (if (eq major-mode 'dired-mode)
(dired-get-file-for-visit)
(buffer-file-name)))))))
(let ((command (apply 'format command
(mapcar (lambda (a) (shell-quote-argument a))
args))))
(message "Running: %s" command)
(shell-command command)))
(defun def-docset! (&rest _)
(message "No docset function defined!")) ;;
;; OS-specific functions
;;
(defun os-open-in-browser ()
"Open the current file in the browser."
(interactive)
(browse-url buffer-file-name))
(defun os-open-in-default-program ()
"Open the current file (or selected file in dired) with xdg-open."
(interactive)
(doom-open-with "xdg-open '%s'"))
;;
;; Plugins
;;
(use-package openwith
:config
(openwith-mode t)
(setq openwith-associations
'(("\\.\\(pdf\\|jpe?g\\|gif\\|docx?\\|pptx?\\|xlsx?\\|zip\\|tar\\(\\.gz\\)?\\|rar\\)$"
"xdg-open" (file)))))
(provide 'core-os-linux) (provide 'core-os-linux)
;;; core-os-linux.el ends here ;;; core-os-linux.el ends here

View file

@ -4,20 +4,21 @@
(defconst IS-LINUX (eq system-type 'gnu/linux)) (defconst IS-LINUX (eq system-type 'gnu/linux))
(defconst IS-WINDOWS (eq system-type 'windows-nt)) (defconst IS-WINDOWS (eq system-type 'windows-nt))
;; Use a shared clipboard (setq
(setq x-select-enable-clipboard t ;; Use a shared clipboard
select-enable-clipboard t) x-select-enable-clipboard t
select-enable-clipboard t
;; Treat clipboard input as UTF-8 string first; compound text next, etc.
x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
;; Stubs, these should be defined in all OS modules ;; Stubs, these should be defined in all OS modules
(noop! doom-open-with (&optional app-name path)) (noop! doom-open-with (&optional app-name path))
(noop! os-switch-to-term) (noop! os-open-in-browser)
(noop! os-switch-to-term-and-cd)
(noop! os-open-in-default-program) (noop! os-open-in-default-program)
(noop! os-reveal) (noop! os-reveal)
(noop! os-reveal-project) (noop! os-reveal-project)
(noop! os-open-in-browser) (noop! os-switch-to-term)
(noop! os-upload) (noop! os-switch-to-term-and-cd)
(noop! os-upload-folder)
(cond (IS-MAC (require 'core-os-osx)) (cond (IS-MAC (require 'core-os-osx))
(IS-LINUX (require 'core-os-linux)) (IS-LINUX (require 'core-os-linux))