Compare commits

...

15 Commits

Author SHA1 Message Date
womax 04bf47cd66 Doom emacs bin export path 2026-04-30 07:54:26 -04:00
womax f114c61348 Better venv aliase and emacs config updates 2026-04-30 07:54:02 -04:00
womax f2653e0cf3 Switch to DOOM Emacs 2026-04-27 20:55:31 -04:00
Antonin Ruan 6ef95200b7 tmux conf and some aliases 2026-04-01 16:53:13 -04:00
Antonin Ruan 354e44f713 mouse fix vimrc 2026-01-27 21:45:45 +01:00
Antonin Ruan 7856bd42bc minor changes 2026-01-27 21:45:39 +01:00
Antonin Ruan 77afc69650 add mosh aliases 2026-01-27 21:44:43 +01:00
Antonin Ruan 255c44ee92 more i3 config 2026-01-27 21:44:09 +01:00
Antonin Ruan cb5df40b40 i3 config and updates 2025-09-27 15:57:35 +02:00
Antonin Ruan ba845c0675 Switch to Melpa Stable 2025-08-19 16:04:07 +02:00
Antonin Ruan 6973d5e562 Remove unused grammar import for treesitter 2025-08-19 16:03:30 +02:00
Antonin Ruan fb8f2726b9 Merge branch 'master' of github.com:AntoninRuan/dotfiles 2025-08-19 16:01:32 +02:00
Antonin Ruan 568b05f1e5 Add aliases, update rofi config and add rofi spotify mode launch script 2025-08-19 15:57:09 +02:00
Antonin Ruan 009dbc73ae Update rofi spotify script to use a better cache architecture 2025-08-19 15:48:30 +02:00
womax 5005d3a4ad Add typescript setup for emacs 2025-06-23 18:45:49 +02:00
25 changed files with 986 additions and 1565 deletions
+32 -2
View File
@@ -19,12 +19,42 @@ alias ls='ls --color=tty'
alias lsa='ls -lah' alias lsa='ls -lah'
alias md='mkdir -p' alias md='mkdir -p'
alias rd=rmdir alias rd=rmdir
alias venv='source .env/bin/activate'
alias which-command=whence alias which-command=whence
alias copy="xclip -selection clipboard" alias copy="xclip -selection clipboard"
alias mkcdir='f() { md $1; cd $1 }; f' alias mkcdir='f() { md $1; cd $1 }; f'
alias sctl='systemctl'
alias userctl='systemctl --user'
alias uctl='userctl'
alias kdiff="kitten diff" alias kdiff="kitten diff"
alias kssh="kitten ssh" alias kssh="kitten ssh"
alias kussh="kitten ssh -o StrictHostKeyChecking=no"
alias os="openstack"
alias mssh="mosh --ssh='kitten ssh'"
alias mussh="mosh --ssh='kitten ssh -o StrictHostKeyChecking=no'"
alias gf2="/usr/bin/gf2 &> /dev/null &" alias gf2="/usr/bin/gf2 &> /dev/null &"
alias qemu-monitor="telnet 127.0.0.1 7777" alias qemu-monitor="telnet 127.0.0.1 7777"
alias sudo="/usr/bin/sudo"
function venv () {
VENV_DIR=""
if [ -d .env ] ; then
VENV_DIR=".env"
elif [ -d .venv ]; then
VENV_DIR=".venv"
elif [ -d env ] ; then
VENV_DIR="env"
elif [ -d venv ] ; then
VENV_DIR="venv"
fi
if [[ -z "$VENV_DIR" ]]; then
echo "Error: no virtual venv directory found"
return
fi
echo "Activating $VENV_DIR"
source "${VENV_DIR}/bin/activate"
}
+186
View File
@@ -0,0 +1,186 @@
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
;; (setq user-full-name "John Doe"
;; user-mail-address "john@doe.com")
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-symbol-font' -- for symbols
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
(setq doom-font (font-spec :family "Iosevka" :size 15 :weight 'semi-light)
doom-variable-pitch-font (font-spec :family "Iosevka" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'gruber-darker)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/org/")
;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `with-eval-after-load' block, otherwise Doom's defaults may override your
;; settings. E.g.
;;
;; (with-eval-after-load 'PACKAGE
;; (setq x y))
;;
;; The exceptions to this rule:
;;
;; - Setting file/directory variables (like `org-directory')
;; - Setting variables which explicitly tell you to set them before their
;; package is loaded (see 'C-h v VARIABLE' to look them up).
;; - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
(defun toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(next-win-edges (window-edges (next-window)))
(this-win-2nd (not (and (<= (car this-win-edges)
(car next-win-edges))
(<= (cadr this-win-edges)
(cadr next-win-edges)))))
(splitter
(if (= (car this-win-edges)
(car (window-edges (next-window))))
'split-window-horizontally
'split-window-vertically)))
(delete-other-windows)
(let ((first-win (selected-window)))
(funcall splitter)
(if this-win-2nd (other-window 1))
(set-window-buffer (selected-window) this-win-buffer)
(set-window-buffer (next-window) next-win-buffer)
(select-window first-win)
(if this-win-2nd (other-window 1))))))
(global-set-key (kbd "C-t") 'toggle-window-split)
(setq compile-command "")
;; Comment
(map! "C-;" 'comment-dwim-2)
;; Duplicate line
(defun duplicate-line ()
"Duplicate current line"
(interactive)
(let ((column (- (point) (pos-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
(global-set-key (kbd "C-,") 'duplicate-line)
;; Magit
(map! :leader "m s" 'magit-status)
;; Multi cursors
(map! "C-S-n" 'mc/mark-next-like-this)
(map! "C-S-p" 'mc/mark-previous-like-this)
(setq tramp-auto-save-directory "/tmp")
;; Move text
(map! "M-p" 'move-text-up)
(map! "M-n" 'move-text-down)
;; LSP
(global-set-key (kbd "M-;") 'xref-find-definitions)
(use-package lsp-mode
:hook ((c-mode
c++-mode
python-mode
rust-mode
tsx-ts-mode
typescript-ts-mode
))
:custom
(lsp-keymap-prefix "s-i")
(lsp-keep-workspace-alive nil)
(lsp-enable-xref t)
(lsp-enable-on-type-formatting nil)
)
(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-idle-delay 0.5
company-minimum-prefix-length 1
lsp-idle-delay 0.1)
(with-eval-after-load 'lsp-mode
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(yas-global-mode))
;; Dired
;; (setq dired-omit-files
;; (concat dired-omit-files "\\|^\\..+$"))
(setq-default dired-dwim-target t)
(setq dired-listing-switches "-alh")
;; Tree sitter
(after! treesit
(setq treesit-language-source-alist
'((typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src" nil nil)
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src" nil nil))))
;; Buffer display name
(with-eval-after-load 'uniquify
(setq uniquify-buffer-name-style 'post-forward-angle-brackets))
;; Config ido
(with-eval-after-load 'ido
(setq ido-max-window-height 5))
+199
View File
@@ -0,0 +1,199 @@
;;; init.el -*- lexical-binding: t; -*-
;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;; NOTE: Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find a link to Doom's Module Index where all of
;; our modules are listed, including what flags they support.
;; NOTE: Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c c k' for non-vim users) to view its documentation. This works on flags
;; as well (those symbols that start with a plus).
;;
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code).
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
company ; the ultimate code completion backend
;;(corfu +orderless) ; complete with cap(f), cape and a flying feather!
;;helm ; the *other* search engine for love and life
ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
;;vertico ; the search engine of the future
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;smooth-scroll ; So smooth you won't believe it's not butter
;;tabs ; a tab bar for Emacs
treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
(vc-gutter +pretty) ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
;;workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
;; (evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
(whitespace +guess +trim) ; a butler for your whitespace
;;word-wrap ; soft wrapping with language-aware indent
:emacs
;;dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;eww ; the internet is gross
;;ibuffer ; interactive buffer management
tramp ; remote files at your arthritic fingertips
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
;;vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
ansible
;;biblio ; Writes a PhD for you (citation needed)
;;collab ; buffers with friends
debugger ; stepping through code, to help you add bugs
;;direnv
docker
editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean...
(lsp +eglot) ; M-x vscode
magit ; a git porcelain for Emacs
make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
terraform ; infrastructure as code
tmux ; an API for interacting with tmux
tree-sitter ; syntax and parsing, sitting in a tree...
upload ; map local to remote projects via ssh/ftp
:os
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
;;ada ; In strong typing we (blindly) trust
;;(agda +local) ; types of types of types of types...
;;beancount ; mind the GAAP
(cc +lsp) ; C > C++ == 1
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;factor
;;faust ; dsp, but you get to keep your soul
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
(go +lsp) ; the hipster dialect
;;(graphql +lsp) ; Give queries a REST
;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
json ; At least it ain't XML
;;janet ; Fun fact: Janet is me!
;;(java +lsp) ; the poster child for carpal tunnel syndrome
(javascript +lsp +tree-sitter) ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
;;odin ; C, minus its footguns
org ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
graphviz ; diagrams for confusing yourself even more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
rest ; Emacs as a REST client
rst ; ReST in peace
(ruby) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
;;web ; the tubes
yaml ; JSON, but readable
;;zig ; C, but simpler
:email
;;(mu4e +org +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
calendar
;;emms
everywhere ; *leave* Emacs!? You must be joking
irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
:config
;;literate
(default +bindings +smartparens))
+61
View File
@@ -0,0 +1,61 @@
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
;; To install a package:
;;
;; 1. Declare them here in a `package!' statement,
;; 2. Run 'doom sync' in the shell,
;; 3. Restart Emacs.
;;
;; Use 'C-h f package\!' to look up documentation for the `package!' macro.
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;; (package! some-package)
;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/radian-software/straight.el#the-recipe-format
;; (package! another-package
;; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;; (package! this-package
;; :recipe (:host github :repo "username/repo"
;; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;; (package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;; (package! builtin-package :recipe (:nonrecursive t))
;; (package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see radian-software/straight.el#279)
;; (package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install.
;; (package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;; (unpin! pinned-package)
;; ...or multiple packages
;; (unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;; (unpin! t)
(package! gruber-darker-theme)
(package! comment-dwim-2)
(package! move-text)
(package! lsp-mode)
(package! lsp-treemacs)
(package! which-key)
+120
View File
@@ -0,0 +1,120 @@
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
font pango:monospace 10
set $wallpaper ~/Pictures/backgrounds/clair-obscur-expedition-33-4k-p8.png
set $lockscreen ~/Pictures/backgrounds/co-lockscreen.png
exec --no-startup-id numlockx
exec --no-startup-id feh --bg-scale $wallpaper
# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
exec --no-startup-id dex --autostart --environment i3
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym XF86AudioPlay exec --no-startup-id playerctl -p spotify play-pause && $refresh_i3status
# Workspace config
include ./workspace.conf
# Floating window correction
include ./floating.conf
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# move tiling windows via drag & drop by left-clicking into the title bar,
# or left-clicking anywhere into the window while holding the floating modifier.
tiling_drag modifier titlebar
# start kitty
bindsym $mod+Return exec kitty
# kill focused window
bindsym $mod+q kill
# start rofi
bindsym $mod+r exec --no-startup-id rofi -show drun
# rofi spotify
bindsym $mod+m exec --no-startup-id /home/womax/.config/scripts/rofi_spotify.sh
bindsym $mod+p exec --no-startup-id rofi -show window
# change focus
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+h focus left
bindsym $mod+l focus right
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Left focus left
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+h move left
bindsym $mod+Shift+l move right
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+g split h
# split in vertical orientation
bindsym $mod+v split v
# change container layout (stacked/tabbed/toggle split)
workspace_layout tabbed
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# hides border
hide_edge_borders smart
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# reload configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace
bindsym $mod+Shift+x restart
# lock screen
bindsym $mod+Control+l exec --no-startup-id "i3lock -kti $lockscreen && sleep 1"
# exit i3 (logout)
bindsym $mod+Shift+e exec --no-startup-id i3-msg exit
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
status_command i3status
}
exec --no-startup-id /usr/bin/dunst
exec kitty
exec emacs
exec firefox
exec discord
exec spotify-launcher
+2
View File
@@ -0,0 +1,2 @@
for_window [title="Steam Settings"] floating enable
for_window [title="Paradox Launcher"] floating enable
+63
View File
@@ -0,0 +1,63 @@
# Define names for default workspaces for which we configure key bindings later on
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to worksapce
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# Make DP-0 primary monitor
exec --no-startup-id xrandr --output "DP-0" --primary
# bind workspace 1 and 3 to primary monitor (DP-0)
workspace $ws1 output DP-0
workspace $ws3 output DP-0
workspace $ws5 output DP-0
# bind worksapce 2 and 4 to secondary monitor (HDMI-0)
workspace $ws2 output HDMI-0
workspace $ws4 output HDMI-0
# assign kitty, emacs to ws1
assign [class="kitty"] $ws1
assign [class="Emacs"] $ws1
# assign firefox to ws2
assign [class="firefox"] $ws2
# assign spotify to ws3
assign [class="Spotify"] $ws3
# assign discord to ws4
assign [class="discord"] $ws4
assign [class="Qemu-system-*"] $ws5
assign [class="steam"] $ws5
+53
View File
@@ -0,0 +1,53 @@
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
# order += "ipv6"
# order += "wireless _first_"
order += "ethernet _first_"
# order += "battery all"
order += "disk /"
# order += "load"
order += "memory"
order += "tztime local"
wireless _first_ {
format_up = "W: (%quality at %essid) %ip"
format_down = "W: down"
}
ethernet _first_ {
format_up = "E: %ip (%speed)"
format_down = "E: down"
}
battery all {
format = "%status %percentage %remaining"
}
disk "/" {
format = "%avail"
}
load {
format = "%1min"
}
memory {
format = "%used | %available"
threshold_degraded = "1G"
format_degraded = "MEMORY < %available"
}
tztime local {
format = "%Y-%m-%d %H:%M:%S"
}
+1 -1
View File
@@ -10,7 +10,7 @@ enable_audio_bell no
# BEGIN_KITTY_FONTS # BEGIN_KITTY_FONTS
font_family family="Iosevka" font_family family="Iosevka"
font_size 18.0 font_size 14.0
bold_font auto bold_font auto
italic_font auto italic_font auto
bold_italic_font auto bold_italic_font auto
+7 -2
View File
@@ -1,5 +1,5 @@
configuration { configuration {
modes: "drun,filebrowser,ssh"; modes: "drun,filebrowser,ssh,window";
show-icons: true; show-icons: true;
display-drun: " "; display-drun: " ";
display-run: " "; display-run: " ";
@@ -11,6 +11,7 @@ configuration {
window-format: "{w}{t}"; window-format: "{w}{t}";
font: "JetBrainsMono 15"; font: "JetBrainsMono 15";
icon-theme: "Colloid"; icon-theme: "Colloid";
ssh-client: "kitten ssh";
filebrowser { filebrowser {
directory: "~/"; directory: "~/";
@@ -18,6 +19,10 @@ configuration {
directories-first: true; directories-first: true;
show-hidden: false; show-hidden: false;
} }
kb-accept-alt: "";
kb-custom-1: "Shift+Return";
} }
@theme "~/.config/rofi/themes/breeze-dracula.rasi" //@theme "~/.config/rofi/themes/breeze-dracula.rasi"
@theme "~/.config/rofi/themes/dmenu.rasi"
+1 -1
View File
@@ -1,2 +1,2 @@
joblib==1.5.1 diskcache==5.6.3
spotipy==2.25.1 spotipy==2.25.1
+85 -47
View File
@@ -1,9 +1,7 @@
#!/home/womax/.config/rofi/scripts/.env/bin/python #!/home/womax/.config/rofi/scripts/.env/bin/python
import joblib from diskcache import Cache
from joblib import expires_after
import os import os
import os.path as path import os.path as path
import shutil
import spotipy import spotipy
from spotipy.oauth2 import SpotifyPKCE from spotipy.oauth2 import SpotifyPKCE
import sys import sys
@@ -20,13 +18,9 @@ cache_dir = path.join(
path.join(os.getenv("HOME"), ".cache")), path.join(os.getenv("HOME"), ".cache")),
"rofi-spotify") "rofi-spotify")
if path.exists(cache_dir) and not path.isdir(cache_dir): track_cache = Cache(path.join(cache_dir, "track_cache"),
shutil.rmtree(cache_dir) eviction_policy="least-recently-stored",
size_limit=int(10e6))
if not path.exists(cache_dir):
os.makedirs(cache_dir, mode=0o755)
memory = joblib.Memory(cache_dir, verbose=0)
scopes = ["user-top-read", "user-modify-playback-state"] scopes = ["user-top-read", "user-modify-playback-state"]
@@ -39,67 +33,111 @@ sp = spotipy.Spotify(
cache_path=path.join(cache_dir, "credentials")) cache_path=path.join(cache_dir, "credentials"))
)) ))
@memory.cache(cache_validation_callback=expires_after(days=30))
def get_top_tracks(limit=200): def get_top_tracks(limit=200):
offset = 0 offset = 0
tracks = [] tracks = []
while offset < limit: while offset < limit:
reading = min(50, limit-offset) reading = min(50, limit-offset)
tracks += sp.current_user_top_tracks( new_tracks = sp.current_user_top_tracks(
limit=reading, limit=reading,
offset=offset)["items"] offset=offset)["items"]
if len(new_tracks) == 0:
return tracks
tracks += new_tracks
offset += reading offset += reading
return tracks return tracks
def simplify_track_info(track):
result = {}
result["id"] = track["id"]
result["fullname"] = f'{track["name"]} - {track["artists"][0]["name"]}'
return result
def get_cached_tracks():
if len(track_cache) == 0:
tt = get_top_tracks(500)
for track in tt:
track_cache[track["id"]] = simplify_track_info(track)
return [track_cache[k] for k in track_cache]
def search_track(query: str):
search_rs = sp.search(query, limit=10, type='track')["tracks"]["items"]
return [simplify_track_info(t) for t in search_rs]
def play_track(track_id: str, track_fullname: str, now=True):
if track_id == "":
return
try:
to_play = {
"id": track_id,
"fullname": track_fullname
}
sp.add_to_queue(f"spotify:track:{to_play['id']}")
track_cache[to_play['id']] = to_play
except spotipy.SpotifyException as err:
print(f"{err.msg}", file=sys.stderr)
return
if now:
time.sleep(0.1)
sp.next_track()
def format_track(track): def format_track(track):
track_format = "{title} - {artist}\0info\x1f{track_id}\n" track_format = "{fullname}\0info\x1f{track_id}\n"
return track_format.format( return track_format.format(
title=track["name"], fullname=track["fullname"],
artist=track["artists"][0]["name"],
track_id=track["id"] track_id=track["id"]
) )
def display_default(): def display_track_list(track_list=None):
liked_tracks = get_top_tracks() if track_list is None:
for item in liked_tracks: track_list = get_cached_tracks()
for item in track_list:
print(format_track(item), end="") print(format_track(item), end="")
def play_track(track_id: str): controls = {
try: "Next": sp.next_track,
sp.add_to_queue(f"spotify:track:{track_id}") "Play": sp.start_playback,
except spotipy.SpotifyException as err: "Pause": sp.pause_playback,
print(f"\0message\x1f{err.msg}") "Previous": sp.previous_track,
return }
time.sleep(0.1)
sp.next_track() def display_controls():
for k, _ in controls.items():
@memory.cache(cache_validation_callback=expires_after(seconds=180)) print(k)
def search_track(query: str):
try:
query_res = sp.search(query, limit=30, type='track')["tracks"]["items"]
if len(query_res) == 0:
print("\0message\x1fNo result in search")
return
for result in query_res:
print(format_track(result), end="")
except spotipy.SpotifyException as err:
print(f"\0message\x1f{err.msg}")
return
def main(): def main():
match int(os.getenv("ROFI_RETV", default=-1)): rofi_retv = int(os.getenv("ROFI_RETV", default=-1));
print(rofi_retv, file=sys.stderr)
match rofi_retv:
case 0: case 0:
# Initial call # Initial call
display_default() # enable custom hot key
print("\0use-hot-keys\x1ftrue")
display_controls()
display_track_list()
case 1: case 1:
# Selected entry # Selected entry
play_track(os.getenv("ROFI_INFO", "")) # Default behavior to play the track immediatly
exit(0) if sys.argv[1] in controls.keys():
controls[sys.argv[1]]()
return
play_track(os.getenv("ROFI_INFO", ""), sys.argv[1])
case 2: case 2:
# Custom entry # Custom entry
track = sys.argv[1] track = sys.argv[1]
search_track(track) display_track_list(search_track(track))
memory.reduce_size(bytes_limit="10M")
case 10:
# Custom hot key 1
# Add entry to the queue
if sys.argv[1] in controls.keys():
return
play_track(os.getenv("ROFI_INFO", ""),
sys.argv[1],
now=False)
case _: case _:
exit(1) exit(1)
+43
View File
@@ -0,0 +1,43 @@
/**
* ROFI Color theme
* User: Qball
* Copyright: Dave Davenport
*/
* {
background-color: Black;
border-color: White;
text-color: White;
font: "Iosevka 16";
}
window {
anchor: south;
location: south;
width: 100%;
padding: 4px;
children: [ horibox ];
}
horibox {
orientation: horizontal;
children: [ prompt, entry, listview ];
}
listview {
layout: horizontal;
spacing: 5px;
lines: 100;
}
entry {
expand: false;
width: 10em;
}
element {
padding: 0px 2px;
}
element selected {
background-color: SteelBlue;
}
element-text, element-icon {
background-color: inherit;
text-color: inherit;
}
-11
View File
@@ -1,11 +0,0 @@
* {
main-bg: #11111be6;
main-fg: #cdd6f4ff;
main-br: #cba6f7ff;
main-ex: #f5e0dcff;
select-bg: #b4befeff;
select-fg: #11111bff;
separatorcolor: transparent;
border-color: transparent;
}
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
rofi -modes "spotify" -show spotify -matching "glob" -normalize-match
-444
View File
@@ -1,444 +0,0 @@
(setq custom-file "~/.emacs.custom.el")
(package-initialize)
(add-to-list 'load-path "~/.emacs.local/")
(load "~/.emacs.rc/rc.el")
(load "~/.emacs.rc/misc-rc.el")
;;; Appearance
(add-to-list 'default-frame-alist `(font . "Iosevka-16"))
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
(column-number-mode 1)
(show-paren-mode 1)
(rc/require-theme 'gruber-darker)
;; (rc/require-theme 'zenburn)
;; (load-theme 'adwaita t)
(rc/require 'all-the-icons 'all-the-icons-dired)
(eval-after-load 'zenburn
(set-face-attribute 'line-number nil :inherit 'default))
(defun toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(next-win-edges (window-edges (next-window)))
(this-win-2nd (not (and (<= (car this-win-edges)
(car next-win-edges))
(<= (cadr this-win-edges)
(cadr next-win-edges)))))
(splitter
(if (= (car this-win-edges)
(car (window-edges (next-window))))
'split-window-horizontally
'split-window-vertically)))
(delete-other-windows)
(let ((first-win (selected-window)))
(funcall splitter)
(if this-win-2nd (other-window 1))
(set-window-buffer (selected-window) this-win-buffer)
(set-window-buffer (next-window) next-win-buffer)
(select-window first-win)
(if this-win-2nd (other-window 1))))))
(global-set-key (kbd "C-t") 'toggle-window-split)
(global-set-key (kbd "C-<tab>") 'next-window-any-frame)
(global-set-key (kbd "C-<iso-lefttab>") 'previous-window-any-frame)
;;; ido
(rc/require 'smex 'ido-completing-read+)
(require 'ido-completing-read+)
(ido-mode 1)
(ido-everywhere 1)
(ido-ubiquitous-mode 1)
(setq ido-auto-merge-work-directories-length -1)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
(setq compile-command "")
;;; comment
(rc/require 'comment-dwim-2)
(global-set-key (kbd "C-;") 'comment-dwim-2)
;;; c-mode
(setq-default c-basic-offset 4
c-default-style '((java-mode . "java")
(awk-mode . "awk")
(other . "bsd")))
(add-hook 'c-mode-hook (lambda ()
(interactive)
(c-toggle-comment-style -1)))
;;; Paredit
(rc/require 'paredit)
(defun rc/turn-on-paredit ()
(interactive)
(paredit-mode 1))
(add-hook 'emacs-lisp-mode-hook 'rc/turn-on-paredit)
(add-hook 'clojure-mode-hook 'rc/turn-on-paredit)
(add-hook 'lisp-mode-hook 'rc/turn-on-paredit)
(add-hook 'common-lisp-mode-hook 'rc/turn-on-paredit)
(add-hook 'scheme-mode-hook 'rc/turn-on-paredit)
(add-hook 'racket-mode-hook 'rc/turn-on-paredit)
;;; Emacs lisp
(add-hook 'emacs-lisp-mode-hook
'(lambda ()
(local-set-key (kbd "C-c C-j")
(quote eval-print-last-sexp))))
(add-to-list 'auto-mode-alist '("Cask" . emacs-lisp-mode))
;;; uxntal-mode
(rc/require 'uxntal-mode)
;;; Haskell mode
(rc/require 'haskell-mode)
(setq haskell-process-type 'cabal-new-repl)
(setq haskell-process-log t)
(add-hook 'haskell-mode-hook 'haskell-indent-mode)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
(add-hook 'haskell-mode-hook 'haskell-doc-mode)
(require 'fasm-mode)
(add-to-list 'auto-mode-alist '("\\.asm\\'" . fasm-mode))
(require 'llvm-mode)
(add-to-list 'auto-mode-alist '("\\.ll\\'" . llvm-mode))
(require 'simpc-mode)
;; (add-to-list 'auto-mode-alist '("\\.[hc]\\(pp\\)?\\'" . simpc-mode))
(setq path-to-ctags "/usr/bin/ctags")
(defun create-tags (dir-name)
"Create tags file."
(interactive "Directory: ")
(shell-command
(format "%s -f TAGS -e -R %s" path-to-ctags (directory-file-name dir-name)))
)
(global-set-key (kbd "M-;") 'xref-find-definitions)
(rc/require 'ess)
(rc/require 'polymode)
(rc/require 'poly-R)
;;; Whitespace mode
(defun rc/set-up-whitespace-handling ()
(interactive)
(whitespace-mode 0)
(add-to-list 'write-file-functions 'delete-trailing-whitespace))
(add-hook 'tuareg-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'c++-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'c-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'simpc-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'emacs-lisp-mode 'rc/set-up-whitespace-handling)
(add-hook 'java-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'lua-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'rust-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'scala-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'markdown-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'haskell-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'python-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'erlang-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'asm-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'fasm-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'go-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'nim-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'yaml-mode-hook 'rc/set-up-whitespace-handling)
(add-hook 'porth-mode-hook 'rc/set-up-whitespace-handling)
;;; display-line-numbers-mode
(when (version<= "26.0.50" emacs-version)
(global-display-line-numbers-mode))
(setq display-line-numbers-type 'relative)
;;; magit
;; magit requres this lib, but it is not installed automatically on
;; Windows.
(rc/require 'cl-lib)
(rc/require 'magit)
(setq magit-auto-revert-mode nil)
(global-set-key (kbd "C-c m s") 'magit-status)
(global-set-key (kbd "C-c m l") 'magit-log)
;;; multiple cursors
(rc/require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C-S-n") 'mc/mark-next-like-this)
(global-set-key (kbd "C-S-p") 'mc/mark-previous-like-this)
;(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;(global-set-key (kbd "C-\"") 'mc/skip-to-next-like-this)
;(global-set-key (kbd "C-:") 'mc/skip-to-previous-like-this)
;;; markdown
(rc/require 'markdown-mode 'impatient-mode 'simple-httpd)
(add-to-list 'auto-mode-alist '("\\.md\\'" . gfm-mode))
(setq markdown-command "pandoc -t html5")
(setq httpd-port 7070)
(setq httpd-host (system-name))
(defun github-markdown-filter (buffer)
(princ
(with-temp-buffer
(let ((tmp (buffer-name)))
(set-buffer buffer)
(set-buffer (markdown tmp))
(format "<!DOCTYPE html><html><title>Markdown preview</title><link rel=\"stylesheet\" href = \"https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css\"/>
<body><article class=\"markdown-body\" style=\"box-sizing: border-box;min-width: 200px;max-width: 980px;margin: 0 auto;padding: 45px;\">%s</article></body></html>" (buffer-string))))
(current-buffer)))
(defun github-markdown-preview ()
"Preview markdown with github style"
(interactive)
(unless (process-status "httpd")
(httpd-start))
(impatient-mode)
(imp-set-user-filter 'github-markdown-filter)
(imp-visit-buffer))
;;; dired
(require 'dired-x)
(setq dired-omit-files
(concat dired-omit-files "\\|^\\..+$"))
(setq-default dired-dwim-target t)
(setq dired-listing-switches "-alh")
(setq dired-mouse-drag-files t)
(global-set-key (kbd "C-d") 'dired)
;;; helmn
(rc/require 'helm)
(global-set-key (kbd "C-c h t") 'helm-cmd-t)
;;; yasnippet
(rc/require 'yasnippet)
(require 'yasnippet)
(setq yas/triggers-in-field nil)
(setq yas-snippet-dirs '("~/.emacs.snippets/"))
(yas-global-mode 1)
;;; word-wrap
(defun rc/enable-word-wrap ()
(interactive)
(toggle-word-wrap 1))
(add-hook 'markdown-mode-hook 'rc/enable-word-wrap)
;;; nxml
(add-to-list 'auto-mode-alist '("\\.html\\'" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.xsd\\'" . nxml-mode))
(add-to-list 'auto-mode-alist '("\\.ant\\'" . nxml-mode))
;;; Makefile
(add-to-list 'auto-mode-alist '("\\make.config\\'" . makefile-mode))
;;; tramp
;;; http://stackoverflow.com/questions/13794433/how-to-disable-autosave-for-tramp-buffers-in-emacs
(setq tramp-auto-save-directory "/tmp")
;;; powershell
(rc/require 'powershell)
(add-to-list 'auto-mode-alist '("\\.ps1\\'" . powershell-mode))
(add-to-list 'auto-mode-alist '("\\.psm1\\'" . powershell-mode))
;;; eldoc mode
(defun rc/turn-on-eldoc-mode ()
(interactive)
(eldoc-mode 1))
(add-hook 'emacs-lisp-mode-hook 'rc/turn-on-eldoc-mode)
;;; Company
(rc/require 'company)
(require 'company)
(global-company-mode)
;; (add-hook 'tuareg-mode-hook
;; (lambda ()
;; (interactive)
;; (company-mode 0)))
;;; Typescript
(rc/require 'typescript-mode)
(add-to-list 'auto-mode-alist '("\\.mts\\'" . typescript-mode))
;;; Tide
(rc/require 'tide)
(defun rc/turn-on-tide-and-flycheck () ;Flycheck is a dependency of tide
(interactive)
(tide-setup)
(flycheck-mode 1))
(add-hook 'typescript-mode-hook 'rc/turn-on-tide-and-flycheck)
;;; Proof general
(rc/require 'proof-general)
(add-hook 'coq-mode-hook
'(lambda ()
(local-set-key (kbd "C-c C-q C-n")
(quote proof-assert-until-point-interactive))))
;;; LaTeX mode
(add-hook 'tex-mode-hook
(lambda ()
(interactive)
(add-to-list 'tex-verbatim-environments "code")))
(setq font-latex-fontify-sectioning 'color)
;;; Move Text
(rc/require 'move-text)
(global-set-key (kbd "M-p") 'move-text-up)
(global-set-key (kbd "M-n") 'move-text-down)
;;; Ebisp
(add-to-list 'auto-mode-alist '("\\.ebi\\'" . lisp-mode))
;;; Go
(rc/require 'go-mode)
;(add-to-list 'compilation-error-regexp-alist 'gotest)
;(add-to-list 'compilation-error-regexp-alist-alist '(gotest "^ \\(\\([^:\n]+\\):\\([0-9]+\\)\\)" 2 3 nil nil 1))
;(add-to-list 'compilation-error-regexp-alist 'gotraceback)
;(add-to-list 'compilation-error-regexp-alist-alist '(gotraceback "^\t\\(\\([^\n\t]+\\):\\([0-9]+\\)\\)\\( \\+0x[0-9a-f]+\\)?$" 2 3 nil (nil . 4) 1))
;;; OCaml
(rc/require 'tuareg)
;;; ASM
(defun my-asm-mode-hook ()
(local-unset-key (vector asm-comment-char))
(setq tab-always-indent (default-value 'tab-always-indent))
(setq comment-start "//"))
(add-hook 'asm-mode-hook #'my-asm-mode-hook)
;;; Clang format
(rc/require 'clang-format)
(global-set-key (kbd "C-o") 'clang-format-buffer)
;;; Lsp-mode
(rc/require 'lsp-mode
'lsp-treemacs
'helm-lsp
'projectile
'hydra
'flycheck
'company
'avy
'which-key
'helm-xref)
(which-key-mode)
(setq lsp-keymap-prefix "s-i")
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c++-mode-hook 'lsp)
(add-hook 'python-mode 'lsp)
;;; zoxide
(rc/require 'zoxide)
(add-hook 'dired-after-readin-hook 'zoxide-add)
(setq gc-cons-threshold (* 100 1024 1024)
read-process-output-max (* 1024 1024)
treemacs-space-between-root-nodes nil
company-idle-delay 0.5
company-minimum-prefix-length 1
lsp-idle-delay 0.1)
(with-eval-after-load 'lsp-mode
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(yas-global-mode))
;;; Packages that don't require configuration
(rc/require
'scala-mode
'd-mode
'yaml-mode
'glsl-mode
'lua-mode
'less-css-mode
'graphviz-dot-mode
'clojure-mode
'cmake-mode
'rust-mode
'csharp-mode
'nim-mode
'jinja2-mode
'purescript-mode
'nix-mode
'dockerfile-mode
'toml-mode
'nginx-mode
'kotlin-mode
'php-mode
'racket-mode
'qml-mode
'ag
'elpy
'typescript-mode
'rfc-mode
'sml-mode
)
(defun astyle-buffer (&optional justify)
(interactive)
(let ((saved-line-number (line-number-at-pos)))
(shell-command-on-region
(point-min)
(point-max)
"astyle --style=kr"
nil
t)
(goto-line saved-line-number)))
(add-hook 'simpc-mode-hook
(lambda ()
(interactive)
(setq-local fill-paragraph-function 'astyle-buffer)))
(require 'compile)
;; pascalik.pas(24,44) Error: Can't evaluate constant expression
compilation-error-regexp-alist-alist
(add-to-list 'compilation-error-regexp-alist
'("\\([a-zA-Z0-9\\.]+\\)(\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?) \\(Warning:\\)?"
1 2 (4) (5)))
(load-file custom-file)
-480
View File
@@ -1,480 +0,0 @@
;;; fasm-mode.el --- Fasm major mode
;; Author: Fanael Linithien <fanael4@gmail.com>
;; URL: https://github.com/Fanael/fasm-mode
;; Version: 0.1.8
;; This file is NOT part of GNU Emacs.
;; Copyright (c) 2013, Fanael Linithien
;; All rights reserved.
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;; * Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of the copyright holder(s) nor the names of any
;; contributors may be used to endorse or promote products derived from
;; this software without specific prior written permission.
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
;; IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
;; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
;; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
;; OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
;; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
;; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;; Code:
(defvar fasm-mode-syntax-table
(let ((syntaxtable (make-syntax-table)))
(modify-syntax-entry ?_ "_" syntaxtable)
(modify-syntax-entry ?. "_" syntaxtable)
(modify-syntax-entry ?$ "_" syntaxtable)
(modify-syntax-entry ?@ "_" syntaxtable)
(modify-syntax-entry ?~ "_" syntaxtable)
(modify-syntax-entry ?? "_" syntaxtable)
(modify-syntax-entry ?! "_" syntaxtable)
(modify-syntax-entry ?= "." syntaxtable)
(modify-syntax-entry ?+ "." syntaxtable)
(modify-syntax-entry ?- "." syntaxtable)
(modify-syntax-entry ?* "." syntaxtable)
(modify-syntax-entry ?/ "." syntaxtable)
(modify-syntax-entry ?\\ "." syntaxtable)
(modify-syntax-entry ?\; "<" syntaxtable)
(modify-syntax-entry ?\n ">" syntaxtable)
(modify-syntax-entry ?\" "\"" syntaxtable)
(modify-syntax-entry ?\' "\"" syntaxtable)
syntaxtable)
"Syntax table for FASM mode.")
(defvar fasm-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<return>") (lambda () (interactive) (insert ?\n)))
map)
"Local keymap for FASM mode.")
(defvar fasm-basic-offset 2
"Offset for FASM mode indentation.")
(eval-when-compile
(defun fasm--regexp-from-keywords (&rest keywords)
(regexp-opt keywords 'symbols)))
(defconst fasm-font-lock-keywords
`(;; Numbers
("\\_<[01]+b\\_>" . 'font-lock-constant-face)
("\\_<[0-9][0-9a-fA-F]*h\\_>" . 'font-lock-constant-face)
("\\_<\\(?:0x\\|\\$\\)[0-9a-fA-F]+\\_>" . 'font-lock-constant-face)
("\\_<[0-9]+\\(?:\\.[0-9]*\\)?\\(?:e[+-]?[0-9]+\\)?\\_>"
. 'font-lock-constant-face)
;; Types
(,(eval-when-compile
(fasm--regexp-from-keywords
"xx"
"xxxx"
"preserve"
"byte" "word" "dword" "fword" "pword" "qword" "tbyte" "tword"
"dqword" "xword" "qqword" "yword" "db" "rb" "dw" "du" "rw" "dd" "rd"
"df" "dp" "rf" "rp" "dq" "rq" "dt" "rt")) . 'font-lock-type-face)
;; Directives and operators
(,(eval-when-compile
(fasm--regexp-from-keywords
"labeling"
"mod" "rva" "plt" "align" "as" "at" "defined" "dup" "eq" "eqtype"
"from" "ptr" "relativeto" "used" "binary" "export" "fixups" "import"
"native" "static" "console" "dynamic" "efiboot" "linkinfo" "readable"
"resource" "writable" "shareable" "writeable" "efiruntime"
"executable" "linkremove" "discardable" "interpreter" "notpageable"
"if"
"end"
"tail_call"
"finish" ;; as end
"literal"
"address"
"branch"
"false?branch"
"err" "org" "data" "else" "heap" "load" "align" "break"
"entry" "extrn" "label" "stack" "store" "times" "while" "assert"
"format" "public" "repeat" "display" "section" "segment" "virtual"
"file")) . 'font-lock-keyword-face)
;; Preprocessor directives
(,(eval-when-compile
(fasm--regexp-from-keywords
"define" "include" "irp" "irps" "macro" "match" "purge" "rept"
"restore" "restruc" "struc" "common" "forward" "local" "reverse"
"equ" "fix")) . 'font-lock-preprocessor-face)
;; Registers
(,(eval-when-compile
(fasm--regexp-from-keywords
"al" "bl" "cl" "dl" "spl" "bpl" "sil" "dil" "r8b" "r9b" "r10b" "r11b"
"r12b" "r13b" "r14b" "r15b" "ah" "bh" "ch" "dh" "ax" "bx" "cx" "dx"
"sp" "bp" "si" "di" "r8w" "r9w" "r10w" "r11w" "r12w" "r13w" "r14w"
"r15w" "eax" "ebx" "ecx" "edx" "esp" "ebp" "esi" "edi" "r8d" "r9d"
"r10d" "r11d" "r12d" "r13d" "r14d" "r15d"
"rax" "rbx" "rcx" "rdx" "rsp" "rbp" "rsi" "rdi"
"r8" "r9" "r10" "r11" "r12" "r13" "r14" "r15"
;; "xax" "xbx" "xcx" "xdx" "xsp" "xbp" "xsi" "xdi"
;; "x8" "x9" "x10" "x11" "x12" "x13" "x14" "x15"
"rip" "es" "cs" "ss" "ds" "fs" "gs" "cr0" "cr2" "cr3" "cr4" "dr0"
"dr1" "dr2" "dr3" "st0" "st1" "st2" "st3" "st4" "st5" "st6" "st7"
"mm0" "mm1" "mm2" "mm3" "mm4" "mm5" "mm6" "mm7" "xmm0" "xmm1" "xmm2"
"xmm3" "xmm4" "xmm5" "xmm6" "xmm7" "xmm8" "xmm9" "xmm10" "xmm11"
"xmm12" "xmm13" "xmm14" "xmm15" "ymm0" "ymm1" "ymm2" "ymm3" "ymm4"
"ymm5" "ymm6" "ymm7" "ymm8" "ymm9" "ymm10" "ymm11" "ymm12" "ymm13"
"ymm14" "ymm15")) . 'font-lock-variable-name-face)
;; Instructions
(,(eval-when-compile
(fasm--regexp-from-keywords
"bt" "in" "ja" "jb" "jc" "je" "jg" "jl" "jo" "jp" "js" "jz" "or"
"aaa" "aad" "aam" "aas" "adc" "add" "and" "bsf" "bsr" "btc" "btr"
"bts" "cbw" "cdq" "clc" "cld" "cli" "cmc" "cmp" "cqo" "cwd" "daa"
"das" "dec" "div" "fld" "fst" "hlt" "inc" "ins" "int" "jae" "jbe"
"jge" "jle" "jmp" "jna" "jnb" "jnc" "jne" "jng" "jnl" "jno" "jnp"
"jns" "jnz" "jpe" "jpo" "lar" "lds" "lea" "les" "lfs" "lgs" "lsl"
"lss" "ltr" "mov" "mul" "neg" "nop" "not" "out" "pop" "por" "rcl"
"rcr" "rep" "ret" "rol" "ror" "rsm" "sal" "sar" "sbb" "shl" "shr"
"stc" "std" "sti" "str" "sub" "ud2" "xor" "adcx" "adox" "andn" "arpl"
"blci" "blcs" "blsi" "blsr" "bzhi" "call" "cdqe" "clac" "clgi" "clts"
"cmps" "cwde" "dppd" "dpps" "emms" "fabs" "fadd" "fbld" "fchs" "fcom"
"fcos" "fdiv" "feni" "fild" "fist" "fld1" "fldz" "fmul" "fnop" "fsin"
"fstp" "fsub" "ftst" "fxam" "fxch" "idiv" "imul" "insb" "insd" "insw"
"int1" "int3" "into" "invd" "iret" "jcxz" "jnae" "jnbe" "jnge" "jnle"
"lahf" "lgdt" "lidt" "lldt" "lmsw" "lock" "lods" "loop" "movd" "movq"
"movs" "mulx" "orpd" "orps" "outs" "pand" "pdep" "pext" "popa" "popd"
"popf" "popq" "popw" "push" "pxor" "repe" "repz" "retd" "retf" "retn"
"retq" "retw" "rorx" "sahf" "salc" "sarx" "scas" "seta" "setb" "setc"
"sete" "setg" "setl" "seto" "setp" "sets" "setz" "sgdt" "shld" "shlx"
"shrd" "shrx" "sidt" "sldt" "smsw" "stac" "stgi" "stos" "test" "verr"
"verw" "vpor" "wait" "xadd" "xchg" "xend" "xlat" "addpd" "addps"
"addsd" "addss" "andpd" "andps" "bextr" "blcic" "blsic" "bound"
"bswap" "cmova" "cmovb" "cmovc" "cmove" "cmovg" "cmovl" "cmovo"
"cmovp" "cmovs" "cmovz" "cmppd" "cmpps" "cmpsb" "cmpsd" "cmpsq"
"cmpss" "cmpsw" "cpuid" "crc32" "divpd" "divps" "divsd" "divss"
"enter" "extrq" "f2xm1" "faddp" "fbstp" "fclex" "fcomi" "fcomp"
"fdisi" "fdivp" "fdivr" "femms" "ffree" "fiadd" "ficom" "fidiv"
"fimul" "finit" "fistp" "fisub" "fldcw" "fldpi" "fmulp" "fneni"
"fprem" "fptan" "fsave" "fsqrt" "fstcw" "fstsw" "fsubp" "fsubr"
"fucom" "fwait" "fyl2x" "icebp" "iretd" "iretq" "iretw" "jecxz"
"jrcxz" "lddqu" "leave" "lodsb" "lodsd" "lodsq" "lodsw" "loopd"
"loope" "loopq" "loopw" "loopz" "lzcnt" "maxpd" "maxps" "maxsd"
"maxss" "minpd" "minps" "minsd" "minss" "movbe" "movsb" "movsd"
"movsq" "movss" "movsw" "movsx" "movzx" "mulpd" "mulps" "mulsd"
"mulss" "mwait" "outsb" "outsd" "outsw" "pabsb" "pabsd" "pabsw"
"paddb" "paddd" "paddq" "paddw" "pandn" "pause" "pavgb" "pavgw"
"pf2id" "pf2iw" "pfacc" "pfadd" "pfmax" "pfmin" "pfmul" "pfrcp"
"pfsub" "pi2fd" "pi2fw" "popad" "popaw" "popfd" "popfq" "popfw"
"pslld" "psllq" "psllw" "psrad" "psraw" "psrld" "psrlq" "psrlw"
"psubb" "psubd" "psubq" "psubw" "ptest" "pusha" "pushd" "pushf"
"pushq" "pushw" "rcpps" "rcpss" "rdmsr" "rdpmc" "rdtsc" "repne"
"repnz" "retfd" "retfq" "retfw" "retnd" "retnq" "retnw" "scasb"
"scasd" "scasq" "scasw" "setae" "setbe" "setge" "setle" "setna"
"setnb" "setnc" "setne" "setng" "setnl" "setno" "setnp" "setns"
"setnz" "setpe" "setpo" "stosb" "stosd" "stosq" "stosw" "subpd"
"subps" "subsd" "subss" "tzcnt" "tzmsk" "vdppd" "vdpps" "vmovd"
"vmovq" "vmrun" "vmxon" "vorpd" "vorps" "vpand" "vpxor" "wrmsr"
"xlatb" "xorpd" "xorps" "xsave" "xtest" "aesdec" "aesenc" "aesimc"
"andnpd" "andnps" "blcmsk" "blsmsk" "cmovae" "cmovbe" "cmovge"
"cmovle" "cmovna" "cmovnb" "cmovnc" "cmovne" "cmovng" "cmovnl"
"cmovno" "cmovnp" "cmovns" "cmovnz" "cmovpe" "cmovpo" "comisd"
"comiss" "fcmovb" "fcmove" "fcmovu" "fcomip" "fcompp" "fdivrp"
"ffreep" "ficomp" "fidivr" "fisttp" "fisubr" "fldenv" "fldl2e"
"fldl2t" "fldlg2" "fldln2" "fnclex" "fndisi" "fninit" "fnsave"
"fnstcw" "fnstsw" "fpatan" "fprem1" "frstor" "frstpm" "fsaved"
"fsavew" "fscale" "fsetpm" "fstenv" "fsubrp" "fucomi" "fucomp"
"fxsave" "getsec" "haddpd" "haddps" "hsubpd" "hsubps" "invept"
"invlpg" "lfence" "llwpcb" "looped" "loopeq" "loopew" "loopne"
"loopnz" "loopzd" "loopzq" "loopzw" "lwpins" "lwpval" "mfence"
"movapd" "movaps" "movdqa" "movdqu" "movhpd" "movhps" "movlpd"
"movlps" "movnti" "movntq" "movsxd" "movupd" "movups" "paddsb"
"paddsw" "pextrb" "pextrd" "pextrq" "pextrw" "pfnacc" "pfsubr"
"phaddd" "phaddw" "phsubd" "phsubw" "pinsrb" "pinsrd" "pinsrq"
"pinsrw" "pmaxsb" "pmaxsd" "pmaxsw" "pmaxub" "pmaxud" "pmaxuw"
"pminsb" "pminsd" "pminsw" "pminub" "pminud" "pminuw" "pmuldq"
"pmulhw" "pmulld" "pmullw" "popcnt" "psadbw" "pshufb" "pshufd"
"pshufw" "psignb" "psignd" "psignw" "pslldq" "psrldq" "psubsb"
"psubsw" "pswapd" "pushad" "pushaw" "pushfd" "pushfq" "pushfw"
"rdmsrq" "rdrand" "rdseed" "rdtscp" "setalc" "setnae" "setnbe"
"setnge" "setnle" "sfence" "shufpd" "shufps" "skinit" "slwpcb"
"sqrtpd" "sqrtps" "sqrtsd" "sqrtss" "swapgs" "sysret" "t1mskc"
"vaddpd" "vaddps" "vaddsd" "vaddss" "vandpd" "vandps" "vcmppd"
"vcmpps" "vcmpsd" "vcmpss" "vdivpd" "vdivps" "vdivsd" "vdivss"
"vlddqu" "vmaxpd" "vmaxps" "vmaxsd" "vmaxss" "vmcall" "vminpd"
"vminps" "vminsd" "vminss" "vmload" "vmovsd" "vmovss" "vmread"
"vmsave" "vmulpd" "vmulps" "vmulsd" "vmulss" "vmxoff" "vpabsb"
"vpabsd" "vpabsw" "vpaddb" "vpaddd" "vpaddq" "vpaddw" "vpandn"
"vpavgb" "vpavgw" "vpcmov" "vpcomb" "vpcomd" "vpcomq" "vpcomw"
"vpermd" "vpermq" "vpperm" "vprotb" "vprotd" "vprotq" "vprotw"
"vpshab" "vpshad" "vpshaq" "vpshaw" "vpshlb" "vpshld" "vpshlq"
"vpshlw" "vpslld" "vpsllq" "vpsllw" "vpsrad" "vpsraw" "vpsrld"
"vpsrlq" "vpsrlw" "vpsubb" "vpsubd" "vpsubq" "vpsubw" "vptest"
"vrcpps" "vrcpss" "vsubpd" "vsubps" "vsubsd" "vsubss" "vxorpd"
"vxorps" "wbinvd" "wrmsrq" "xabort" "xbegin" "xgetbv" "xrstor"
"xsetbv" "blcfill" "blendpd" "blendps" "blsfill" "clflush" "cmovnae"
"cmovnbe" "cmovnge" "cmovnle" "cmpeqpd" "cmpeqps" "cmpeqsd" "cmpeqss"
"cmplepd" "cmpleps" "cmplesd" "cmpless" "cmpltpd" "cmpltps" "cmpltsd"
"cmpltss" "cmpxchg" "fcmovbe" "fcmovnb" "fcmovne" "fcmovnu" "fdecstp"
"fincstp" "fldenvd" "fldenvw" "fnsaved" "fnsavew" "fnstenv" "frndint"
"frstord" "frstorw" "fsincos" "fstenvd" "fstenvw" "fucomip" "fucompp"
"fxrstor" "fxtract" "fyl2xp1" "insertq" "invlpga" "invpcid" "invvpid"
"ldmxcsr" "loopned" "loopneq" "loopnew" "loopnzd" "loopnzq" "loopnzw"
"monitor" "movddup" "movdq2q" "movhlps" "movlhps" "movntdq" "movntpd"
"movntps" "movntsd" "movntss" "movq2dq" "mpsadbw" "paddusb" "paddusw"
"palignr" "pavgusb" "pblendw" "pcmpeqb" "pcmpeqd" "pcmpeqq" "pcmpeqw"
"pcmpgtb" "pcmpgtd" "pcmpgtq" "pcmpgtw" "pfcmpeq" "pfcmpge" "pfcmpgt"
"pfpnacc" "pfrsqrt" "phaddsw" "phsubsw" "pmaddwd" "pmulhrw" "pmulhuw"
"pmuludq" "pshufhw" "pshuflw" "psubusb" "psubusw" "roundpd" "roundps"
"roundsd" "roundss" "rsqrtps" "rsqrtss" "stmxcsr" "syscall" "sysexit"
"sysretq" "ucomisd" "ucomiss" "vaesdec" "vaesenc" "vaesimc" "vandnpd"
"vandnps" "vcomisd" "vcomiss" "vfrczpd" "vfrczps" "vfrczsd" "vfrczss"
"vhaddpd" "vhaddps" "vhsubpd" "vhsubps" "vmclear" "vmmcall" "vmovapd"
"vmovaps" "vmovdqa" "vmovdqu" "vmovhpd" "vmovhps" "vmovlpd" "vmovlps"
"vmovupd" "vmovups" "vmptrld" "vmptrst" "vmwrite" "vpaddsb" "vpaddsw"
"vpcomub" "vpcomud" "vpcomuq" "vpcomuw" "vpermpd" "vpermps" "vpextrb"
"vpextrd" "vpextrq" "vpextrw" "vphaddd" "vphaddw" "vphsubd" "vphsubw"
"vpinsrb" "vpinsrd" "vpinsrq" "vpinsrw" "vpmaxsb" "vpmaxsd" "vpmaxsw"
"vpmaxub" "vpmaxud" "vpmaxuw" "vpminsb" "vpminsd" "vpminsw" "vpminub"
"vpminud" "vpminuw" "vpmuldq" "vpmulhw" "vpmulld" "vpmullw" "vpsadbw"
"vpshufb" "vpshufd" "vpsignb" "vpsignd" "vpsignw" "vpslldq" "vpsllvd"
"vpsllvq" "vpsravd" "vpsrldq" "vpsrlvd" "vpsrlvq" "vpsubsb" "vpsubsw"
"vshufpd" "vshufps" "vsqrtpd" "vsqrtps" "vsqrtsd" "vsqrtss" "vtestpd"
"vtestps" "xsave64" "addsubpd" "addsubps" "blendvpd" "blendvps"
"cmpneqpd" "cmpneqps" "cmpneqsd" "cmpneqss" "cmpnlepd" "cmpnleps"
"cmpnlesd" "cmpnless" "cmpnltpd" "cmpnltps" "cmpnltsd" "cmpnltss"
"cmpordpd" "cmpordps" "cmpordsd" "cmpordss" "cvtdq2pd" "cvtdq2ps"
"cvtpd2dq" "cvtpd2pi" "cvtpd2ps" "cvtpi2pd" "cvtpi2ps" "cvtps2dq"
"cvtps2pd" "cvtps2pi" "cvtsd2si" "cvtsd2ss" "cvtsi2sd" "cvtsi2ss"
"cvtss2sd" "cvtss2si" "fcmovnbe" "fnstenvd" "fnstenvw" "fxsave64"
"insertps" "maskmovq" "movmskpd" "movmskps" "movntdqa" "movshdup"
"movsldup" "packssdw" "packsswb" "packusdw" "packuswb" "pblendvb"
"pfrcpit1" "pfrcpit2" "pfrsqit1" "pmovmskb" "pmovsxbd" "pmovsxbq"
"pmovsxbw" "pmovsxdq" "pmovsxwd" "pmovsxwq" "pmovzxbd" "pmovzxbq"
"pmovzxbw" "pmovzxdq" "pmovzxwd" "pmovzxwq" "pmulhrsw" "prefetch"
"rdfsbase" "rdgsbase" "sysenter" "sysexitq" "unpckhpd" "unpckhps"
"unpcklpd" "unpcklps" "vblendpd" "vblendps" "vcmpeqpd" "vcmpeqps"
"vcmpeqsd" "vcmpeqss" "vcmpgepd" "vcmpgeps" "vcmpgesd" "vcmpgess"
"vcmpgtpd" "vcmpgtps" "vcmpgtsd" "vcmpgtss" "vcmplepd" "vcmpleps"
"vcmplesd" "vcmpless" "vcmpltpd" "vcmpltps" "vcmpltsd" "vcmpltss"
"vfmaddpd" "vfmaddps" "vfmaddsd" "vfmaddss" "vfmsubpd" "vfmsubps"
"vfmsubsd" "vfmsubss" "vldmxcsr" "vmlaunch" "vmovddup" "vmovhlps"
"vmovlhps" "vmovntdq" "vmovntpd" "vmovntps" "vmpsadbw" "vmresume"
"vpaddusb" "vpaddusw" "vpalignr" "vpblendd" "vpblendw" "vpcmpeqb"
"vpcmpeqd" "vpcmpeqq" "vpcmpeqw" "vpcmpgtb" "vpcmpgtd" "vpcmpgtq"
"vpcmpgtw" "vpcomeqb" "vpcomeqd" "vpcomeqq" "vpcomeqw" "vpcomgeb"
"vpcomged" "vpcomgeq" "vpcomgew" "vpcomgtb" "vpcomgtd" "vpcomgtq"
"vpcomgtw" "vpcomleb" "vpcomled" "vpcomleq" "vpcomlew" "vpcomltb"
"vpcomltd" "vpcomltq" "vpcomltw" "vphaddbd" "vphaddbq" "vphaddbw"
"vphadddq" "vphaddsw" "vphaddwd" "vphaddwq" "vphsubbw" "vphsubdq"
"vphsubsw" "vphsubwd" "vpmacsdd" "vpmacswd" "vpmacsww" "vpmaddwd"
"vpmulhuw" "vpmuludq" "vpshufhw" "vpshuflw" "vpsubusb" "vpsubusw"
"vroundpd" "vroundps" "vroundsd" "vroundss" "vrsqrtps" "vrsqrtss"
"vstmxcsr" "vucomisd" "vucomiss" "vzeroall" "wrfsbase" "wrgsbase"
"xacquire" "xrelease" "xrstor64" "xsaveopt" "cmpxchg8b" "cvttpd2dq"
"cvttpd2pi" "cvttps2dq" "cvttps2pi" "cvttsd2si" "cvttss2si"
"extractps" "fxrstor64" "pclmulqdq" "pcmpestri" "pcmpestrm"
"pcmpistri" "pcmpistrm" "pmaddubsw" "prefetchw" "punpckhbw"
"punpckhdq" "punpckhwd" "punpcklbw" "punpckldq" "punpcklwd"
"vaddsubpd" "vaddsubps" "vblendvpd" "vblendvps" "vcmpneqpd"
"vcmpneqps" "vcmpneqsd" "vcmpneqss" "vcmpngepd" "vcmpngeps"
"vcmpngesd" "vcmpngess" "vcmpngtpd" "vcmpngtps" "vcmpngtsd"
"vcmpngtss" "vcmpnlepd" "vcmpnleps" "vcmpnlesd" "vcmpnless"
"vcmpnltpd" "vcmpnltps" "vcmpnltsd" "vcmpnltss" "vcmpordpd"
"vcmpordps" "vcmpordsd" "vcmpordss" "vcvtdq2pd" "vcvtdq2ps"
"vcvtpd2dq" "vcvtpd2ps" "vcvtph2ps" "vcvtps2dq" "vcvtps2pd"
"vcvtps2ph" "vcvtsd2si" "vcvtsd2ss" "vcvtsi2sd" "vcvtsi2ss"
"vcvtss2sd" "vcvtss2si" "vfnmaddpd" "vfnmaddps" "vfnmaddsd"
"vfnmaddss" "vfnmsubpd" "vfnmsubps" "vfnmsubsd" "vfnmsubss"
"vinsertps" "vmovmskpd" "vmovmskps" "vmovntdqa" "vmovshdup"
"vmovsldup" "vpackssdw" "vpacksswb" "vpackusdw" "vpackuswb"
"vpblendvb" "vpcomequb" "vpcomequd" "vpcomequq" "vpcomequw"
"vpcomgeub" "vpcomgeud" "vpcomgeuq" "vpcomgeuw" "vpcomgtub"
"vpcomgtud" "vpcomgtuq" "vpcomgtuw" "vpcomleub" "vpcomleud"
"vpcomleuq" "vpcomleuw" "vpcomltub" "vpcomltud" "vpcomltuq"
"vpcomltuw" "vpcomneqb" "vpcomneqd" "vpcomneqq" "vpcomneqw"
"vpermilpd" "vpermilps" "vphaddubd" "vphaddubq" "vphaddubw"
"vphaddudq" "vphadduwd" "vphadduwq" "vpmacsdqh" "vpmacsdql"
"vpmacssdd" "vpmacsswd" "vpmacssww" "vpmadcswd" "vpmovmskb"
"vpmovsxbd" "vpmovsxbq" "vpmovsxbw" "vpmovsxdq" "vpmovsxwd"
"vpmovsxwq" "vpmovzxbd" "vpmovzxbq" "vpmovzxbw" "vpmovzxdq"
"vpmovzxwd" "vpmovzxwq" "vpmulhrsw" "vunpckhpd" "vunpckhps"
"vunpcklpd" "vunpcklps" "aesdeclast" "aesenclast" "cmpunordpd"
"cmpunordps" "cmpunordsd" "cmpunordss" "cmpxchg16b" "loadall286"
"loadall386" "maskmovdqu" "phminposuw" "prefetcht0" "prefetcht1"
"prefetcht2" "punpckhqdq" "punpcklqdq" "vcmptruepd" "vcmptrueps"
"vcmptruesd" "vcmptruess" "vcvttpd2dq" "vcvttps2dq" "vcvttsd2si"
"vcvttss2si" "vextractps" "vgatherdpd" "vgatherdps" "vgatherqpd"
"vgatherqps" "vmaskmovpd" "vmaskmovps" "vpclmulqdq" "vpcmpestri"
"vpcmpestrm" "vpcmpistri" "vpcmpistrm" "vpcomnequb" "vpcomnequd"
"vpcomnequq" "vpcomnequw" "vpcomtrueb" "vpcomtrued" "vpcomtrueq"
"vpcomtruew" "vperm2f128" "vperm2i128" "vpermil2pd" "vpermil2ps"
"vpgatherdd" "vpgatherdq" "vpgatherqd" "vpgatherqq" "vpmacssdqh"
"vpmacssdql" "vpmadcsswd" "vpmaddubsw" "vpmaskmovd" "vpmaskmovq"
"vpunpckhbw" "vpunpckhdq" "vpunpckhwd" "vpunpcklbw" "vpunpckldq"
"vpunpcklwd" "vzeroupper" "xsaveopt64" "pclmulhqhdq" "pclmullqhdq"
"prefetchnta" "vaesdeclast" "vaesenclast" "vcmpeq_ospd" "vcmpeq_osps"
"vcmpeq_ossd" "vcmpeq_osss" "vcmpeq_uqpd" "vcmpeq_uqps" "vcmpeq_uqsd"
"vcmpeq_uqss" "vcmpeq_uspd" "vcmpeq_usps" "vcmpeq_ussd" "vcmpeq_usss"
"vcmpfalsepd" "vcmpfalseps" "vcmpfalsesd" "vcmpfalsess" "vcmpge_oqpd"
"vcmpge_oqps" "vcmpge_oqsd" "vcmpge_oqss" "vcmpgt_oqpd" "vcmpgt_oqps"
"vcmpgt_oqsd" "vcmpgt_oqss" "vcmple_oqpd" "vcmple_oqps" "vcmple_oqsd"
"vcmple_oqss" "vcmplt_oqpd" "vcmplt_oqps" "vcmplt_oqsd" "vcmplt_oqss"
"vcmpord_spd" "vcmpord_sps" "vcmpord_ssd" "vcmpord_sss" "vcmpunordpd"
"vcmpunordps" "vcmpunordsd" "vcmpunordss" "vfmadd132pd" "vfmadd132ps"
"vfmadd132sd" "vfmadd132ss" "vfmadd213pd" "vfmadd213ps" "vfmadd213sd"
"vfmadd213ss" "vfmadd231pd" "vfmadd231ps" "vfmadd231sd" "vfmadd231ss"
"vfmaddsubpd" "vfmaddsubps" "vfmsub132pd" "vfmsub132ps" "vfmsub132sd"
"vfmsub132ss" "vfmsub213pd" "vfmsub213ps" "vfmsub213sd" "vfmsub213ss"
"vfmsub231pd" "vfmsub231ps" "vfmsub231sd" "vfmsub231ss" "vfmsubaddpd"
"vfmsubaddps" "vinsertf128" "vinserti128" "vmaskmovdqu" "vpcomfalseb"
"vpcomfalsed" "vpcomfalseq" "vpcomfalsew" "vpcomtrueub" "vpcomtrueud"
"vpcomtrueuq" "vpcomtrueuw" "vphminposuw" "vpunpckhqdq" "vpunpcklqdq"
"pclmulhqhqdq" "pclmulhqlqdq" "pclmullqhqdq" "pclmullqlqdq"
"vbroadcastsd" "vbroadcastss" "vcmpneq_oqpd" "vcmpneq_oqps"
"vcmpneq_oqsd" "vcmpneq_oqss" "vcmpneq_ospd" "vcmpneq_osps"
"vcmpneq_ossd" "vcmpneq_osss" "vcmpneq_uspd" "vcmpneq_usps"
"vcmpneq_ussd" "vcmpneq_usss" "vcmpnge_uqpd" "vcmpnge_uqps"
"vcmpnge_uqsd" "vcmpnge_uqss" "vcmpngt_uqpd" "vcmpngt_uqps"
"vcmpngt_uqsd" "vcmpngt_uqss" "vcmpnle_uqpd" "vcmpnle_uqps"
"vcmpnle_uqsd" "vcmpnle_uqss" "vcmpnlt_uqpd" "vcmpnlt_uqps"
"vcmpnlt_uqsd" "vcmpnlt_uqss" "vextractf128" "vextracti128"
"vfnmadd132pd" "vfnmadd132ps" "vfnmadd132sd" "vfnmadd132ss"
"vfnmadd213pd" "vfnmadd213ps" "vfnmadd213sd" "vfnmadd213ss"
"vfnmadd231pd" "vfnmadd231ps" "vfnmadd231sd" "vfnmadd231ss"
"vfnmsub132pd" "vfnmsub132ps" "vfnmsub132sd" "vfnmsub132ss"
"vfnmsub213pd" "vfnmsub213ps" "vfnmsub213sd" "vfnmsub213ss"
"vfnmsub231pd" "vfnmsub231ps" "vfnmsub231sd" "vfnmsub231ss"
"vpbroadcastb" "vpbroadcastd" "vpbroadcastq" "vpbroadcastw"
"vpclmulhqhdq" "vpclmullqhdq" "vpcomfalseub" "vpcomfalseud"
"vpcomfalseuq" "vpcomfalseuw" "vpermilmo2pd" "vpermilmo2ps"
"vpermilmz2pd" "vpermilmz2ps" "vpermiltd2pd" "vpermiltd2ps"
"vcmptrue_uspd" "vcmptrue_usps" "vcmptrue_ussd" "vcmptrue_usss"
"vcmpunord_spd" "vcmpunord_sps" "vcmpunord_ssd" "vcmpunord_sss"
"vpclmulhqlqdq" "vpclmullqlqdq" "vbroadcastf128" "vbroadcasti128"
"vcmpfalse_ospd" "vcmpfalse_osps" "vcmpfalse_ossd" "vcmpfalse_osss"
"vfmaddsub132pd" "vfmaddsub132ps" "vfmaddsub213pd" "vfmaddsub213ps"
"vfmaddsub231pd" "vfmaddsub231ps" "vfmsubadd132pd" "vfmsubadd132ps"
"vfmsubadd213pd" "vfmsubadd213ps" "vfmsubadd231pd" "vfmsubadd231ps"
"aeskeygenassist" "vaeskeygenassist")) . 'font-lock-builtin-face)
;; Labels
("^[ \t]*\\([a-z$A-Z0-9.?!@]\\(?:\\sw\\|\\s_\\)*\\):"
. (1 'font-lock-function-name-face))
;; Macro names
("\\(?:macro\\|struc\\)[ \t]+\\([a-zA-Z0-9.?!@]\\(?:\\sw\\|\\s_\\)*\\)"
. (1 'font-lock-function-name-face)))
"Syntax highlighting for FASM mode.")
;; (defun fasm--get-indent-level (lineoffset)
;; (save-excursion
;; (forward-line (1- lineoffset))
;; (back-to-indentation)
;; (current-column)))
(defun empty-line? ()
(save-excursion
(let ((column-a (progn (move-beginning-of-line nil)
(current-column)))
(column-b (progn (back-to-indentation)
(current-column))))
;; 下面这个谓词看似是冗余的 但是没有关系
(and (= column-b column-a)
(eq (following-char) 10))
)))
(defun above-char ()
(interactive)
(save-excursion
(backward-char 1)
(following-char)))
(defun fasm-label? ()
(interactive)
(save-excursion
(and (progn
(whitespace-cleanup)
(not (empty-line?)))
(progn
;; (whitespace-cleanup)
(end-of-line)
(eq 58 ;; 58 -- ":"
(above-char))))))
;; (defun' test-fasm-get-indent ()
;; (interactive)
;; (message "><><><"))
(defun fasm-get-indent (n)
(save-excursion
(forward-line n)
(cond ((empty-line?)
"empty-line")
((fasm-label?)
"fasm-label")
(t
(progn
(back-to-indentation)
(current-column))))))
(defun fasm-indent-line ()
"Indent according to FASM major mode."
(interactive)
;; 可以发现缩进函数根本就写不好 因为emacs不能真正明白文本的语法
(cond
;; 下面是根据当前一行来缩进
((fasm-label?)
(let ()
(back-to-indentation)
(delete-backward-char (current-column))))
;; 下面是根据上一行来缩进
(t;; else
(back-to-indentation)
(let ((prev-indent (fasm-get-indent -1))
(curr-indent (current-column)))
(cond ((equal prev-indent "empty-line")
;; (indent-to 8)
(indent-to 3)
)
((equal prev-indent "fasm-label")
;; (indent-to 0)
;; 上面的那个命令根本不会缩进 这样看似是合理的 所以增加下面这句:
(message "do not indent at all !"))
((< curr-indent prev-indent)
(indent-to prev-indent))
((>= curr-indent prev-indent)
(delete-backward-char (- curr-indent prev-indent)))
((>= curr-indent prev-indent)
(delete-backward-char (- curr-indent prev-indent)))
)))))
;; Emacs < 24 did not have prog-mode
(defalias 'fasm-parent-mode
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
;;;###autoload
(define-derived-mode fasm-mode fasm-parent-mode
"Fasm"
"Major mode for editing assembly in FASM format."
(set (make-local-variable 'font-lock-defaults)
(list 'fasm-font-lock-keywords nil t))
(set (make-local-variable 'indent-line-function) 'fasm-indent-line)
(set (make-local-variable 'comment-start) ";; "))
(provide 'fasm-mode)
;;; fasm-mode.el ends here
-292
View File
@@ -1,292 +0,0 @@
;;; llvm-mode.el --- Major mode for the LLVM IR language -*- lexical-binding: t; -*-
;;
;; This is free and unencumbered software released into the public domain.
;;
;; Author: Noah Peart <noah.v.peart@gmail.com>
;; URL: https://github.com/nverno/llvm-mode
;; Package-Requires: ((emacs "25.1"))
;; Created: 16 February 2020
;; Version: 0.1.0
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;; Major mode for editing LLVM IR files.
;; Modified from https://github.com/llvm-mirror/llvm//utils/emacs/llvm-mode.el
;; to include
;; - additional syntax
;; - font-lock for globals (vars/declares/defines)
;; - imenu
;; - indentation: `llvm-mode-indent-offset' and `llvm-mode-label-offset'
;; - completion:
;; + global variables
;; + global declares/defines
;; TODO:
;; + keywords / attributes
;; + could add labels / %uids as well
;;
;; - vim syntax => https://github.com/llvm-mirror/llvm/utils/vim/syntax/llvm.vim
;;
;; Reference:
;; https://github.com/llvm-mirror/llvm/docs/LangRef.rst
;;
;;; Installation:
;;
;; Add to `load-path' and generate autoloads or
;; ```lisp
;; (require 'llvm-mode)
;; ```
;;
;;; Code:
(require 'smie)
(defgroup llvm nil
"Major mode for editing llvm assembly source code."
:group 'languages
:prefix "llvm-")
(defcustom llvm-mode-indent-offset 2
"Indentation column following opening braces."
:group 'llvm
:type 'integer)
(defcustom llvm-mode-label-offset 0
"Indentation column for labels."
:group 'llvm
:type 'integer)
(defvar llvm-mode-lookup-instruction-uri
"https://llvm.org/docs/LangRef.html#%s-instruction")
(defvar llvm-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?% "_" table)
(modify-syntax-entry ?. "_" table)
(modify-syntax-entry ?\; "< " table)
(modify-syntax-entry ?\n "> " table)
(modify-syntax-entry ?: "." table)
(modify-syntax-entry ?* "." table)
table)
"Syntax table used while in LLVM mode.")
(defconst llvm-mode-font-lock-keywords
(list
;; Attributes
`(,(regexp-opt
'("alwaysinline" "argmemonly" "builtin" "cold" "convergent" "immarg"
"inaccessiblemem_or_argmemonly" "inaccessiblememonly" "inlinehint"
"jumptable" "minsize" "naked" "nobuiltin" "noduplicate"
"noimplicitfloat" "noinline" "nonlazybind" "norecurse" "noredzone"
"noreturn" "nounwind" "optnone" "optsize" "readnone" "readonly"
"returns_twice" "safestack" "sanitize_address" "sanitize_hwaddress"
"sanitize_memory" "sanitize_memtag" "sanitize_thread" "speculatable"
"ssp" "sspreq" "sspstrong" "strictfp" "uwtable" "writeonly")
'symbols)
. font-lock-constant-face)
;; Globals
'("@[[:alnum:]_]+" . font-lock-function-name-face)
;; Variables
'("%[-a-zA-Z$._][-a-zA-Z$._0-9]*" . font-lock-variable-name-face)
;; Labels
'("[-a-zA-Z$._0-9]+:" . font-lock-variable-name-face)
;; Unnamed variable slots
'("%[-]?[0-9]+" . font-lock-variable-name-face)
;; Types
`(,(regexp-opt
'("void" "i1" "i8" "i16" "i32" "i64" "i128" "float" "double" "type"
"label" "opaque")
'symbols)
. font-lock-type-face)
;; Integer literals
'("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
;; Floating point constants
'("\\b[-+]?[0-9]+.[0-9]*\\([eE][-+]?[0-9]+\\)?\\b" . font-lock-preprocessor-face)
;; Hex constants
'("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face)
;; Keywords
`(,(regexp-opt
'(;; Toplevel entities
"declare" "define" "module" "target" "source_filename" "global"
"constant" "const" "attributes" "uselistorder" "uselistorder_bb"
;; Linkage types
"private" "internal" "weak" "weak_odr" "linkonce" "linkonce_odr"
"available_externally" "appending" "common" "extern_weak" "external"
"uninitialized" "implementation" "..."
;; Values
"true" "false" "null" "undef" "zeroinitializer" "none" "c" "asm"
"blockaddress"
;; Calling conventions
"ccc" "fastcc" "coldcc" "webkit_jscc" "anyregcc" "preserve_mostcc"
"preserve_allcc" "cxx_fast_tlscc" "swiftcc" "atomic" "volatile"
"personality" "prologue" "section")
'symbols)
. font-lock-keyword-face)
;; Arithmetic and Logical Operators
`(,(regexp-opt
'("add" "sub" "mul" "sdiv" "udiv" "urem" "srem" "and" "or" "xor" "setne"
"seteq" "setlt" "setgt" "setle" "setge")
'symbols)
. font-lock-keyword-face)
;; Floating-point operators
`(,(regexp-opt '("fadd" "fsub" "fneg" "fmul" "fdiv" "frem") 'symbols)
. font-lock-keyword-face)
;; Special instructions
`(,(regexp-opt
'("phi" "tail" "call" "select" "to" "shl" "lshr" "ashr" "fcmp" "icmp"
"va_arg" "landingpad")
'symbols)
. font-lock-keyword-face)
;; Control instructions
`(,(regexp-opt
'("ret" "br" "switch" "invoke" "resume" "unwind" "unreachable"
"indirectbr")
'symbols)
. font-lock-keyword-face)
;; Memory operators
`(,(regexp-opt
'("malloc" "alloca" "free" "load" "store" "getelementptr" "fence"
"cmpxchg" "atomicrmw")
'symbols)
. font-lock-keyword-face)
;; Casts
`(,(regexp-opt
'("bitcast" "inttoptr" "ptrtoint" "trunc" "zext" "sext" "fptrunc" "fpext"
"fptoui" "fptosi" "uitofp" "sitofp" "addrspacecast")
'symbols)
. font-lock-keyword-face)
;; Vector ops
`(,(regexp-opt '("extractelement" "insertelement" "shufflevector") 'symbols)
. font-lock-keyword-face)
;; Aggregate ops
`(,(regexp-opt '("extractvalue" "insertvalue") 'symbols) . font-lock-keyword-face)
;; Metadata types
`(,(regexp-opt '("distinct") 'symbols) . font-lock-keyword-face)
;; Use-list order directives
`(,(regexp-opt '("uselistorder" "uselistorder_bb") 'symbols)
. font-lock-keyword-face))
"Syntax highlighting for LLVM.")
;; -------------------------------------------------------------------
;;; Indentation
(defconst llvm-mode-smie-grammar
(smie-prec2->grammar
(smie-precs->prec2
'((assoc ":")))))
;; return ":" on label line
(defun llvm-mode--smie-forward-token ()
(let ((tok (smie-default-forward-token)))
(save-match-data
(if (not (looking-at "[ \t]*:")) tok
(goto-char (match-end 0))
":"))))
(defun llvm-mode-smie-rules (kind token)
(pcase (cons kind token)
(`(:elem . basic) llvm-mode-indent-offset)
(`(:elem . args) 0)
(`(:close-all . ,_) t)
(`(:before . ":")
(if (smie-rule-parent-p ":") 0
llvm-mode-label-offset))
(`(:after . ":")
(if (smie-rule-prev-p ":") llvm-mode-indent-offset
(- llvm-mode-indent-offset llvm-mode-label-offset)))
(`(:list-intro . ,(or ":" "")) t)))
;; -------------------------------------------------------------------
;;; Completion
(defconst llvm-mode-global-regexp
(concat "^\\s-*" (regexp-opt '("declare" "define")) "\\s-*"
"[^@\n]+@\\([[:alnum:]_]+\\)"
"\\|^\\s-*@\\([[:alnum:]_]+\\) *="))
(defun llvm-mode--globals ()
(let (res)
(save-excursion
(goto-char (point-min))
(while (re-search-forward llvm-mode-global-regexp nil t)
(push (or (match-string-no-properties 1)
(match-string-no-properties 2))
res)))
res))
;; basic completion at point
(defun llvm-mode-completion-at-point ()
(when-let* ((bnds (bounds-of-thing-at-point 'symbol)))
(let ((table
(cond
((eq ?@ (char-before (car bnds)))
(list
(completion-table-with-cache
(lambda (_string) (llvm-mode--globals)))
:annotation-function (lambda (_s) " <g>"))))))
(when table
(nconc (list (car bnds) (cdr bnds))
table
(list :exclusive 'no))))))
(defun llvm-mode-lookup-instruction-online (instr)
"Lookup help for INSTR, default to thing at point, in online manual.
With prefix, query for INSTR."
(interactive
(list
(or (and (not current-prefix-arg) (thing-at-point 'symbol))
(read-from-minibuffer "LLVM help for: "))))
(browse-url
(format llvm-mode-lookup-instruction-uri instr)))
;; Imenu: defines / declares / labels
;; XXX: remove duplicate labels??
(defvar llvm-mode-imenu-regexp
`((nil
,(concat (regexp-opt '("declare" "define")) "[^@\n]+@\\([[:alnum:]_]+\\)")
1)
("Label" "^\\s-*\\([[:alpha:]][[:alnum:]_]*\\):" 1)))
(defvar llvm-mode-map
(let ((km (make-sparse-keymap)))
(define-key km (kbd "M-?") #'llvm-mode-lookup-instruction-online)
km))
;;;###autoload
(define-derived-mode llvm-mode prog-mode "LLVM"
"Major mode for editing LLVM source files.
\\{llvm-mode-map}
Runs `llvm-mode-hook' on startup."
(setq font-lock-defaults `(llvm-mode-font-lock-keywords))
(setq-local comment-start ";")
(setq-local imenu-generic-expression llvm-mode-imenu-regexp)
(add-hook 'completion-at-point-functions #'llvm-mode-completion-at-point nil t)
(smie-setup llvm-mode-smie-grammar #'llvm-mode-smie-rules
:forward-token #'llvm-mode--smie-forward-token
:backward-token #'smie-default-backward-token))
;; Associate .ll files with llvm-mode
;;;###autoload
(add-to-list 'auto-mode-alist (cons "\\.ll\\'" 'llvm-mode))
(provide 'llvm-mode)
;;; llvm-mode.el ends here
-111
View File
@@ -1,111 +0,0 @@
(require 'subr-x)
(defvar simpc-mode-syntax-table
(let ((table (make-syntax-table)))
;; C/C++ style comments
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
(modify-syntax-entry ?\n "> b" table)
;; Preprocessor stuff?
(modify-syntax-entry ?# "." table)
;; Chars are the same as strings
(modify-syntax-entry ?' "\"" table)
;; Treat <> as punctuation (needed to highlight C++ keywords
;; properly in template syntax)
(modify-syntax-entry ?< "." table)
(modify-syntax-entry ?> "." table)
(modify-syntax-entry ?& "." table)
(modify-syntax-entry ?% "." table)
table))
(defun simpc-types ()
'("char" "int" "long" "short" "void" "bool" "float" "double" "signed" "unsigned"
"char16_t" "char32_t" "char8_t"
"int8_t" "uint8_t" "int16_t" "uint16_t" "int32_t" "uint32_t" "int64_t" "uint64_t"
"uintptr_t"
"size_t"))
(defun simpc-keywords ()
'("auto" "break" "case" "const" "continue" "default" "do"
"else" "enum" "extern" "for" "goto" "if" "register"
"return" "sizeof" "static" "struct" "switch" "typedef"
"union" "volatile" "while" "alignas" "alignof" "and"
"and_eq" "asm" "atomic_cancel" "atomic_commit" "atomic_noexcept" "bitand"
"bitor" "catch" "class" "co_await"
"co_return" "co_yield" "compl" "concept" "const_cast" "consteval" "constexpr"
"constinit" "decltype" "delete" "dynamic_cast" "explicit" "export" "false"
"friend" "inline" "mutable" "namespace" "new" "noexcept" "not" "not_eq"
"nullptr" "operator" "or" "or_eq" "private" "protected" "public" "reflexpr"
"reinterpret_cast" "requires" "static_assert" "static_cast" "synchronized"
"template" "this" "thread_local" "throw" "true" "try" "typeid" "typename"
"using" "virtual" "wchar_t" "xor" "xor_eq"))
(defun simpc-font-lock-keywords ()
(list
`("# *[#a-zA-Z0-9_]+" . font-lock-preprocessor-face)
`("#.*include \\(\\(<\\|\"\\).*\\(>\\|\"\\)\\)" . (1 font-lock-string-face))
`(,(regexp-opt (simpc-keywords) 'symbols) . font-lock-keyword-face)
`(,(regexp-opt (simpc-types) 'symbols) . font-lock-type-face)))
(defun simpc--previous-non-empty-line ()
(save-excursion
(forward-line -1)
(while (and (not (bobp))
(string-empty-p
(string-trim-right
(thing-at-point 'line t))))
(forward-line -1))
(thing-at-point 'line t)))
(defun simpc--indentation-of-previous-non-empty-line ()
(save-excursion
(forward-line -1)
(while (and (not (bobp))
(string-empty-p
(string-trim-right
(thing-at-point 'line t))))
(forward-line -1))
(current-indentation)))
(defun simpc--desired-indentation ()
(let* ((cur-line (string-trim-right (thing-at-point 'line t)))
(prev-line (string-trim-right (simpc--previous-non-empty-line)))
(indent-len 4)
(prev-indent (simpc--indentation-of-previous-non-empty-line)))
(cond
((string-match-p "^\\s-*switch\\s-*(.+)" prev-line)
prev-indent)
((and (string-suffix-p "{" prev-line)
(string-prefix-p "}" (string-trim-left cur-line)))
prev-indent)
((string-suffix-p "{" prev-line)
(+ prev-indent indent-len))
((string-prefix-p "}" (string-trim-left cur-line))
(max (- prev-indent indent-len) 0))
((string-suffix-p ":" prev-line)
(if (string-suffix-p ":" cur-line)
prev-indent
(+ prev-indent indent-len)))
((string-suffix-p ":" cur-line)
(max (- prev-indent indent-len) 0))
(t prev-indent))))
;;; TODO: customizable indentation (amount of spaces, tabs, etc)
(defun simpc-indent-line ()
(interactive)
(when (not (bobp))
(let* ((desired-indentation
(simpc--desired-indentation))
(n (max (- (current-column) (current-indentation)) 0)))
(indent-line-to desired-indentation)
(forward-char n))))
(define-derived-mode simpc-mode prog-mode "Simple C"
"Simple major mode for editing C files."
:syntax-table simpc-mode-syntax-table
(setq-local font-lock-defaults '(simpc-font-lock-keywords))
(setq-local indent-line-function 'simpc-indent-line)
(setq-local comment-start "// "))
(provide 'simpc-mode)
-137
View File
@@ -1,137 +0,0 @@
(require 'ansi-color)
(global-set-key (kbd "C-c p") 'find-file-at-point)
(global-set-key (kbd "C-c i m") 'imenu)
(setq-default inhibit-splash-screen t
make-backup-files nil
tab-width 4
indent-tabs-mode nil
compilation-scroll-output t
visible-bell (equal system-type 'windows-nt))
(defun rc/colorize-compilation-buffer ()
(read-only-mode 'toggle)
(ansi-color-apply-on-region compilation-filter-start (point))
(read-only-mode 'toggle))
(add-hook 'compilation-filter-hook 'rc/colorize-compilation-buffer)
(defun rc/buffer-file-name ()
(if (equal major-mode 'dired-mode)
default-directory
(buffer-file-name)))
(defun rc/parent-directory (path)
(file-name-directory (directory-file-name path)))
(defun rc/root-anchor (path anchor)
(cond
((string= anchor "") nil)
((file-exists-p (concat (file-name-as-directory path) anchor)) path)
((string-equal path "/") nil)
(t (rc/root-anchor (rc/parent-directory path) anchor))))
(defun rc/clipboard-org-mode-file-link (anchor)
(interactive "sRoot anchor: ")
(let* ((root-dir (rc/root-anchor default-directory anchor))
(org-mode-file-link (format "file:%s::%d"
(if root-dir
(file-relative-name (rc/buffer-file-name) root-dir)
(rc/buffer-file-name))
(line-number-at-pos))))
(kill-new org-mode-file-link)
(message org-mode-file-link)))
;;; Taken from here:
;;; http://stackoverflow.com/questions/2416655/file-path-to-clipboard-in-emacs
(defun rc/put-file-name-on-clipboard ()
"Put the current file name on the clipboard"
(interactive)
(let ((filename (rc/buffer-file-name)))
(when filename
(kill-new filename)
(message filename))))
(defun rc/put-buffer-name-on-clipboard ()
"Put the current buffer name on the clipboard"
(interactive)
(kill-new (buffer-name))
(message (buffer-name)))
(defun rc/kill-autoloads-buffers ()
(interactive)
(dolist (buffer (buffer-list))
(let ((name (buffer-name buffer)))
(when (string-match-p "-autoloads.el" name)
(kill-buffer buffer)
(message "Killed autoloads buffer %s" name)))))
(defun rc/start-python-simple-http-server ()
(interactive)
(shell-command "python -m SimpleHTTPServer 3001 &"
"*Simple Python HTTP Server*"))
(global-set-key (kbd "C-x p s") 'rc/start-python-simple-http-server)
;;; Taken from here:
;;; http://blog.bookworm.at/2007/03/pretty-print-xml-with-emacs.html
(defun bf-pretty-print-xml-region (begin end)
"Pretty format XML markup in region. You need to have nxml-mode
http://www.emacswiki.org/cgi-bin/wiki/NxmlMode installed to do
this. The function inserts linebreaks to separate tags that have
nothing but whitespace between them. It then indents the markup
by using nxml's indentation rules."
(interactive "r")
(save-excursion
(nxml-mode)
(goto-char begin)
(while (search-forward-regexp "\>[ \\t]*\<" nil t)
(backward-char) (insert "\n"))
(indent-region begin end))
(message "Ah, much better!"))
;;; Stolen from http://ergoemacs.org/emacs/emacs_unfill-paragraph.html
(defun rc/unfill-paragraph ()
"Replace newline chars in current paragraph by single spaces.
This command does the inverse of `fill-paragraph'."
(interactive)
(let ((fill-column 90002000)) ; 90002000 is just random. you can use `most-positive-fixnum'
(fill-paragraph nil)))
(global-set-key (kbd "C-c M-q") 'rc/unfill-paragraph)
(defun rc/load-path-here ()
(interactive)
(add-to-list 'load-path default-directory))
(defconst rc/frame-transparency 85)
(defun rc/toggle-transparency ()
(interactive)
(let ((frame-alpha (frame-parameter nil 'alpha)))
(if (or (not frame-alpha)
(= (cadr frame-alpha) 100))
(set-frame-parameter nil 'alpha
`(,rc/frame-transparency
,rc/frame-transparency))
(set-frame-parameter nil 'alpha '(100 100)))))
(defun rc/duplicate-line ()
"Duplicate current line"
(interactive)
(let ((column (- (point) (point-at-bol)))
(line (let ((s (thing-at-point 'line t)))
(if s (string-remove-suffix "\n" s) ""))))
(move-end-of-line 1)
(newline)
(insert line)
(move-beginning-of-line 1)
(forward-char column)))
(global-set-key (kbd "C-,") 'rc/duplicate-line)
;;; A little hack which fixes a problem with meta key in fluxbox under VNC.
(setq x-alt-keysym 'meta)
;(setq confirm-kill-emacs 'y-or-n-p)
-34
View File
@@ -1,34 +0,0 @@
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
;; (add-to-list 'package-archives
;; '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(defvar rc/package-contents-refreshed nil)
(defun rc/package-refresh-contents-once ()
(when (not rc/package-contents-refreshed)
(setq rc/package-contents-refreshed t)
(package-refresh-contents)))
(defun rc/require-one-package (package)
(when (not (package-installed-p package))
(rc/package-refresh-contents-once)
(package-install package)))
(defun rc/require (&rest packages)
(dolist (package packages)
(rc/require-one-package package)))
(defun rc/require-theme (theme)
(let ((theme-package (->> theme
(symbol-name)
(funcall (-flip #'concat) "-theme")
(intern))))
(rc/require theme-package)
(load-theme theme t)))
(rc/require 'dash)
(require 'dash)
(rc/require 'dash-functional)
(require 'dash-functional)
+2
View File
@@ -0,0 +1,2 @@
set mouse=
set ttymouse=
+2
View File
@@ -59,5 +59,7 @@ eval "$(fzf --zsh)"
eval "$(oh-my-posh init zsh --config '~/.p10k.omp.yml')" eval "$(oh-my-posh init zsh --config '~/.p10k.omp.yml')"
#eval "$(~/Dev/oh-my-posh/src/omp init zsh --config '~/.p10k.omp.yml')" #eval "$(~/Dev/oh-my-posh/src/omp init zsh --config '~/.p10k.omp.yml')"
export PATH="$PATH:$HOME/.config/emacs/bin"
# Created by `pipx` on 2025-08-18 19:52:55 # Created by `pipx` on 2025-08-18 19:52:55
export PATH="$PATH:/home/womax/.local/bin" export PATH="$PATH:/home/womax/.local/bin"
+5 -3
View File
@@ -1,11 +1,13 @@
.emacs|symlink| .config/doom|symlink|
.emacs.local|symlink|
.emacs.rc|symlink|
.config/kitty|symlink| .config/kitty|symlink|
.config/i3|symlink|
.config/i3status|symlink|
.config/rofi|symlink| .config/rofi|symlink|
.config/kanata|symlink| .config/kanata|symlink|
.config/kanata-tray|symlink| .config/kanata-tray|symlink|
.config/scripts|symlink|
.zshrc|symlink| .zshrc|symlink|
.p10k.omp.yml|symlink| .p10k.omp.yml|symlink|
.zsh|symlink| .zsh|symlink|
.aliases|symlink| .aliases|symlink|
.vimrc|symlink|
+121
View File
@@ -0,0 +1,121 @@
#
# Config
#
# Reset configuration
unbind-key -a
# Tmux use bash
#set-option -g default-shell /bin/bash
#set-option -g default-command "bash --rcfile /home/aruan/rc"
# Disable mouse support in tmux
# Who is using mouse anyway?
set -g mouse off
# Needed http://superuser.com/questions/360832/how-can-i-make-ctrlleft-right-keys-work-right-in-tmux
set-window-option -g xterm-keys on
# Status bar options
set-option -g status-bg black
set-option -g status-fg green
set-option -g status-interval 1
set-option -g status-justify left
set-option -g status-keys vi
set-option -g status-left "[#S]" # Session name on left
set-option -g status-left-length 15
set-option -g status-right "#H [%H:%M:%S %d.%m.%y]" # Date and host on right
set-option -g status-right-length 40
set-option -g default-terminal "screen-256color" # Recommended by tmux
set-option -g status-position top # Move status bar to the top
set-option -g window-status-current-style bright # active pane name in bold
# Windows options
# Renumber windows when we move them
set-option -g renumber-windows on
# Aggressive resize
set-window-option -g aggressive-resize on # Resize
set-window-option -g mode-keys vi # VI mode
set-option -s escape-time 0 # No wait on escape
# Reload config
# bind-key r source-file /etc/tmux/tmux-aruan.conf \; display-message "Config reloaded."
#
# Bindings
#
# bind-key -n --> prefix not needed
# bind-key --> prefix needed
bind-key : command-prompt
#
# Windows bindings
#
bind-key & confirm-before -p "kill-window #W? (y/n)" kill-window
bind-key -n C-n new-window \; rename-window "-"
bind-key c new-window \; rename-window "-"
bind-key -n F2 new-window \; rename-window "-"
bind-key -n F3 previous-window
bind-key -n F4 next-window
bind-key -n C-S-F3 swap-window -t :-1
bind-key -n C-S-F4 swap-window -t :+1
bind-key -n F6 detach
# Detach all other clients
bind-key -n S-F6 detach-client -a
bind-key -n F7 copy-mode
bind-key -n M-NPage copy-mode \; send-keys NPage
bind-key -n M-PPage copy-mode \; send-keys PPage
bind-key -n F8 command-prompt -p "(rename-window) " "rename-window '%%'"
bind-key -n C-F8 command-prompt -p "(rename-session) " "rename-session '%%'"
bind-key -n F9 last-window
# Select windows with alt+number
bind-key -n M-0 select-window -t 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
#
# Panes bindings
#
# Split panes
bind-key h split-window -v
bind-key v split-window -h
# Move between pane with arrow
bind-key -n S-left select-pane -L
bind-key -n S-right select-pane -R
bind-key -n S-up select-pane -U
bind-key -n S-down select-pane -D
# Next layout
bind-key -n C-space next-layout
# Synchronise panes
bind-key -n M-s set-window-option synchronize-panes
bind-key -n M-z resize-pane -Z
# Kill pane
bind-key x confirm-before -p "kill-pane #W? (y/n)" kill-pane
# Resize pane
bind-key -n C-S-up resize-pane -U 10
bind-key -n C-S-down resize-pane -D 10
bind-key -n C-S-left resize-pane -L 10
bind-key -n C-S-right resize-pane -R 10
#
# Misc
#
# Blinking status on change
set-option -g window-status-format " #{?window_activity_flag, #[fg=colour231]#[blink],#[fg=colour245]}#{?window_bell_flag,#[fg=colour01]#[blink],#[fg=colour245]}#I:#W "
set-option -g monitor-activity on
#pane border
set-option -g pane-border-style 'bg=colour235'
set-option -g pane-border-style 'fg=colour238'
set-option -g pane-active-border-style 'bg=colour235'
set-option -g pane-active-border-style 'fg=colour51'