Spacemacs能对scratch补全,却不能对打开Python文件的buffer补全。

请教大家,为什么我的Spacemacs在scratch(我设置了默认Python mode)中可以正常补全(但不能跳转到定义),在Python文件buffer中却不行呢?使用的major mode和minor mode看起来是一样的。

将scratch中的内容另存为t1.py文件之后依然可以正常补全,但如果重新打开t1.py文件,又不能补全了。

我用的是Windows 10系统下的最新的Spacemacs develop版,之前补全和代码跳转都正常,昨天又pip install了一些包(pip install rope jedi flake8 importmagic autopep8 yapf),今天发现就异常(message buffer中无任何提示)了。

在Python文件buffer中将anaconda-mode disable之后可以补全,但候选补全明显不合理。在scratch中是否激活anaconda-mode对补全功能貌似没有影响。

重装Spacemacs之后,转到scratch之后会提示安装依赖的RPC,安装之后scratch可以补全,在打开的Python文件buffer下依然不能补全

1C}GS)622{5_JLZC

我用的Python相关设置主要如下:

  ;; python environment
;;; package --- summary or add python emacs mode: elpy
  ;; add repository

  (require 'package)
  (setq package-archives '(
                           ("gnu" . "http://elpa.gnu.org/packages/")
                           ("melpa" . "http://melpa.milkbox.net/packages/")
                           ))
  (add-to-list 'package-archives
               '("marmalade" . "http://marmalade-repo.org/packages/"))
  (package-initialize)

  ;; automatical complete: company
  (require 'company)
  (add-hook 'after-init-hook 'global-company-mode); global enable
  (setq company-show-numbers t); display serial number
  (setq company-idle-delay 0.2); menu delay
  (setq company-minimum-prefix-length 1); start completelyness number

  ;; elpy-- main actor
  (require 'elpy)
  (elpy-enable)
  ;; enable elpy jedi backend
  (setq elpy-rpc-backend "jedi")

  ;; Fixing a key binding bug in elpy
  (define-key yas-minor-mode-map (kbd "C-c k") 'yas-expand)
  ;; Fixing another key binding bug in iedit mode
  (define-key global-map (kbd "C-c o") 'iedit-mode)

  ;; grammal check: flycheck
  (add-hook 'after-init-hook #'global-flycheck-mode);global enable
                                        ; close flymake,  start flycheck
  (when (require 'flycheck nil t)
    (setq elpy-modules(delq 'elpy-module-flymake elpy-modules))
    (add-hook 'elpy-mode-hook 'flycheck-mode))

;;; Commentary:

  ;; 自动完成
  (require 'company)
  (global-company-mode t); 全局开启

  (setq company-idle-delay 0.2;菜单延迟
        company-minimum-prefix-length 1; 开始补全字数
        company-require-match nil
        company-dabbrev-ignore-case nil
        company-dabbrev-downcase nil
        company-show-numbers t; 显示序号
        company-transformers '(company-sort-by-backend-importance)
        company-continue-commands '(not helm-dabbrev)
        )
                                        ; 补全后端使用anaconda
  (add-to-list 'company-backends '(company-anaconda :with company-yasnippet))
                                        ; 补全快捷键
  (global-set-key (kbd "<S-tab>") 'company-complete)
                                        ; 补全菜单选项快捷键
  (define-key company-active-map (kbd "C-n") 'company-select-next)
  (define-key company-active-map (kbd "C-p") 'company-select-previous)

  ;; 在python模式中自动启用
  (add-hook 'python-mode-hook 'anaconda-mode)

话说为啥不用 spacemacs 的 layer 却自己配

本来就已经在layer中加了Python,请问是要换成Anaconda还是什么layer吗?

我假定你这块是放在 user-config 里面的,但你这配置也太乱了,刚开始你只需要启动 layer,设置 variable 就行了,不然干嘛用 spacemacs :joy:

  1. 不需要,spacemacs 已经做了
  (require 'package)
  (setq package-archives '(
                           ("gnu" . "http://elpa.gnu.org/packages/")
                           ("melpa" . "http://melpa.milkbox.net/packages/")
                           ))
  (add-to-list 'package-archives
               '("marmalade" . "http://marmalade-repo.org/packages/"))
  (package-initialize)
  1. 建议用 company layer
  ;; automatical complete: company
  (require 'company)
  (add-hook 'after-init-hook 'global-company-mode); global enable
  (setq company-show-numbers t); display serial number
  (setq company-idle-delay 0.2); menu delay
  (setq company-minimum-prefix-length 1); start completelyness number
;;; Commentary:

  ;; 自动完成
  (require 'company)
  (global-company-mode t); 全局开启

  (setq company-idle-delay 0.2;菜单延迟
        company-minimum-prefix-length 1; 开始补全字数
        company-require-match nil
        company-dabbrev-ignore-case nil
        company-dabbrev-downcase nil
        company-show-numbers t; 显示序号
        company-transformers '(company-sort-by-backend-importance)
        company-continue-commands '(not helm-dabbrev)
        )
                                        ; 补全后端使用anaconda
  (add-to-list 'company-backends '(company-anaconda :with company-yasnippet))
                                        ; 补全快捷键
  (global-set-key (kbd "<S-tab>") 'company-complete)
                                        ; 补全菜单选项快捷键
  (define-key company-active-map (kbd "C-n") 'company-select-next)
  (define-key company-active-map (kbd "C-p") 'company-select-previous)
  1. 这也有个 layer
  ;; grammal check: flycheck
  (add-hook 'after-init-hook #'global-flycheck-mode);global enable
                                        ; close flymake,  start flycheck
  (when (require 'flycheck nil t)
    (setq elpy-modules(delq 'elpy-module-flymake elpy-modules))
    (add-hook 'elpy-mode-hook 'flycheck-mode))
  1. 这个应该不需要
  ;; elpy-- main actor
  (require 'elpy)
  (elpy-enable)
  ;; enable elpy jedi backend
  (setq elpy-rpc-backend "jedi")
  1. 这个如果你 python layer 后端是 ancaconda-mode 的话,不需要,别的后端也更不需要了
  ;; 在python模式中自动启用
  (add-hook 'python-mode-hook 'anaconda-mode)
2 个赞

建议重读 spacemacs 文档,大概就是一般用 layer(我复制了很久之前我的配置,只是让你参考样式)

(defun dotspacemacs/layers ()
  (setq-default
   ;; List of configuration layers to load.
   dotspacemacs-configuration-layers
   '(
       (python :packages (not yapfify live-py-mode)
           :variables
           python-backend 'lsp
           python-sort-imports-on-save t
           python-test-runner '(pytest nose)
           python-formatter 'black
           python-format-on-save nil
           blacken-fast-unsafe t
           python-fill-column 88)
   (auto-completion :packages (not auto-yasnippet auto-complete ac-ispell)
                    :variables
                    auto-completion-enable-help-tooltip 'manual
                    auto-completion-use-company-box t
                    auto-completion-enable-snippets-in-popup t
                    auto-completion-enable-sort-by-usage nil)
   (syntax-checking :variables
                    syntax-checking-enable-by-default nil)
    )
   )

额外 packages 放 dotspacemacs-additional-packages '(doom-themes) 中,别的才放到 user-config

2 个赞

非常感谢您耐心的指导,本人非IT人士,作为小白一直在单独摸索,配置大部分是从网上各处找来拼凑的,可能有些格式较老。我会看看Spacemacs文档。

我大致了解您所说的理念,但目前限于水平配置还比较乱。您方便帮我再看看怎么修改吗,感激不尽! 这是我之前出问题时的配置,那一大段是从网上抄的,的确放在usr-config。

;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.

(defun dotspacemacs/layers ()
  "Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
  (setq-default
   ;; Base distribution to use. This is a layer contained in the directory
   ;; `+distribution'. For now available distributions are `spacemacs-base'
   ;; or `spacemacs'. (default 'spacemacs)
   dotspacemacs-distribution 'spacemacs
   ;; Lazy installation of layers (i.e. layers are in only when a file
   ;; with a supported type is opened). Possible values are `all', `unused'
   ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
   ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
   ;; lazy install any layer that support lazy installation even the layers
   ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
   ;; installation feature and you have to explicitly list a layer in the
   ;; variable `dotspacemacs-configuration-layers' to install it.
   ;; (default 'unused)
   dotspacemacs-enable-lazy-installation 'unused
   ;; If non-nil then Spacemacs will ask for confirmation before installing
   ;; a layer lazily. (default t)
   dotspacemacs-ask-for-lazy-installation t
   ;; If non-nil layers with lazy install support are lazy installed.
   ;; List of additional paths where to look for configuration layers.
   ;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
   dotspacemacs-configuration-layer-path '()
   ;; List of configuration layers to load.
   dotspacemacs-configuration-layers
   '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     ;; version-control
     ;; spell-checking
     ;; javascript
     ;; latex
     ;; html
     ;; helm
     ;; ruby
     ;; lua
     ;; org
     python
     emacs-lisp
     vimscript
     autohotkey
     windows-scripts
     better-defaults
     (ibuffer :variables ibuffer-group-buffers-by 'projects)
     (syntax-checking :variables
                      syntax-checking-enable-by-default nil
                      syntax-checking-enable-tooltips nil)
     (spell-checking :variables spell-checking-enable-by-default nil)
     (auto-completion :variables
                      auto-completion-enable-sort-by-usage t
                      auto-completion-enable-snippets-in-popup t
                      :disabled-for org markdown)
     markdown
     graphviz
     octave
     git
     ivy
     csv
     (shell :variables
            shell-default-height 30
            shell-default-position 'bottom)

     )

   ;; List of additional packages that will be installed without being
   ;; wrapped in a layer. If you need some configuration for these
   ;; packages, then consider creating a layer. You can also put the
   ;; configuration in `dotspacemacs/user-config'.
   dotspacemacs-additional-packages '(
                                      key-chord
                                      jedi
                                      jedi-core
                                      elpy
                                      epc
                                      deferred
                                      auto-complete
                                      ;; 快捷代码块插件
                                      yasnippet
                                      ;; 常用代码块
                                      yasnippet-snippets
                                      )
   ;; A list of packages that cannot be updated.
   dotspacemacs-frozen-packages '()
   ;; A list of packages that will not be installed and loaded.
   dotspacemacs-excluded-packages '()
   ;; Defines the behaviour of Spacemacs when installing packages.
   ;; Possible values are `used-only', `used-but-keep-unused' and `all'.
   ;; `used-only' installs only explicitly used packages and uninstall any
   ;; unused packages as well as their unused dependencies.
   ;; `used-but-keep-unused' installs only the used packages but won't uninstall
   ;; them if they become unused. `all' installs *all* packages supported by
   ;; Spacemacs and never uninstall them. (default is `used-only')
   dotspacemacs-install-packages 'used-only
   ))
(defun dotspacemacs/init ()
  "Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
  ;; This setq-default sexp is an exhaustive list of all the supported
  ;; spacemacs settings.
  (setq-default
   ;; If non nil ELPA repositories are contacted via HTTPS whenever it's
   ;; possible. Set it to nil if you have no way to use HTTPS in your
   ;; environment, otherwise it is strongly recommended to let it set to t.
   ;; This variable has no effect if Emacs is launched with the parameter
   ;; `--insecure' which forces the value of this variable to nil.
   ;; (default t)
   dotspacemacs-elpa-https t
   ;; Maximum allowed time in seconds to contact an ELPA repository.
   dotspacemacs-elpa-timeout 5
   ;; If non nil then spacemacs will check for updates at startup
   ;; when the current branch is not `develop'. Note that checking for
   ;; new versions works via git commands, thus it calls GitHub services
   ;; whenever you start Emacs. (default nil)
   dotspacemacs-check-for-update nil
   ;; If non-nil, a form that evaluates to a package directory. For example, to
   ;; use different package directories for different Emacs versions, set this
   ;; to `emacs-version'.
   dotspacemacs-elpa-subdirectory emacs-version
   ;; One of `vim', `emacs' or `hybrid'.
   ;; `hybrid' is like `vim' except that `insert state' is replaced by the
   ;; `hybrid state' with `emacs' key bindings. The value can also be a list
   ;; with `:variables' keyword (similar to layers). Check the editing styles
   ;; section of the documentation for details on available variables.
   ;; (default 'vim)
   dotspacemacs-editing-style 'hybrid
   ;; If non nil output loading progress in `*Messages*' buffer. (default nil)
   dotspacemacs-verbose-loading nil
   ;; Specify the startup banner. Default value is `official', it displays
   ;; the official spacemacs logo. An integer value is the index of text
   ;; banner, `random' chooses a random text banner in `core/banners'
   ;; directory. A string value must be a path to an image format supported
   ;; by your Emacs build.
   ;; If the value is nil then no banner is displayed. (default 'official)
   dotspacemacs-startup-banner nil
   ;; List of items to show in startup buffer or an association list of
   ;; the form `(list-type . list-size)`. If nil then it is disabled.
   ;; Possible values for list-type are:
   ;; `recents' `bookmarks' `projects' `agenda' `todos'."
   ;; List sizes may be nil, in which case
   ;; `spacemacs-buffer-startup-lists-length' takes effect.
   dotspacemacs-startup-lists '((recents . 9)
                                (projects . 9))
   ;; True if the home buffer should respond to resize events.
   dotspacemacs-startup-buffer-responsive t
   ;; Default major mode for a new empty buffer. Possible values are mode
   ;; names such as `text-mode'; and `nil' to use Fundamental mode.
   ;; (default `text-mode')
   dotspacemacs-new-empty-buffer-major-mode 'text-mode
   ;; Default major mode of the scratch buffer (default `text-mode')
   dotspacemacs-scratch-mode 'python-mode
   ;; List of themes, the first of the list is loaded when spacemacs starts.
   ;; Press <SPC> T n to cycle to the next theme in the list (works great
   ;; with 2 themes variants, one dark and one light)
   dotspacemacs-themes '(
		                     spacemacs-dark
		                     spacemacs-light

		                     solarized-light
		                     solarized-dark
		                     leuven
		                     monokai
		                     zenburn

		                     )
   ;; If non nil the cursor color matches the state color in GUI Emacs.
   dotspacemacs-colorize-cursor-according-to-state t
   ;; Default font, or prioritized list of fonts. `powerline-scale' allows to
   ;; quickly tweak the mode-line size to make separators look not too crappy.
   dotspacemacs-default-font '("Source Code Pro"
                               :size 22
                               :weight normal
                               :width normal
                               :powerline-scale 1.1)
   ;; The leader key
   dotspacemacs-leader-key "SPC"
   ;; The key used for Emacs commands (M-x) (after pressing on the leader key).
   ;; (default "SPC")
   dotspacemacs-emacs-command-key "SPC"
   ;; The key used for Vim Ex commands (default ":")
   dotspacemacs-ex-command-key ":"
   ;; The leader key accessible in `emacs state' and `insert state'
   ;; (default "M-m")
   dotspacemacs-emacs-leader-key "M-m"
   ;; Major mode leader key is a shortcut key which is the equivalent of
   ;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
   dotspacemacs-major-mode-leader-key ","
   ;; Major mode leader key accessible in `emacs state' and `insert state'.
   ;; (default "C-M-m")
   dotspacemacs-major-mode-emacs-leader-key "C-M-m"
   ;; These variables control whether separate commands are bound in the GUI to
   ;; the key pairs C-i, TAB and C-m, RET.
   ;; Setting it to a non-nil value, allows for separate commands under <C-i>
   ;; and TAB or <C-m> and RET.
   ;; In the terminal, these pairs are generally indistinguishable, so this only
   ;; works in the GUI. (default nil)
   dotspacemacs-distinguish-gui-tab nil
   ;; If non nil `Y' is remapped to `y$' in Evil states. (default nil)
   dotspacemacs-remap-Y-to-y$ nil
   ;; If non-nil, the shift mappings `<' and `>' retain visual state if used
   ;; there. (default t)
   dotspacemacs-retain-visual-state-on-shift t
   ;; If non-nil, J and K move lines up and down when in visual mode.
   ;; (default nil)
   dotspacemacs-visual-line-move-text nil
   ;; If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.
   ;; (default nil)
   dotspacemacs-ex-substitute-global nil
   ;; Name of the default layout (default "Default")
   dotspacemacs-default-layout-name "Default"
   ;; If non nil the default layout name is displayed in the mode-line.
   ;; (default nil)
   dotspacemacs-display-default-layout nil
   ;; If non nil then the last auto saved layouts are resume automatically upon
   ;; start. (default nil)
   dotspacemacs-auto-resume-layouts nil
   ;; Size (in MB) above which spacemacs will prompt to open the large file
   ;; literally to avoid performance issues. Opening a file literally means that
   ;; no major mode or minor modes are active. (default is 1)
   dotspacemacs-large-file-size 1
   ;; Location where to auto-save files. Possible values are `original' to
   ;; auto-save the file in-place, `cache' to auto-save the file to another
   ;; file stored in the cache directory and `nil' to disable auto-saving.
   ;; (default 'cache)
   dotspacemacs-auto-save-file-location 'cache
   ;; Maximum number of rollback slots to keep in the cache. (default 5)
   dotspacemacs-max-rollback-slots 5
   ;; If non nil, `helm' will try to minimize the space it uses. (default nil)
   dotspacemacs-helm-resize nil
   ;; if non nil, the helm header is hidden when there is only one source.
   ;; (default nil)
   dotspacemacs-helm-no-header nil
   ;; define the position to display `helm', options are `bottom', `top',
   ;; `left', or `right'. (default 'bottom)
   dotspacemacs-helm-position 'bottom
   ;; Controls fuzzy matching in helm. If set to `always', force fuzzy matching
   ;; in all non-asynchronous sources. If set to `source', preserve individual
   ;; source settings. Else, disable fuzzy matching in all sources.
   ;; (default 'always)
   dotspacemacs-helm-use-fuzzy 'always
   ;; If non nil the paste micro-state is enabled. When enabled pressing `p`
   ;; several times cycle between the kill ring content. (default nil)
   dotspacemacs-enable-paste-transient-state nil
   ;; Which-key delay in seconds. The which-key buffer is the popup listing
   ;; the commands bound to the current keystroke sequence. (default 0.4)
   dotspacemacs-which-key-delay 0.4
   ;; Which-key frame position. Possible values are `right', `bottom' and
   ;; `right-then-bottom'. right-then-bottom tries to display the frame to the
   ;; right; if there is insufficient space it displays it at the bottom.
   ;; (default 'bottom)
   dotspacemacs-which-key-position 'bottom
   ;; If non nil a progress bar is displayed when spacemacs is loading. This
   ;; may increase the boot time on some systems and emacs builds, set it to
   ;; nil to boost the loading time. (default t)
   dotspacemacs-loading-progress-bar t
   ;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
   ;; (Emacs 24.4+ only)
   dotspacemacs-fullscreen-at-startup t
   ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
   ;; Use to disable fullscreen animations in OSX. (default nil)
   dotspacemacs-fullscreen-use-non-native t
   ;; If non nil the frame is maximized when Emacs starts up.
   ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
   ;; (default nil) (Emacs 24.4+ only)
   dotspacemacs-maximized-at-startup nil
   ;; A value from the range (0..100), in increasing opacity, which describes
   ;; the transparency level of a frame when it's active or selected.
   ;; Transparency can be toggled through `toggle-transparency'. (default 90)
   dotspacemacs-active-transparency 90
   ;; A value from the range (0..100), in increasing opacity, which describes
   ;; the transparency level of a frame when it's inactive or deselected.
   ;; Transparency can be toggled through `toggle-transparency'. (default 90)
   dotspacemacs-inactive-transparency 90
   ;; If non nil show the titles of transient states. (default t)
   dotspacemacs-show-transient-state-title t
   ;; If non nil show the color guide hint for transient state keys. (default t)
   dotspacemacs-show-transient-state-color-guide t
   ;; If non nil unicode symbols are displayed in the mode line. (default t)
   dotspacemacs-mode-line-unicode-symbols t
   ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
   ;; scrolling overrides the default behavior of Emacs which recenters point
   ;; when it reaches the top or bottom of the screen. (default t)
   dotspacemacs-smooth-scrolling t
   ;; Control line numbers activation.
   ;; If set to `t' or `relative' line numbers are turned on in all `prog-mode' and
   ;; `text-mode' derivatives. If set to `relative', line numbers are relative.
   ;; This variable can also be set to a property list for finer control:
   ;; '(:relative nil
   ;;   :disabled-for-modes dired-mode
   ;;                       doc-view-mode
   ;;                       markdown-mode
   ;;                       org-mode
   ;;                       pdf-view-mode
   ;;                       text-mode
   ;;   :size-limit-kb 1000)
   ;; (default nil)
   dotspacemacs-line-numbers t
   ;; Code folding method. Possible values are `evil' and `origami'.
   ;; (default 'evil)
   dotspacemacs-folding-method 'evil
   ;; If non-nil smartparens-strict-mode will be enabled in programming modes.
   ;; (default nil)
   dotspacemacs-smartparens-strict-mode nil
   ;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
   ;; over any automatically added closing parenthesis, bracket, quote, etc…
   ;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
   dotspacemacs-smart-closing-parenthesis nil
   ;; Select a scope to highlight delimiters. Possible values are `any',
   ;; `current', `all' or `nil'. Default is `all' (highlight any scope and
   ;; emphasis the current one). (default 'all)
   dotspacemacs-highlight-delimiters 'all
   ;; If non nil, advise quit functions to keep server open when quitting.
   ;; (default nil)
   dotspacemacs-persistent-server nil
   ;; List of search tool executable names. Spacemacs uses the first installed
   ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
   ;; (default '("ag" "pt" "ack" "grep"))
   dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
   ;; The default package repository used if no explicit repository has been
   ;; specified with an installed package.
   ;; Not used for now. (default nil)
   dotspacemacs-default-package-repository nil
   ;; Delete whitespace while saving buffer. Possible values are `all'
   ;; to aggressively delete empty line and long sequences of whitespace,
   ;; `trailing' to delete only the whitespace at end of lines, `changed'to
   ;; delete only whitespace for changed lines or `nil' to disable cleanup.
   ;; (default nil)
   dotspacemacs-whitespace-cleanup nil
   ))
(defun dotspacemacs/user-init ()
  "Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
 This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
  (setq configuration-layer-elpa-archives
        '(("melpa-cn" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
          ("org-cn"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
          ("gnu-cn"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")))

  ;; (setq custom-file (expand-file-name "custom.el" dotspacemacs-directory))
  ;; (load custom-file 'no-error 'no-message)

  ;; (setenv "PATH" "e:/lxs/");设置根目录与路径。
  (setenv "HOME" "e:/lxs/")
  (setq default-directory "e:/lxs/");设置默认打开目录;set the default file path
  (setq desktop-path '("e:/lxs/"))
  (setq desktop-dirname "e:/lxs/")
  (setq byte-compile-warnings '(cl-functions))
  (add-to-list 'load-path (expand-file-name "e:/lxs/.emacs.d/eshell/"))
  (add-to-list 'load-path (expand-file-name "e:/lxs/.emacs.d/private/"))
  (add-to-list 'load-path (expand-file-name "e:/lxs/.emacs.d/private/evil-mc"))

  )
(defun dotspacemacs/config ()

  )
(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."

  ;; 设置中文字体
  (if (display-graphic-p) (dolist (charset '(kana han cjk-misc bopomofo))
                            (set-fontset-font (frame-parameter nil 'font) charset
                                              (font-spec :family "WenQuanYi Micro Hei Mono" :size 22))))

  (prefer-coding-system 'utf-8)                   ; 设置默认读入文件编码
  (setq default-buffer-file-coding-system 'utf-8) ; 设置写入文件编码

  (set-default 'truncate-lines t)                 ; 默认不自动断行
  (setq ivy-initial-inputs-alist nil)             ; counsel-M-x等取消默认的开头字符^,Original value was (counsel-package . "^+") (counsel-M-x . "^") (org-refile . "^") (woman . "^")

  ;; 保存并恢复窗口与缓冲区
  ;; (desktop-save-mode t)
  ;; (desktop-read)

  (display-time-mode 1)                           ; 常显
  (setq display-time-24hr-format t)               ; 格式
  (setq display-time-day-and-date t)              ; 显示时间、星期、日期
  (setq calendar-week-start-day 1)                ; 星期一作为日历显示第一天

  ;; 设置tab为4个空格的宽度,而不是原来的2
  (setq c-basic-offset 4)
  (setq default-tab-width 4)
  (setq-default indent-tabs-mode nil)
  (setq python-indent-guess-indent-offset-verbose nil)

  ;; (require 'ls-lisp)
  ;; (setq ls-lisp-use-insert-directory-program nil)
  ;; (setq ls-lisp-use-insert-directory-program t)
  ;; (setq dired-quick-sort-setup nil)
  ;; (setq dired-quick-sort-setup t)
  ;; (setq dired-quick-sort-suppress-setup-warning nil)
  ;; (setq dired-quick-sort-suppress-setup-warning t)
  ;; (dired-quick-sort-suppress-setup-warning t)
  ;; (set-default dired-quick-sort-suppress-setup-warning t)
  ;; (set-default ls-lisp-use-insert-directory-program t)
  ;; (ls-lisp-use-insert-directory-program t)

  ;; (require 'aweshell)

  (global-set-key (kbd "<f5>") 'eshell)                                     ; 进入eshell
  (global-set-key (kbd "<f7>") 'dotspacemacs/sync-configuration-layers)     ; 重新加载设置
  (global-set-key (kbd "<f9>") 'spacemacs/find-dotfile)                     ; 打开Spacemacs配置文件

  (require 'evil-mc)
  (evil-mc-mode  1) ;; enable
  (global-evil-mc-mode  1) ;; enable

  (require 'ibuffer)
  (global-set-key (kbd "<C-tab>") 'next-buffer)       ;切换到下一个buffer
  (global-set-key (kbd "<C-S-tab>") 'previous-buffer) ;切换到上一个buffer

  ;; 全局启用yas-snippet代码块插件
  (yas-global-mode 1) ;; or M-x yas-reload-all if you've started YASnippet already.

  ;; 设置kk退出插入模式
  (require 'key-chord)
  (key-chord-mode 1)
  (key-chord-define evil-insert-state-map  "kk" 'evil-normal-state)
  (key-chord-define evil-hybrid-state-map  "kk" 'evil-normal-state)

  (evil-define-key 'normal go-mode-map "gd" ’godef-jump)

  (define-key evil-normal-state-map (kbd "zC") 'centered-cursor-mode)                    ;光标居中滚动模式

  (define-key evil-normal-state-map (kbd ",i") 'python-start-or-switch-repl)             ;打开iPython
  (define-key evil-normal-state-map (kbd ",/") 'evilnc-comment-or-uncomment-lines)       ;行添加或取消注释
  (define-key evil-normal-state-map (kbd ",l") 'evilnc-comment-or-uncomment-to-the-line) ;添加或取消注释到第几行
  (define-key evil-normal-state-map (kbd ",p") 'evilnc-comment-or-uncomment-paragraphs)  ;段落添加或取消注释
  (define-key evil-normal-state-map (kbd ",r") 'evilnc-comment-or-uncomment-region)      ;区域添加或取消注释
  (define-key evil-normal-state-map (kbd ",k") 'evilnc-kill-to-line)                     ;删除到第几行
  (define-key evil-normal-state-map (kbd ",y") 'evilnc-copy-to-line)                     ;复制到第几行
  (define-key evil-normal-state-map (kbd ",n") 'evilnc-copy-and-comment-lines)           ;复制并注释行
  (define-key evil-normal-state-map (kbd ",o") 'evilnc-comment-operator)                 ;注释操作
  (define-key evil-visual-state-map (kbd ",/") 'evilnc-comment-or-uncomment-lines)       ;行添加或取消注释
  (define-key evil-visual-state-map (kbd ",l") 'evilnc-comment-or-uncomment-to-the-line) ;添加或取消注释到第几行
  (define-key evil-visual-state-map (kbd ",p") 'evilnc-comment-or-uncomment-paragraphs)  ;段落添加或取消注释
  (define-key evil-visual-state-map (kbd ",r") 'evilnc-comment-or-uncomment-region)      ;区域添加或取消注释
  (define-key evil-visual-state-map (kbd ",k") 'evilnc-kill-to-line)                     ;删除到第几行
  (define-key evil-visual-state-map (kbd ",y") 'evilnc-copy-to-line)                     ;复制到第几行
  (define-key evil-visual-state-map (kbd ",n") 'evilnc-copy-and-comment-lines)           ;复制并注释行

  ;; SPC后按键自定义功能
  (evil-leader/set-key

    "ae" 'eshell
    "ag" 'gnus
    "al" 'package-list-packages
    "ar" 'calendar
    "ass" 'shell
    "ase" 'eshell

    "bb" 'switch-to-buffer
    "bg" 'rename-buffer
    "bl" 'ibuffer
    "bk" 'kill-buffer
    "bK" 'spacemacs/kill-other-buffers
    "by" 'spacemacs/copy-whole-buffer-to-clipboard

    "Bd" 'bookmark-delete
    "Bl" 'bookmark-bmenu-list
    "Br" 'bookmark-rename
    "BR" 'bookmark-relocate
    "Bs" 'bookmark-set
    "Bm" 'evil-show-marks

    "ds" 'delete-trailing-whitespace
    "dl" 'delete-trailing-lines
    "dd" 'ediff-directories
    "df" 'ediff
    "d3" 'ediff3
    "dw" 'ediff-windows

    "fmi" 'insert-kbd-macro
    "fmn" 'name-last-kbd-macro
    "fmb" 'kmacro-start-macro-or-insert-counter
    "fme" 'kmacro-end-or-call-macro
    "fp"  'project-find-file
    "fP"  'project-search

    "ga" 'magit-remote-add
    "gc" 'magit-clone
    "gL" 'magit-log
    "gp" 'magit-push
    "gr" 'magit-remote

    "is" 'yas-insert-snippet

    "jU" 'browse-url-at-point

    "MA" 'ahk-mode
    "Ma" 'anaconda-mode
    "Mc" 'c++-mode
    "Me" 'emacs-lisp-mode
    "Mf" 'fortran-mode
    "MF" 'flycheck-mode
    "Mo" 'org-mode
    "Mp" 'python-mode
    "Ms" 'scroll-all-mode
    "Mt" 'text-mode

    "pA" 'treemacs--add-project-to-current-workspace
    "pC" 'treemacs-collapse-all-projects

    "rc" 'copy-rectangle-to-register    ;列模式复制,C-x r r
    "ri" 'insert-rectangle              ;列模式粘贴,C-x r i
    "rk" 'kill-rectangle                ;列删除
    "rs" 'string-rectangle              ;列替换
    "rr" 'insert-register               ;粘贴,C-x r i
    "rq" 'query-replace                 ;替换

    "sd" 'spacemacs/swiper-all-region-or-symbol

    "xbd" 'describe-current-coding-system
    "xbr" 'revert-buffer-with-coding-system
    "xbk" 'set-buffer-file-coding-system
    "xbu" 'universal-coding-system-argument

    "0" 'select-window-0
    "1" 'select-window-1
    "2" 'select-window-2
    "3" 'select-window-3
    "4" 'select-window-4
    "w/" 'split-window-right
    "w-" 'split-window-below
    ":"  'counsel-M-x
    "wM" 'delete-other-windows
    "wa" 'make-frame
    "wg" 'golden-ratio
    "wx" 'delete-frame

    "C-a" 'mark-whole-buffer
    "C-s" 'replace-string
    "C-r" 'replace-regexp
    "C-z" 'repeat

    ","   'describe-key
    "."   'describe-variable

    )

  (require 'package)
  (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)

  ;; 开启全局 Company 补全
  (global-company-mode 1)
  (setq hippie-expand-try-function-list '(try-expand-debbrev
                                          try-expand-debbrev-all-buffers
					                                try-expand-debbrev-from-kill
					                                try-complete-file-name-partially
					                                try-complete-file-name
					                                try-expand-all-abbrevs
					                                try-expand-list
					                                try-expand-line
					                                try-complete-lisp-symbol-partially
					                                try-complete-lisp-symbol))
  (global-set-key (kbd "<f8>") 'hippie-expand)

  ;; python environment
;;; package --- summary or add python emacs mode: elpy
  ;; add repository

  (require 'package)
  (setq package-archives '(
                           ("gnu" . "http://elpa.gnu.org/packages/")
                           ("melpa" . "http://melpa.milkbox.net/packages/")
                           ))
  (add-to-list 'package-archives
               '("marmalade" . "http://marmalade-repo.org/packages/"))
  (package-initialize)

  ;; automatical complete: company
  (require 'company)
  (add-hook 'after-init-hook 'global-company-mode); global enable
  (setq company-show-numbers t); display serial number
  (setq company-idle-delay 0.2); menu delay
  (setq company-minimum-prefix-length 1); start completelyness number

  ;; elpy-- main actor
  (require 'elpy)
  (elpy-enable)
  ;; enable elpy jedi backend
  (setq elpy-rpc-backend "jedi")

  ;; Fixing a key binding bug in elpy
  (define-key yas-minor-mode-map (kbd "C-c k") 'yas-expand)
  ;; Fixing another key binding bug in iedit mode
  (define-key global-map (kbd "C-c o") 'iedit-mode)

  ;; grammal check: flycheck
  (add-hook 'after-init-hook #'global-flycheck-mode);global enable
                                        ; close flymake,  start flycheck
  (when (require 'flycheck nil t)
    (setq elpy-modules(delq 'elpy-module-flymake elpy-modules))
    (add-hook 'elpy-mode-hook 'flycheck-mode))

;;; Commentary:

  ;; 自动完成
  (require 'company)
  (global-company-mode t); 全局开启

  (setq company-idle-delay 0.1;菜单延迟
        company-minimum-prefix-length 1; 开始补全字数
        company-require-match nil
        company-dabbrev-ignore-case nil
        company-dabbrev-downcase nil
        company-show-numbers t; 显示序号
        company-transformers '(company-sort-by-backend-importance)
        company-continue-commands '(not helm-dabbrev)
        )
                                        ; 补全后端使用anaconda
  (add-to-list 'company-backends '(company-anaconda :with company-yasnippet))
                                        ; 补全快捷键
  (global-set-key (kbd "<S-tab>") 'company-complete)
                                        ; 补全菜单选项快捷键
  (define-key company-active-map (kbd "C-n") 'company-select-next)
  (define-key company-active-map (kbd "C-p") 'company-select-previous)

  ;; 在python模式中自动启用
  (add-hook 'python-mode-hook 'anaconda-mode)

  )

按之前的配置,使用cmd写runemacs.exe t1.py打开Python文件,或者在Spacemacs打开的Python文件中SPC f o用默认的Spacemacs重新打开,都可以正常补全,并且自动激活了flymake mode(依然不能跳转到函数定义),但在这个窗口再用SPC f f打开另一个Python文件又不能补全了。

下面是按您的理念稍微修改之后的,貌似对Python补全完全失效了,message中error提示jedi-0.18.0版本太新,后来我安装了jedi-0.17.1版本,现在打开Python文件会提示

Error (use-package): dap-mode/:config: Key sequence d d d starts with non-prefix key d d

并且,Python完全没有补全,.spacemacs内的与补全等编辑一切正常。

;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.

(defun dotspacemacs/layers ()
  "Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
  (setq-default
   ;; Base distribution to use. This is a layer contained in the directory
   ;; `+distribution'. For now available distributions are `spacemacs-base'
   ;; or `spacemacs'. (default 'spacemacs)
   dotspacemacs-distribution 'spacemacs
   ;; Lazy installation of layers (i.e. layers are in only when a file
   ;; with a supported type is opened). Possible values are `all', `unused'
   ;; and `nil'. `unused' will lazy install only unused layers (i.e. layers
   ;; not listed in variable `dotspacemacs-configuration-layers'), `all' will
   ;; lazy install any layer that support lazy installation even the layers
   ;; listed in `dotspacemacs-configuration-layers'. `nil' disable the lazy
   ;; installation feature and you have to explicitly list a layer in the
   ;; variable `dotspacemacs-configuration-layers' to install it.
   ;; (default 'unused)
   dotspacemacs-enable-lazy-installation 'unused
   ;; If non-nil then Spacemacs will ask for confirmation before installing
   ;; a layer lazily. (default t)
   dotspacemacs-ask-for-lazy-installation t
   ;; If non-nil layers with lazy install support are lazy installed.
   ;; List of additional paths where to look for configuration layers.
   ;; Paths must have a trailing slash (i.e. `~/.mycontribs/')
   dotspacemacs-configuration-layer-path '()
   ;; List of configuration layers to load.
   dotspacemacs-configuration-layers
   '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press <SPC f e R> (Vim style) or
     ;; <M-m f e R> (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     ;; version-control
     ;; spell-checking
     ;; javascript
     ;; latex
     ;; html
     ;; helm
     ;; ruby
     ;; lua
     ;; org
     ;; company
     ;; flycheck
     emacs-lisp
     vimscript
     autohotkey
     windows-scripts
     better-defaults
     (ibuffer :variables ibuffer-group-buffers-by 'projects)
     (python :packages (not yapfify live-py-mode)
             :variables
             python-backend 'lsp
             python-sort-imports-on-save t
             python-test-runner '(pytest nose)
             python-formatter 'black
             python-format-on-save nil
             blacken-fast-unsafe t
             python-fill-column 88)
     (syntax-checking :variables
                      syntax-checking-enable-by-default nil
                      syntax-checking-enable-tooltips nil)
     (spell-checking :variables spell-checking-enable-by-default nil)
     (auto-completion :variables
                      auto-completion-enable-sort-by-usage t
                      auto-completion-enable-snippets-in-popup t
                      :disabled-for org markdown)
     markdown
     graphviz
     octave
     git
     ivy
     csv
     (shell :variables
            shell-default-height 30
            shell-default-position 'bottom)

     )

   ;; List of additional packages that will be installed without being
   ;; wrapped in a layer. If you need some configuration for these
   ;; packages, then consider creating a layer. You can also put the
   ;; configuration in `dotspacemacs/user-config'.
   dotspacemacs-additional-packages '(
                                      key-chord
                                      jedi
                                      jedi-core
                                      elpy
                                      epc
                                      deferred
                                      auto-complete
                                      ;; 快捷代码块插件
                                      yasnippet
                                      ;; 常用代码块
                                      yasnippet-snippets
                                      )
   ;; A list of packages that cannot be updated.
   dotspacemacs-frozen-packages '()
   ;; A list of packages that will not be installed and loaded.
   dotspacemacs-excluded-packages '()
   ;; Defines the behaviour of Spacemacs when installing packages.
   ;; Possible values are `used-only', `used-but-keep-unused' and `all'.
   ;; `used-only' installs only explicitly used packages and uninstall any
   ;; unused packages as well as their unused dependencies.
   ;; `used-but-keep-unused' installs only the used packages but won't uninstall
   ;; them if they become unused. `all' installs *all* packages supported by
   ;; Spacemacs and never uninstall them. (default is `used-only')
   dotspacemacs-install-packages 'used-only
   ))
(defun dotspacemacs/init ()
  "Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
  ;; This setq-default sexp is an exhaustive list of all the supported
  ;; spacemacs settings.
  (setq-default
   ;; If non nil ELPA repositories are contacted via HTTPS whenever it's
   ;; possible. Set it to nil if you have no way to use HTTPS in your
   ;; environment, otherwise it is strongly recommended to let it set to t.
   ;; This variable has no effect if Emacs is launched with the parameter
   ;; `--insecure' which forces the value of this variable to nil.
   ;; (default t)
   dotspacemacs-elpa-https t
   ;; Maximum allowed time in seconds to contact an ELPA repository.
   dotspacemacs-elpa-timeout 5
   ;; If non nil then spacemacs will check for updates at startup
   ;; when the current branch is not `develop'. Note that checking for
   ;; new versions works via git commands, thus it calls GitHub services
   ;; whenever you start Emacs. (default nil)
   dotspacemacs-check-for-update nil
   ;; If non-nil, a form that evaluates to a package directory. For example, to
   ;; use different package directories for different Emacs versions, set this
   ;; to `emacs-version'.
   dotspacemacs-elpa-subdirectory emacs-version
   ;; One of `vim', `emacs' or `hybrid'.
   ;; `hybrid' is like `vim' except that `insert state' is replaced by the
   ;; `hybrid state' with `emacs' key bindings. The value can also be a list
   ;; with `:variables' keyword (similar to layers). Check the editing styles
   ;; section of the documentation for details on available variables.
   ;; (default 'vim)
   dotspacemacs-editing-style 'hybrid
   ;; If non nil output loading progress in `*Messages*' buffer. (default nil)
   dotspacemacs-verbose-loading nil
   ;; Specify the startup banner. Default value is `official', it displays
   ;; the official spacemacs logo. An integer value is the index of text
   ;; banner, `random' chooses a random text banner in `core/banners'
   ;; directory. A string value must be a path to an image format supported
   ;; by your Emacs build.
   ;; If the value is nil then no banner is displayed. (default 'official)
   dotspacemacs-startup-banner nil
   ;; List of items to show in startup buffer or an association list of
   ;; the form `(list-type . list-size)`. If nil then it is disabled.
   ;; Possible values for list-type are:
   ;; `recents' `bookmarks' `projects' `agenda' `todos'."
   ;; List sizes may be nil, in which case
   ;; `spacemacs-buffer-startup-lists-length' takes effect.
   dotspacemacs-startup-lists '((recents . 9)
                                (projects . 9))
   ;; True if the home buffer should respond to resize events.
   dotspacemacs-startup-buffer-responsive t
   ;; Default major mode for a new empty buffer. Possible values are mode
   ;; names such as `text-mode'; and `nil' to use Fundamental mode.
   ;; (default `text-mode')
   dotspacemacs-new-empty-buffer-major-mode 'text-mode
   ;; Default major mode of the scratch buffer (default `text-mode')
   dotspacemacs-scratch-mode 'python-mode
   ;; List of themes, the first of the list is loaded when spacemacs starts.
   ;; Press <SPC> T n to cycle to the next theme in the list (works great
   ;; with 2 themes variants, one dark and one light)
   dotspacemacs-themes '(
		                     spacemacs-dark
		                     spacemacs-light

		                     solarized-light
		                     solarized-dark
		                     leuven
		                     monokai
		                     zenburn

		                     )
   ;; If non nil the cursor color matches the state color in GUI Emacs.
   dotspacemacs-colorize-cursor-according-to-state t
   ;; Default font, or prioritized list of fonts. `powerline-scale' allows to
   ;; quickly tweak the mode-line size to make separators look not too crappy.
   dotspacemacs-default-font '("Source Code Pro"
                               :size 22
                               :weight normal
                               :width normal
                               :powerline-scale 1.1)
   ;; The leader key
   dotspacemacs-leader-key "SPC"
   ;; The key used for Emacs commands (M-x) (after pressing on the leader key).
   ;; (default "SPC")
   dotspacemacs-emacs-command-key "SPC"
   ;; The key used for Vim Ex commands (default ":")
   dotspacemacs-ex-command-key ":"
   ;; The leader key accessible in `emacs state' and `insert state'
   ;; (default "M-m")
   dotspacemacs-emacs-leader-key "M-m"
   ;; Major mode leader key is a shortcut key which is the equivalent of
   ;; pressing `<leader> m`. Set it to `nil` to disable it. (default ",")
   dotspacemacs-major-mode-leader-key ","
   ;; Major mode leader key accessible in `emacs state' and `insert state'.
   ;; (default "C-M-m")
   dotspacemacs-major-mode-emacs-leader-key "C-M-m"
   ;; These variables control whether separate commands are bound in the GUI to
   ;; the key pairs C-i, TAB and C-m, RET.
   ;; Setting it to a non-nil value, allows for separate commands under <C-i>
   ;; and TAB or <C-m> and RET.
   ;; In the terminal, these pairs are generally indistinguishable, so this only
   ;; works in the GUI. (default nil)
   dotspacemacs-distinguish-gui-tab nil
   ;; If non nil `Y' is remapped to `y$' in Evil states. (default nil)
   dotspacemacs-remap-Y-to-y$ nil
   ;; If non-nil, the shift mappings `<' and `>' retain visual state if used
   ;; there. (default t)
   dotspacemacs-retain-visual-state-on-shift t
   ;; If non-nil, J and K move lines up and down when in visual mode.
   ;; (default nil)
   dotspacemacs-visual-line-move-text nil
   ;; If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.
   ;; (default nil)
   dotspacemacs-ex-substitute-global nil
   ;; Name of the default layout (default "Default")
   dotspacemacs-default-layout-name "Default"
   ;; If non nil the default layout name is displayed in the mode-line.
   ;; (default nil)
   dotspacemacs-display-default-layout nil
   ;; If non nil then the last auto saved layouts are resume automatically upon
   ;; start. (default nil)
   dotspacemacs-auto-resume-layouts nil
   ;; Size (in MB) above which spacemacs will prompt to open the large file
   ;; literally to avoid performance issues. Opening a file literally means that
   ;; no major mode or minor modes are active. (default is 1)
   dotspacemacs-large-file-size 1
   ;; Location where to auto-save files. Possible values are `original' to
   ;; auto-save the file in-place, `cache' to auto-save the file to another
   ;; file stored in the cache directory and `nil' to disable auto-saving.
   ;; (default 'cache)
   dotspacemacs-auto-save-file-location 'cache
   ;; Maximum number of rollback slots to keep in the cache. (default 5)
   dotspacemacs-max-rollback-slots 5
   ;; If non nil, `helm' will try to minimize the space it uses. (default nil)
   dotspacemacs-helm-resize nil
   ;; if non nil, the helm header is hidden when there is only one source.
   ;; (default nil)
   dotspacemacs-helm-no-header nil
   ;; define the position to display `helm', options are `bottom', `top',
   ;; `left', or `right'. (default 'bottom)
   dotspacemacs-helm-position 'bottom
   ;; Controls fuzzy matching in helm. If set to `always', force fuzzy matching
   ;; in all non-asynchronous sources. If set to `source', preserve individual
   ;; source settings. Else, disable fuzzy matching in all sources.
   ;; (default 'always)
   dotspacemacs-helm-use-fuzzy 'always
   ;; If non nil the paste micro-state is enabled. When enabled pressing `p`
   ;; several times cycle between the kill ring content. (default nil)
   dotspacemacs-enable-paste-transient-state nil
   ;; Which-key delay in seconds. The which-key buffer is the popup listing
   ;; the commands bound to the current keystroke sequence. (default 0.4)
   dotspacemacs-which-key-delay 0.4
   ;; Which-key frame position. Possible values are `right', `bottom' and
   ;; `right-then-bottom'. right-then-bottom tries to display the frame to the
   ;; right; if there is insufficient space it displays it at the bottom.
   ;; (default 'bottom)
   dotspacemacs-which-key-position 'bottom
   ;; If non nil a progress bar is displayed when spacemacs is loading. This
   ;; may increase the boot time on some systems and emacs builds, set it to
   ;; nil to boost the loading time. (default t)
   dotspacemacs-loading-progress-bar t
   ;; If non nil the frame is fullscreen when Emacs starts up. (default nil)
   ;; (Emacs 24.4+ only)
   dotspacemacs-fullscreen-at-startup t
   ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen.
   ;; Use to disable fullscreen animations in OSX. (default nil)
   dotspacemacs-fullscreen-use-non-native t
   ;; If non nil the frame is maximized when Emacs starts up.
   ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.
   ;; (default nil) (Emacs 24.4+ only)
   dotspacemacs-maximized-at-startup nil
   ;; A value from the range (0..100), in increasing opacity, which describes
   ;; the transparency level of a frame when it's active or selected.
   ;; Transparency can be toggled through `toggle-transparency'. (default 90)
   dotspacemacs-active-transparency 90
   ;; A value from the range (0..100), in increasing opacity, which describes
   ;; the transparency level of a frame when it's inactive or deselected.
   ;; Transparency can be toggled through `toggle-transparency'. (default 90)
   dotspacemacs-inactive-transparency 90
   ;; If non nil show the titles of transient states. (default t)
   dotspacemacs-show-transient-state-title t
   ;; If non nil show the color guide hint for transient state keys. (default t)
   dotspacemacs-show-transient-state-color-guide t
   ;; If non nil unicode symbols are displayed in the mode line. (default t)
   dotspacemacs-mode-line-unicode-symbols t
   ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth
   ;; scrolling overrides the default behavior of Emacs which recenters point
   ;; when it reaches the top or bottom of the screen. (default t)
   dotspacemacs-smooth-scrolling t
   ;; Control line numbers activation.
   ;; If set to `t' or `relative' line numbers are turned on in all `prog-mode' and
   ;; `text-mode' derivatives. If set to `relative', line numbers are relative.
   ;; This variable can also be set to a property list for finer control:
   ;; '(:relative nil
   ;;   :disabled-for-modes dired-mode
   ;;                       doc-view-mode
   ;;                       markdown-mode
   ;;                       org-mode
   ;;                       pdf-view-mode
   ;;                       text-mode
   ;;   :size-limit-kb 1000)
   ;; (default nil)
   dotspacemacs-line-numbers t
   ;; Code folding method. Possible values are `evil' and `origami'.
   ;; (default 'evil)
   dotspacemacs-folding-method 'evil
   ;; If non-nil smartparens-strict-mode will be enabled in programming modes.
   ;; (default nil)
   dotspacemacs-smartparens-strict-mode nil
   ;; If non-nil pressing the closing parenthesis `)' key in insert mode passes
   ;; over any automatically added closing parenthesis, bracket, quote, etc…
   ;; This can be temporary disabled by pressing `C-q' before `)'. (default nil)
   dotspacemacs-smart-closing-parenthesis nil
   ;; Select a scope to highlight delimiters. Possible values are `any',
   ;; `current', `all' or `nil'. Default is `all' (highlight any scope and
   ;; emphasis the current one). (default 'all)
   dotspacemacs-highlight-delimiters 'all
   ;; If non nil, advise quit functions to keep server open when quitting.
   ;; (default nil)
   dotspacemacs-persistent-server nil
   ;; List of search tool executable names. Spacemacs uses the first installed
   ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.
   ;; (default '("ag" "pt" "ack" "grep"))
   dotspacemacs-search-tools '("ag" "pt" "ack" "grep")
   ;; The default package repository used if no explicit repository has been
   ;; specified with an installed package.
   ;; Not used for now. (default nil)
   dotspacemacs-default-package-repository nil
   ;; Delete whitespace while saving buffer. Possible values are `all'
   ;; to aggressively delete empty line and long sequences of whitespace,
   ;; `trailing' to delete only the whitespace at end of lines, `changed'to
   ;; delete only whitespace for changed lines or `nil' to disable cleanup.
   ;; (default nil)
   dotspacemacs-whitespace-cleanup nil
   ))
(defun dotspacemacs/user-init ()
  "Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
 This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
  (setq configuration-layer-elpa-archives
        '(("melpa-cn" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
          ("org-cn"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
          ("gnu-cn"   . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")))

  ;; (setq custom-file (expand-file-name "custom.el" dotspacemacs-directory))
  ;; (load custom-file 'no-error 'no-message)

  ;; (setenv "PATH" "e:/lxs/");设置根目录与路径。
  (setenv "HOME" "e:/lxs/")
  (setq default-directory "e:/lxs/");设置默认打开目录;set the default file path
  (setq desktop-path '("e:/lxs/"))
  (setq desktop-dirname "e:/lxs/")
  (setq byte-compile-warnings '(cl-functions))
  (add-to-list 'load-path (expand-file-name "e:/lxs/.emacs.d/eshell/"))
  (add-to-list 'load-path (expand-file-name "e:/lxs/.emacs.d/private/"))
  (add-to-list 'load-path (expand-file-name "e:/lxs/.emacs.d/private/evil-mc"))

  )
(defun dotspacemacs/config ()

  )
(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."

  ;; 设置中文字体
  (if (display-graphic-p) (dolist (charset '(kana han cjk-misc bopomofo))
                            (set-fontset-font (frame-parameter nil 'font) charset
                                              (font-spec :family "WenQuanYi Micro Hei Mono" :size 22))))

  (prefer-coding-system 'utf-8)                   ; 设置默认读入文件编码
  (setq default-buffer-file-coding-system 'utf-8) ; 设置写入文件编码

  (set-default 'truncate-lines t)                 ; 默认不自动断行
  (setq ivy-initial-inputs-alist nil)             ; counsel-M-x等取消默认的开头字符^,Original value was (counsel-package . "^+") (counsel-M-x . "^") (org-refile . "^") (woman . "^")

  ;; 保存并恢复窗口与缓冲区
  ;; (desktop-save-mode t)
  ;; (desktop-read)

  (display-time-mode 1)                           ; 常显
  (setq display-time-24hr-format t)               ; 格式
  (setq display-time-day-and-date t)              ; 显示时间、星期、日期
  (setq calendar-week-start-day 1)                ; 星期一作为日历显示第一天

  ;; 设置tab为4个空格的宽度,而不是原来的2
  (setq c-basic-offset 4)
  (setq default-tab-width 4)
  (setq-default indent-tabs-mode nil)
  (setq python-indent-guess-indent-offset-verbose nil)

  ;; (require 'ls-lisp)
  ;; (setq ls-lisp-use-insert-directory-program nil)
  ;; (setq ls-lisp-use-insert-directory-program t)
  ;; (setq dired-quick-sort-setup nil)
  ;; (setq dired-quick-sort-setup t)
  ;; (setq dired-quick-sort-suppress-setup-warning nil)
  ;; (setq dired-quick-sort-suppress-setup-warning t)
  ;; (dired-quick-sort-suppress-setup-warning t)
  ;; (set-default dired-quick-sort-suppress-setup-warning t)
  ;; (set-default ls-lisp-use-insert-directory-program t)
  ;; (ls-lisp-use-insert-directory-program t)

  ;; (require 'aweshell)

  (global-set-key (kbd "<f5>") 'eshell)                                     ; 进入eshell
  (global-set-key (kbd "<f7>") 'dotspacemacs/sync-configuration-layers)     ; 重新加载设置
  (global-set-key (kbd "<f9>") 'spacemacs/find-dotfile)                     ; 打开Spacemacs配置文件

  (require 'evil-mc)
  (evil-mc-mode  1) ;; enable
  (global-evil-mc-mode  1) ;; enable

  (require 'ibuffer)
  (global-set-key (kbd "<C-tab>") 'next-buffer)       ;切换到下一个buffer
  (global-set-key (kbd "<C-S-tab>") 'previous-buffer) ;切换到上一个buffer

  ;; 全局启用yas-snippet代码块插件
  (yas-global-mode 1) ;; or M-x yas-reload-all if you've started YASnippet already.

  ;; 设置kk退出插入模式
  (require 'key-chord)
  (key-chord-mode 1)
  (key-chord-define evil-insert-state-map  "kk" 'evil-normal-state)
  (key-chord-define evil-hybrid-state-map  "kk" 'evil-normal-state)

  (evil-define-key 'normal go-mode-map "gd" ’godef-jump)

  (define-key evil-normal-state-map (kbd "zC") 'centered-cursor-mode)                    ;光标居中滚动模式

  (define-key evil-normal-state-map (kbd ",i") 'python-start-or-switch-repl)             ;打开iPython
  (define-key evil-normal-state-map (kbd ",/") 'evilnc-comment-or-uncomment-lines)       ;行添加或取消注释
  (define-key evil-normal-state-map (kbd ",l") 'evilnc-comment-or-uncomment-to-the-line) ;添加或取消注释到第几行
  (define-key evil-normal-state-map (kbd ",p") 'evilnc-comment-or-uncomment-paragraphs)  ;段落添加或取消注释
  (define-key evil-normal-state-map (kbd ",r") 'evilnc-comment-or-uncomment-region)      ;区域添加或取消注释
  (define-key evil-normal-state-map (kbd ",k") 'evilnc-kill-to-line)                     ;删除到第几行
  (define-key evil-normal-state-map (kbd ",y") 'evilnc-copy-to-line)                     ;复制到第几行
  (define-key evil-normal-state-map (kbd ",n") 'evilnc-copy-and-comment-lines)           ;复制并注释行
  (define-key evil-normal-state-map (kbd ",o") 'evilnc-comment-operator)                 ;注释操作
  (define-key evil-visual-state-map (kbd ",/") 'evilnc-comment-or-uncomment-lines)       ;行添加或取消注释
  (define-key evil-visual-state-map (kbd ",l") 'evilnc-comment-or-uncomment-to-the-line) ;添加或取消注释到第几行
  (define-key evil-visual-state-map (kbd ",p") 'evilnc-comment-or-uncomment-paragraphs)  ;段落添加或取消注释
  (define-key evil-visual-state-map (kbd ",r") 'evilnc-comment-or-uncomment-region)      ;区域添加或取消注释
  (define-key evil-visual-state-map (kbd ",k") 'evilnc-kill-to-line)                     ;删除到第几行
  (define-key evil-visual-state-map (kbd ",y") 'evilnc-copy-to-line)                     ;复制到第几行
  (define-key evil-visual-state-map (kbd ",n") 'evilnc-copy-and-comment-lines)           ;复制并注释行

  ;; SPC后按键自定义功能
  (evil-leader/set-key

    "ae" 'eshell
    "ag" 'gnus
    "al" 'package-list-packages
    "ar" 'calendar
    "ass" 'shell
    "ase" 'eshell

    "bb" 'switch-to-buffer
    "bg" 'rename-buffer
    "bl" 'ibuffer
    "bk" 'kill-buffer
    "bK" 'spacemacs/kill-other-buffers
    "by" 'spacemacs/copy-whole-buffer-to-clipboard

    "Bd" 'bookmark-delete
    "Bl" 'bookmark-bmenu-list
    "Br" 'bookmark-rename
    "BR" 'bookmark-relocate
    "Bs" 'bookmark-set
    "Bm" 'evil-show-marks

    "ds" 'delete-trailing-whitespace
    "dl" 'delete-trailing-lines
    "dd" 'ediff-directories
    "df" 'ediff
    "d3" 'ediff3
    "dw" 'ediff-windows

    "fmi" 'insert-kbd-macro
    "fmn" 'name-last-kbd-macro
    "fmb" 'kmacro-start-macro-or-insert-counter
    "fme" 'kmacro-end-or-call-macro
    "fp"  'project-find-file
    "fP"  'project-search

    "ga" 'magit-remote-add
    "gc" 'magit-clone
    "gL" 'magit-log
    "gp" 'magit-push
    "gr" 'magit-remote

    "is" 'yas-insert-snippet

    "jU" 'browse-url-at-point

    "MA" 'ahk-mode
    "Ma" 'anaconda-mode
    "Mc" 'c++-mode
    "Me" 'emacs-lisp-mode
    "Mf" 'fortran-mode
    "MF" 'flycheck-mode
    "Mo" 'org-mode
    "Mp" 'python-mode
    "Ms" 'scroll-all-mode
    "Mt" 'text-mode

    "pA" 'treemacs--add-project-to-current-workspace
    "pC" 'treemacs-collapse-all-projects

    "rc" 'copy-rectangle-to-register    ;列模式复制,C-x r r
    "ri" 'insert-rectangle              ;列模式粘贴,C-x r i
    "rk" 'kill-rectangle                ;列删除
    "rs" 'string-rectangle              ;列替换
    "rr" 'insert-register               ;粘贴,C-x r i
    "rq" 'query-replace                 ;替换

    "sd" 'spacemacs/swiper-all-region-or-symbol

    "xbd" 'describe-current-coding-system
    "xbr" 'revert-buffer-with-coding-system
    "xbk" 'set-buffer-file-coding-system
    "xbu" 'universal-coding-system-argument

    "0" 'select-window-0
    "1" 'select-window-1
    "2" 'select-window-2
    "3" 'select-window-3
    "4" 'select-window-4
    "w/" 'split-window-right
    "w-" 'split-window-below
    ":"  'counsel-M-x
    "wM" 'delete-other-windows
    "wa" 'make-frame
    "wg" 'golden-ratio
    "wx" 'delete-frame

    "C-a" 'mark-whole-buffer
    "C-s" 'replace-string
    "C-r" 'replace-regexp
    "C-z" 'repeat

    ","   'describe-key
    "."   'describe-variable

    )

  )

冒昧请您再帮我看看应该怎么配置,如果能直接发给我修改版就更好了。

感激不尽!!!

您有没有推荐的Python配置,我直接用高手的吧,自己越折腾越乱 :joy:

你不需要装 jedi,jedi-core,elpy,epc 那些包,(不确定会不会有冲突),Spacemacs 已经帮你弄好了。至于你的配置,要改起来的话有点多🤣,周末如果有空再帮你看吧(完全不保证)

Spacemacs 已经够无脑了,只要你想用 Emacs,就得学习和折腾,要么就换 vscode 之类的

1 个赞
(add-hook 'python-mode-hook #'(lambda ()
								(require 'lsp-pyright)
								(setq lsp-pyright-auto-import-completions t
									  lsp-pyright-use-library-code-for-types t
									  lsp-pyright-auto-search-paths t)								
								(lsp)
								)

装一个lsp-mode + lsp-pyright + pyvenv 包就够用了,网上的教程多半不够新.

建议直接上这个

不谈Spacemacs,只谈Centaur Emacs - Emacs-general - Emacs China (emacs-china.org),

你就不用管我上面那一段配置了.

1 个赞

要是用spacemacs,就好好读读文档吧,起码你也应该读读里面关于python layer的文档。这么让别人帮你直接改,总归不是办法。

1 个赞
  • 我不太建议楼主按照你现在代码逻辑来做,因为@lxs913 是在使用spacemacs。可以按照spacemacs的方式来调用lsp,和你这个有一定区别。@Voleking 这样的帮忙更好些,还是在围绕楼主目前的主题配置。

  • @lxs913, 我也不建议你马上就调转到Centaur Emacs,先折腾下spacemacs,围绕一个点来做。spacemacs的文档还算OK,你多读读python layer,如果尝试lsp,就读读spacemacs的lsp 文档,加下这个layer就好。

  • anaconda-mode 有段时间没更新了,目前确实是lsp-pyright 更舒服很多。但使用anaconda 应该不至于出现你报的问题,我想。你可以再看看。

2 个赞

你这个实在改不下去,给你个最简配置能用 lsp 补全的参考,Ubuntu Pastebin 简单来说进去把 init.el 删了,让 spacemacs 重建一个,然后只改了 dotspacemacs-configuration-layers

   ;; List of configuration layers to load.
   dotspacemacs-configuration-layers
   '(
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press `SPC f e R' (Vim style) or
     ;; `M-m f e R' (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     auto-completion
     emacs-lisp
     ivy
     lsp
     (python :variables
             python-backend 'lsp
             ;; python-lsp-server 'pyright
             )
     syntax-checking
     )

然后如果安装 pip install python-language-server 就可以补全了。不过 lsp 没法在 scratch 补全,你可以把后端换成 anaconda。

dotspacemacs-additional-packages 里面的包要么 spacemacs 装了,要么有同功能的(key-chord->evil-escape),都应该没有必要。

默认有快捷键了 spc b n/p

默认已经启动

spacemacs-evil 有 evil-escape 这个包做这个的,自己去看文档咋弄

spacemacs 有自己的函数给 space 绑键。

大致建议就是:

  1. 确认用的 develop 分支
  2. 从全新的 init.el 重头来过(备份自己旧的配置)
  3. 去把文档通读了 Spacemacs documentation
  4. 把这个文件的所有注释读一遍
  5. 每加一个 layer 去通读一遍 layer 的文档,默认早起需求只需要改 layer 的 variable 就好了(Spacemacs spc h l 可以看 layer 的文档。
  6. 搜解决方案加上个 spacemacs 的关键词
  7. 短期别自己加快捷键,M-x 调函数,会有快捷键提示,spacemacs 默认还是挺好的,如果没有才自己加
  8. 以上步骤边用边做,但起码保证核心功能正常

最后如果弄不好没必要强迫自己,看你也不用 org mode 啥的,VS Code 挺好的😂

2 个赞

感谢您的指路,目前折腾的配置的确不够规范和系统,返回原来的配置,卸载并重装jedi(pip过程也有版本冲突之类的error提示)之后居然又可以正常补全并跳转到定义了。暂时还能用,有空我再好好看看相关的文档将配置规范化。

使用Anaconda与lsp不冲突吧?我的dotspacemacs-configuration-layers中有python没有anaconda,anaconda-mode是Python layer自带的吗?

如果用lsp,是在layer中直接添加lsp吗? 简单试了下,在dotspacemacs-configuration-layers中添加lsp-pyright,提示:

                    - Unknown layer lsp-pyright declared in dotfile.      

改成在dotspacemacs-configuration-layers中添加lsp,不知道是不是清华源没有这个layer相关的包,message buffer提示了大量的error:

Loading e:/lxs/.spacemacs…done (Spacemacs) → refreshing package archive: melpa-cn… [1/3] Contacting host: mirrors.tuna.tsinghua.edu.cn:80 (Spacemacs) → refreshing package archive: org-cn… [2/3] Contacting host: mirrors.tuna.tsinghua.edu.cn:80 (Spacemacs) → refreshing package archive: gnu-cn… [3/3] Contacting host: mirrors.tuna.tsinghua.edu.cn:80 [2 times] Package refresh done (Spacemacs) → installing package: lsp-ivy@lsp… [1/7] Contacting host: mirrors.tuna.tsinghua.edu.cn:80 (Spacemacs) Error: An error occurred while installing lsp-ivy (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → installing package: lsp-mode@lsp… [2/7] (Spacemacs) Error: An error occurred while installing lsp-mode (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → installing package: lsp-origami@lsp… [3/7] Parsing tar file…done Extracting…done INFO Scraping files for origami-autoloads.el… Generating autoloads for origami-parsers.el…done Generating autoloads for origami-pkg.el…done Generating autoloads for origami.el…done INFO Scraping files for origami-autoloads.el…done Wrote e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019/origami-autoloads.el [2 times] Checking e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019… [2 times] Compiling e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019/origami-parsers.el…done Wrote e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019/origami-parsers.elc Checking e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019… [2 times] Compiling e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019/origami.el…done Wrote e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019/origami.elc Checking e:/lxs/.emacs.d/elpa/27.2/develop/origami-20200331.1019… Done (Total of 2 files compiled, 2 skipped) Contacting host: mirrors.tuna.tsinghua.edu.cn:80 (Spacemacs) Error: An error occurred while installing lsp-origami (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → installing package: lsp-pyright@python… [4/7] Contacting host: mirrors.tuna.tsinghua.edu.cn:80 (Spacemacs) Error: An error occurred while installing lsp-pyright (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → installing package: lsp-python-ms@python… [5/7] (Spacemacs) Error: An error occurred while installing lsp-python-ms (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → installing package: lsp-treemacs@lsp… [6/7] (Spacemacs) Error: An error occurred while installing lsp-treemacs (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → installing package: lsp-ui@lsp… [7/7] (Spacemacs) Error: An error occurred while installing lsp-ui (error: (file-error http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/lsp-mode-20210630.2003.tar Not found))

(Spacemacs) → deleting origami… [1/1] Package ‘origami-20200331.1019’ deleted. Auto-evilification could not remap these functions in map ‘archive-mode-map’:

  • ‘archive-chgrp-entry’ originally mapped on ‘G’ Auto-evilification could not remap these functions in map ‘tar-mode-map’:
  • ‘tar-chgrp-entry’ originally mapped on ‘G’ Loading e:/lxs/.emacs.d/.cache/recentf…done Saving file e:/lxs/.emacs.d/.cache/.custom-settings… Wrote e:/lxs/.emacs.d/.cache/.custom-settings Spacemacs is ready. [yas] Prepared just-in-time loading of snippets successfully. Loading e:/lxs/.emacs.d/.cache/company-statistics-cache.el (source)…done [yas] Prepared just-in-time loading of snippets successfully. Skipping check for new version (reason: dotfile) Truncate long lines disabled truncate-lines disabled. evil-line-move: Beginning of buffer [12 times] Beginning of buffer [3 times] End of buffer [3 times] Mark set [2 times] Saving file e:/lxs/.emacs.d/.cache/recentf… Wrote e:/lxs/.emacs.d/.cache/recentf Mark set

这些问题如果太初级,我抽空看看文档再试吧,谢谢。

  • anaconda-mode 与 lsp 都是给python做语义支持的,没有anaconda layer,但是有conda layer,那个是对conda本身的,和你考虑python layer 应该没关系。
  • anaconda-mode 与 lsp 在python layer 的配置中,应该只能选择一个吧。
  • 对,添加lsp,而不是lsp-pyright,后者是lsp在支持python时候特用的一个python language server,python文档里都有写。
  • 你后面下载的问题我不知道,因为我不需要这个源。你可以搜索下论坛里面关于包源的设置。
1 个赞

谢谢您的分享,我找时间试试。 您这兼容大部分Spacemacs的操作吧?也是evil吧?我本人比较喜欢hybrid模式,一般用vim,insert下用Emacs。

感谢您的指路,我在Windows里跳回原来的配置,卸载并重装jedi(pip过程也有版本冲突之类的error提示)之后居然又可以正常补全并跳转到定义了。暂时还能用,有空我再好好看看相关的文档将配置规范化。

  1. 确实已经在用develop分支

  2. 折腾配置太累,Windows配置暂时还用之前的。在wsl中用了您推荐的初始lsp版,感觉挺好用的,我会慢慢看文档添加功能。

  3. 文档打算浏览一遍。

  4. 注释之前看过一点,后续和文档一起看全一些。

  5. layer文档之前也打开过但没有仔细看,后续尽量改成规范的varible配置。

  6. 已基本知道怎么搜索答案,可惜中文资料还是有点少,英文好多打不开,看起来也略微有点吃力。Emacs感觉学无止境,如果有高人指点会少走弯路,节省太多精力。也可能是我东拼西凑修修补补的方法不对,从一开始就应该好好看官方文档。

  7. 知道M-x这个方法,经常忘了快捷键就用spc spc来搜索关键词。spc b n/p 也早就知道,只是以前习惯了C-tab感觉更快,现在不知道为什么C-tab配置失效,不会转到下一个buffer,而是打开switch-buffer的minibuffer。evil-escape用kk退出插入模式我后续找找文档配置。spacemacs 有自己的函数给 space 绑键,目前感觉原配置这样集中设置自己的快捷键挺舒服并自然的,有空找找新函数如何配置。

  8. 暂时打算在wsl中按您给的初始文件逐步丰富配置。

layer添加org重启Spacemacs会提示“Package org-contrib is unavailable. Is the package name misspelled?”,因此注释掉了,org初步学了下,没感觉到其精妙,的确用得少。

vscode只有简单的了解,vscode使用vim插件的同时是不是还能支持Emacs的快捷键?暂时没有换用的打算,比较喜欢Emacs这种使用同一套操作方法使用丰富的功能。

1 个赞

没法正常访问好多网络确实很难,我觉得你如果还想一直用 Emacs 可能得学下

喜欢就行,happy hacking :smile:

前面吐槽了挺多😂,是希望说既然用了 Spacemacs 就享受它弄好的很多东西,而不是自己从哪不知道找到的东西瞎拼起来,当然其实怎么用都行。

他的这些代码和你说的那些没有关系,就是怎么使用 lsp-pyright 的,你用 Spacemacs 把我那行注释掉的反注释就可以用 pyright 了。