Files
dotfiles/emacs/init.el

93 lines
2.7 KiB
EmacsLisp
Raw Normal View History

2026-02-10 19:40:14 +01:00
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; Optional: Refresh the package list automatically if it's empty
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'multiple-cursors)
(package-refresh-contents)
(package-install 'multiple-cursors))
(require 'multiple-cursors)
;; (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "<f2>") 'mc/mark-next-like-this)
(global-set-key (kbd "S-<f2>") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-<f2>") 'mc/mark-all-like-this)
(global-display-line-numbers-mode)
(setq backup-directory-alist `(("." . "~/emacs/autosaves/")))
(setq auto-save-file-name-transforms '((".*" "~/emacs/autosaves/\\1" t)))
(load-theme 'gruber-darker t)
(menu-bar-mode -1)
;; Disable the tool bar (the row of icons at the top)
(tool-bar-mode -1)
;; Disable the scroll bar (the vertical bar on the side)
(scroll-bar-mode -1)
(set-face-attribute 'default nil :height 170)
(setq project-vc-extra-root-markers '("CMakeLists.txt" "Makefile" "package.json" ".root"))
(use-package company
:ensure t
:init (global-company-mode)
:config
(setq company-idle-delay 0.0 ; How long to wait before popup (0 = instant)
company-minimum-prefix-length 1)) ; Show list after typing 1 character
;(use-package lsp-mode
; :ensure t
; :init
; :hook ( ;(c-mode . lsp)
; (c++-mode . lsp))
; :commands lsp)
(setenv "PATH" (concat "/home/cool/opt/cross/bin:" (getenv "PATH")))
(add-to-list 'exec-path "/home/cool/opt/cross/bin")
(setq-default c-basic-offset 8)
(defun c-style ()
(c-set-offset 'defun-open 0)
(c-set-offset 'substatement-open 0)
(setq c-backslash-column 80)
(setq c-backslash-max-column 80))
(add-hook 'c-mode-common-hook 'c-style)
(setq-default fill-column 80)
(global-display-fill-column-indicator-mode)
(defun my-c-backslash-region-80 ()
(interactive)
(c-backslash-region (region-beginning) (region-end) 80 nil))
(add-hook 'c-mode-hook
(lambda ()
(local-set-key (kbd "C-c \\") 'my-c-backslash-region-80)))
2026-02-10 19:40:14 +01:00
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(company gruber-darker-theme lsp-mode magit multiple-cursors)))
2026-02-10 19:40:14 +01:00
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)