Vim and Emacs - ionathanch/ionathanch.github.io GitHub Wiki

.vimrc

sensible.vim with the following additions:

colorscheme peachpuff " desert, slate are nice too
set shiftwidth=2      " 2-space tabs (reindenting)
set tabstop=2         " 2-space tabs (viewing)
set softtabstop=2     " 2-space tabs (editing)
set expandtab         " tabs -> spaces
set number            " line numbers
set hlsearch          " highlight search matches
set smartcase         " being smart about cases during searching
set mouse=a           " click to place cursor

" Map register "+ to system secondary clipboard
" and set Ctrl-c/Ctrl-x as copy/cut
" N.B. Pasting will still require Ctrl-Shift-V
set clipboard=unnamedplus
vmap <C-C> "+y
vmap <C-X> "+d

" :W sudo-saves the file
" (useful for handling the permission-denied error)
" https://github.com/amix/vimrc/blob/master/vimrcs/basic.vim
" command! W execute [cmd] -- :W runs [cmd]
" [cmd] <bar> [cmd]        -- command sequencing
" :w ![cmd]                -- run [cmd] with buffer as stdin
" tee [file]               -- print stdin to [file] and stdout
" %                        -- current file name
" edit!                    -- reopen file to clear unsaved flag
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!

.emacs

;; Sensible key bindings
(global-set-key [backtab] 'auto-complete) ;; S-<tab>
(global-set-key (kbd "C-f") 'isearch-forward)
(define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)
(global-set-key (kbd "C-z") 'undo)
(global-set-key (kbd "C-s") 'save-buffer)
(global-set-key (kbd "C-S-s") 'write-file) ;; TODO: Make it open dialog box somehow
(global-set-key (kbd "C-o") 'find-file)
(global-set-key (kbd "C-a") 'mark-whole-buffer)
(global-set-key (kbd "C-w") 'kill-buffer-and-window)
(global-set-key (kbd "C-t") 'split-window-horizontally)
(global-set-key (kbd "C-S-t") 'tab-new)
(global-set-key (kbd "C-q") 'delete-frame)
(global-set-key (kbd "C-n") 'make-frame-command)
(global-set-key (kbd "ESC ESC ESC") 'keyboard-quit)

;; https://stackoverflow.com/a/26484229/9270195
(defadvice find-file-read-args (around find-file-read-args-always-use-dialog-box act)
  "Simulate invoking menu item as if by the mouse; see `use-dialog-box'."
  (let ((last-nonmenu-event nil))
     ad-do-it))

;; Other configurations
(set-frame-font "Julia Mono" nil t)
(set-fontset-font t 'han "TW-Kai")
(setq-default cursor-type 'bar)
(setq-default mouse-wheel-scroll-amount '(1 ((shift) . 1)))
⚠️ **GitHub.com Fallback** ⚠️