22 Cometimentos

7 ficheiros alterados com 80 adições e 26 eliminações
  1. +1
    -0
      Makefile
  2. +50
    -19
      emacs.el
  3. +1
    -0
      gitignore_global
  4. +14
    -0
      others/ptpython.py
  5. +4
    -1
      profile
  6. +9
    -5
      shrc
  7. +1
    -1
      tmux.conf

+ 1
- 0
Makefile Ver ficheiro

@@ -345,6 +345,7 @@ endif
$(git_conf) alias.stashsnap '! gitdir="`git rev-parse --git-dir`" && : >>"$$gitdir"/logs/refs/snapshot && cmt=`git stash create` && test -n "$$cmt" && git update-ref refs/snapshot $$cmt && echo Snapshot created: $$cmt'
#$(git_conf) alias.snap '! gitdir="`git rev-parse --git-dir`" && export GIT_INDEX_FILE="$$gitdir"/snapshot.index && cp -pf "$$gitdir"/index "$$GIT_INDEX_FILE" && git add -Av && : >>"$$gitdir"/logs/refs/snapshot && git update-ref refs/snapshot $$(git commit-tree $$(git write-tree) -m Snapshot -p HEAD) && git show --stat snapshot'
$(git_conf) alias.snap snapshot
$(git_conf) alias.pr checkout-pr

$(git_conf) alias.setcmd '! f(){ git config alias.$$1 "! $$2"; }; f'
$(git_conf) alias.make '!make'


+ 50
- 19
emacs.el Ver ficheiro

@@ -26,6 +26,8 @@
;; make directories
(unless (file-directory-p (expand-file-name user-emacs-directory))
(make-directory (expand-file-name user-emacs-directory)))
(unless (file-directory-p (expand-file-name "info" user-emacs-directory))
(make-directory (expand-file-name "info" user-emacs-directory)))

