From a3c1649a195cf87db6581b5a8c703fa867462210 Mon Sep 17 00:00:00 2001 From: gxlin Date: Mon, 14 Jun 2021 15:34:09 +0800 Subject: more config --- .emacs.d/init-mu4e.el | 33 +++++++++++++++++++++++++ .emacs.d/init.el | 2 ++ .emacs.d/modes/init-lsp-mode.el | 2 +- .tmux.conf | 53 +++++++++++++++++++++++++++-------------- .vim/keybindings.vim | 10 ++++++++ .vim/plugins/fugitive.vim | 4 ++++ .vim/plugins/vimwiki.vim | 3 +++ .zshrc | 1 - 8 files changed, 88 insertions(+), 20 deletions(-) create mode 100644 .emacs.d/init-mu4e.el create mode 100644 .vim/plugins/fugitive.vim diff --git a/.emacs.d/init-mu4e.el b/.emacs.d/init-mu4e.el new file mode 100644 index 0000000..bfa2bdc --- /dev/null +++ b/.emacs.d/init-mu4e.el @@ -0,0 +1,33 @@ +(use-package mu4e + :ensure nil + :config + (setq mail-user-agent 'mu4e-user-agent) + (setq + message-send-mail-function 'smtpmail-send-it + smtpmail-default-smtp-server "smtp.gmail.com" + smtpmail-smtp-server "smtp.gmail.com" + smtpmail-local-domain "gmail.com") + (setq mu4e-use-fancy-chars t) + (setq mu4e-attachment-dir "~/Downloads/") + (setq mu4e-view-show-images t) + ; (setq mu4e-get-mail-command "offlineimap" + ; mu4e-update-interval 300) + (setq mu4e-index-cleanup nil + mu4e-index-lazy-check t) + + (setq mu4e-contexts + `( ,(make-mu4e-context + :name "Gmail" + :match-func (lambda (msg) + (when msg + (string-prefix-p "/Gmail" (mu4e-message-field msg :maildir)))) + :vars '( + (mu4e-trash-folder . "/Gmail/[Gmail].Bin") + (mu4e-refile-folder . "/Gmail/[Gmail].All Mail") + (mu4e-sent-folder . "/Gmail/[Gmail].Sent Mail") + (mu4e-drafts-folder . "/Gmail/[Gmail].Drafts"))))) + (add-to-list 'mu4e-view-actions '("View in Browser" . mu4e-action-view-in-browser) t) + (evil-define-key 'normal 'global + (kbd "m") 'mu4e)) + +(provide 'init-mu4e) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 7d213be..927ec8c 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -18,6 +18,7 @@ (setq use-package-always-ensure t) (xterm-mouse-mode 1) ;; Enable mouse +(add-to-list 'load-path "~/.dotfiles/.emacs.d/") (add-to-list 'load-path "~/.dotfiles/.emacs.d/modes/") (use-package atom-one-dark-theme @@ -37,6 +38,7 @@ (require 'init-evil-mode) (require 'init-org-mode) (require 'init-lsp-mode) +(require 'init-mu4e) ;; ledger-mode (use-package ledger-mode diff --git a/.emacs.d/modes/init-lsp-mode.el b/.emacs.d/modes/init-lsp-mode.el index b5c391a..a44c722 100644 --- a/.emacs.d/modes/init-lsp-mode.el +++ b/.emacs.d/modes/init-lsp-mode.el @@ -8,6 +8,6 @@ (evil-define-key 'normal lsp-mode-map (kbd "gd") 'lsp-find-definition (kbd "gr") 'lsp-find-references) - (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.git\\'") + (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.git\\'")) (provide 'init-lsp-mode) diff --git a/.tmux.conf b/.tmux.conf index 1813106..454d63c 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,25 +1,42 @@ -# modify the prefix -# unbind ^b -# set -g prefix 'M-`' +# general + +unbind ^b +set -g prefix 'C-\' +bind 'C-\' send-prefix -2 +set -sg escape-time 0 + +set -g default-terminal "xterm-256color" +bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced' +set -g mouse on +set-option -g allow-rename off # vim mode -setw -g mode-keys vi +set-window-option -g mode-keys vi + +# navigation + +bind n new-session +bind f command-prompt -p find-session: 'switch-client -t %%' + +bind | split-window -h -c '#{pane_current_path}' +bind - split-window -v -c '#{pane_current_path}' +unbind '"' +unbind % + +## swtich between pane +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +## resize the pane +bind H resize-pane -L 5 +bind L resize-pane -R 5 +bind K resize-pane -U 5 +bind J resize-pane -D 5 + # copy and paste like vim # bind -T copy-mode-vi 'v' send -X begin-selection # bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" -# swtich between pane -# bind h select-pane -L -# bind j select-pane -D -# bind k select-pane -U -# bind l select-pane -R - -# resize the pane -# bind h resize-pane -L 10 -# bind l resize-pane -R 10 -# bind k resize-pane -U 5 -# bind j resize-pane -D 5 - -# color of tmux -set -g default-terminal "screen-256color" diff --git a/.vim/keybindings.vim b/.vim/keybindings.vim index 7a68992..b76eb27 100644 --- a/.vim/keybindings.vim +++ b/.vim/keybindings.vim @@ -43,3 +43,13 @@ function! s:split_line_text_at_cursor() let text_before_cursor = (col('.') > 1) ? line_text[: col('.')-2] : '' return [text_before_cursor, text_after_cursor] endfunction + +function! s:toggle_quickfix() + if empty(filter(getwininfo(), 'v:val.quickfix')) + copen + else + cclose + endif +endfunction + +nnoremap c :call s:toggle_quickfix() diff --git a/.vim/plugins/fugitive.vim b/.vim/plugins/fugitive.vim new file mode 100644 index 0000000..8029fc3 --- /dev/null +++ b/.vim/plugins/fugitive.vim @@ -0,0 +1,4 @@ +Plug 'tpope/vim-fugitive' + +nnoremap gl :Gclog! -- % +nnoremap gd :Gdiffsplit diff --git a/.vim/plugins/vimwiki.vim b/.vim/plugins/vimwiki.vim index f2930e4..cba8593 100644 --- a/.vim/plugins/vimwiki.vim +++ b/.vim/plugins/vimwiki.vim @@ -4,3 +4,6 @@ let g:vimwiki_list = [{'path': '~/Documents/notes', \ 'syntax': 'markdown', 'ext': '.md'}] au FileType vimwiki setlocal textwidth=72 + +let g:vimwiki_CJK_length = 1 +let g:vimwiki_url_maxsave = 0 diff --git a/.zshrc b/.zshrc index bf3fc6a..e96709c 100644 --- a/.zshrc +++ b/.zshrc @@ -63,4 +63,3 @@ if ! zplug check --verbose; then fi zplug load -alias emacs='emacs -nw' -- cgit v1.2.3