Skip to content

Commit

Permalink
inital commit of emacs setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rajcspsg committed Mar 9, 2021
0 parents commit 8c8e592
Show file tree
Hide file tree
Showing 13 changed files with 657 additions and 0 deletions.
13 changes: 13 additions & 0 deletions centaur-tabs.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(use-package centaur-tabs
:config
(setq centaur-tabs-style "bar"
centaur-tabs-height 32
centaur-tabs-set-icons t
centaur-tabs-set-modified-marker t
centaur-tabs-show-navigation-buttons t
centaur-tabs-set-bar 'under
x-underline-at-descent-line t)
(centaur-tabs-headline-match)
(centaur-tabs-mode t)
(setq uniquify-separator "/")
(setq uniquify-buffer-name-style 'forward))
19 changes: 19 additions & 0 deletions clojure.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(setq package-selected-packages '(clojure-mode lsp-mode cider lsp-treemacs flycheck company))

(when (cl-find-if-not #'package-installed-p package-selected-packages)
(package-refresh-contents)
(mapc #'package-install package-selected-packages))

(add-hook 'clojure-mode-hook 'lsp)
(add-hook 'clojurescript-mode-hook 'lsp)
(add-hook 'clojurec-mode-hook 'lsp)

(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-minimum-prefix-length 1
lsp-lens-enable t
lsp-signature-auto-activate nil
; lsp-enable-indentation nil ; uncomment to use cider indentation instead of lsp
; lsp-enable-completion-at-point nil ; uncomment to use cider completion instead of lsp
)
12 changes: 12 additions & 0 deletions cmake.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(use-package lsp-mode
:ensure t)

(use-package cmake-mode
:ensure t
:mode ("CMakeLists\\.txt\\'" "\\.cmake\\'")
:hook (cmake-mode . lsp-deferred))

(use-package cmake-font-lock
:ensure t
:after cmake-mode
:config (cmake-font-lock-activate))
30 changes: 30 additions & 0 deletions cpp.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(setq package-selected-packages '(lsp-mode yasnippet lsp-treemacs helm-lsp
projectile hydra flycheck company avy which-key helm-xref dap-mode))

(when (cl-find-if-not #'package-installed-p package-selected-packages)
(package-refresh-contents)
(mapc #'package-install package-selected-packages))

;; sample `helm' configuration use https://github.com/emacs-helm/helm/ for details
(helm-mode)

(require 'helm-xref)
(define-key global-map [remap find-file] #'helm-find-files)
(define-key global-map [remap execute-extended-command] #'helm-M-x)
(define-key global-map [remap switch-to-buffer] #'helm-mini)

(which-key-mode)
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)

(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-idle-delay 0.0
company-minimum-prefix-length 1
lsp-idle-delay 0.1) ;; clangd is fast

(with-eval-after-load 'lsp-mode
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(require 'dap-cpptools)
(yas-global-mode))
51 changes: 51 additions & 0 deletions golang.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
(use-package lsp-mode
:ensure t
:commands (lsp lsp-deferred)
:hook (go-mode . lsp-deferred))

;;Set up before-save hooks to format buffer and add/delete imports.
;;Make sure you don't have other gofmt/goimports hooks enabled.

(defun lsp-go-install-save-hooks ()
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)

;;Optional - provides fancier overlays.

(use-package lsp-ui
:ensure t
:commands lsp-ui-mode
:init
)

;;Company mode is a standard completion package that works well with lsp-mode.
;;company-lsp integrates company mode completion with lsp-mode.
;;completion-at-point also works out of the box but doesn't support snippets.

(use-package company
:ensure t
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 1))

(use-package company-lsp
:ensure t
:commands company-lsp)

;;Optional - provides snippet support.

(use-package yasnippet
:ensure t
:commands yas-minor-mode
:hook (go-mode . yas-minor-mode))

;;lsp-ui-doc-enable is false because I don't like the popover that shows up on the right
;;I'll change it if I want it back


(setq lsp-ui-doc-enable nil
lsp-ui-peek-enable t
lsp-ui-sideline-enable t
lsp-ui-imenu-enable t
lsp-ui-flycheck-enable t)
36 changes: 36 additions & 0 deletions haskell.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
(setenv "PATH" (concat (getenv "HOME") "/.ghcup/bin:" (getenv "HOME") "/.local/bin:" "/usr/local/bin:" (getenv "PATH")))

(setq exec-path
(reverse
(append
(reverse exec-path)
(list (concat (getenv "HOME") "/.ghcup/bin" (getenv "HOME") "/.local/bin") "/usr/local/bin" ))))

(use-package flycheck
:ensure t
:init
(global-flycheck-mode t))

(use-package yasnippet
:ensure t)

(use-package lsp-mode
:ensure t
:hook (haskell-mode . lsp)
:commands lsp)

(use-package lsp-ui
:ensure t
:commands lsp-ui-mode)

(use-package lsp-haskell
:ensure t
:config
;; :mode ("\\.cabal\\" "\\.hs\\")
(setq lsp-haskell-server-path "haskell-language-server-wrapper")
(setq lsp-haskell-server-args ())
;; Comment/uncomment this line to see interactions between lsp client/server.
(setq lsp-log-io t))

(add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-literate-mode-hook #'lsp)
49 changes: 49 additions & 0 deletions init.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(menu-bar-mode -1)
(tool-bar-mode -1)

;;(setq EMACS_DIR "~/.emacs.d/")

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
;; (setq use-package-always-pin "melpa-stable")
(package-initialize)

;; Download use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))

(eval-when-compile (require 'use-package))
(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.
'(custom-enabled-themes '(doom-palenight))
'(custom-safe-themes
'("c83c095dd01cde64b631fb0fe5980587deec3834dc55144a6e78ff91ebc80b19" default))
'(package-selected-packages
'(helm-swoop lsp-java clojure-mode lsp-mode cider lsp-treemacs flycheck company)))
(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.
)

(load "~/.emacs.d/centaur-tabs.el")
(load "~/.emacs.d/treemacs.el")
(load "~/.emacs.d/cmake.el")
;;(load "~/.emacs.d/java.el")
(load "~/.emacs.d/scala.el")
(load "~/.emacs.d/golang.el")
(load "~/.emacs.d/python.el")
(load "~/.emacs.d/haskell.el")
(load "~/.emacs.d/cpp.el")
(load "~/.emacs.d/clojure.el")
(load "~/.emacs.d/tabnine.el")
(load "~/.emacs.d/java.el")


(add-hook 'emacs-startup-hook 'treemacs)
Loading

0 comments on commit 8c8e592

Please sign in to comment.