Chris Jones a6d253a190 formatting | 3 年之前 | |
---|---|---|
.. | ||
vim | 3 年之前 | |
README.md | 4 年之前 | |
editorconfig | 7 年之前 | |
init.vim | 6 年之前 | |
vimrc | 3 年之前 |
For an exhaustive collection of notes I have taken while actively working with these dotfiles using Vim and Neovim click me 👈
❗️ June 11, 2019 Load vim-jsx-pretty before vim-polyglot to avoid this issue
I use the same vimrc
for both Vim 8 and Neovim on macOS and GNU+Linux distros. That said there are a few specific settings related to Neovim contained within the init.vim
I use a modified version of a code fold function provided by wincent's dotfiles for customizing the display output chars for code folds throughout various source files.
./vim/autoload/settings.vim
I use minpac to install and update various Vim and Neovim Plugins, which are listed in my vimrc
.
autocmds.vim
found in ./vim/plugin
contains a few autocmds, ie. functions for various tasks, ie. there is an autocmd that places the cursor at the previous position when reopening a file / buffer after it has been closed. Another useful autocmd that will refresh / update a buffer when the buffer regains focus, ie. move focus away from current Vim / Neovim buffer, make some changes to the file that is currently open in Vim via another Vim buffer or other form of file manipulation, and when putting focus back in the buffer the changes made by the external command should be present in the Vim buffer (this really needs to worded better).
mappings.vim
found in ./vim/plugin
contains various mappings for making life easier while using Vim and Neovim, useful mappings include opening files, creating horizontal and vertical empty buffer splits for viewing different files within the same pane / window of a Vim / Neovim session, and a few different mappings for changing the lcd and exiting insert mode.
settings.vim
found in ./vim/plugin
contains settings related to configuring Vim and Neovim, ie. enabling mouse support, incremental searching through files, setting up directories for swap, undo, session, and view files.
./vim/after/plugin
contains all the .vim
files for configuring plugins for Vim and Neovim, ie. deoplete, lightline, indentLine, and what not.
When problems arise, (and they will) with configuration settings a good place to start to launch Vim or Neovim without a configuration, and then gradually test such problematic setting or vim file
nvim -u NONE
The above command will launch Neovim with no RC file defined and all settings will be their defaults, and any user defined settings within a ~/.vimrc
etc will be ignored for the session unless they are loaded manually.
For my recent case of troubleshooting FoldColumn
highlighting / colors for my current configuration, I launched Neovim with above command and then changed certain highlight
settings.
FWR, the version of Neovim I'm using respects the guifg
and guibg
so use those instead of ctermfg and ctermbg.
I use a vim plugin known as vim-commentary to set / toggle comment strings for various filetypes, ie. markdown files and what not. The default Neovim syntax file uses >
as the commentstring for markdown documents which github flavored markdown does not use. ie. github flavored markdown uses HTML commentstring, ie. <!-- comment -->
I set a custom commentstring
for markdown files to use the HTML commentstring, however changing the commentstring
can be problematic because if a view vim file is set, the commentstring will be read from the view file even though if a vim sytnax file is updated, for that reason delete the view file generally located within the ./vim/tmp
directory, then set the commentstring. Finally, close & reopen vim to see if commentstring is set appropriately. I set the commenstring
for markdown files located within the plugin_vim-commentary.vim
To see where the commentstring is being set for a particular file learn more
:verbose set commentstring?
see the following section related to troubleshooting eslint with coc
:CheckHealth
.vimrc
within the home directory.$HOME/.vim/vim/pack/minpac/start
❗️ If .vim is symlinked then the above directory might be different.
I have stopped using ALE for linting and have been experimenting using CoC along various CoC plugins, ie. coc-eslint to lint javascript & related files, in conjunction with various language linters.
🚨 I have not setup tidy, shellcheck, or markdownlint yet with coc, as I believe that would require loading the appropriate coc related language linter in order to lint those specific source files.
when updating a eslint configuration file, say disabling the no unused vars while drafting the file, and one wants to reload the current buffer after making changes to a eslint configuration file, just reload the buffer and making the changes. ie. e
coc-eslint should pickup on the latest eslintrc configuration changes. if that fails for whatever reason, then restart the coc server.
CocRestart
[coc.nvim] Failed to load the ESLint library for the document /opt/code/typescript/index.ts
to fix the above error msg, for my particular use case dec 9, 2020 all that was required was running,
CocUpdate
i did resolve some path issues related to global yarn pkgs bin the other day so that may be related to addressing the above issue as well.
To invoke HTML 5 tidy from a CLI
tidy [FILE.html]
To not show any output, and only errors & warning if there are any present in an HTML file
tidy -eq [FILE.html]
.md
documentssearch query hot reload/hotreload markdown/md documents in browser
There is a chrome extension markdown-viewer that allows rendering of markdown documents using the file
URL to access local markdown documents, and provides hot reloading of the documents on save along with other assorted features learn more
The above method comes across as the easiest way to render markdown documents locally while still editing the markdown file in vim, and yes there are JS and vim solutions to spin a web server and serve the document, but the above mentioned chrome extension is quite painless and gets the job done.