Some helpful tips on how to use Emacs org-mode as a developer. Here is a blog article I’ve written on the topic if you’re interested.
// Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
// Remove any duplicates from an array of primitives. | |
const unique = [...new Set(arr)] | |
// Sleep in async functions. Use: await sleep(2000). | |
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
// or | |
const sleep = util.promisify(setTimeout); |
"{ Auto commands | |
" Do not use smart case in command line mode, | |
" extracted from https://goo.gl/vCTYdK | |
augroup dynamic_smartcase | |
autocmd! | |
autocmd CmdLineEnter : set nosmartcase | |
autocmd CmdLineLeave : set smartcase | |
augroup END | |
" Set textwidth for text file types |
For a while, JSX
and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.
This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.
Set up web-mode
web-mode
provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.
I recently switched over to neovim (see my screenshots at the bottom). Below is my updated config file.
It's currently synchronized with my .vimrc
config except for a block of neovim-specific terminal key mappings.
This is still a work in progress (everyone's own config is always a labor of love), but I'm already extremely pleased with how well this is working for me with neovim. While terminal mode isn't enough to make me stop using tmux, it is quite good and I like having it since it simplifies my documentation workflow for yanking terminal output to paste in a markdown buffer.
These days I primarily develop in Go. I'm super thrilled and grateful for fatih/vim-go,
-- Inspired by Linux alt-drag or Better Touch Tools move/resize functionality | |
function get_window_under_mouse() | |
-- Invoke `hs.application` because `hs.window.orderedWindows()` doesn't do it | |
-- and breaks itself | |
local _ = hs.application | |
local my_pos = hs.geometry.new(hs.mouse.getAbsolutePosition()) | |
local my_screen = hs.mouse.getCurrentScreen() |
These are just proof of concept at the moment. All taken from the following sources:
Credits for Nescaline to:
* Copyright (c) 2014 Vesa Kivimäki
(defn factorize [n] | |
((fn f [n [h & r :as ps]] | |
(cond (< n 2) '() | |
(zero? (mod n h)) (cons h (lazy-seq (f (quot n h) ps))) | |
:else (recur n r))) | |
n prime-numbers))) |