tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

vim.rst (2873B)


      1 Vim / Neovim
      2 ============
      3 
      4 AutoCompletion
      5 --------------
      6 
      7 For C++, anything that can use an LSP like :code:`coc.nvim`,
      8 :code:`nvim-lspconfig`, or what not, should work as long as you generate a
      9 :ref:`compilation database <CompileDB back-end-compileflags>` and point to it.
     10 
     11 Additionally, `YouCompleteMe <https://github.com/ycm-core/YouCompleteMe/>`__
     12 works without the need of a C++ compilation database as long as you have run
     13 :code:`./mach build` or :code:`./mach configure`. Configuration for this lives
     14 in :searchfox:`.ycm_extra_conf <.ycm_extra_conf>` at the root of the repo.
     15 
     16 Rust auto-completion should work both with Rust's LSP :code:`rust-analyzer`.
     17 
     18 Make sure that the LSP is configured in a way that it detects the root of the
     19 tree as a workspace, not the crate you happen to be editing. For example, the
     20 default of :code:`nvim-lspconfig` is to search for the closest
     21 :code:`Cargo.toml` file, which is not what you want. You'd want something like:
     22 
     23 .. code ::
     24 
     25    root_dir = lspconfig.util.root_pattern(".git")
     26 
     27 You also need to set some options to get full diagnostics:
     28 
     29 .. code ::
     30 
     31   "rust-analyzer.cargo.extraEnv": {
     32     "CARGO_TARGET_DIR": "/path/to/objdir"
     33   },
     34   "rust-analyzer.vfs.extraIncludes": ["/path/to/objdir", "/optional/path/to/windows_rs_dir"],
     35   "rust-analyzer.check.overrideCommand": [ "/path/to/mach", "--log-no-times", "cargo", "check", "--all-crates", "--message-format-json" ],
     36   "rust-analyzer.cargo.buildScripts.overrideCommand": [ "/path/to/mach", "--log-no-times", "cargo", "check", "--all-crates", "--message-format-json" ],
     37 
     38 The easiest way to make these work out of the box is using
     39 `codesettings.nvim <https://github.com/mrjones2014/codesettings.nvim>`__, which
     40 automatically supports importing VSCode configuration files.
     41 :code:`./mach ide vscode --no-interactive` will then generate the right
     42 configuration for you.
     43 
     44 ESLint
     45 ------
     46 
     47 The easiest way to integrate ESLint with VIM is using the `Syntastic plugin
     48 <https://github.com/vim-syntastic/syntastic>`__.
     49 
     50 In order for VIM to detect jsm files as JS you might want something like this
     51 in your :code:`.vimrc`:
     52 
     53 .. code::
     54 
     55    autocmd BufRead,BufNewFile *.jsm set filetype=javascript
     56 
     57 :code:`mach eslint --setup` installs a specific ESLint version and some ESLint
     58 plugins into the repositories' :code:`node_modules`.
     59 
     60 You need something like this in your :code:`.vimrc` to run the checker
     61 automatically on save:
     62 
     63 .. code::
     64 
     65    autocmd FileType javascript,html,xhtml let b:syntastic_checkers = ['javascript/eslint']
     66 
     67 You need to have :code:`eslint` in your :code:`PATH`, which you can get with
     68 :code:`npm install -g eslint`. You need at least version 6.0.0.
     69 
     70 You can also use something like `eslint_d
     71 <https://github.com/mantoni/eslint_d.js#editor-integration>`__ which should
     72 also do that automatically:
     73 
     74 .. code::
     75 
     76    let g:syntastic_javascript_eslint_exec = 'eslint_d'