mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
89 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4c55edb44 | ||
|
|
58b1e0aa9f | ||
|
|
f7bb7caba6 | ||
|
|
617fb733d7 | ||
|
|
9082e124a5 | ||
|
|
2ffba14a6c | ||
|
|
1a36e711df | ||
|
|
4ab3d0414f | ||
|
|
8059940caa | ||
|
|
081c2717b3 | ||
|
|
1d3bfc5c5f | ||
|
|
3c5d7bf0e5 | ||
|
|
3134f088cd | ||
|
|
639b3d6067 | ||
|
|
4f55f53958 | ||
|
|
085f0eb7e3 | ||
|
|
9f41333378 | ||
|
|
e9ffd6c39d | ||
|
|
988cf54f26 | ||
|
|
9dbeb67de5 | ||
|
|
36bdde7fc9 | ||
|
|
4dd1350f25 | ||
|
|
311768ce72 | ||
|
|
a1942e6142 | ||
|
|
e528acd799 | ||
|
|
3c7b40bc15 | ||
|
|
a0179d01c1 | ||
|
|
377c54c88c | ||
|
|
3f78429c81 | ||
|
|
414a4593ce | ||
|
|
aa891f7acd | ||
|
|
a522cf7c5e | ||
|
|
5b7944031e | ||
|
|
1efec8bc8f | ||
|
|
ec6549948a | ||
|
|
528aa2f19a | ||
|
|
295f47b1fb | ||
|
|
8ce677a50f | ||
|
|
6322c7c212 | ||
|
|
aa0cf40591 | ||
|
|
15dfccf81e | ||
|
|
0aed2b42ac | ||
|
|
1e84dd6248 | ||
|
|
1b937d80af | ||
|
|
78a8804f77 | ||
|
|
6759171794 | ||
|
|
f357b0bee8 | ||
|
|
2b24d0794e | ||
|
|
f10f688374 | ||
|
|
d6b83710c4 | ||
|
|
590baf4ca9 | ||
|
|
dc4ff3d499 | ||
|
|
6b76b7781c | ||
|
|
21127b3170 | ||
|
|
b542bec561 | ||
|
|
7ce35a0a5f | ||
|
|
61ae7acc14 | ||
|
|
d533859af9 | ||
|
|
74e8aed170 | ||
|
|
532e457ad4 | ||
|
|
9555052f94 | ||
|
|
b84d57ccec | ||
|
|
4741291176 | ||
|
|
38883b3fc5 | ||
|
|
597b11638f | ||
|
|
694f4d0ca1 | ||
|
|
e5c506aae3 | ||
|
|
22eead5d0f | ||
|
|
a6ded3a154 | ||
|
|
91b4d85592 | ||
|
|
a19a91397f | ||
|
|
3928935402 | ||
|
|
3604449b6a | ||
|
|
146ef5d0b8 | ||
|
|
6fd7155787 | ||
|
|
665250fe58 | ||
|
|
6a2ded6ca8 | ||
|
|
41db6639d6 | ||
|
|
1b9b208653 | ||
|
|
97fcc581e6 | ||
|
|
2e9f5fedfa | ||
|
|
1280c98314 | ||
|
|
9cd43dcba9 | ||
|
|
d02fd0a69d | ||
|
|
980fd531a8 | ||
|
|
148dabd7ad | ||
|
|
b9d1f2ee92 | ||
|
|
b2959e8acf | ||
|
|
b5ec8d2a91 |
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
40
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!-- Before reporting: make sure that you have read the doc (https://github.com/jdhao/nvim-config/tree/master/docs) and searched existing issues. -->
|
||||
|
||||
- `nvim --version`:
|
||||
- terminal emulator and version:
|
||||
- Operating system/version:
|
||||
- Have you read and followed all steps in the [doc](https://github.com/jdhao/nvim-config/tree/master/docs):
|
||||
- Output of command `set runtimepath`:
|
||||
|
||||
<!-- paste your runtimepath below --->
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
**Describe the bug**
|
||||
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
|
||||
Steps to reproduce the issue:
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
**Expected behavior**
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Screenshots**
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
**Additional context**
|
||||
|
||||
<!-- Add any other context about the problem here. -->
|
||||
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
19
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@ en.utf-8.add.spl
|
||||
*.exe
|
||||
.netrwhist
|
||||
packer_compiled.lua
|
||||
*.log
|
||||
.DS_Store
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2021 jdhao
|
||||
Copyright (c) 2018-2022 jdhao
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
92
README.md
92
README.md
@@ -1,25 +1,32 @@
|
||||
```
|
||||
███ ██ ██ ██ ██ ███ ███ ██████ ██████ ███ ██ ███████ ██ ██████
|
||||
████ ██ ██ ██ ██ ████ ████ ██ ██ ██ ████ ██ ██ ██ ██
|
||||
██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ █████ ██ ██ ███
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||
██ ████ ████ ██ ██ ██ ██████ ██████ ██ ████ ██ ██ ██████
|
||||
```
|
||||
|
||||
<div align="center"><p>
|
||||
<a href="https://github.com/jdhao/nvim-config/releases/latest">
|
||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
||||
<div align="center">
|
||||
<p>
|
||||
<a>
|
||||
<img alt="Linux" src="https://img.shields.io/badge/Linux-%23.svg?style=flat-square&logo=linux&color=FCC624&logoColor=black" />
|
||||
</a>
|
||||
<a>
|
||||
<img alt="macOS" src="https://img.shields.io/badge/macOS-%23.svg?style=flat-square&logo=apple&color=000000&logoColor=white" />
|
||||
</a>
|
||||
<a>
|
||||
<img alt="Windows" src="https://img.shields.io/badge/Windows-%23.svg?style=flat-square&logo=windows&color=0078D6&logoColor=white" />
|
||||
</a>
|
||||
<a href="https://github.com/jdhao/nvim-config/commits">
|
||||
<img src="https://badgen.net/github/commits/jdhao/nvim-config" alt="Commit number" />
|
||||
</a>
|
||||
<a href="https://github.com/jdhao/nvim-config">
|
||||
<img src="https://img.shields.io/github/repo-size/jdhao/nvim-config?style=flat-square&label=Repo" alt="Repo size">
|
||||
<a href="https://github.com/jdhao/nvim-config/network">
|
||||
<img alt="Forks" src="https://badgen.net/github/forks/jdhao/nvim-config">
|
||||
</a>
|
||||
<a href="https://github.com/neovim/neovim/releases/tag/v0.6.1">
|
||||
<img src="https://img.shields.io/badge/Neovim-0.6.1-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||
<a href="https://github.com/jdhao/nvim-config/stargazers">
|
||||
<img alt="Stars" src="https://badgen.net/github/stars/jdhao/nvim-config">
|
||||
</a>
|
||||
<a href="https://github.com/jdhao/nvim-config/releases/latest">
|
||||
<img alt="Latest release" src="https://img.shields.io/github/v/release/jdhao/nvim-config" />
|
||||
</a>
|
||||
<a href="https://github.com/neovim/neovim/releases/tag/stable">
|
||||
<img src="https://img.shields.io/badge/Neovim-0.7.0-blueviolet.svg?style=flat-square&logo=Neovim&logoColor=green" alt="Neovim minimum version"/>
|
||||
</a>
|
||||
<a href="https://github.com/jdhao/nvim-config/search?l=vim-script">
|
||||
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" alt="Top languages"/>
|
||||
</a>
|
||||
<img src="https://img.shields.io/github/languages/top/jdhao/nvim-config" />
|
||||
<a href="https://github.com/jdhao/nvim-config/blob/master/LICENSE">
|
||||
<img src="https://img.shields.io/github/license/jdhao/nvim-config?style=flat-square&logo=GNU&label=License" alt="License"/>
|
||||
</a>
|
||||
@@ -28,21 +35,21 @@
|
||||
|
||||
# Introduction
|
||||
|
||||
This repo hosts my Nvim configuration for all the platforms I am using (Linux,
|
||||
Windows and macOS). `init.vim` is the config entry point for terminal Nvim,
|
||||
and `ginit.vim` is the additional config file for GUI client of Nvim (I am
|
||||
using [neovim-qt](https://github.com/equalsraf/neovim-qt) for now on Windows).
|
||||
This repo hosts my Nvim configuration for Linux, macOS, and Windows.
|
||||
`init.vim` is the config entry point for terminal Nvim,
|
||||
and `ginit.vim` is the additional config file for [GUI client of Nvim](https://github.com/neovim/neovim/wiki/Related-projects#gui).
|
||||
|
||||
My configurations are heavily documented to make it as clear as possible. While
|
||||
you can download the whole repository and use it, it is not recommended though.
|
||||
Good configurations are personal. Everyone should have his or her unique config
|
||||
file. You are encouraged to copy from this repo the part you feel useful and
|
||||
add it to your own Nvim config.
|
||||
My configurations are heavily documented to make it as clear as possible.
|
||||
While you can download the whole repository and use it, it is not recommended though.
|
||||
Good configurations are personal. Everyone should have his or her unique config file.
|
||||
You are encouraged to copy from this repo the part you feel useful and add it to your own Nvim config.
|
||||
|
||||
See [doc here](docs/README.md) on how to install Nvim's dependencies, Nvim
|
||||
itself, and how to set up on different platforms (Linux, macOS and Windows).
|
||||
# Install and setup
|
||||
|
||||
**This config is tested against [Nvim v0.6.1 release](https://github.com/neovim/neovim/releases/tag/v0.6.0).
|
||||
See [doc here](docs/README.md) on how to install Nvim's dependencies, Nvim itself,
|
||||
and how to set up on different platforms (Linux, macOS, and Windows).
|
||||
|
||||
**This config is tested against [Nvim v0.7.0 release](https://github.com/neovim/neovim/releases/tag/stable).
|
||||
No backward compatibility is guaranteed.**
|
||||
|
||||
# Features #
|
||||
@@ -58,6 +65,7 @@ No backward compatibility is guaranteed.**
|
||||
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim).
|
||||
+ Ultra fast snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips).
|
||||
+ Beautiful status line via [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim).
|
||||
+ File tree explorer via [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua).
|
||||
+ Better quickfix list with [nvim-bqf](https://github.com/kevinhwang91/nvim-bqf).
|
||||
+ Show search index and count with [nvim-hlslens](https://github.com/kevinhwang91/nvim-hlslens).
|
||||
+ Command line auto-completion via [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
||||
@@ -129,11 +137,9 @@ Go to a string starting with `se`
|
||||
<img src="https://user-images.githubusercontent.com/16662357/128589873-aadb8264-1098-4834-9876-fa66a309be05.gif" width="800">
|
||||
</p>
|
||||
|
||||
|
||||
# Shortcuts
|
||||
|
||||
Some of the shortcuts I use frequently. In the following shortcuts, `<leader>`
|
||||
represents ASCII character `,`.
|
||||
Some of the shortcuts I use frequently is listed here. In the following shortcuts, `<leader>` represents ASCII character `,`.
|
||||
|
||||
| Shortcut | Mode | platform | Description |
|
||||
|-------------------|---------------|-----------------|------------------------------------------------------------------|
|
||||
@@ -150,7 +156,6 @@ represents ASCII character `,`.
|
||||
| `<leader>q` | Normal | Linux/macOS/Win | Quit current window |
|
||||
| `<leader>Q` | Normal | Linux/macOS/Win | Quit all window and close Nvim |
|
||||
| `<leader>w` | Normal | Linux/macOS/Win | Save current buffer content |
|
||||
| `<leader>cd` | Normal | Linux/macOS/Win | Change current directory to where current file is |
|
||||
| `<leader>y` | Normal | Linux/macOS/Win | Copy the content of entire buffer to default register |
|
||||
| `<leader>cl` | Normal | Linux/macOS/Win | Toggle cursor column |
|
||||
| `<leader>cd` | Normal | Linux/macOS/Win | Change current working directory to to the dir of current buffer |
|
||||
@@ -159,6 +164,8 @@ represents ASCII character `,`.
|
||||
| `<leader>gw` | Normal | Linux/macOS/Win | Run Git add for current file |
|
||||
| `<leader>gd` | Normal | Linux/macOS/Win | Run git diff for current file |
|
||||
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
|
||||
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
|
||||
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
|
||||
| `<F9>` | Normal | Linux/macOS/Win | Run current source file (for Python, C++) |
|
||||
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
|
||||
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
|
||||
@@ -174,8 +181,7 @@ represents ASCII character `,`.
|
||||
|
||||
# Custom commands
|
||||
|
||||
In addition to commands provided by various plugins, I have also created
|
||||
several custom commands for personal use.
|
||||
In addition to commands provided by various plugins, I have also created some custom commands for personal use.
|
||||
|
||||
| command | description | example |
|
||||
|------------|-------------------------------------------------------------------------|--------------------------------|
|
||||
@@ -183,22 +189,24 @@ several custom commands for personal use.
|
||||
| `Edit` | edit multiple files at the same time, supports globing | `Edit *.vim` |
|
||||
| `Datetime` | print current date and time or convert Unix time stamp to date and time | `Datetime 12345` or `Datetime` |
|
||||
|
||||
# Trouble shooting
|
||||
# Contributing
|
||||
|
||||
If you come across an issue, you can first use `:checkhealth` command provided
|
||||
by `nvim` to trouble-shoot yourself. Please read carefully the messages
|
||||
provided by health check.
|
||||
If you find anything that needs improving, do not hesitate to point it out or create a PR.
|
||||
|
||||
If you come across an issue, you can first use `:checkhealth` command provided by `nvim` to trouble-shoot yourself.
|
||||
Please read carefully the messages provided by health check.
|
||||
|
||||
If you still have an issue, [open a new issue](https://github.com/jdhao/nvim-config/issues).
|
||||
|
||||
# Further readings
|
||||
|
||||
Some of the resources that I find helpful in mastering Vim is documented [here](docs/nvim_resources.md).
|
||||
You may also be interested in my post in configuring Vim on different platforms:
|
||||
Some of the resources that I find helpful in mastering Nvim is documented [here](docs/nvim_resources.md).
|
||||
You may also be interested in my posts on configuring Nvim:
|
||||
|
||||
+ My nvim notes can be found [here](https://jdhao.github.io/categories/Nvim/)
|
||||
+ [Using Neovim for Three years](https://jdhao.github.io/2021/12/31/using_nvim_after_three_years/)
|
||||
+ [Config nvim on Linux for Python development](https://jdhao.github.io/2018/12/24/centos_nvim_install_use_guide_en/)
|
||||
+ [Nvim config on Windows 10](https://jdhao.github.io/2018/11/15/neovim_configuration_windows/)
|
||||
+ [Nvim-qt config on Windows 10](https://jdhao.github.io/2019/01/17/nvim_qt_settings_on_windows/)
|
||||
+ My nvim notes can be found [here](https://jdhao.github.io/categories/Nvim/)
|
||||
|
||||
<b id="f1">1:</b> Not enabled by default for Linux, see [this issue](https://github.com/jdhao/nvim-config/issues/4) on how to enable vimtex on Linux. [↩](#a1)
|
||||
<b id="f1">1:</b> Not enabled for Linux, you need to tweak [`lua/plugins.lua`](lua/plugins.lua) and change the condition for installing vimtex.[↩](#a1)
|
||||
|
||||
@@ -45,3 +45,25 @@ function! AddListSymbol(type, ...) abort
|
||||
call setline(line, new_text)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
" Add hard line breaks for Markdown
|
||||
nnoremap <buffer><silent> \ :set operatorfunc=AddLineBreak<CR>g@
|
||||
xnoremap <buffer><silent> \ :<C-U> call AddLineBreak(visualmode(), 1)<CR>
|
||||
|
||||
function! AddLineBreak(type, ...) abort
|
||||
if a:0
|
||||
let line_start = line("'<")
|
||||
let line_end = line("'>")
|
||||
else
|
||||
let line_start = line("'[")
|
||||
let line_end = line("']")
|
||||
endif
|
||||
|
||||
for line in range(line_start, line_end)
|
||||
let text = getline(line)
|
||||
" add backslash to each line
|
||||
let new_text = text . "\\"
|
||||
|
||||
call setline(line, new_text)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
2
after/ftplugin/tex.lua
Normal file
2
after/ftplugin/tex.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
vim.o.textwidth = 120
|
||||
vim.o.wrap = true
|
||||
@@ -1,3 +0,0 @@
|
||||
set textwidth=79
|
||||
|
||||
set wrap
|
||||
@@ -85,7 +85,7 @@ function! s:custom_highlight() abort
|
||||
highlight FloatBorder guifg=LightGreen guibg=NONE
|
||||
|
||||
" highlight for matching parentheses
|
||||
highlight MatchParen cterm=bold,reverse,underline gui=bold,reverse,underline
|
||||
highlight MatchParen cterm=bold,underline gui=bold,underline
|
||||
endfunction
|
||||
|
||||
" highlight yanked region, see `:h lua-highlight`
|
||||
@@ -101,10 +101,22 @@ augroup END
|
||||
|
||||
" Quit Nvim if we have only one window, and its filetype match our pattern.
|
||||
function! s:quit_current_win() abort
|
||||
let quit_filetypes = ['qf', 'vista']
|
||||
let buftype = getbufvar(bufnr(), '&filetype')
|
||||
if winnr('$') == 1 && index(quit_filetypes, buftype) != -1
|
||||
quit
|
||||
let l:quit_filetypes = ['qf', 'vista', 'NvimTree']
|
||||
|
||||
let l:should_quit = v:true
|
||||
|
||||
let l:tabwins = nvim_tabpage_list_wins(0)
|
||||
for w in l:tabwins
|
||||
let l:buf = nvim_win_get_buf(w)
|
||||
let l:bf = getbufvar(l:buf, '&filetype')
|
||||
|
||||
if index(l:quit_filetypes, l:bf) == -1
|
||||
let l:should_quit = v:false
|
||||
endif
|
||||
endfor
|
||||
|
||||
if l:should_quit
|
||||
qall
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -118,3 +130,8 @@ augroup packer_auto_compile
|
||||
autocmd!
|
||||
autocmd BufWritePost */nvim/lua/plugins.lua source <afile> | PackerCompile
|
||||
augroup END
|
||||
|
||||
augroup auto_create_dir
|
||||
autocmd!
|
||||
autocmd BufWritePre * lua require('utils').may_create_dir()
|
||||
augroup END
|
||||
|
||||
@@ -7,9 +7,6 @@ let g:logging_level = 'info'
|
||||
"}}
|
||||
|
||||
"{{ Builtin variables
|
||||
" Disable Python2 support
|
||||
let g:loaded_python_provider = 0
|
||||
|
||||
" Disable perl provider
|
||||
let g:loaded_perl_provider = 0
|
||||
|
||||
@@ -41,13 +38,17 @@ let g:vimsyn_embed = 'l'
|
||||
|
||||
" Use English as main language
|
||||
language en_US.utf-8
|
||||
|
||||
" use filetype.lua instead of filetype.vim
|
||||
let g:do_filetype_lua = 1
|
||||
let g:did_load_filetypes = 0
|
||||
"}}
|
||||
|
||||
"{{ Disable loading certain plugins
|
||||
" Whether to load netrw by default, see
|
||||
" https://github.com/bling/dotvim/issues/4
|
||||
" let g:loaded_netrw = 0
|
||||
" let g:loaded_netrwPlugin = 0
|
||||
let g:loaded_netrw = 1
|
||||
let g:loaded_netrwPlugin = 1
|
||||
let g:netrw_liststyle = 3
|
||||
if g:is_win
|
||||
let g:netrw_http_cmd = 'curl --ssl-no-revoke -Lo'
|
||||
|
||||
@@ -12,6 +12,10 @@ call utils#Cabbrev('pud', 'PackerUpdate')
|
||||
call utils#Cabbrev('pc', 'PackerClean')
|
||||
call utils#Cabbrev('ps', 'PackerSync')
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" configurations for vim script plugin "
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
"""""""""""""""""""""""""UltiSnips settings"""""""""""""""""""
|
||||
" Trigger configuration. Do not use <tab> if you use YouCompleteMe
|
||||
let g:UltiSnipsExpandTrigger='<c-j>'
|
||||
@@ -27,13 +31,6 @@ let g:UltiSnipsJumpBackwardTrigger='<c-k>'
|
||||
" https://jdhao.github.io/2019/04/17/neovim_snippet_s1/ for details.
|
||||
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
|
||||
|
||||
"""""""""""""""""""""""""" semshi settings """""""""""""""""""""""""""""""
|
||||
" Do not highlight for all occurrences of variable under cursor
|
||||
let g:semshi#mark_selected_nodes=0
|
||||
|
||||
" Do not show error sign since linting plugin is specialized for that
|
||||
let g:semshi#error_sign=v:false
|
||||
|
||||
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
||||
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
|
||||
|
||||
@@ -59,7 +56,7 @@ if g:is_linux
|
||||
endif
|
||||
|
||||
" Only fuzzy-search files names
|
||||
let g:Lf_DefaultMode = 'NameOnly'
|
||||
let g:Lf_DefaultMode = 'FullPath'
|
||||
|
||||
" Popup window settings
|
||||
let w = float2nr(&columns * 0.8)
|
||||
@@ -96,11 +93,9 @@ nnoremap <silent> <leader>fg :<C-U>Leaderf rg --no-messages --popup<CR>
|
||||
|
||||
" Search vim help files
|
||||
nnoremap <silent> <leader>fh :<C-U>Leaderf help --popup<CR>
|
||||
nnoremap <silent> <leader>h :<C-U>echoerr "Use \<lt>leader>fh instead!"<CR>
|
||||
|
||||
" Search tags in current buffer
|
||||
nnoremap <silent> <leader>ft :<C-U>Leaderf bufTag --popup<CR>
|
||||
nnoremap <silent> <leader>t :<C-U>echoerr "Use \<lt>leader>ft instead!"<CR>
|
||||
|
||||
" Switch buffers
|
||||
nnoremap <silent> <leader>fb :<C-U>Leaderf buffer --popup<CR>
|
||||
@@ -387,21 +382,17 @@ endif
|
||||
nnoremap <leader>dp :<C-U>GdbStartPDB python -m pdb %<CR>
|
||||
|
||||
""""""""""""""""""""""""""""""wilder.nvim settings""""""""""""""""""""""""""""""
|
||||
augroup wilder_init
|
||||
autocmd!
|
||||
" CursorHold is suggested here: https: //github.com/gelguy/wilder.nvim/issues/89#issuecomment-934465957.
|
||||
autocmd CursorHold * ++once call s:wilder_init()
|
||||
augroup END
|
||||
call timer_start(250, { -> s:wilder_init() })
|
||||
|
||||
function! s:wilder_init() abort
|
||||
try
|
||||
call wilder#enable_cmdline_enter()
|
||||
set wildcharm=<Tab>
|
||||
cmap <expr> <Tab> wilder#in_context() ? wilder#next() : "\<Tab>"
|
||||
cmap <expr> <S-Tab> wilder#in_context() ? wilder#previous() : "\<S-Tab>"
|
||||
|
||||
" only / and ? are enabled by default
|
||||
call wilder#set_option('modes', ['/', '?', ':'])
|
||||
call wilder#setup({
|
||||
\ 'modes': [':', '/', '?'],
|
||||
\ 'next_key': '<Tab>',
|
||||
\ 'previous_key': '<S-Tab>',
|
||||
\ 'accept_key': '<C-y>',
|
||||
\ 'reject_key': '<C-e>'
|
||||
\ })
|
||||
|
||||
call wilder#set_option('pipeline', [
|
||||
\ wilder#branch(
|
||||
@@ -423,11 +414,12 @@ function! s:wilder_init() abort
|
||||
let l:hl = wilder#make_hl('WilderAccent', 'Pmenu', [{}, {}, {'foreground': '#f4468f'}])
|
||||
call wilder#set_option('renderer', wilder#popupmenu_renderer({
|
||||
\ 'highlighter': wilder#basic_highlighter(),
|
||||
\ 'winblend': 5,
|
||||
\ 'max_height': 15,
|
||||
\ 'highlights': {
|
||||
\ 'accent': l:hl,
|
||||
\ },
|
||||
\ 'left': [' ', wilder#popupmenu_devicons(),],
|
||||
\ 'right': [' ', wilder#popupmenu_scrollbar(),],
|
||||
\ 'apply_incsearch_fix': 0,
|
||||
\ }))
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
|
||||
@@ -85,7 +85,7 @@ if !s:status
|
||||
endif
|
||||
|
||||
execute 'call ' . s:colorscheme_func
|
||||
if g:logging_level == 'debug'
|
||||
let s:msg1 = "Currently loaded theme: " . s:theme
|
||||
if g:logging_level == 'info'
|
||||
let s:msg1 = "Colorscheme: " . s:theme
|
||||
call v:lua.vim.notify(s:msg1, 'info', {'title': 'nvim-config'})
|
||||
endif
|
||||
|
||||
158
docs/README.md
158
docs/README.md
@@ -1,20 +1,21 @@
|
||||
This doc summarizes how to install and use this configuration in detail.
|
||||
|
||||
# Pre-requisite
|
||||
|
||||
There are a few dependencies if we want to use Nvim for efficient editing and
|
||||
development work.
|
||||
There are a few dependencies if we want to use Nvim for efficient editing and development work.
|
||||
|
||||
## Python
|
||||
|
||||
A lot of Nvim plugins are mainly written in Python. To use auto-completion and
|
||||
other features, we must install Python 3. The easiest way to install is via
|
||||
[Anaconda](https://www.anaconda.com/distribution/#download-section) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html). Make sure that
|
||||
you can run `python --version`, and that the output should be Python 3.x.
|
||||
A lot of Nvim plugins are mainly written in Python, so we must install Python 3.
|
||||
The easiest way to install is via [Anaconda](https://docs.anaconda.com/anaconda/install/index.html) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html).
|
||||
|
||||
After installation, make sure that you can run `python --version`,
|
||||
and that the output should be Python 3.x.
|
||||
|
||||
## Pynvim
|
||||
|
||||
Nvim relies on [pynvim](https://github.com/neovim/pynvim) to communicate with
|
||||
plugins that utilize its Python binding. Pynvim is required by plugins such as
|
||||
[Semshi](https://github.com/numirias/semshi).
|
||||
Nvim relies on [pynvim](https://github.com/neovim/pynvim) to communicate with plugins that utilize its Python binding.
|
||||
Pynvim is required by plugins such as [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
||||
|
||||
```
|
||||
pip install -U pynvim
|
||||
@@ -22,16 +23,20 @@ pip install -U pynvim
|
||||
|
||||
## python-lsp-server
|
||||
|
||||
[python-lsp-server](https://github.com/python-lsp/python-lsp-server) is the community-fork of [pyls](https://github.com/palantir/python-language-server), and it is a Python Language Server for completion,
|
||||
linting, go to definition, etc.
|
||||
[python-lsp-server (pylsp)](https://github.com/python-lsp/python-lsp-server) is a Python [Language Server](https://microsoft.github.io/language-server-protocol/) for completion, linting, go to definition, etc.
|
||||
|
||||
```
|
||||
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
||||
```
|
||||
|
||||
Note the executable for pylsp is also named `pylsp`. You need to set its PATH correctly.
|
||||
If you use pip from Anaconda, the executable path may be something like `$CONDA_ROOT/bin/pylsp`.
|
||||
For native python, the path for pylsp may be like `$HOME/.local/bin/pylsp`
|
||||
|
||||
## Node
|
||||
|
||||
We need to install node.js from [here](https://nodejs.org/en/download/):
|
||||
We need to install node.js from [here](https://nodejs.org/en/download/).
|
||||
For Linux, you can use the following script:
|
||||
|
||||
```bash
|
||||
# Ref: https://johnpapa.net/node-and-npm-without-sudo/
|
||||
@@ -57,30 +62,29 @@ source ~/.bash_profile
|
||||
|
||||
## vim-language-server
|
||||
|
||||
[vim-language-server](https://github.com/iamcco/vim-language-server) provides
|
||||
completion for vim script. We can install vim-language-server globally and set
|
||||
its path:
|
||||
[vim-language-server](https://github.com/iamcco/vim-language-server) provides completion for vim script. We can install vim-language-server globally:
|
||||
|
||||
```bash
|
||||
npm install -g vim-language-server
|
||||
|
||||
export PATH="$HOME/.npm-packages/bin:$PATH"
|
||||
```
|
||||
|
||||
vim-language-server is installed in the same directory as the node executable.
|
||||
|
||||
## Git
|
||||
|
||||
Git is used by the plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) to clone plugins from GitHub or
|
||||
other Git repositories.
|
||||
Git is required by plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) and other git-related plugins.
|
||||
|
||||
Since Git is usually pre-installed on Linux and macOS, we do not need to worry
|
||||
if we are on these two platforms. For Windows, install [Git for Windows](https://git-scm.com/download/win)
|
||||
and make sure you can call `git` from the command line.
|
||||
For Linux and macOS, Git is usually pre-installed.
|
||||
The version of Git on the Linux system may be too old so that plugins may break.
|
||||
Check [here](https://jdhao.github.io/2021/03/27/upgrade_git_on_linux/) on how to install and set up the latest version of Git.
|
||||
For Windows, install [Git for Windows](https://git-scm.com/download/win) and make sure you can run `git` from command line.
|
||||
|
||||
## ctags
|
||||
|
||||
In order to use tags related plugins such as [vista.vim](https://github.com/liuchengxu/vista.vim), we need to
|
||||
install a ctags distribution. Universal-ctags is preferred.
|
||||
In order to use tags related plugins such as [vista.vim](https://github.com/liuchengxu/vista.vim), we need to install a ctags distribution.
|
||||
Universal-ctags is preferred.
|
||||
|
||||
To install it on Linux, we need to build it from source. See [here](https://askubuntu.com/a/836521/768311) for the details.
|
||||
To install ctags on macOS, use [Homebrew](https://github.com/universal-ctags/homebrew-universal-ctags):
|
||||
|
||||
```bash
|
||||
@@ -93,100 +97,97 @@ To install it Windows, use [chocolatey](https://chocolatey.org/) or [scoop](http
|
||||
choco install universal-ctags
|
||||
|
||||
# scoop bucket add extras
|
||||
# scoop install univeral-ctags
|
||||
# scoop install universal-ctags
|
||||
```
|
||||
|
||||
To install it on Linux, we need to build it from source. See [here](https://askubuntu.com/a/836521/768311)
|
||||
for the details.
|
||||
|
||||
Set its PATH properly and make sure you can call `ctags` from command line.
|
||||
Set its PATH properly and make sure you can run `ctags` from command line.
|
||||
|
||||
## Ripgrep
|
||||
|
||||
[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
|
||||
searching plugins.
|
||||
[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 searching plugins.
|
||||
|
||||
For Windows and macOS, we can install it via chocolatey and homebrew
|
||||
respectively. For Linux, we can download the executable file from its [release
|
||||
page](https://github.com/BurntSushi/ripgrep/releases) and install it.
|
||||
For Windows and macOS, we can install it via chocolatey and homebrew respectively.
|
||||
For Linux, we can download the [binary release](https://github.com/BurntSushi/ripgrep/releases) and install it.
|
||||
|
||||
Set its PATH properly and make sure you can run `rg` from command line.
|
||||
|
||||
## Linters
|
||||
|
||||
A linter is a tool to check the source code for possible style and syntax
|
||||
issues. Based on the programming languages we use, we may need to install
|
||||
various linters.
|
||||
A linter is a tool to check the source code for possible style and syntax issues.
|
||||
Based on the programming languages we use, we may need to install various linters.
|
||||
|
||||
+ Python: [pylint](https://github.com/PyCQA/pylint) and [flake8](https://github.com/PyCQA/flake8).
|
||||
+ Vim script: [vint](https://github.com/Kuniwak/vint).
|
||||
|
||||
Set their PATH properly and make sure you can run `pylint`, `flake8` and `vint` from command line.
|
||||
|
||||
## Terminal emulators
|
||||
|
||||
Which [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator) we
|
||||
choose to use greatly affects the appearance and functionalities of Nvim.
|
||||
Since Nvim supports true colors, terminals that support true colors are
|
||||
preferred. For a list of terminals that support true colors, see [here](https://github.com/termstandard/colors).
|
||||
Which [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator) we choose to use greatly affects the appearance and features of Nvim.
|
||||
Since Nvim supports true colors, terminals that support true colors are preferred.
|
||||
For a list of terminals that support true colors, see [here](https://github.com/termstandard/colors).
|
||||
|
||||
For macOS, we can use [kitty](https://sw.kovidgoyal.net/kitty/), [iterm2](https://www.iterm2.com/), or [Alacritty](https://github.com/jwilm/alacritty).
|
||||
If you connect to Linux server on Windows, I recommend [wsltty](https://github.com/mintty/wsltty) and
|
||||
[Cygwin](https://www.cygwin.com/), both of them use [mintty](https://github.com/mintty/mintty) as the terminal emulator.
|
||||
For macOS, we can use [kitty](https://sw.kovidgoyal.net/kitty/), [iterm2](https://www.iterm2.com/), [wezterm](https://wezfurlong.org/wezterm/) or [Alacritty](https://github.com/jwilm/alacritty).
|
||||
|
||||
For the latest version of Windows 10, you can also try the new [Windows
|
||||
Terminal](https://github.com/microsoft/terminal).
|
||||
If you ssh to Linux server on Windows, I recommend [wsltty](https://github.com/mintty/wsltty) and [Cygwin](https://www.cygwin.com/),
|
||||
both of them use [mintty](https://github.com/mintty/mintty) as the terminal emulator.
|
||||
For the latest version of Windows 10, you can also try [Windows Terminal](https://github.com/microsoft/terminal).
|
||||
|
||||
## Font
|
||||
## Patched Fonts
|
||||
|
||||
Since statusline or file explorer plugins often use Unicode symbols not
|
||||
available in normal font, we need to install a patched font from the [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) project.
|
||||
Since statusline or file explorer plugins often use Unicode symbols not available in normal font,
|
||||
we need to install a patched font from the [nerd-fonts](https://github.com/ryanoasis/nerd-fonts) project.
|
||||
|
||||
# Install Nvim
|
||||
|
||||
There are various ways to install Nvim depending on your system. Current
|
||||
configuration is tested against nvim v0.6.0.
|
||||
There are various ways to install Nvim depending on your system.
|
||||
Current configuration is tested against nvim v0.7.0.
|
||||
|
||||
## Linux
|
||||
|
||||
We can directly download the binary release from [here](https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-linux64.tar.gz).
|
||||
We can directly download the binary release from [here](https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz).
|
||||
You can also use the system package manager to install nvim,
|
||||
but that is not reliable since latest version may not be available.
|
||||
|
||||
## Windows
|
||||
|
||||
The easiest way to install Nvim on Windows is via chocolatey:
|
||||
You may download from [nvim release](https://github.com/neovim/neovim/releases/download/stable/nvim-win64.zip) from GitHub and manually extract it.
|
||||
|
||||
Another way to install Nvim on Windows is via chocolatey or scoop:
|
||||
|
||||
```
|
||||
choco install neovim
|
||||
```
|
||||
|
||||
You may download from [nvim release](https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-win64.zip) from GitHub and manually extract it.
|
||||
# via scoop
|
||||
# scoop bucket add versions
|
||||
# scoop install neovim
|
||||
```
|
||||
|
||||
## macOS
|
||||
|
||||
It is recommended to install neovim via [Homebrew](https://brew.sh/) on macOS.
|
||||
Simply run the following command:
|
||||
It is recommended to install neovim via [Homebrew](https://brew.sh/) on macOS. Simply run the following command:
|
||||
|
||||
```bash
|
||||
brew install neovim
|
||||
```
|
||||
|
||||
After installing Nvim, we need to add the directory where the Nvim executable
|
||||
(`nvim` on Linux and macOS, `nvim.exe` on Windows) resides to the system `PATH`.
|
||||
|
||||
Make sure that you can call `nvim` from the command line after all these
|
||||
setups.
|
||||
After installing Nvim, we need to set the path to nvim correctly.
|
||||
Make sure that you can run `nvim` from the command line after all these setups.
|
||||
|
||||
# Setting up Nvim
|
||||
|
||||
## Install plugin manager packer.nvim
|
||||
|
||||
I use packer.nvim to manage my plugins. We need to install packer.nvim on our
|
||||
system first.
|
||||
I use packer.nvim to manage my 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, run the following command (on PowerShell):
|
||||
|
||||
```
|
||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim "$env:LOCALAPPDATA\nvim-data\site\pack\packer\opt\packer.nvim"
|
||||
```
|
||||
|
||||
For macOS and Linux, use the following command:
|
||||
For macOS and Linux, run the following command:
|
||||
|
||||
```bash
|
||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
||||
@@ -194,30 +195,27 @@ git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvi
|
||||
|
||||
## How to install this configuration
|
||||
|
||||
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1]. On Linux
|
||||
and macOS, the directory is `~/.config/nvim`. First, we need to remove all the
|
||||
files under the config directory (including dot files), then go to this
|
||||
directory, and run the following command to install this configuration:
|
||||
On Linux and macOS, the directory is `~/.config/nvim`.
|
||||
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1].
|
||||
First, we need to remove all the files under the config directory (including dot files),
|
||||
then go to this directory, and run the following command:
|
||||
|
||||
```
|
||||
git clone --depth=1 https://github.com/jdhao/nvim-config.git .
|
||||
```
|
||||
|
||||
After that, when we first open nvim, run command `:PackerSync` to install all
|
||||
the plugins and generate `packer_compiled.lua`. Since I use quite a lot of
|
||||
plugins (more than 60), it may take some time to install all of them, depending
|
||||
on your network condition.
|
||||
After that, when we first open nvim, run command `:PackerSync` to install all the plugins.
|
||||
Since I use quite a lot of plugins (more than 60), it may take some time to install all of them.
|
||||
|
||||
# Automatic installation
|
||||
|
||||
## Automatic Installation for Linux #
|
||||
|
||||
To set up a workable Nvim environment on Linux, I use [this bash script](nvim_setup_linux.sh) to automatically install necessary
|
||||
dependencies, Nvim itself and Nvim configs in this repo.
|
||||
To set up a workable Nvim environment on Linux,
|
||||
I use [a bash script](nvim_setup_linux.sh) to automatically install necessary dependencies, Nvim itself and configs.
|
||||
|
||||
Note that the variable `PYTHON_INSTALLED`, `SYSTEM_PYTHON` and
|
||||
`ADD_TO_SYSTEM_PATH` in the script should be set properly based on your
|
||||
environment.
|
||||
Note that the variable `PYTHON_INSTALLED`, `SYSTEM_PYTHON` and `ADD_TO_SYSTEM_PATH` in the script
|
||||
should be set properly based on your environment.
|
||||
|
||||
## Automatic installation for Windows
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
wget https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-macos.tar.gz
|
||||
wget https://github.com/neovim/neovim/releases/download/stable/nvim-macos.tar.gz
|
||||
|
||||
if [[ ! -d "$HOME/tools/" ]]; then
|
||||
mkdir -p "$HOME/tools"
|
||||
|
||||
@@ -34,11 +34,11 @@ fi
|
||||
if [[ "$INSTALL_ANACONDA" = true ]]; then
|
||||
CONDA_DIR=$HOME/tools/anaconda
|
||||
CONDA_NAME=Anaconda.sh
|
||||
CONDA_LINK="https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.05-Linux-x86_64.sh"
|
||||
CONDA_LINK="https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.11-Linux-x86_64.sh"
|
||||
else
|
||||
CONDA_DIR=$HOME/tools/miniconda
|
||||
CONDA_NAME=Miniconda.sh
|
||||
CONDA_LINK="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh"
|
||||
CONDA_LINK="https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh"
|
||||
fi
|
||||
|
||||
if [[ ! "$PYTHON_INSTALLED" = true ]]; then
|
||||
@@ -87,21 +87,21 @@ else
|
||||
fi
|
||||
|
||||
#######################################################################
|
||||
# Install node and vim-language-server #
|
||||
# Install node and js-based language server #
|
||||
#######################################################################
|
||||
NODE_DIR=$HOME/tools/nodejs
|
||||
NODE_SRC_NAME=$HOME/packages/nodejs.tar.gz
|
||||
# when download speed is slow, we can also use its mirror site: https://mirrors.ustc.edu.cn/node/v15.0.0/
|
||||
NODE_LINK="https://mirrors.ustc.edu.cn/node/v15.0.0/node-v15.0.0-linux-x64.tar.xz"
|
||||
if [[ -z "$(command -v node)" ]]; then
|
||||
echo "Install Nodejs"
|
||||
echo "Install Node.js"
|
||||
if [[ ! -f $NODE_SRC_NAME ]]; then
|
||||
echo "Downloading nodejs and renaming"
|
||||
echo "Downloading Node.js and renaming"
|
||||
wget $NODE_LINK -O "$NODE_SRC_NAME"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$NODE_DIR" ]]; then
|
||||
echo "Creating nodejs directory under tools directory"
|
||||
echo "Creating Node.js directory under tools directory"
|
||||
mkdir -p "$NODE_DIR"
|
||||
echo "Extracting to $HOME/tools/nodejs directory"
|
||||
tar xvf "$NODE_SRC_NAME" -C "$NODE_DIR" --strip-components 1
|
||||
@@ -111,18 +111,21 @@ if [[ -z "$(command -v node)" ]]; then
|
||||
echo "export PATH=\"$NODE_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
|
||||
fi
|
||||
else
|
||||
echo "Nodejs is already installed. Skip installing it."
|
||||
echo "Node.js is already installed. Skip installing it."
|
||||
fi
|
||||
|
||||
# Install vim-language-server
|
||||
"$NODE_DIR/bin/npm" install -g vim-language-server
|
||||
|
||||
# Install bash-language-server
|
||||
"$NODE_DIR/bin/npm" install -g bash-language-server
|
||||
|
||||
#######################################################################
|
||||
# Ripgrep part #
|
||||
#######################################################################
|
||||
RIPGREP_DIR=$HOME/tools/ripgrep
|
||||
RIPGREP_SRC_NAME=$HOME/packages/ripgrep.tar.gz
|
||||
RIPGREP_LINK="https://hub.fastgit.org/BurntSushi/ripgrep/releases/download/12.0.0/ripgrep-12.0.0-x86_64-unknown-linux-musl.tar.gz"
|
||||
RIPGREP_LINK="https://github.com/BurntSushi/ripgrep/releases/download/12.0.0/ripgrep-12.0.0-x86_64-unknown-linux-musl.tar.gz"
|
||||
if [[ -z "$(command -v rg)" ]] && [[ ! -f "$RIPGREP_DIR/rg" ]]; then
|
||||
echo "Install ripgrep"
|
||||
if [[ ! -f $RIPGREP_SRC_NAME ]]; then
|
||||
@@ -160,7 +163,7 @@ fi
|
||||
#######################################################################
|
||||
CTAGS_SRC_DIR=$HOME/packages/ctags
|
||||
CTAGS_DIR=$HOME/tools/ctags
|
||||
CTAGS_LINK="https://hub.fastgit.org/universal-ctags/ctags.git"
|
||||
CTAGS_LINK="https://github.com/universal-ctags/ctags.git"
|
||||
if [[ ! -f "$CTAGS_DIR/bin/ctags" ]]; then
|
||||
echo "Install ctags"
|
||||
|
||||
@@ -188,7 +191,7 @@ fi
|
||||
NVIM_DIR=$HOME/tools/nvim
|
||||
NVIM_SRC_NAME=$HOME/packages/nvim-linux64.tar.gz
|
||||
NVIM_CONFIG_DIR=$HOME/.config/nvim
|
||||
NVIM_LINK="https://github.com/neovim/neovim/releases/download/v0.6.0/nvim-linux64.tar.gz"
|
||||
NVIM_LINK="https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz"
|
||||
if [[ ! -f "$NVIM_DIR/bin/nvim" ]]; then
|
||||
echo "Installing Nvim"
|
||||
echo "Creating nvim directory under tools directory"
|
||||
@@ -216,10 +219,10 @@ if [[ -d "$NVIM_CONFIG_DIR" ]]; then
|
||||
mv "$NVIM_CONFIG_DIR" "$NVIM_CONFIG_DIR.backup"
|
||||
fi
|
||||
|
||||
git clone --depth=1 https://hub.fastgit.org/jdhao/nvim-config.git "$NVIM_CONFIG_DIR"
|
||||
git clone --depth=1 https://github.com/jdhao/nvim-config.git "$NVIM_CONFIG_DIR"
|
||||
|
||||
echo "Installing packer.nvim"
|
||||
git clone --depth=1 https://hub.fastgit.org/wbthomason/packer.nvim \
|
||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim \
|
||||
~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
||||
|
||||
echo "Installing nvim plugins, please wait"
|
||||
|
||||
@@ -15,6 +15,9 @@ scoop install universal-ctags
|
||||
# Install vim-language-server
|
||||
npm install -g vim-language-server
|
||||
|
||||
# Install bash-language-server
|
||||
npm install -g bash-language-server
|
||||
|
||||
# Install miniconda3
|
||||
scoop install miniconda3
|
||||
|
||||
@@ -26,4 +29,4 @@ pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
||||
|
||||
# Install neovim nightly
|
||||
scoop bucket add versions
|
||||
scoop install neovim-nightly
|
||||
scoop install neovim
|
||||
|
||||
@@ -3,6 +3,9 @@ inoremap <silent> <S-Insert> <C-R>+
|
||||
cnoremap <S-Insert> <C-R>+
|
||||
nnoremap <silent> <C-6> <C-^>
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" config for nvim-qt "
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" To check if neovim-qt is running, use `exists('g:GuiLoaded')`,
|
||||
" see https://github.com/equalsraf/neovim-qt/issues/219
|
||||
if exists('g:GuiLoaded')
|
||||
@@ -13,6 +16,9 @@ if exists('g:GuiLoaded')
|
||||
GuiFont! Hack\ NF:h10:l
|
||||
endif
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" config for fvim "
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
if exists('g:fvim_loaded')
|
||||
set termguicolors
|
||||
colorscheme gruvbox8_hard
|
||||
|
||||
16
init.vim
16
init.vim
@@ -1,14 +1,14 @@
|
||||
" Description: This is my personal Nvim configuration supporting Mac, Linux
|
||||
" and Windows, with various plugins configured. This configuration evolves as
|
||||
" I learn more about Nvim and becomes more proficient in using Nvim. Since it
|
||||
" is very long (more than 1000 lines!), you should read it carefully and take
|
||||
" only the settings and options that suits you. I would not recommend cloning
|
||||
" this repo and replace your own config. Good configurations are personal,
|
||||
" This is my personal Nvim configuration supporting Mac, Linux and Windows, with various plugins configured.
|
||||
" This configuration evolves as I learn more about Nvim and become more proficient in using Nvim.
|
||||
" Since it is very long (more than 1000 lines!), you should read it carefully and take only the settings that suit you.
|
||||
" I would not recommend cloning this repo and replace your own config. Good configurations are personal,
|
||||
" built over time with a lot of polish.
|
||||
"
|
||||
" Author: Jie-dong Hao
|
||||
" Email: jdhao@hotmail.com
|
||||
" Blog: https://jdhao.github.io/
|
||||
|
||||
let g:config_files = [
|
||||
let s:core_conf_files = [
|
||||
\ 'globals.vim',
|
||||
\ 'options.vim',
|
||||
\ 'autocommands.vim',
|
||||
@@ -17,6 +17,6 @@ let g:config_files = [
|
||||
\ 'themes.vim'
|
||||
\ ]
|
||||
|
||||
for s:fname in g:config_files
|
||||
for s:fname in s:core_conf_files
|
||||
execute printf('source %s/core/%s', stdpath('config'), s:fname)
|
||||
endfor
|
||||
|
||||
@@ -18,6 +18,7 @@ dashboard.section.buttons.val = {
|
||||
dashboard.button( "Leader f f", " > Find file", ":Leaderf file --popup<CR>"),
|
||||
dashboard.button( "Leader f r", " > Recent files" , ":Leaderf mru --popup<CR>"),
|
||||
dashboard.button( "Leader f g", " > Project grep" , ":Leaderf rg --popup<CR>"),
|
||||
dashboard.button( "u", " > Update plugins" , ":PackerSync<CR>"),
|
||||
dashboard.button( "e", " > New file" , ":enew <CR>"),
|
||||
dashboard.button( "q", " > Quit NVIM", ":qa<CR>"),
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
local api = vim.api
|
||||
local lsp = vim.lsp
|
||||
|
||||
local utils = require("utils")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.show_line_diagnostics()
|
||||
@@ -15,25 +17,21 @@ function M.show_line_diagnostics()
|
||||
end
|
||||
|
||||
local custom_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_set_keymap("n", "<C-]>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.diagnostic.setqflist({open = true})<CR>", opts)
|
||||
buf_set_keymap("n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
local opts = { silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "<C-]>", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, opts)
|
||||
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts)
|
||||
|
||||
vim.cmd([[
|
||||
autocmd CursorHold <buffer> lua require('config.lsp').show_line_diagnostics()
|
||||
@@ -41,10 +39,10 @@ local custom_attach = function(client, bufnr)
|
||||
|
||||
-- Set some key bindings conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting_sync()<CR>", opts)
|
||||
vim.keymap.set("n", "<space>f", vim.lsp.buf.formatting_sync, opts)
|
||||
end
|
||||
if client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("x", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR><ESC>", opts)
|
||||
vim.keymap.set("x", "<space>f", vim.lsp.buf.range_formatting, opts)
|
||||
end
|
||||
|
||||
-- The blow command will highlight the current variable and its usages in the buffer.
|
||||
@@ -67,53 +65,78 @@ local custom_attach = function(client, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(lsp.protocol.make_client_capabilities())
|
||||
local capabilities = lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.pylsp.setup({
|
||||
on_attach = custom_attach,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pylint = { enabled = true, executable = "pylint" },
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
jedi_completion = { fuzzy = true },
|
||||
pyls_isort = { enabled = true },
|
||||
pylsp_mypy = { enabled = true },
|
||||
if utils.executable('pylsp') then
|
||||
lspconfig.pylsp.setup({
|
||||
on_attach = custom_attach,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pylint = { enabled = true, executable = "pylint" },
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
jedi_completion = { fuzzy = true },
|
||||
pyls_isort = { enabled = true },
|
||||
pylsp_mypy = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
flags = {
|
||||
debounce_text_changes = 200,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
flags = {
|
||||
debounce_text_changes = 200,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
else
|
||||
vim.notify("pylsp not found!", 'warn', {title = 'Nvim-config'})
|
||||
end
|
||||
|
||||
-- lspconfig.pyright.setup{
|
||||
-- on_attach = custom_attach,
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- if utils.executable('pyright') then
|
||||
-- lspconfig.pyright.setup{
|
||||
-- on_attach = custom_attach,
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- else
|
||||
-- vim.notify("pyright not found!", 'warn', {title = 'Nvim-config'})
|
||||
-- end
|
||||
|
||||
lspconfig.clangd.setup({
|
||||
on_attach = custom_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = { "c", "cpp", "cc" },
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
})
|
||||
if utils.executable('clangd') then
|
||||
lspconfig.clangd.setup({
|
||||
on_attach = custom_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = { "c", "cpp", "cc" },
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
})
|
||||
else
|
||||
vim.notify("clangd not found!", 'warn', {title = 'Nvim-config'})
|
||||
end
|
||||
|
||||
-- set up vim-language-server
|
||||
lspconfig.vimls.setup({
|
||||
on_attach = custom_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
if utils.executable('vim-language-server') then
|
||||
lspconfig.vimls.setup({
|
||||
on_attach = custom_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 500,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
})
|
||||
else
|
||||
vim.notify("vim-language-server not found!", 'warn', {title = 'Nvim-config'})
|
||||
end
|
||||
|
||||
-- set up bash-language-server
|
||||
if utils.executable('bash-language-server') then
|
||||
lspconfig.bashls.setup({
|
||||
on_attach = custom_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
|
||||
local sumneko_binary_path = vim.fn.exepath("lua-language-server")
|
||||
if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then
|
||||
@@ -123,7 +146,7 @@ if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
|
||||
require("lspconfig").sumneko_lua.setup({
|
||||
lspconfig.sumneko_lua.setup({
|
||||
on_attach = custom_attach,
|
||||
cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/main.lua" },
|
||||
settings = {
|
||||
|
||||
@@ -9,54 +9,76 @@ cmp.setup({
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<S-Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<Esc>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<S-Tab>'] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Esc>'] = cmp.mapping.close(),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
||||
{ name = 'ultisnips' }, -- For ultisnips user.
|
||||
{ name = 'nvim_lua' }, -- for nvim lua function
|
||||
{ name = 'path' }, -- for path completion
|
||||
{ name = 'buffer', keyword_length = 4 }, -- for buffer word completion
|
||||
{ name = 'omni' },
|
||||
{ name = 'emoji', insert = true, } -- emoji completion
|
||||
},
|
||||
completion = {
|
||||
keyword_length = 1,
|
||||
completeopt = "menu,noselect"
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false
|
||||
view = {
|
||||
entries = 'custom',
|
||||
},
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
with_text = false,
|
||||
menu = {
|
||||
mode = "symbol_text",
|
||||
menu = ({
|
||||
nvim_lsp = "[LSP]",
|
||||
ultisnips = "[US]",
|
||||
nvim_lua = "[Lua]",
|
||||
path = "[Path]",
|
||||
buffer = "[Buffer]",
|
||||
emoji = "[Emoji]",
|
||||
},
|
||||
omni = "[Omni]",
|
||||
}),
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd("hi link CmpItemMenu Comment")
|
||||
-- see https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-visual-studio-code-dark-theme-colors-to-the-menu
|
||||
vim.cmd[[
|
||||
highlight! link CmpItemMenu Comment
|
||||
" gray
|
||||
highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080
|
||||
" blue
|
||||
highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6
|
||||
highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6
|
||||
" light blue
|
||||
highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE
|
||||
highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE
|
||||
highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE
|
||||
" pink
|
||||
highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0
|
||||
highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0
|
||||
" front
|
||||
highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4
|
||||
highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4
|
||||
highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4
|
||||
]]
|
||||
|
||||
62
lua/config/nvim-tree.lua
Normal file
62
lua/config/nvim-tree.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local nvim_tree = require("nvim-tree")
|
||||
|
||||
nvim_tree.setup({
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
update_to_buf_dir = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
},
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = false,
|
||||
update_cwd = false,
|
||||
ignore_list = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {},
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 35,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = "left",
|
||||
auto_resize = true,
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {},
|
||||
},
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "yes",
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<space>s", "<cmd>lua require'nvim-tree'.toggle(false, true)<CR>", { noremap = true, silent = true })
|
||||
@@ -5,6 +5,7 @@ vim.cmd[[ hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ff
|
||||
require('hop').setup({
|
||||
case_insensitive = true,
|
||||
char2_fallback_key = '<CR>',
|
||||
quit_key='<Esc>',
|
||||
})
|
||||
|
||||
vim.api.nvim_set_keymap('n', 'f', "<cmd>lua require'hop'.hint_char2()<cr>", {noremap = true})
|
||||
|
||||
@@ -119,6 +119,6 @@ require("lualine").setup({
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {'quickfix', 'fugitive'},
|
||||
extensions = {'quickfix', 'fugitive', 'nvim-tree'},
|
||||
})
|
||||
|
||||
|
||||
@@ -4,14 +4,7 @@ local fn = vim.fn
|
||||
vim.g.package_home = fn.stdpath("data") .. "/site/pack/packer/"
|
||||
local packer_install_dir = vim.g.package_home .. "/opt/packer.nvim"
|
||||
|
||||
local plug_url_format = ""
|
||||
if vim.g.is_linux then
|
||||
plug_url_format = "https://hub.fastgit.org/%s"
|
||||
else
|
||||
plug_url_format = "https://github.com/%s"
|
||||
end
|
||||
|
||||
local packer_repo = string.format(plug_url_format, "wbthomason/packer.nvim")
|
||||
local packer_repo = "https://github.com/wbthomason/packer.nvim"
|
||||
local install_cmd = string.format("10split |term git clone --depth=1 %s %s", packer_repo, packer_install_dir)
|
||||
|
||||
-- Auto-install packer in case it hasn't been installed.
|
||||
@@ -31,7 +24,7 @@ require("packer").startup({
|
||||
|
||||
use({"wbthomason/packer.nvim", opt = true})
|
||||
|
||||
use {"onsails/lspkind-nvim", event = "BufEnter"}
|
||||
use({"onsails/lspkind-nvim", event = "VimEnter"})
|
||||
-- auto-completion engine
|
||||
use {"hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]]}
|
||||
|
||||
@@ -40,6 +33,8 @@ require("packer").startup({
|
||||
use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
|
||||
use {"hrsh7th/cmp-path", after = "nvim-cmp"}
|
||||
use {"hrsh7th/cmp-buffer", after = "nvim-cmp"}
|
||||
use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
|
||||
|
||||
-- use {"hrsh7th/cmp-cmdline", after = "nvim-cmp"}
|
||||
use {"quangnguyen30192/cmp-nvim-ultisnips", after = {'nvim-cmp', 'ultisnips'}}
|
||||
if vim.g.is_mac then
|
||||
@@ -233,7 +228,9 @@ require("packer").startup({
|
||||
-- Better git log display
|
||||
use({ "rbong/vim-flog", requires = "tpope/vim-fugitive", cmd = { "Flog" } })
|
||||
|
||||
use({ "kevinhwang91/nvim-bqf", event = "FileType qf", config = [[require('config.bqf')]] })
|
||||
use({ "christoomey/vim-conflicted", requires = "tpope/vim-fugitive", cmd = {"Conflicted"}})
|
||||
|
||||
use({ "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] })
|
||||
|
||||
-- Better git commit experience
|
||||
use({"rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]]})
|
||||
@@ -352,13 +349,17 @@ require("packer").startup({
|
||||
|
||||
-- show and trim trailing whitespaces
|
||||
use {'jdhao/whitespace.nvim', event = 'VimEnter'}
|
||||
|
||||
-- file explorer
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = { 'kyazdani42/nvim-web-devicons' },
|
||||
config = [[require('config.nvim-tree')]]
|
||||
}
|
||||
end,
|
||||
config = {
|
||||
max_jobs = 16,
|
||||
compile_path = util.join_paths(vim.fn.stdpath('config'), 'lua', 'packer_compiled.lua'),
|
||||
git = {
|
||||
default_url_format = plug_url_format,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -14,4 +14,14 @@ function M.executable(name)
|
||||
return false
|
||||
end
|
||||
|
||||
function M.may_create_dir()
|
||||
local fpath = vim.fn.expand('<afile>')
|
||||
local parent_dir = vim.fn.fnamemodify(fpath, ":p:h")
|
||||
local res = vim.fn.isdirectory(parent_dir)
|
||||
|
||||
if res == 0 then
|
||||
vim.fn.mkdir(parent_dir, 'p')
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -8,6 +8,7 @@ snippet bare "barebone code template"
|
||||
#include <unordered_set>
|
||||
#include <stack>
|
||||
#include <queue>
|
||||
#include <numeric>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
@@ -70,3 +70,99 @@ endsnippet
|
||||
snippet yh "直角引号" w
|
||||
「$1」
|
||||
endsnippet
|
||||
|
||||
snippet info "info box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.info-msg {
|
||||
color: #059;
|
||||
background-color: #BEF;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="info-msg">
|
||||
<i class="fa fa-info-circle"> Info</i></br>
|
||||
${1:info text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet warn "warning box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.warning-msg {
|
||||
color: #9F6000;
|
||||
background-color: #FEEFB3;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="warning-msg">
|
||||
<i class="fa fa-warning"> Warning</i></br>
|
||||
${1:warning text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet error "error box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.error-msg {
|
||||
color: #D8000C;
|
||||
background-color: #FFBABA;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="error-msg">
|
||||
<i class="fa fa-times-circle"> Error</i></br>
|
||||
${1:error text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet success "success box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.success-msg {
|
||||
color: #270;
|
||||
background-color: #DFF2BF;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="success-msg">
|
||||
<i class="fa fa-check"></i>
|
||||
${1:success text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet td "too long do not read" bw
|
||||
tl;dr: $1
|
||||
endsnippet
|
||||
|
||||
6
my_snippets/snippets.snippets
Normal file
6
my_snippets/snippets.snippets
Normal file
@@ -0,0 +1,6 @@
|
||||
# copied from https://github.com/honza/vim-snippets/blob/master/UltiSnips/snippets.snippets
|
||||
snippet snip "Ultisnips snippet definition" b
|
||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
||||
${0:${VISUAL}}
|
||||
`!p snip.rv = "endsnippet"`
|
||||
endsnippet
|
||||
@@ -1,3 +1,9 @@
|
||||
snippet frac "Math fractions"
|
||||
\frac{${1:NUM}}{${2:DEN}} $0
|
||||
snippet use "usepackage" b
|
||||
\usepackage{${1:package}}
|
||||
endsnippet
|
||||
|
||||
snippet eqa "equation enviroment" b
|
||||
\begin{equation}\label{$1}
|
||||
$2
|
||||
\end{equation}
|
||||
endsnippet
|
||||
|
||||
119
plugin/log-autocmds.vim
Normal file
119
plugin/log-autocmds.vim
Normal file
@@ -0,0 +1,119 @@
|
||||
command! LogAutocmds call s:log_autocmds_toggle()
|
||||
|
||||
function! s:log_autocmds_toggle()
|
||||
augroup LogAutocmd
|
||||
autocmd!
|
||||
augroup END
|
||||
|
||||
let l:date = strftime('%F', localtime())
|
||||
let s:activate = get(s:, 'activate', 0) ? 0 : 1
|
||||
if !s:activate
|
||||
call s:log('Stopped autocmd log (' . l:date . ')')
|
||||
return
|
||||
endif
|
||||
|
||||
call s:log('Started autocmd log (' . l:date . ')')
|
||||
augroup LogAutocmd
|
||||
for l:au in s:aulist
|
||||
silent execute 'autocmd' l:au '* call s:log(''' . l:au . ''')'
|
||||
endfor
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
function! s:log(message)
|
||||
silent execute '!echo "'
|
||||
\ . strftime('%T', localtime()) . ' - ' . a:message . '"'
|
||||
\ '>> /tmp/vim_log_autocommands'
|
||||
endfunction
|
||||
|
||||
" These are deliberately left out due to side effects
|
||||
" - SourceCmd
|
||||
" - FileAppendCmd
|
||||
" - FileWriteCmd
|
||||
" - BufWriteCmd
|
||||
" - FileReadCmd
|
||||
" - BufReadCmd
|
||||
" - FuncUndefined
|
||||
|
||||
let s:aulist = [
|
||||
\ 'BufNewFile',
|
||||
\ 'BufReadPre',
|
||||
\ 'BufRead',
|
||||
\ 'BufReadPost',
|
||||
\ 'FileReadPre',
|
||||
\ 'FileReadPost',
|
||||
\ 'FilterReadPre',
|
||||
\ 'FilterReadPost',
|
||||
\ 'StdinReadPre',
|
||||
\ 'StdinReadPost',
|
||||
\ 'BufWrite',
|
||||
\ 'BufWritePre',
|
||||
\ 'BufWritePost',
|
||||
\ 'FileWritePre',
|
||||
\ 'FileWritePost',
|
||||
\ 'FileAppendPre',
|
||||
\ 'FileAppendPost',
|
||||
\ 'FilterWritePre',
|
||||
\ 'FilterWritePost',
|
||||
\ 'BufAdd',
|
||||
\ 'BufCreate',
|
||||
\ 'BufDelete',
|
||||
\ 'BufWipeout',
|
||||
\ 'BufFilePre',
|
||||
\ 'BufFilePost',
|
||||
\ 'BufEnter',
|
||||
\ 'BufLeave',
|
||||
\ 'BufWinEnter',
|
||||
\ 'BufWinLeave',
|
||||
\ 'BufUnload',
|
||||
\ 'BufHidden',
|
||||
\ 'BufNew',
|
||||
\ 'SwapExists',
|
||||
\ 'FileType',
|
||||
\ 'Syntax',
|
||||
\ 'EncodingChanged',
|
||||
\ 'TermChanged',
|
||||
\ 'VimEnter',
|
||||
\ 'GUIEnter',
|
||||
\ 'GUIFailed',
|
||||
\ 'TermResponse',
|
||||
\ 'QuitPre',
|
||||
\ 'VimLeavePre',
|
||||
\ 'VimLeave',
|
||||
\ 'FileChangedShell',
|
||||
\ 'FileChangedShellPost',
|
||||
\ 'FileChangedRO',
|
||||
\ 'ShellCmdPost',
|
||||
\ 'ShellFilterPost',
|
||||
\ 'CmdUndefined',
|
||||
\ 'SpellFileMissing',
|
||||
\ 'SourcePre',
|
||||
\ 'VimResized',
|
||||
\ 'FocusGained',
|
||||
\ 'FocusLost',
|
||||
\ 'CursorHold',
|
||||
\ 'CursorHoldI',
|
||||
\ 'CursorMoved',
|
||||
\ 'CursorMovedI',
|
||||
\ 'WinEnter',
|
||||
\ 'WinLeave',
|
||||
\ 'TabEnter',
|
||||
\ 'TabLeave',
|
||||
\ 'CmdwinEnter',
|
||||
\ 'CmdwinLeave',
|
||||
\ 'InsertEnter',
|
||||
\ 'InsertChange',
|
||||
\ 'InsertLeave',
|
||||
\ 'InsertCharPre',
|
||||
\ 'TextChanged',
|
||||
\ 'TextChangedI',
|
||||
\ 'ColorScheme',
|
||||
\ 'RemoteReply',
|
||||
\ 'QuickFixCmdPre',
|
||||
\ 'QuickFixCmdPost',
|
||||
\ 'SessionLoadPost',
|
||||
\ 'MenuPopup',
|
||||
\ 'CompleteDone',
|
||||
\ 'User',
|
||||
\ ]
|
||||
|
||||
@@ -355,3 +355,63 @@ Keymap
|
||||
iCloud
|
||||
keyframe
|
||||
maskRCNN
|
||||
vundle
|
||||
ycm
|
||||
ftplugin
|
||||
vim9
|
||||
dotfile
|
||||
magit
|
||||
xelatex
|
||||
subarray
|
||||
fvim
|
||||
CUDA
|
||||
cuda
|
||||
cpu
|
||||
jdhao
|
||||
whitelisted
|
||||
BST
|
||||
autocmd
|
||||
init
|
||||
miniconda
|
||||
tsinghua
|
||||
pylsp
|
||||
mypy
|
||||
isort
|
||||
ustc
|
||||
PyTorch
|
||||
maxcdn
|
||||
torchvision
|
||||
FFmpeg
|
||||
pyav
|
||||
wezterm
|
||||
frac
|
||||
argmax
|
||||
NeruIPS
|
||||
InfoNCE
|
||||
LSTM
|
||||
linkedin
|
||||
hotmail
|
||||
datetime
|
||||
csv
|
||||
iterable
|
||||
dataframe
|
||||
CRNN
|
||||
ICPR
|
||||
matplotlib
|
||||
scikit
|
||||
NumPy
|
||||
cudnn
|
||||
SGD
|
||||
ImageNet
|
||||
ReLU
|
||||
CIFAR
|
||||
ResNet
|
||||
XGBoost
|
||||
Shenzhen
|
||||
Tanh
|
||||
Kaggle
|
||||
minist
|
||||
src
|
||||
RGBA
|
||||
yapf
|
||||
Vimming
|
||||
|
||||
Reference in New Issue
Block a user