;; Custom file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
@@ -528,10 +530,11 @@ Otherwize hook it."
(define-key ctl-x-map (kbd "C-x") 'my-exchange-point-and-mark)
(when (fboundp 'counsel-mark-ring)
(define-key ctl-x-map "m" 'counsel-mark-ring))
(with-eval-after-load 'ivy
(defvar ivy-sort-functions-alist)
(add-to-list 'ivy-sort-functions-alist
'(counsel-mark-ring)))
;; ?
;; (with-eval-after-load 'ivy
;; (defvar ivy-sort-functions-alist)
;; (add-to-list 'ivy-sort-functions-alist
;; '(counsel-mark-ring)))
(run-with-idle-timer 10 t
(lambda ()
(push-mark)
@@ -792,6 +795,10 @@ THEM are function and its args."
(with-eval-after-load 'minibuffer-line
(set-face-underline 'minibuffer-line nil)
)
(with-eval-after-load 'git-ps1-mode
(defvar git-ps1-mode-ps1-file-candidates-list)
(add-to-list 'git-ps1-mode-ps1-file-candidates-list
"/Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh"))
(when (fboundp 'minibuffer-line-mode)
(set-variable 'minibuffer-line-refresh-interval
25)
@@ -991,7 +998,7 @@ THEM are function and its args."
(defvar whitespace-mode)
(add-to-list 'whitespace-display-mappings
;; We need t since last one takes precedence
`(tab-mark ?\t ,(vconcat "|>\t")) t)
`(tab-mark ?\t ,(vconcat ">\t")) t)
;; (add-to-list 'whitespace-display-mappings
;; `(newline-mark ?\n ,(vconcat "$\n")))
(set-variable 'whitespace-style '(face
@@ -1246,6 +1253,7 @@ THEM are function and its args."
:history 'my-cousel-recently-history
:preselect default-directory
:action (lambda (x) (find-file x))
:sort nil
:caller 'my-counsel-recently))

(define-key ctl-x-map (kbd "C-r") 'my-counsel-recently)
@@ -1487,14 +1495,7 @@ ORIG-FUNC is the target function, and ARGS is the argument when it is called."
(set-variable 'remember-notes-initial-major-mode
'change-log-mode)

(declare-function global-magit-file-mode "magit-files")
(with-eval-after-load 'magit-files
;; `global-magit-file-mode' is enabled by default and this mode overwrites
;; existing keybindings.
;; Apparently it is a HARMFUL behavior and it is really awful that I have
;; to disable thie mode here, but do anyway.
;; See also https://github.com/magit/magit/issues/3517
(global-magit-file-mode -1))
(set-variable 'magit-define-global-key-bindings nil)

(with-eval-after-load 'magit-section
(set-face-background 'magit-section-highlight
@@ -1837,9 +1838,12 @@ ORIG-FUNC is the target function, and ARGS is the argument when it is called."

(with-eval-after-load 'sql
(require 'sql-indent nil t))
(set-variable 'sqlind-basic-offset 4)
(add-to-list 'auto-mode-alist
'("\\.hql\\'" . sql-mode))

(set-variable 'sqlformat-command 'pgformatter)

(when (fboundp 'git-command)
(define-key ctl-x-map "g" 'git-command))

@@ -2091,6 +2095,13 @@ ORIG-FUNC is the target function, and ARGS is the argument when it is called."
(add-to-list 'interpreter-mode-alist
'("node" . js-mode))

(add-hook 'js-mode-hook
(lambda ()
;; Stop current line highlighting
(set-variable 'js-indent-level 2 t)
))


(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

(with-eval-after-load 'uniquify
@@ -2176,7 +2187,7 @@ ORIG-FUNC is the target function, and ARGS is the argument when it is called."
(add-hook 'go-mode-hook
(lambda()
(defvar go-mode-map)
(add-hook 'before-save-hook' 'gofmt-before-save nil t)
(add-hook 'before-save-hook 'gofmt-before-save nil t)
(define-key go-mode-map (kbd "M-.") 'godef-jump)))

(when (fboundp 'k8s-mode)
@@ -2568,6 +2579,13 @@ ARG is num to show, or defaults to 7."
(define-key ctl-x-map "T" 'git-worktree)
(define-key ctl-x-map "W" 'git-walktree)

(defun mkcdd ()
"Make date directory and open it with dired."
(interactive)
(let ((d (format-time-string "%Y%m%d-%H%M%S")))
(make-directory d)
(find-file d)))

(when (fboundp 'browse-url-default-macosx-browser)
(defalias 'browse-osx 'browse-url-default-macosx-browser))

@@ -2718,10 +2736,11 @@ and search from projectile root (if projectile is available)."
(error "No symbol at point")))
(error "My-Rgrep: Command for rgrep not found"))))
(if (eval-and-compile (require 'projectile nil t))
(projectile-with-default-dir (or (projectile-project-root)
default-directory)
(compilation-start command-args
'grep-mode))
(with-temp-buffer
(cd (or (projectile-project-root)
default-directory))
(compilation-start command-args
'grep-mode))
(compilation-start command-args
'grep-mode))))

@@ -2965,6 +2984,7 @@ ARGS are not used."
url))


(declare-function vterm "vterm")
;; 前の実行結果を残したまま次のコマンドを実行する方法はあるだろうか
(defun my-vterm-cmd (command)
"Start arbitrary command in vterm buffer."
@@ -2997,8 +3017,9 @@ ARGS are not used."
;; (set-variable 'eglot-extend-to-xref t))

(set-variable 'lsp-python-ms-auto-install-server t)
(set-variable 'lsp-python-ms-parse-dot-env-enabled t)
(set-variable 'lsp-python-ms-python-executable-cmd "python3")
(add-hook 'python-mode-hook #'my-lsp-python-setup)
;; (add-hook 'python-mode-hook #'my-lsp-python-setup)

(defun my-lsp-python-setup ()
"Setup python ms."
@@ -3006,6 +3027,16 @@ ARGS are not used."
(require 'lsp-python-ms nil t))
(lsp)))

(set-variable 'awk-preview-default-program
"# C-c C-l: Update preview C-c C-c: Commit and exit
# C-c C-r: Resest to original C-c C-k: Abort
{
# Replace string
# gsub(BEFORE, AFTER, $0)
print NR, $0
}
")



(message "Emacs started at %s"


gitignore → gitignore_global Ver ficheiro

@@ -1,3 +1,4 @@
# ln -s `pwd`/gitignore_global XDG_CONFIG_HOME/git/ignore
\#*
*~
.DS_Store

+ 14
- 0
others/ptpython.py Ver ficheiro

@@ -0,0 +1,14 @@
"""
Configuration for ``ptpython``.

Copy this file to $XDG_CONFIG_HOME/ptpython/config.py
On Linux, this is: ~/.config/ptpython/config.py
On macOS, this is: ~/Library/Application Support/ptpython/config.py
"""

__all__ = ["configure"]


def configure(repl):
repl.use_code_colorscheme("native")
return

+ 4
- 1
profile Ver ficheiro

@@ -132,7 +132,10 @@ then
export PIPX_DEFAULT_PYTHON="$HOME"/.brew/bin/python3
fi

export STARDICT_DATA_DIR=$HOME/.brew/share/sdcv-dict-oxford
if which brew >/dev/null
then
export STARDICT_DATA_DIR=`brew --prefix`/share/sdcv-dict-oxford
fi

export HOMEBREW_NO_AUTO_UPDATE=1



+ 9
- 5
shrc Ver ficheiro

@@ -341,6 +341,9 @@ __safe_alias py2=python2
__safe_alias ipy=ipython
__safe_alias ipy3=ipython3
__safe_alias ipy2=ipython2
__safe_alias ipy=ptpython
__safe_alias ipy3=ptpython3

__safe_alias rl=rlwrap
__safe_alias igosh=gosh-rl

@@ -971,9 +974,10 @@ __my_ps1_moc(){
}

for f in /usr/share/git/git-prompt.sh \
"`brew --prefix 2>/dev/null`"/etc/bash_completion.d/git-prompt.sh \
/Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh \
/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh \
/usr/local/opt/bash-git-prompt/share/gitprompt.sh \
"`brew --prefix 2>/dev/null`"/etc/bash_completion.d/git-prompt.sh \
/usr/share/git-core/contrib/completion/git-prompt.sh \
/usr/local/share/git-core/contrib/completion/git-prompt.sh \
/etc/bash_completion.d/git-prompt \
@@ -1042,11 +1046,11 @@ __my_ps1_jobs(){
}

__my_ps1_dollar(){
if test -z "$SHLVL"
if test -z "$2"
then
printf "$1"
else
perl -e 'while($ARGV[0]-- > 0){print "$ARGV[1]";}' $SHLVL "$1"
perl -e 'while($ARGV[0]-- > 0){print "$ARGV[1]";}' "$2" "$1"
fi
}

@@ -1168,13 +1172,13 @@ if $inzsh
then
PROMPT="\
${__my_ps1_beg}[${__my_c2}%n@%M${__my_cdef}:${__my_c1}%~/${__my_cdef}]\$(__my_ps1_info1)
${__my_ps1_beg}\$(__my_ps1_info2) $(__my_ps1_dollar %#) "
${__my_ps1_beg}\$(__my_ps1_info2) $(__my_ps1_dollar %# $SHLVL) "
RPROMPT="%D{%Y/%m/%d %H:%M}"
elif $inbash
then
PS1="\
${__my_ps1_beg}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_info1)\n\
${__my_ps1_beg}\D{%Y/%m/%d %H:%M} \$(__my_ps1_info2)${__my_ps1_right} $(__my_ps1_dollar \\$) "
${__my_ps1_beg}\D{%Y/%m/%d %H:%M} \$(__my_ps1_info2)${__my_ps1_right} $(__my_ps1_dollar \\$ $SHLVL) "
else
true
# PS1="$(printf $(whoami)@$(hostname)$ )"


+ 1
- 1
tmux.conf Ver ficheiro

@@ -29,7 +29,7 @@ setw -g mode-keys vi
#setw -g mode-mouse off
#set -g default-command /bin/bash
# Use C-z x to kill window
set -g default-command "while true; do /bin/bash -l; done"
set -g default-command "while true; do env SHLVL= /bin/bash -l; done"

# Use pasteboard on MacOS
run-shell 'test "`uname`" = Darwin && tmux bind-key -T copy-mode-vi "Enter" send-keys -X copy-pipe-and-cancel "pbcopy"'


Carregando…
Cancelar
Guardar