Skip to content

Instantly share code, notes, and snippets.

@zuchmanski
Created January 7, 2017 11:22
Show Gist options
  • Save zuchmanski/a6c9e819cd745e2b0549c86cf75b3412 to your computer and use it in GitHub Desktop.
Save zuchmanski/a6c9e819cd745e2b0549c86cf75b3412 to your computer and use it in GitHub Desktop.
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
;; or `spacemacs'. (default 'spacemacs)
dotspacemacs-distribution 'spacemacs
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
;; List of configuration layers to load. If it is the symbol `all' instead
;; of a list then all discovered layers will be installed.
dotspacemacs-configuration-layers
'(
sql
;; ----------------------------------------------------------------
;; Example of useful layers you may want to use right away.
;; Uncomment some layer names and press <SPC f e R> (Vim style) or
;; <M-m f e R> (Emacs style) to install them.
;; ----------------------------------------------------------------
auto-completion
;; better-defaults
emacs-lisp
git
ruby
ruby-on-rails
osx
colors
markdown
;; org
;; (shell :variables
;; shell-default-height 30
;; shell-default-position 'bottom)
;; spell-checking
syntax-checking
version-control
)
;; List of additional packages that will be installed without being
;; wrapped in a layer. If you need some configuration for these
;; packages then consider to create a layer, you can also put the
;; configuration in `dotspacemacs/config'.
dotspacemacs-additional-packages '(
haml-mode
coffee-mode
sass-mode
rvm
expand-region
darkroom
ace-jump-mode
robe
yaml-mode
multiple-cursors
el-get
tangotango-theme
atom-one-dark-theme
color-theme-sanityinc-tomorrow
material-theme
solarized-theme
evil-mc
evil-escape
ruby-hash-syntax
ruby-refactor
tabbar
simpleclip
evil-easymotion
moe-theme
sublime-themes
evil-vimish-fold
)
;; A list of packages and/or extensions that will not be install and loaded.
dotspacemacs-excluded-packages '()
;; If non-nil spacemacs will delete any orphan packages, i.e. packages that
;; are declared in a layer which is not a member of
;; the list `dotspacemacs-configuration-layers'. (default t)
dotspacemacs-delete-orphan-packages t))
(defun dotspacemacs/init ()
"Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
;; This setq-default sexp is an exhaustive list of all the supported
;; spacemacs settings.
(setq-default
;; One of `vim', `emacs' or `hybrid'. Evil is always enabled but if the
;; variable is `emacs' then the `holy-mode' is enabled at startup. `hybrid'
;; uses emacs key bindings for vim's insert mode, but otherwise leaves evil
;; unchanged. (default 'vim)
dotspacemacs-editing-style 'vim
;; If non nil output loading progress in `*Messages*' buffer. (default nil)
dotspacemacs-verbose-loading nil
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a radark
dotspacemacs-themes '(
material
sanityinc-tomorrow-eighties
spacemacs-dark
spacemacs-light
)
;; If non nil the cursor color matches the state color.
dotspacemacs-colorize-cursor-according-to-state t
;; Default font. `powerline-scale' allows to quickly tweak the mode-line
;; size to make separators look not too crappy.
dotspacemacs-default-font '("Fira Code"
:size 14
:weight normal
:width normal
:powerline-scale 1)
;; The leader key
dotspacemacs-leader-key "SPC"
;; The leader key accessible in `emacs state' and `insert state'
;; (default "M-m")
dotspacemacs-emacs-leader-key "M-m"
;; Major mode leader key is a shortcut key which is the equivalent of
;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
dotspacemacs-major-mode-leader-key ","
;; Major mode leader key accessible in `emacs state' and `insert state'.
;; (default "C-M-m)
dotspacemacs-major-mode-emacs-leader-key "C-M-m"
;; The command key used for Evil commands (ex-commands) and
;; Emacs commands (M-x).
;; By default the command key is `:' so ex-commands are executed like in Vim
;; with `:' and Emacs commands are executed with `<leader> :'.
dotspacemacs-command-key ":"
;; If non nil `Y' is remapped to `y$'. (default t)
dotspacemacs-remap-Y-to-y$ t
;; Location where to auto-save files. Possible values are `original' to
;; auto-save the file in-place, `cache' to auto-save the file to another
;; file stored in the cache directory and `nil' to disable auto-saving.
;; (default 'cache)
dotspacemacs-auto-save-file-location 'cache
;; If non nil then `ido' replaces `helm' for some commands. For now only
;; `find-files' (SPC f f), `find-spacemacs-file' (SPC f e s), and
;; `find-contrib-file' (SPC f e c) are replaced. (default nil)
dotspacemacs-use-ido nil
;; If non nil, `helm' will try to miminimize the space it uses. (default nil)
dotspacemacs-helm-resize nil
;; if non nil, the helm header is hidden when there is only one source.
;; (default nil)
dotspacemacs-helm-no-header nil
;; define the position to display `helm', options are `bottom', `top',
;; `left', or `right'. (default 'bottom)
dotspacemacs-helm-position 'bottom
;; If non nil the paste micro-state is enabled. When enabled pressing `p`
;; several times cycle between the kill ring content. (default nil)
dotspacemacs-enable-paste-micro-state nil
;; Which-key delay in seconds. The which-key buffer is the popup listing
;; the commands bound to the current keystroke sequence. (default 0.4)
dotspacemacs-which-key-delay 0.4
;; Which-key frame position. Possible values are `right', `bottom' and
;; `right-then-bottom'. right-then-bottom tries to display the frame to the
;; right; if there is insufficient space it displays it at the bottom.
;; (default 'bottom)
dotspacemacs-which-key-position 'bottom
;; If non nil a progress bar is displayed when spacemacs is loading. This
;; may increase the boot time on some systems and emacs builds, set it to
;; nil to boost the loading time. (default t)
dotspacemacs-loading-progress-bar t
;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
;; (Emacs 24.4+ only)
dotspacemacs-fullscreen-at-startup nil
;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
;; Use to disable fullscreen animations in OSX. (default nil)
dotspacemacs-fullscreen-use-non-native nil
;; If non nil the frame is maximized when Emacs starts up.
;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
;; (default nil) (Emacs 24.4+ only)
dotspacemacs-maximized-at-startup nil
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's active or selected.
;; Transparency can be toggled through `toggle-transparency'. (default 90)
dotspacemacs-active-transparency 90
;; A value from the range (0..100), in increasing opacity, which describes
;; the transparency level of a frame when it's inactive or deselected.
;; Transparency can be toggled through `toggle-transparency'. (default 90)
dotspacemacs-inactive-transparency 90
;; If non nil unicode symbols are displayed in the mode line. (default t)
dotspacemacs-mode-line-unicode-symbols t
;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
;; scrolling overrides the default behavior of Emacs which recenters the
;; point when it reaches the top or bottom of the screen. (default t)
dotspacemacs-smooth-scrolling t
;; If non-nil smartparens-strict-mode will be enabled in programming modes.
;; (default nil)
dotspacemacs-smartparens-strict-mode nil
;; Select a scope to highlight delimiters. Possible values are `any',
;; `current', `all' or `nil'. Default is `all' (highlight any scope and
;; emphasis the current one). (default 'all)
dotspacemacs-highlight-delimiters 'all
;; If non nil advises quit functions to keep server open when quitting.
;; (default nil)
dotspacemacs-persistent-server nil
;; List of search tool executable names. Spacemacs uses the first installed
;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
;; (default '("ag" "pt" "ack" "grep"))
dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
;; The default package repository used if no explicit repository has been
;; specified with an installed package.
;; Not used for now. (default nil)
dotspacemacs-default-package-repository nil
))
(defun dotspacemacs/user-init ()
"Initialization function for user code.
It is called immediately after `dotspacemacs/init'. You are free to put any
user code."
(add-hook 'ruby-mode-hook 'robe-mode)
(add-hook 'ruby-mode-hook 'yard-mode)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(add-hook 'ruby-mode-hook
(lambda () (modify-syntax-entry ?_ "w")))
(add-hook 'coffee-mode-hook
(lambda () (modify-syntax-entry ?_ "w")))
(eval-after-load 'company
'(push 'company-robe company-backends))
(add-to-list 'auto-mode-alist '("\\.rabl\\'" . ruby-mode))
;; (add-hook 'ruby-mode-hook (lambda () (electric-indent-local-mode -1)))
)
(defun dotspacemacs/user-config ()
"Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration. You are free to put any user code."
(setq-default line-spacing 5)
(setq neo-vc-integration nil)
(setq neo-theme 'nerd)
(setq powerline-default-separator nil)
(rvm-use-default)
(setq flycheck-ruby-executable "/Users/sebcioz/.rvm/rubies/ruby-2.3.0/bin/ruby")
(evil-ex-define-cmd "sp" 'split-window-below-and-focus)
(evil-ex-define-cmd "vs" 'split-window-right-and-focus)
(evil-ex-define-cmd "vsp" 'split-window-right-and-focus)
(golden-ratio-mode 1)
(global-superword-mode 1)
(global-company-mode)
(simpleclip-mode 1)
(spaceline-toggle-window-number-off)
(spaceline-toggle-evil-state-off)
(spaceline-toggle-buffer-modified-off)
(spaceline-toggle-buffer-size-off)
(spaceline-toggle-major-mode-off)
(spaceline-toggle-minor-modes-off)
(spaceline-toggle-buffer-id-off)
(spaceline-toggle-buffer-encoding-abbrev-off)
(spaceline-toggle-buffer-position-off)
(spaceline-toggle-hud-off)
(modify-syntax-entry ?_ "w")
(setq golden-ratio-adjust-factor .8
golden-ratio-wide-adjust-factor .8)
(setq-default dotspacemacs-configuration-layers
'((auto-completion :variables
auto-completion-enable-snippets-in-popup t)))
(setq ac-delay 0.2)
(setq ac-auto-show-menu 0.2)
(define-key evil-visual-state-map (kbd "v") 'er/expand-region)
(global-set-key (kbd "s-w") 'kill-this-buffer)
(global-set-key (kbd "s-e") 'helm-mini)
(global-set-key (kbd "s-p") 'helm-projectile-find-file)
(global-set-key (kbd "s-o") 'avy-goto-char-timer)
(setq ace-jump-word-mode-use-query-char nil)
(defun shift-region (distance)
(let ((mark (mark)))
(save-excursion
(indent-rigidly (region-beginning) (region-end) distance)
(push-mark mark t t)
(setq deactivate-mark nil))))
(defun shift-right ()
(interactive)
(shift-region 2))
(defun shift-left ()
(interactive)
(shift-region -2))
(global-set-key [S-right] 'shift-right)
(global-set-key [S-left] 'shift-left)
;;; SPACE BRACKETS
(defun my/c-mode-insert-space (arg)
(interactive "*P")
(let ((prev (char-before))
(next (char-after)))
(self-insert-command (prefix-numeric-value arg))
(if (and prev next
(string-match-p "[[({]" (string prev))
(string-match-p "[])}]" (string next)))
(save-excursion (self-insert-command 1)))))
(defun my/c-mode-delete-space (arg &optional killp)
(interactive "*p\nP")
(let ((prev (char-before))
(next (char-after))
(pprev (char-before (- (point) 1))))
(if (and prev next pprev
(char-equal prev ?\s) (char-equal next ?\s)
(string-match "[[({]" (string pprev)))
(delete-char 1))
(backward-delete-char-untabify arg killp)))
(global-set-key " " 'my/c-mode-insert-space)
(global-set-key "\177" 'my/c-mode-delete-space)
;;; END SPACE BRACKEtS
(global-set-key "+" 'er/expand-region)
(global-set-key "-" 'er/contract-region)
(setq default-frame-alist '((width . 160) (height . 50)))
(define-key evil-motion-state-map "j" #'evil-next-visual-line)
(define-key evil-motion-state-map "k" #'evil-previous-visual-line)
(define-key evil-normal-state-map (kbd "C-k") (lambda ()
(interactive)
(evil-scroll-up nil)))
(define-key evil-normal-state-map (kbd "C-j") (lambda ()
(interactive)
(evil-scroll-down nil)))
;; ;; (add-hook 'ruby-mode-hook 'ruby-refactor-mode-launch)
(setq ruby-insert-encoding-magic-comment nil)
;; ;; (setq ruby-align-chained-calls nil
;; ;; ruby-align-to-stmt-keywords nil
;; ;; ruby-deep-indent-paren nil
;; ;; ruby-deep-indent-paren-style nil
;; ;; ruby-use-smie nil)
(setq js-indent-level 2)
;; (setq 'ruby-align-to-stmt-keywords t)
;; ;; (autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t)
;; ;; (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
;; ;; (add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
;; (defadvice inf-ruby-console-auto (before activate-rvm-for-robe activate)
;; (rvm-activate-corresponding-ruby))
(require 'tabbar)
(tabbar-mode 1)
(defun tabbar-buffer-groups ()
"Returns the list of group names the current buffer belongs to."
(list
(cond
((string-equal "*" (substring (buffer-name) 0 1))
"Common"
)
(t
"General"
))))
(setq tabbar-buffer-groups-function 'tabbar-buffer-groups)
(global-set-key [M-s-left] 'tabbar-backward)
(global-set-key [M-s-right] 'tabbar-forward)
(defcustom tabbar-hide-header-button t
"Hide header button at left-up corner.
Default is t."
:type 'boolean
:set (lambda (symbol value)
(set symbol value)
(if value
(setq
tabbar-scroll-left-help-function nil ;don't show help information
tabbar-scroll-right-help-function nil
tabbar-help-on-tab-function nil
tabbar-home-help-function nil
tabbar-buffer-home-button (quote (("") "")) ;don't show tabbar button
tabbar-scroll-left-button (quote (("") ""))
tabbar-scroll-right-button (quote (("") "")))))
:group 'tabbar)
(defun tabbar-filter (condp lst)
(delq nil
(mapcar (lambda (x) (and (funcall condp x) x)) lst)))
(defun tabbar-filter-buffer-list ()
(tabbar-filter
(lambda (x)
(let ((name (format "%s" x)))
(and
(not (string-prefix-p "*epc" name))
(not (string-prefix-p "*helm" name))
(not (string-prefix-p "*Messages*" name))
(not (string-equal "*" (substring name 0 1)))
)))
(delq nil
(mapcar #'(lambda (b)
(cond
;; Always include the current buffer.
((eq (current-buffer) b) b)
((buffer-file-name b) b)
((char-equal ?\ (aref (buffer-name b) 0)) nil)
((buffer-live-p b) b)))
(buffer-list)))))
(setq tabbar-buffer-list-function 'tabbar-filter-buffer-list)
;; TABBAR VISUAL
;; Tabbar settings
(set-face-attribute
'tabbar-default nil
:background "gray20"
:foreground "gray20"
:box '(:line-width 1 :color "gray20" :style nil))
(set-face-attribute
'tabbar-unselected nil
:background "gray30"
:foreground "white"
:box '(:line-width 5 :color "gray30" :style nil))
(set-face-attribute
'tabbar-selected nil
:background "gray75"
:foreground "black"
:box '(:line-width 5 :color "gray75" :style nil))
(set-face-attribute
'tabbar-highlight nil
:background "white"
:foreground "black"
:underline nil
:box '(:line-width 5 :color "white" :style nil))
(set-face-attribute
'tabbar-button nil
:box '(:line-width 1 :color "gray20" :style nil))
(set-face-attribute
'tabbar-separator nil
:background "gray20"
:height 0.6)
;; Change padding of the tabs
;; we also need to set separator to avoid overlapping tabs by highlighted tabs
(custom-set-variables
'(tabbar-separator (quote (0.5))))
;; adding spaces
(defun tabbar-buffer-tab-label (tab)
"Return a label for TAB.
That is, a string used to represent it on the tab bar."
(let ((label (if tabbar--buffer-show-groups
(format " [%s] " (tabbar-tab-tabset tab))
(format " %s " (tabbar-tab-value tab)))))
;; Unless the tab bar auto scrolls to keep the selected tab
;; visible, shorten the tab label to keep as many tabs as possible
;; in the visible area of the tab bar.
(if tabbar-auto-scroll-flag
label
(tabbar-shorten
label (max 1 (/ (window-width)
(length (tabbar-view
(tabbar-current-tabset)))))))))
(tabbar-mode 1)
;; TABBAR VISUAL END
;; (setq x-select-enable-clipboard nil)
;; (evilem-default-keybindings "SPC o")
;; (global-set-key (kbd "C-o") 'avy-goto-char-2)
)
;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(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.
'(compilation-message-face (quote default))
'(cua-global-mark-cursor-color "#2aa198")
'(cua-normal-cursor-color "#839496")
'(cua-overwrite-cursor-color "#b58900")
'(cua-read-only-cursor-color "#859900")
'(highlight-changes-colors (quote ("#d33682" "#6c71c4")))
'(highlight-symbol-colors
(--map
(solarized-color-blend it "#002b36" 0.25)
(quote
("#b58900" "#2aa198" "#dc322f" "#6c71c4" "#859900" "#cb4b16" "#268bd2"))))
'(highlight-symbol-foreground-color "#93a1a1")
'(highlight-tail-colors
(quote
(("#073642" . 0)
("#546E00" . 20)
("#00736F" . 30)
("#00629D" . 50)
("#7B6000" . 60)
("#8B2C02" . 70)
("#93115C" . 85)
("#073642" . 100))))
'(hl-bg-colors
(quote
("#7B6000" "#8B2C02" "#990A1B" "#93115C" "#3F4D91" "#00629D" "#00736F" "#546E00")))
'(hl-fg-colors
(quote
("#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36" "#002b36")))
'(magit-diff-use-overlays nil)
'(nrepl-message-colors
(quote
("#dc322f" "#cb4b16" "#b58900" "#546E00" "#B4C342" "#00629D" "#2aa198" "#d33682" "#6c71c4")))
'(package-selected-packages
(quote
(sql-indent org undo-tree evil-vimish-fold vimish-fold uuidgen toc-org osx-dictionary org-plus-contrib org-bullets minitest link-hint hide-comnt git-link eyebrowse evil-visual-mark-mode evil-unimpaired evil-ediff dumb-jump column-enforce-mode color-identifiers-mode rake inflections spinner parent-mode request haml-mode gitignore-mode fringe-helper git-gutter+ pkg-info epl flx with-editor pos-tip auto-complete bind-key git-gutter packed avy company anzu iedit smartparens highlight flycheck yasnippet helm popup helm-core markdown-mode magit magit-popup git-commit async hydra projectile f inf-ruby s dash powerline package-build bind-map evil sublime-themes base16-theme moe-theme evil-easymotion simpleclip tabbar-ruler mode-icons tabbar yaml-mode ws-butler window-numbering which-key volatile-highlights vi-tilde-fringe use-package tangotango-theme spacemacs-theme spaceline solarized-theme smooth-scrolling smeargle sass-mode rvm ruby-tools ruby-test-mode ruby-refactor ruby-hash-syntax rubocop rspec-mode robe reveal-in-osx-finder restart-emacs rbenv rainbow-mode rainbow-identifiers rainbow-delimiters quelpa projectile-rails popwin persp-mode pcre2el pbcopy paradox page-break-lines osx-trash orgit open-junk-file neotree multiple-cursors move-text mmm-mode material-theme markdown-toc magit-gitflow macrostep lorem-ipsum linum-relative leuven-theme launchctl info+ indent-guide ido-vertical-mode hungry-delete hl-todo highlight-parentheses highlight-numbers highlight-indentation help-fns+ helm-themes helm-swoop helm-projectile helm-mode-manager helm-make helm-gitignore helm-flx helm-descbinds helm-company helm-c-yasnippet helm-ag google-translate golden-ratio gitconfig-mode gitattributes-mode git-timemachine git-messenger git-gutter-fringe git-gutter-fringe+ gh-md flycheck-pos-tip flx-ido fill-column-indicator feature-mode fancy-battery expand-region exec-path-from-shell evil-visualstar evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-indent-plus evil-iedit-state evil-exchange evil-escape evil-args evil-anzu eval-sexp-fu enh-ruby-mode elisp-slime-nav el-get diff-hl define-word darkroom company-statistics company-quickhelp color-theme-sanityinc-tomorrow coffee-mode clean-aindent-mode chruby bundler buffer-move bracketed-paste auto-yasnippet auto-highlight-symbol auto-compile atom-one-dark-theme aggressive-indent adaptive-wrap ace-window ace-link ace-jump-mode ace-jump-helm-line ac-ispell)))
'(paradox-github-token t)
'(pos-tip-background-color "#073642")
'(pos-tip-foreground-color "#93a1a1")
'(safe-local-variable-values (quote ((encoding . utf-8))))
'(smartrep-mode-line-active-bg (solarized-color-blend "#859900" "#073642" 0.2))
'(tabbar-separator (quote (0.5)))
'(term-default-bg-color "#002b36")
'(term-default-fg-color "#839496")
'(weechat-color-list
(quote
(unspecified "#002b36" "#073642" "#990A1B" "#dc322f" "#546E00" "#859900" "#7B6000" "#b58900" "#00629D" "#268bd2" "#93115C" "#d33682" "#00736F" "#2aa198" "#839496" "#657b83")))
'(xterm-color-names
["#073642" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#eee8d5"])
'(xterm-color-names-bright
["#002b36" "#cb4b16" "#586e75" "#657b83" "#839496" "#6c71c4" "#93a1a1" "#fdf6e3"]))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment