Skip to content

Instantly share code, notes, and snippets.

@jacknagel
Last active April 24, 2017 00:30
Show Gist options
  • Save jacknagel/bfabe2a34f2d6698aa94570bb06bfbff to your computer and use it in GitHub Desktop.
Save jacknagel/bfabe2a34f2d6698aa94570bb06bfbff to your computer and use it in GitHub Desktop.
uemacs config
; https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git/
; the command bound to M-FNR will execute for every new buffer
bind-to-key execute-macro-1 M-FNR
; custom key bindings
bind-to-key newline-and-indent ^J
;bind-to-key execute-macro-2 ^T
;bind-to-key execute-macro-3
;bind-to-key execute-macro-4
; settings
set $fillcol 78
set $scroll FALSE
set $overlap 2
; macros
1 store-macro
!if &gre &sin $cfname "COMMIT_EDITMSG" 0
add-mode "wrap"
set $fillcol 72
!endif
!if &gre &sin $cfname "TAG_EDITMSG" 0
add-mode "wrap"
set $fillcol 72
!endif
!if &gre &sin $cfname "gitconfig" 0
4 handle-tab
!endif
!if &gre &sin $cfname ".gitmodules" 0
4 handle-tab
!endif
!if &gre &sin $cfname "git-rebase-todo" 0
4 handle-tab
!endif
!if &gre &sin $cfname ".pl" 0
add-mode "cmode"
4 handle-tab
!endif
!if &gre &sin $cfname ".py" 0
4 handle-tab
!endif
!if &gre &sin $cfname ".rb" 0
2 handle-tab
!endif
!if &gre &sin $cfname ".sh" 0
4 handle-tab
!endif
!if &gre &sin $cfname ".tex" 0
add-mode "wrap"
!endif
!if &gre &sin $cfname ".txt" 0
add-mode "wrap"
!endif
!if &gre &sin $cfname "README" 0
add-mode "wrap"
!endif
set %rctmp &sin $cfname "."
!if &equ %rctmp 0
!return
!endif
set %rctmp &mid $cfname &add %rctmp 1 5
!if &or &seq %rctmp "c" &seq %rctmp "h"
add-mode "cmode"
!endif
!endm
2 store-macro
filter-buffer "sed 's/[ \t]*$//'"
!endm
3 store-macro
write-message "[Indenting region]"
set %endline $curline
set %endpos $cwline
exchange-point-and-mark
set-mark
!while &gre %endline $curline
beginning-of-line
handle-tab
next-line
!endwhile
beginning-of-line
set $cwline %endpos
write-message "[Region indented]"
!endm
4 store-macro
write-message "[Undenting region]"
set %endline $curline
set %endpos $cwline
exchange-point-and-mark
set-mark
!while &gre %endline $curline
beginning-of-line
!if &gre $lwidth 0
delete-next-character
!endif
next-line
!endwhile
beginning-of-line
set $cwline %endpos
write-message "[Region undented]"
!endm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment