An open API service indexing awesome lists of open source software.

https://github.com/customcommander/dotfiles


https://github.com/customcommander/dotfiles

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

* My Dotfiles

** Development

I use Emacs and its literate programming features.

The content of both the =Makefile= and the =files= directory
is generated out of this org file, so do not edit these directly
but work on this document instead!

Then:

1. Run =C-c C-v t=
2. Commit all the changes
3. Run =make=

** Install

1. Clone this repository (or pull the latest changes)
2. Run =make=

These are the files that will be copied over your home directory

#+begin_src makefile :tangle Makefile :mkdirp yes
install: $(HOME)/.gitconfig \
$(HOME)/.gitconfig-local \
$(HOME)/.gitignore \
$(HOME)/.emacs.d/init.el
#+end_src

** My Setup

*** Manual Install

#+begin_src shell
brew install clojure-lsp/brew/clojure-lsp-native
#+end_src

*** Git

My global Git configuration file will be installed in my home directory:

#+begin_src makefile :tangle Makefile :mkdirp yes
$(HOME)/.gitconfig: files/.gitconfig
cp -f $^ $@
#+end_src

It will make provision for local additions that
can't be checked in for whatever reason (e.g. work stuff).

#+begin_src text :tangle files/.gitconfig :mkdirp yes
[include]
path = ~/.gitconfig-local
#+end_src

That file also lives in my home directory:

#+begin_src makefile :tangle Makefile
$(HOME)/.gitconfig-local:; touch $(HOME)/.gitconfig-local
#+end_src

These are the things I always want Git to ignore:

#+begin_src text :tangle files/.gitignore :mkdirp yes
,*~
.DS_Store
.\#*
.clj-kondo
.cljs_node_repl
.cpcache
.hgignore
.lsp
.nrepl-port
\#*\#
dist
node_modules
out
resources
target
#+end_src

These patterns live in a file in my home directory:

#+begin_src makefile :tangle Makefile
$(HOME)/.gitignore: files/.gitignore
cp -f $^ $@
#+end_src

And that file is referenced in my global Git configuration file:

#+begin_src text :tangle files/.gitconfig :mkdirp yes
[core]
excludesFile = ~/.gitignore
#+end_src

*** Emacs

Open Emacs maximised:

#+begin_src emacs-lisp :tangle files/init.el
(add-to-list 'initial-frame-alist '(fullscreen . maximized))
#+end_src

/Remember that what we usually refer to as a window is called a frame in Emacs parlance./

I don't find both Emacs toolbar & scrollbar very useful so I disable them:

#+begin_src emacs-lisp :tangle files/init.el
(tool-bar-mode -1)
(scroll-bar-mode -1)
#+end_src

Disable default left and right margins:

#+begin_src emacs-lisp :tangle files/init.el
(set-fringe-mode 0)
#+end_src

I always want to see line numbers so I enable that feature globally:

#+begin_src emacs-lisp :tangle files/init.el
(global-display-line-numbers-mode t)
#+end_src

I need this as other I cannot type that character :)

#+begin_src emacs-lisp :tangle files/init.el
(global-set-key (kbd "M-3") (lambda ()
(interactive)
(insert "#")))
#+end_src

This seems to be frowned upon but I find using =Shift= and the arrow keys
really handy to navigate the windows:

#+begin_src emacs-lisp :tangle files/init.el
(windmove-default-keybindings)
#+end_src

This allows a "circular" navigation e.g. if you reach the last window
then =Shift-= get you back to the first window.

#+begin_src emacs-lisp :tangle files/init.el
(setq windmove-wrap-around t)
#+end_src

#+begin_src emacs-lisp :tangle files/init.el
(setq treesit-language-source-alist
'((tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")))

(mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist))
#+end_src

Indentation

#+begin_src emacs-lisp :tangle files/init.el
(electric-indent-mode -1)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq-default js-indent-level 2)
#+end_src

I need this to avoid choking lsp-mode:
https://emacs-lsp.github.io/lsp-mode/page/performance/

#+begin_src emacs-lisp :tangle files/init.el
(setq read-process-output-max (* 1024 1024)) ;; 1mb
(setq gc-cons-threshold 100000000)
#+end_src

Use =ibuffer= instead of =list-buffers= on =C-x C-b=

#+begin_src emacs-lisp :tangle files/init.el
(global-set-key (kbd "C-x C-b") 'ibuffer)
#+end_src

**** Packages

I use [[https://github.com/radian-software/straight.el][straight.el]] as my package manager.

This is what is needed to bootstrap it:

#+begin_src emacs-lisp :tangle files/init.el
(defvar bootstrap-version)

(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))

;; tell `use-package` to use `straight.el` as the package manager
(setq straight-use-package-by-default t)

(straight-use-package 'use-package)
#+end_src

**** Fira Code

First, make sure [[https://github.com/tonsky/FiraCode][Fira Code]] is installed!

#+begin_src emacs-lisp :tangle files/init.el
(set-frame-font "Fira Code:size=14")

(use-package ligature
:init
;; Enable the www ligature in every possible major mode
(ligature-set-ligatures 't '("www"))

;; Enable ligatures in programming modes
(ligature-set-ligatures 'prog-mode '("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\" "{-" "::"
":::" ":=" "!!" "!=" "!==" "-}" "----" "-->" "->" "->>"
"-<" "-<<" "-~" "#{" "#[" "##" "###" "####" "#(" "#?" "#_"
"#_(" ".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*" "/**"
"/=" "/==" "/>" "//" "///" "&&" "||" "||=" "|=" "|>" "^=" "$>"
"++" "+++" "+>" "=:=" "==" "===" "==>" "=>" "=>>" "<="
"=<<" "=/=" ">-" ">=" ">=>" ">>" ">>-" ">>=" ">>>" "<*"
"<*>" "<|" "<|>" "<$" "<$>" "