emacs config on win10 for rust 1

native win32

(setq package-archives (("gnu"   . "http://mirrors.ustc.edu.cn/elpa/gnu/")
                         ("melpa" . "http://mirrors.ustc.edu.cn/elpa/melpa/")))

(use-package rustic)
(add-hook rust-mode-hook
      (lambda () (setq indent-tabs-mode nil)))
(add-hook rust-mode-hook
      (lambda () (define-key rust-mode-map (kbd "C-c C-c") rust-run)))
(setq rust-format-on-save t)

(require yasnippet)
(yas-global-mode 1)
(electric-pair-mode)
(global-company-mode)

(add-hook julia-mode-hook julia-repl-mode)

(setq racket-program "G:\\Program Files\\Racket\\Racket.exe")
(require racket-xp)
(add-hook racket-mode-hook #racket-xp-mode)

(add-hook racket-mode-hook #racket-mode-xref-backend-function)
(add-hook racket-xp-mode-hook #racket-xp-xref-backend-function)
(add-hook racket-repl-mode-hook #racket-repl-xref-backend-function)

(use-package paredit
  :ensure t
  :config
  (dolist (m (emacs-lisp-mode-hook
           lisp-mode-hook
           racket-mode-hook
           racket-repl-mode-hook))
    (add-hook m #paredit-mode))
  (bind-keys :map paredit-mode-map
         ("{" . paredit-open-curly)
         ("}" . paredit-close-curly))
  (unless terminal-frame
    (bind-keys :map paredit-mode-map
           ("M-[" . paredit-wrap-square)
           ("M-{" . paredit-wrap-curly))))

(eval-after-load scheme
  (define-key scheme-mode-map "\t" scheme-complete-or-indent))
(autoload scheme-get-current-symbol-info "scheme-complete" nil t)
(add-hook scheme-mode-hook
      (lambda ()
        (make-local-variable eldoc-documentation-function)
        (setq eldoc-documentation-function scheme-get-current-symbol-info)
        (eldoc-mode)))

;(require rainbow-delimiters)
(require highlight-parentheses)

(dolist (m (emacs-lisp-mode-hook
         lisp-mode-hook
         racket-mode-hook
         racket-repl-mode-hook))
  ;(add-hook m #rainbow-delimiters-mode)
  (add-hook m #highlight-parentheses-mode))
(global-paren-face-mode)
(load (expand-file-name "C:/users/o/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl")
(slime-setup (slime-fancy slime-company))
(add-to-list slime-contribs slime-repl)
(load-theme solarized-dark t)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they wont work right.
 (julia-program "G:/Julia 1.5.3/bin/julia.exe")
 (package-selected-packages
   (all-the-icons-dired dired-du dired-explorer dired-filter dired-icon dired-rainbow direx paren-face common-lisp-snippets redshank slime-company slime highlight-parentheses solarized-theme rainbow-delimiters yasnippet use-package-hydra use-package-ensure-system-package use-package-el-get use-package-chords thrift scribble-mode scheme-complete rustic racket-mode paredit mic-paren lsp-ui lsp-julia julia-vterm julia-shell julia-repl flycheck-rust flycheck-julia el-get company)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they wont work right.
 (default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 143 :width normal)))))

msys2

;(setq package-archives (("gnu"   . "http://mirrors.ustc.edu.cn/elpa/gnu/")
 ;                        ("melpa" . "http://mirrors.ustc.edu.cn/elpa/melpa/")))
(setq package-archives (("gnu" . "http://mirrors.ustc.edu.cn/elpa/gnu/")
                         ("melpa" . "http://mirrors.ustc.edu.cn/elpa/melpa/")
                         ("melpa-stable" . "http://mirrors.ustc.edu.cn/elpa/melpa-stable/")
                         ("org" . "http://mirrors.ustc.edu.cn/elpa/org/")))
(setq package-archives nil)
(global-company-mode)
(global-flycheck-mode)

(eval-after-load company
  (add-to-list company-backends company-irony))

(eval-after-load company
  (add-to-list company-backends company-c-headers))

(add-hook c++-mode-hook irony-mode)
(add-hook c-mode-hook irony-mode)
(add-hook objc-mode-hook irony-mode)

(defun compile-gtk-single-file ()
  (interactive)
  (let* ((base-name (file-name-base (buffer-file-name)))
     (exe-name (concat base-name ".exe"))
     (source-name (concat base-name ".c"))
     (cmd (read-shell-command "Compile single gtk file: "
                 (concat "gcc `pkg-config --cflags gtk4` -o "
                     exe-name " "
                     source-name
                     " `pkg-config --libs gtk4`"
                     " && ./"
                     exe-name
                     " &"))))
    (shell-command cmd)))

(defun run-gtk-single-file ()
  (interactive)
  (let* ((base-name (file-name-base (buffer-file-name)))
     (exe-name (concat base-name ".exe"))
     (cmd (read-shell-command "Run single gtk file: "
                  (concat "./"
                      exe-name
                      " &"))))
    (shell-command cmd)))

(add-hook c-mode-hook
      (lambda ()
         (local-set-key (kbd "C-c c") compile-gtk-single-file)
         (local-set-key (kbd "C-c r") run-gtk-single-file)))

(ivy-mode)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(setq search-default-mode #char-fold-to-regexp)
(global-set-key "\C-s" swiper)
(global-set-key (kbd "C-c C-r") ivy-resume)
(global-set-key (kbd "M-x") counsel-M-x)
(global-set-key (kbd "C-x C-f") counsel-find-file)
(define-key minibuffer-local-map (kbd "C-r") counsel-minibuffer-history)

(setenv "GTAGSLIBPATH" "G:/msys64/mingw64/include/")
(load-file "g:/msys64/home/o/.emacs.d/global-tags.el/global-tags.el")
(add-hook c-mode-hook #global-tags-exclusive-backend-mode)
(add-hook c-mode-hook
      (lambda ()
        (add-hook after-save-hook
              #global-tags-update-database-with-buffer
              nil
              t)))



(use-package ivy-xref
  :ensure t
  :init
  ;; xref initialization is different in Emacs 27 - there are two different
  ;; variables which can be set rather than just one
  (when (>= emacs-major-version 27)
    (setq xref-show-definitions-function #ivy-xref-show-defs))
  ;; Necessary in Emacs <27. In Emacs 27 it will affect all xref-based
  ;; commands other than xref-find-definitions (e.g. project-find-regexp)
  ;; as well
  (setq xref-show-xrefs-function #ivy-xref-show-xrefs))

;; Windows performance tweaks
;;
(when (boundp w32-pipe-read-delay)
  (setq w32-pipe-read-delay 0))
;; Set the buffer size to 64K on Windows (from the original 4K)
(when (boundp w32-pipe-buffer-size)
  (setq irony-server-w32-pipe-buffer-size (* 64 1024)))

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they wont work right.
 (company-backends
   (company-c-headers company-clang company-irony company-bbdb company-semantic company-cmake company-capf company-clang company-files
               (company-dabbrev-code company-gtags company-etags company-keywords)
               company-oddmuse company-dabbrev))
 (company-c-headers-path-system
   ("g:/msys64/mingw64/include" "g:/msys64/mingw64/include/gtk-4.0" "g:/msys64/mingw64/include/glib-2.0" "g:/msys64/mingw64/include/graphene-1.0" "g:/msys64/mingw64/lib/glib-2.0/include" "g:/msys64/mingw64/include/cairo" "g:/msys64/mingw64/include/pango-1.0" "g:/msys64/usr/include" "g:/msys64/mingw64/include/harfbuzz" "g:/msys64/mingw64/include/gdk-pixbuf-2.0" "g:/msys64/mingw64/lib/graphene-1.0/include"))
 (company-clang-arguments
   ("-IG:/msys64/mingw64/include" "-IG:/msys64/mingw64/include/gtk-4.0" "-IG:/msys64/mingw64/include/glib-2.0" "-IG:/msys64/mingw64/include/graphene-1.0" "-IG:/msys64/mingw64/lib/glib-2.0/include" "-IG:/msys64/mingw64/include/cairo" "-IG:/msys64/mingw64/include/pango-1.0" "-IG:/msys64/usr/include" "-IG:/msys64/mingw64/include/harfbuzz" "-IG:/msys64/mingw64/include/gdk-pixbuf-2.0" "-IG:/msys64/mingw64/lib/graphene-1.0/include"))
 (company-minimum-prefix-length 2)
 (flycheck-clang-include-path
   ("g:/msys64/mingw64/include" "g:/msys64/mingw64/include/gtk-4.0" "g:/msys64/mingw64/include/glib-2.0" "g:/msys64/mingw64/include/graphene-1.0" "g:/msys64/mingw64/lib/glib-2.0/include" "g:/msys64/mingw64/include/cairo" "g:/msys64/mingw64/include/pango-1.0" "g:/msys64/usr/include" "g:/msys64/mingw64/include/harfbuzz" "g:/msys64/mingw64/include/gdk-pixbuf-2.0" "g:/msys64/mingw64/lib/graphene-1.0/include"))
 (flycheck-clang-includes nil)
 (flycheck-gcc-include-path nil)
 (package-selected-packages
   (ht async persp-mode-projectile-bridge use-package ivy-xcdoc ivy-xref counsel-gtags swiper ivy gxref flycheck-irony company-irony-c-headers company-irony irony clang-capf clang-format clang-format+ company company-c-headers company-ctags))
 (sql-connection-alist
   (("stock"
      (sql-product ms)
      (sql-user "sa")
      (sql-password "JianBing!@#0831")
      (sql-server "121.196.17.12")
      (sql-database "DataSource"))))
 (sql-ms-program
   "C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\SQLCMD.EXE"))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they wont work right.
 )

 

emacs config on win10 for rust 1

上一篇:自定义WPF分页控件


下一篇:AcWing 双指针、BFS与图论打卡