Skip to content

Instantly share code, notes, and snippets.

@nenadalm
Last active November 3, 2021 15:12
Show Gist options
  • Save nenadalm/dd400aaf3d78d4cb59cc3c6c65eefba3 to your computer and use it in GitHub Desktop.
Save nenadalm/dd400aaf3d78d4cb59cc3c6c65eefba3 to your computer and use it in GitHub Desktop.
(setq inhibit-startup-screen t)
(setq gc-cons-threshold 50000000)
(tool-bar-mode -1)
(menu-bar-mode -1)
(setq-default indent-tabs-mode nil)
(setq tab-width 4)
(setq c-basic-indent 4)
(setq scroll-conservatively 1)
(global-linum-mode)
(ido-mode)
(setq show-trailing-whitespace t)
(setq column-number-mode t)
(fset 'yes-or-no-p 'y-or-n-p)
(setq require-final-newline t)
(global-auto-revert-mode t)
(global-hl-line-mode +1)
(setq browse-url-browser-function #'browse-url-chrome)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(require 'package)
(setq package-archives
'(("org" . "http://orgmode.org/elpa/")
("melpa" . "http://melpa.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/"))
package-archive-priorities
'(("melpa-stable" . 15)
("org" . 10)
("gnu" . 5)
("melpa" . 0)))
(setq package-enable-at-startup nil)
(package-initialize)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(use-package zenburn-theme
:ensure t
:config (load-theme 'zenburn t))
(use-package xclip
:ensure t
:unless (display-graphic-p)
:config (xclip-mode 1))
(use-package magit
:ensure t)
(use-package web-mode
:ensure t
:mode ("\\.tpl\\'" . web-mode)
:config (setq web-mode-engines-alist '(("go" . "\\.tpl\\'"))))
(use-package k8s-mode
:ensure t
:hook (k8s-mode . yas-minor-mode))
(use-package org
:config
(setq org-clock-report-include-clocking-task t)
(add-hook 'org-mode-hook #'visual-line-mode)
(add-hook 'org-mode-hook
(lambda ()
(electric-indent-local-mode -1))))
(use-package adoc-mode
:ensure t)
(use-package json-mode
:ensure t)
(use-package helm
:ensure t)
(use-package yaml-mode
:ensure t)
(use-package less-css-mode
:ensure t)
(use-package rainbow-delimiters
:ensure t
:config
(custom-set-faces
'(rainbow-delimiters-depth-1-face ((t (:foreground "dark orange"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "deep pink"))))
'(rainbow-delimiters-depth-3-face ((t (:foreground "chartreuse"))))
'(rainbow-delimiters-depth-4-face ((t (:foreground "deep sky blue"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "yellow"))))
'(rainbow-delimiters-depth-6-face ((t (:foreground "orchid"))))
'(rainbow-delimiters-depth-7-face ((t (:foreground "spring green"))))
'(rainbow-delimiters-depth-8-face ((t (:foreground "sienna1"))))))
(use-package neotree
:ensure t
:bind (("<f8>" . neotree-project-dir))
:config
(setq neo-smart-open t)
(defun neotree-project-dir ()
"Open NeoTree using the git root."
(interactive)
(let ((project-dir (projectile-project-root))
(file-name (buffer-file-name)))
(neotree-toggle)
(if project-dir
(if (neo-global--window-exists-p)
(progn
(neotree-dir project-dir)
(neotree-find file-name)))
(message "Could not find git project root.")))))
; highlights changed lines
(use-package diff-hl
:ensure t
:config
(if (display-graphic-p)
(global-diff-hl-mode)
(setq diff-hl-side 'right)
(global-diff-hl-mode)
(diff-hl-margin-mode)))
; autocompletion
(use-package company
:ensure t
:bind ("C-c c" . company-complete)
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1)
(global-company-mode)
(setq company-dabbrev-downcase nil)
(add-hook 'css-mode-hook (lambda ()
(set (make-local-variable 'company-backends) '(company-css company-dabbrev)))))
(use-package company-quickhelp
:ensure t
:config
(company-quickhelp-mode 1))
(use-package which-key
:ensure t
:config
(which-key-mode))
(use-package projectile
:ensure t
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode))
(use-package tabbar
:ensure t
:config
(defun tabbar-move-current-tab-one-place-left ()
"Move current tab one place left, unless it's already the leftmost."
(interactive)
(let* ((bufset (tabbar-current-tabset t))
(old-bufs (tabbar-tabs bufset))
(first-buf (car old-bufs))
(new-bufs (list)))
(if (string= (buffer-name) (format "%s" (car first-buf)))
old-bufs ; the current tab is the leftmost
(setq not-yet-this-buf first-buf)
(setq old-bufs (cdr old-bufs))
(while (and
old-bufs
(not (string= (buffer-name) (format "%s" (car (car old-bufs))))))
(push not-yet-this-buf new-bufs)
(setq not-yet-this-buf (car old-bufs))
(setq old-bufs (cdr old-bufs)))
(if old-bufs ; if this is false, then the current tab's buffer name is mysteriously missing
(progn
(push (car old-bufs) new-bufs) ; this is the tab that was to bev moved
(push not-yet-this-buf new-bufs)
(setq new-bufs (reverse new-bufs))
(setq new-bufs (append new-bufs (cdr old-bufs))))
(error "Error: current buffer's name was not found in Tabbar's buffer list"))
(set bufset new-bufs)
(tabbar-set-template bufset nil)
(tabbar-display-update))))
(defun tabbar-move-current-tab-one-place-right ()
"Move current tab one place right, unless it's already the rightmost."
(interactive)
(let* ((bufset (tabbar-current-tabset t))
(old-bufs (tabbar-tabs bufset))
(first-buf (car old-bufs))
(new-bufs (list)))
(while (and
old-bufs
(not (string= (buffer-name) (format "%s" (car (car old-bufs))))))
(push (car old-bufs) new-bufs)
(setq old-bufs (cdr old-bufs)))
(if old-bufs ; if this is false, then the current tab's buffer name is mysteriously missing
(progn
(setq the-buffer (car old-bufs))
(setq old-bufs (cdr old-bufs))
(if old-bufs ; if this is false, then the current tab is the rightmost
(push (car old-bufs) new-bufs))
(push the-buffer new-bufs)) ; this is the tab that was to be moved
(error "Error: current buffer's name was not found in Tabbar's buffer list"))
(setq new-bufs (reverse new-bufs))
(setq new-bufs (append new-bufs (cdr old-bufs)))
(set bufset new-bufs)
(tabbar-set-template bufset nil)
(tabbar-display-update)))
(global-set-key (kbd "C-S-<prior>") 'tabbar-move-current-tab-one-place-left)
(global-set-key (kbd "C-S-<next>") 'tabbar-move-current-tab-one-place-right)
(global-set-key (kbd "C-<prior>") 'tabbar-backward-tab)
(global-set-key (kbd "C-<next>") 'tabbar-forward-tab)
(tabbar-mode))
(use-package markdown-mode
:ensure t)
(use-package lsp-treemacs
:ensure t)
(use-package iedit
:ensure t)
(use-package lsp-mode
:ensure t
:init (setq lsp-keymap-prefix "C-l")
:hook ((clojure-mode . lsp)
(clojurec-mode . lsp)
(clojurescript-mode . lsp)
(lsp-mode . lsp-enable-which-key-integration))
:commands lsp
:config
(setq lsp-lens-enable t
lsp-completion-enable nil
lsp-headerline-breadcrumb-enable nil)
(setq read-process-output-max (* 1024 1024)))
(use-package lsp-ui
:ensure t)
(use-package paredit
:ensure t
:config
(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'eval-expression-minibuffer-setup-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
(add-hook 'scheme-mode-hook #'enable-paredit-mode))
(use-package clojure-mode
:ensure t
:config
(show-paren-mode t)
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
(add-hook 'clojure-mode-hook #'enable-paredit-mode))
(use-package cider
:ensure t
:config
(setq cider-eldoc-display-context-dependent-info t)
(setq cider-enhanced-cljs-completion-p nil)
(setq cider-save-file-on-load t))
; javascript
;; (use-package indium
;; :ensure t)
(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
'(iedit lsp-mode k8s-mode web-mode psc-ide ## less-css-mode markdown-mode yaml-mode company-quickhelp tabbar ido-mode diff-hl hl-diff projectile auto-complete helm evil-visual-mark-mode))
'(safe-local-variable-values '((engine . php))))
(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.
'(rainbow-delimiters-depth-1-face ((t (:foreground "dark orange"))))
'(rainbow-delimiters-depth-2-face ((t (:foreground "deep pink"))))
'(rainbow-delimiters-depth-3-face ((t (:foreground "chartreuse"))))
'(rainbow-delimiters-depth-4-face ((t (:foreground "deep sky blue"))))
'(rainbow-delimiters-depth-5-face ((t (:foreground "yellow"))))
'(rainbow-delimiters-depth-6-face ((t (:foreground "orchid"))))
'(rainbow-delimiters-depth-7-face ((t (:foreground "spring green"))))
'(rainbow-delimiters-depth-8-face ((t (:foreground "sienna1")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment