mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
chore: formatting and fix spell errors
This commit is contained in:
parent
d434627738
commit
8dffa8bd23
@ -5,7 +5,7 @@
|
|||||||
# Introduction
|
# Introduction
|
||||||
|
|
||||||
This repo hosts my Nvim configuration for all the platforms I am using (Linux,
|
This repo hosts my Nvim configuration for all the platforms I am using (Linux,
|
||||||
Windows and macOS). `init.vim` is the config entrypoint for terminal Neovim,
|
Windows and macOS). `init.vim` is the config entry point for terminal Neovim,
|
||||||
and `ginit.vim` is the additional config file for GUI client of Neovim (I am
|
and `ginit.vim` is the additional config file for GUI client of Neovim (I am
|
||||||
using [neovim-qt](https://github.com/equalsraf/neovim-qt) for now on Windows).
|
using [neovim-qt](https://github.com/equalsraf/neovim-qt) for now on Windows).
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ backward compatibility is guaranteed.**
|
|||||||
+ Markdown writing and syntax highlighting via [vim-markdown](https://github.com/plasticboy/vim-markdown),
|
+ Markdown writing and syntax highlighting via [vim-markdown](https://github.com/plasticboy/vim-markdown),
|
||||||
Markdown Previewing via [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
Markdown Previewing via [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
||||||
+ Command line auto-completion via [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
+ Command line auto-completion via [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
||||||
+ Annimated GUI style notifiation via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
||||||
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
||||||
+ Source code linting via [Ale](https://github.com/dense-analysis/ale).
|
+ Source code linting via [Ale](https://github.com/dense-analysis/ale).
|
||||||
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
||||||
|
|||||||
@ -11,7 +11,7 @@ function! text_obj#URL() abort
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" We need to find all possible URL on this line and their start, end idx.
|
" We need to find all possible URL on this line and their start, end index.
|
||||||
" Then find where current cursor is, and decide if cursor is on one of the
|
" Then find where current cursor is, and decide if cursor is on one of the
|
||||||
" URLs.
|
" URLs.
|
||||||
let line_text = getline('.')
|
let line_text = getline('.')
|
||||||
@ -54,10 +54,10 @@ function! text_obj#URL() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! text_obj#MdCodeBlock(type) abort
|
function! text_obj#MdCodeBlock(type) abort
|
||||||
" the parameter type specify whether it is inner text objects or arround
|
" the parameter type specify whether it is inner text objects or around
|
||||||
" text objects.
|
" text objects.
|
||||||
|
|
||||||
" Move the cursor to the end of line in case that cursor is on the openning
|
" Move the cursor to the end of line in case that cursor is on the opening
|
||||||
" of a code block. Actually, there are still issues if the cursor is on the
|
" of a code block. Actually, there are still issues if the cursor is on the
|
||||||
" closing of a code block. In this case, the start row of code blocks would
|
" closing of a code block. In this case, the start row of code blocks would
|
||||||
" be wrong. Unless we can match code blocks, it not easy to fix this.
|
" be wrong. Unless we can match code blocks, it not easy to fix this.
|
||||||
|
|||||||
@ -41,7 +41,7 @@ function! utils#HasAirlinetheme(name) abort
|
|||||||
return !empty(globpath(&runtimepath, l:pat))
|
return !empty(globpath(&runtimepath, l:pat))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Generate random integers in the range [Low, High] in pure vimscrpt,
|
" Generate random integers in the range [Low, High] in pure vim script,
|
||||||
" adapted from https://stackoverflow.com/a/12739441/6064933
|
" adapted from https://stackoverflow.com/a/12739441/6064933
|
||||||
function! utils#RandInt(Low, High) abort
|
function! utils#RandInt(Low, High) abort
|
||||||
" Use lua to generate random int. It is faster. Ref: https://stackoverflow.com/a/20157671/6064933
|
" Use lua to generate random int. It is faster. Ref: https://stackoverflow.com/a/20157671/6064933
|
||||||
@ -152,7 +152,7 @@ function! utils#Inside_git_repo() abort
|
|||||||
if match(res, 'true') == -1
|
if match(res, 'true') == -1
|
||||||
return v:false
|
return v:false
|
||||||
else
|
else
|
||||||
" Manually trigger a speical user autocmd InGitRepo (to use it for
|
" Manually trigger a specical user autocmd InGitRepo (to use it for
|
||||||
" lazyloading of fugitive by packer.nvim).
|
" lazyloading of fugitive by packer.nvim).
|
||||||
" See also https://github.com/wbthomason/packer.nvim/discussions/534.
|
" See also https://github.com/wbthomason/packer.nvim/discussions/534.
|
||||||
doautocmd User InGitRepo
|
doautocmd User InGitRepo
|
||||||
|
|||||||
@ -92,6 +92,6 @@ endfunction
|
|||||||
|
|
||||||
augroup git_repo_check
|
augroup git_repo_check
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd VimEnter,DirChanged * call utils#Inside_git_repo()
|
autocmd VimEnter,DirChanged * call utils#Inside_git_repo()
|
||||||
augroup END
|
augroup END
|
||||||
"}
|
"}
|
||||||
|
|||||||
@ -76,7 +76,7 @@ set fileformats=unix,dos " Fileformats to use for new files
|
|||||||
|
|
||||||
set inccommand=nosplit " Show the result of substitution in real time for preview
|
set inccommand=nosplit " Show the result of substitution in real time for preview
|
||||||
|
|
||||||
" Ignore certain files and folders when globbing
|
" Ignore certain files and folders when globing
|
||||||
set wildignore+=*.o,*.obj,*.bin,*.dll,*.exe
|
set wildignore+=*.o,*.obj,*.bin,*.dll,*.exe
|
||||||
set wildignore+=*/.git/*,*/.svn/*,*/__pycache__/*,*/build/**
|
set wildignore+=*/.git/*,*/.svn/*,*/__pycache__/*,*/build/**
|
||||||
set wildignore+=*.jpg,*.png,*.jpeg,*.bmp,*.gif,*.tiff,*.svg,*.ico
|
set wildignore+=*.jpg,*.png,*.jpeg,*.bmp,*.gif,*.tiff,*.svg,*.ico
|
||||||
|
|||||||
@ -36,10 +36,10 @@ let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
|
|||||||
|
|
||||||
"{{ Language specific plugin
|
"{{ Language specific plugin
|
||||||
"""""""""""""""""""""""""" semshi settings """""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""" semshi settings """""""""""""""""""""""""""""""
|
||||||
" Do not highlight for all occurances of variable under cursor
|
" Do not highlight for all occurrences of variable under cursor
|
||||||
let g:semshi#mark_selected_nodes=0
|
let g:semshi#mark_selected_nodes=0
|
||||||
|
|
||||||
" Do not show error sign since linting plugin is specicialized for that
|
" Do not show error sign since linting plugin is specialized for that
|
||||||
let g:semshi#error_sign=v:false
|
let g:semshi#error_sign=v:false
|
||||||
|
|
||||||
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
||||||
@ -160,7 +160,7 @@ let g:vista_stay_on_open = 0
|
|||||||
nnoremap <silent> <Space>t :<C-U>Vista!!<CR>
|
nnoremap <silent> <Space>t :<C-U>Vista!!<CR>
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ File editting
|
"{{ File editing
|
||||||
""""""""""""""""""""""""vim-auto-save settings"""""""""""""""""""""""
|
""""""""""""""""""""""""vim-auto-save settings"""""""""""""""""""""""
|
||||||
" Enable autosave on nvim startup
|
" Enable autosave on nvim startup
|
||||||
let g:auto_save = 1
|
let g:auto_save = 1
|
||||||
@ -209,7 +209,7 @@ let g:better_escape_interval = 200
|
|||||||
let g:XkbSwitchEnabled = 1
|
let g:XkbSwitchEnabled = 1
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ Linting and formating
|
"{{ Linting and formatting
|
||||||
"""""""""""""""""""""""""""""" neoformat settings """""""""""""""""""""""
|
"""""""""""""""""""""""""""""" neoformat settings """""""""""""""""""""""
|
||||||
let g:neoformat_enabled_python = ['black', 'yapf']
|
let g:neoformat_enabled_python = ['black', 'yapf']
|
||||||
let g:neoformat_cpp_clangformat = {
|
let g:neoformat_cpp_clangformat = {
|
||||||
@ -306,7 +306,7 @@ nmap s <Nop>
|
|||||||
omap s <Nop>
|
omap s <Nop>
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ LaTeX editting
|
"{{ LaTeX editing
|
||||||
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
||||||
if ( g:is_win || g:is_mac ) && executable('latex')
|
if ( g:is_win || g:is_mac ) && executable('latex')
|
||||||
function! SetServerName() abort
|
function! SetServerName() abort
|
||||||
@ -427,7 +427,7 @@ let g:airline#extensions#hunks#non_zero_only = 1
|
|||||||
" Speed up airline
|
" Speed up airline
|
||||||
let g:airline_highlighting_cache = 1
|
let g:airline_highlighting_cache = 1
|
||||||
|
|
||||||
" The key in the following shortcode are the layout when we use a specific
|
" The keys in the following shortcode are the layout when we use a specific
|
||||||
" input method mode. On my macOS, 0 means that we are trying to input Chinese,
|
" input method mode. On my macOS, 0 means that we are trying to input Chinese,
|
||||||
" and 1 means we are using English mode.
|
" and 1 means we are using English mode.
|
||||||
" See also https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
" See also https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
||||||
|
|||||||
@ -103,7 +103,7 @@ Set its PATH properly and make sure you can call `ctags` from command line.
|
|||||||
|
|
||||||
## Ripgrep
|
## Ripgrep
|
||||||
|
|
||||||
[Ripgrep](https://github.com/BurntSushi/ripgrep), aka, `rg`, is a fast greping
|
[Ripgrep](https://github.com/BurntSushi/ripgrep), aka, `rg`, is a fast grepping
|
||||||
tool available for both Linux, Windows and macOS. It is used by several
|
tool available for both Linux, Windows and macOS. It is used by several
|
||||||
searching plugins.
|
searching plugins.
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ setups.
|
|||||||
I use [packer.nvim](https://github.com/wbthomason/packer.nvim) to manage my
|
I use [packer.nvim](https://github.com/wbthomason/packer.nvim) to manage my
|
||||||
plugins. We need to install packer.nvim on our system first.
|
plugins. We need to install packer.nvim on our system first.
|
||||||
|
|
||||||
For Windows, if curl is installed, use the following command (on Powershell):
|
For Windows, if curl is installed, use the following command (on PowerShell):
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim"
|
git clone --depth=1 https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\start\packer.nvim"
|
||||||
|
|||||||
@ -37,7 +37,7 @@ local on_attach = function(client, bufnr)
|
|||||||
autocmd CursorHold <buffer> lua require('config.lsp').show_line_diagnostics()
|
autocmd CursorHold <buffer> lua require('config.lsp').show_line_diagnostics()
|
||||||
]]
|
]]
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some key bindings conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -82,7 +82,7 @@ require('packer').startup(
|
|||||||
-- Another grep tool (similar to Sublime Text Ctrl+Shift+F)
|
-- Another grep tool (similar to Sublime Text Ctrl+Shift+F)
|
||||||
-- use 'dyng/ctrlsf.vim'
|
-- use 'dyng/ctrlsf.vim'
|
||||||
|
|
||||||
-- A greping tool
|
-- A grepping tool
|
||||||
-- use {'mhinz/vim-grepper', cmd = {'Grepper', '<plug>(GrepperOperator)'}}
|
-- use {'mhinz/vim-grepper', cmd = {'Grepper', '<plug>(GrepperOperator)'}}
|
||||||
|
|
||||||
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
-- A list of colorscheme plugin you may want to try. Find what suits you.
|
||||||
@ -213,7 +213,7 @@ require('packer').startup(
|
|||||||
-- carefully to use its full power
|
-- carefully to use its full power
|
||||||
use 'wellle/targets.vim'
|
use 'wellle/targets.vim'
|
||||||
|
|
||||||
-- Plugin to manipulate characer pairs quickly
|
-- Plugin to manipulate character pairs quickly
|
||||||
-- use 'tpope/vim-surround'
|
-- use 'tpope/vim-surround'
|
||||||
use 'machakann/vim-sandwich'
|
use 'machakann/vim-sandwich'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user