initial commit
This commit is contained in:
commit
6327d228b3
2 changed files with 282 additions and 0 deletions
267
linux/init.el
Normal file
267
linux/init.el
Normal file
|
|
@ -0,0 +1,267 @@
|
|||
;;-*-coding: iso-latin-1-*-
|
||||
;; Disable GC for the duration of init scripts
|
||||
(let ((gc-cons-threshold most-positive-fixnum))
|
||||
(global-auto-revert-mode t)
|
||||
;;(w32-register-hot-key [C-])
|
||||
|
||||
|
||||
;; Eval buffer
|
||||
(global-set-key (kbd "<f5>") #'eval-buffer)
|
||||
|
||||
;;; PACKAGE BOOTSTRAPPING ;;;
|
||||
|
||||
(require 'package)
|
||||
(setq package-enable-at-startup nil)
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "https://melpa.org/packages/"))
|
||||
|
||||
(package-initialize)
|
||||
|
||||
;; Bootstrap `use-package'
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-refresh-contents)
|
||||
(package-install 'use-package))
|
||||
|
||||
(eval-when-compile
|
||||
(require 'use-package))
|
||||
|
||||
(use-package ssh-agency
|
||||
:ensure t)
|
||||
|
||||
(use-package benchmark-init
|
||||
:ensure t
|
||||
:config
|
||||
;; To disable collection of benchmark data after init is done.
|
||||
(add-hook 'after-init-hook 'benchmark-init/deactivate))
|
||||
|
||||
(use-package tangotango-theme
|
||||
:ensure t
|
||||
:config (load-theme 'tangotango t))
|
||||
|
||||
(use-package magit
|
||||
:ensure t)
|
||||
;;:init (setq magit-git-executable "C:/capybara/git/bin/git.exe"))
|
||||
|
||||
(use-package centered-cursor-mode
|
||||
:ensure t)
|
||||
|
||||
(use-package projectile
|
||||
:ensure t
|
||||
:config (projectile-global-mode))
|
||||
|
||||
(use-package helm-projectile
|
||||
:ensure t)
|
||||
|
||||
(use-package projectile-ripgrep
|
||||
:ensure t)
|
||||
|
||||
;;; USER CONFIG ;;;
|
||||
|
||||
;;Using helm as minibuffer autocompletion manager
|
||||
(setf projectile-completion-system 'helm)
|
||||
(setf projectile-indexing-method 'alien)
|
||||
|
||||
;; Windows: Let git's UI ask for passphrase
|
||||
;;(setenv "SSH_ASKPASS" "git-gui--askpass")
|
||||
;;(require 'exec-path
|
||||
;;(exec-path-from-shell
|
||||
;;l-copy-env "SSH_AGENT_PID")
|
||||
;;(exec-path-from-shell-copy-env "SSH_AUTH_SOCK")
|
||||
|
||||
;; Display line numbers ;;in prog files
|
||||
;;(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
||||
(add-hook 'after-init-hook 'global-display-line-numbers-mode t)
|
||||
|
||||
;; Disable backup files
|
||||
(setq make-backup-files nil)
|
||||
|
||||
;; Disable window cruft
|
||||
(menu-bar-mode -1)
|
||||
|
||||
;; Disable toolbar
|
||||
(tool-bar-mode -1)
|
||||
|
||||
;; Disable scrollbar
|
||||
(scroll-bar-mode -1)
|
||||
|
||||
;; Use better buffer list
|
||||
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
||||
|
||||
;; Disable splash screen and startup message
|
||||
(setq inhibit-startup-message t)
|
||||
(setq initial-scratch-message nil)
|
||||
|
||||
;; Use regex search toolsx
|
||||
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
|
||||
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
|
||||
|
||||
;; On-home-row pointxx movement
|
||||
(global-set-key (kbd "C-k") 'next-line)
|
||||
(global-set-key (kbd "C-l") 'previous-line)
|
||||
(global-set-key (kbd "C-;") 'forward-char)
|
||||
(global-set-key (kbd "C-ñ") 'forward-char)
|
||||
(global-set-key (kbd "C-j") 'backward-char)
|
||||
|
||||
(global-set-key (kbd "C-f") 'forward-word)
|
||||
(global-set-key (kbd "C-b") 'backward-word)
|
||||
|
||||
(global-set-key (kbd "C-x C-u") (lambda () (interactive) (other-window -1)))
|
||||
(global-set-key (kbd "C-x C-o") (lambda () (interactive) (other-window 1)))
|
||||
(global-set-key (kbd "C-x u") 'dired-jump)
|
||||
(global-set-key (kbd "C-x o") 'delete-blank-lines)
|
||||
|
||||
;; On-home-row cycling through buffers
|
||||
(global-set-key (kbd "C-x C-j") 'previous-buffer)
|
||||
(global-set-key (kbd "C-x C-ñ") 'next-buffer)
|
||||
(global-set-key (kbd "C-x C-;") 'next-buffer)
|
||||
|
||||
;; x(global-set-key (kbd "C-x C-´") 'enlarge-window)
|
||||
;;(global-set-key (kbd "C-x C-'") 'enlarge-window)
|
||||
(global-set-key (kbd "C-c C-'") (lambda () (interactive) (enlarge-window 10)))
|
||||
(global-set-key (kbd "C-c C-/") (lambda () (interactive) (enlarge-window -10)))
|
||||
|
||||
(global-set-key (kbd "C-z") 'kill-whole-line)
|
||||
;;(global-set-key (kbd "C-x C-o") (lambda () (interactive) (other-window 1)))
|
||||
;;(global-set-key (kbd "C-x u") 'dired-jump)
|
||||
;;(global-set-key (kbd "C-x o") 'delete-blank-lines)
|
||||
|
||||
(global-set-key (kbd "C-n") 'undo)
|
||||
(define-key input-decode-map [?\C-m] [C-m])
|
||||
(global-set-key (kbd "<C-m>") 'undo-redo)
|
||||
|
||||
|
||||
;;zap-to-char M-z, toggle-input-method C-\, transpose-chars C-t
|
||||
(global-set-key (kbd "M-b") 'backward-char)
|
||||
(global-set-key (kbd "M-f") 'forward-char)
|
||||
|
||||
(global-set-key (kbd "C-c C-SPC") 'string-insert-rectangle)
|
||||
(global-set-key (kbd "C-x C-SPC") 'rectangle-mark-mode)
|
||||
(global-set-key (kbd "C-x SPC") 'pop-global-mark)
|
||||
|
||||
(desktop-save-mode 1)
|
||||
(setq desktop-restore-eager nil)
|
||||
;;(setf desktop-restore-eager 5)
|
||||
(delete-selection-mode 1)
|
||||
|
||||
;; C++
|
||||
(add-hook 'c++-mode-hook (lambda ()
|
||||
(setq-local comment-start "/*")
|
||||
(setq-local comment-end "*/")
|
||||
(setq-local comment-style 'extra-line)))
|
||||
|
||||
(global-set-key [f6] 'comment-region)
|
||||
(global-set-key (kbd "M-i") (lambda () (interactive) (scroll-up 1)) )
|
||||
(global-set-key (kbd "M-p") (lambda () (interactive) (scroll-down 1)) )
|
||||
|
||||
(global-set-key [f9] (lambda () (interactive) (find-file user-init-file)) )
|
||||
|
||||
(global-set-key [f8] 'projectile-find-file)
|
||||
(global-set-key [f7] 'projectile-compile-project)
|
||||
|
||||
|
||||
;; oddly specific buffer movement
|
||||
|
||||
(global-set-key (kbd "C-h u") 'info-apropos)
|
||||
|
||||
(global-set-key (kbd "C-,") (lambda () (interactive) (move-to-window-line -1)) )
|
||||
(global-set-key (kbd "M-,") (lambda () (interactive) (move-to-window-line 0)) )
|
||||
|
||||
(global-set-key (kbd "C-.") 'end-of-buffer)
|
||||
(global-set-key (kbd "M-.") 'beginning-of-buffer)
|
||||
|
||||
;; info-apropos mapping
|
||||
(global-set-key (kbd "C-h u") 'info-apropos)
|
||||
|
||||
|
||||
;; (global-set-key (kbd "C-x C-<dead-acute>") 'enlarge-window)
|
||||
;; Remapping save commit in Magit
|
||||
(define-key with-editor-mode-map (kbd "C-c C-c") nil)
|
||||
|
||||
;;
|
||||
(define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file)
|
||||
(define-key dired-mode-map (kbd "a") 'dired-find-file)
|
||||
(setq global-auto-revert-non-file-buffers t)
|
||||
(add-hook 'dired-mode-hook (lambda () (setq-local auto-revert-verbose nil)) )
|
||||
(add-hook 'ibuffer-mode-hook (lambda () (ibuffer-auto-mode t)))
|
||||
|
||||
(setq compilation-scroll-output t)
|
||||
|
||||
;; Copy config
|
||||
(defun copy-region-or-word ()
|
||||
"If mark is active, copy region. Otherwise, copy word currently on cursor"
|
||||
(interactive)
|
||||
(if mark-active
|
||||
(if (bound-and-true-p rectangle-mark-mode)
|
||||
(progn (copy-rectangle-as-kill (region-beginning) (region-end))
|
||||
(kill-new (mapconcat 'identity (extract-rectangle (region-beginning) (region-end)) "\n")))
|
||||
(kill-ring-save (region-beginning) (region-end)))
|
||||
(let ((region (bounds-of-thing-at-point 'symbol)))
|
||||
(copy-region-as-kill (car region) (cdr region)))))
|
||||
|
||||
;; Tabulation and Tree-sitter config
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.cpp\\'" . c++-ts-mode))
|
||||
|
||||
(setq major-mode-remap-alist
|
||||
'((c-mode . c-ts-mode)
|
||||
(bash-mode . bash-ts-mode)
|
||||
; (cpp-mode . c++-ts-mode)
|
||||
(asm-mode . asm-ts-mode)
|
||||
(cmake-mode . cmake-ts-mode)
|
||||
(c-sharp-mode . c-sharp-mode)
|
||||
(css-mode . css-ts-mode)
|
||||
(bash-mode . bash-ts-mode)
|
||||
(dockerfile-mode . dockerfile-ts-mode)
|
||||
(elisp-mode . elisp-ts-mode)
|
||||
(elm-mode . elm-ts-mode)
|
||||
(gitcommit-mode . gitcommit-ts-mode)
|
||||
(gitignore-mode . gitignore-ts-mode)
|
||||
(git-rebase-mode . git-rebase-ts-mode)
|
||||
(json-mode . json-ts-mode)
|
||||
(latex-mode . latex-ts-mode)
|
||||
(lua-mode . lua-ts-mode)
|
||||
(make-mode . make-ts-mode)
|
||||
(sql-mode . sql-ts-mode)
|
||||
(csv-mode . csv-ts-mode)))
|
||||
|
||||
(customize-set-variable 'treesit-font-lock-level 2)
|
||||
|
||||
(setq-default indent-tabs-mode t)
|
||||
(setq-default tab-width 4) ; Assuming you want your tabs to be four spaces wide
|
||||
(global-set-key (kbd "C-/") 'tab-to-tab-stop)
|
||||
(defvaralias 'c-basic-offset 'tab-width)
|
||||
(defvaralias 'c-ts-mode-indent-offset 'tab-width)
|
||||
(defvaralias 'c++-ts-mode-indent-offset 'tab-width)
|
||||
|
||||
;; Change *scratch* to org-mode + fixes for extreme notetaking action
|
||||
(setq initial-major-mode 'org-mode)
|
||||
;(define-key org-mode-map (kbd "C-j") nil)
|
||||
|
||||
(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
|
||||
'(projectile-ripgrep helm-projectile projectile ssh-agency tangotango-theme)))
|
||||
(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.
|
||||
)
|
||||
(put 'dired-find-alternate-file 'disabled nil)
|
||||
)
|
||||
(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
|
||||
'(benchmark-init projectile-ripgrep helm-projectile projectile ssh-agency tangotango-theme)))
|
||||
(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.
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue