mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
274 Commits
v0.5.1
...
86e3b29730
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86e3b29730 | ||
|
|
bc9b0a8cf8 | ||
|
|
fb9a0bb2dd | ||
|
|
59525c5577 | ||
|
|
6539e72a5d | ||
|
|
b279c0cd95 | ||
|
|
96129335ad | ||
|
|
b6fa0b7aa5 | ||
|
|
dff469ddc4 | ||
|
|
6d5cda0f97 | ||
|
|
4d35362e83 | ||
|
|
e57e747b26 | ||
|
|
c3f8d75ece | ||
|
|
78baf8d015 | ||
|
|
9d8a58be17 | ||
|
|
2372d9159f | ||
|
|
e9a3d16260 | ||
|
|
fdf8236fc2 | ||
|
|
085c8017d8 | ||
|
|
efa7b215e7 | ||
|
|
e68c687f23 | ||
|
|
497f93d6c7 | ||
|
|
cfe2e0611d | ||
|
|
9de08d0afe | ||
|
|
d5b7584e68 | ||
|
|
64a7a23309 | ||
|
|
c1efc0bad6 | ||
|
|
b3b69f21f4 | ||
|
|
f491e26676 | ||
|
|
e7e4892c22 | ||
|
|
a52a362b02 | ||
|
|
2880d7bce3 | ||
|
|
7e6dd23d37 | ||
|
|
fcbd7d3a0d | ||
|
|
97f302084f | ||
|
|
9d29544d72 | ||
|
|
cad9f5a214 | ||
|
|
ecde08941b | ||
|
|
ab88c112ff | ||
|
|
4c96243a4c | ||
|
|
fdc158272b | ||
|
|
b331cddc73 | ||
|
|
b11c57e36f | ||
|
|
84d73660fa | ||
|
|
a9cc10b2ef | ||
|
|
cad6112cc2 | ||
|
|
4d7fd6580a | ||
|
|
f492a94db6 | ||
|
|
0c92d9a018 | ||
|
|
369687b047 | ||
|
|
54908dfe9f | ||
|
|
2e5f5c5991 | ||
|
|
8291b15599 | ||
|
|
3de31f7d0a | ||
|
|
6b59c268f9 | ||
|
|
dd550dc3d0 | ||
|
|
3aae07df56 | ||
|
|
ed5ddf60cc | ||
|
|
bcdc8d3f66 | ||
|
|
5498a05bf7 | ||
|
|
644f8b6e2d | ||
|
|
3af7dd51b8 | ||
|
|
e0fc068f2e | ||
|
|
58ed71f870 | ||
|
|
aae9a7b7a7 | ||
|
|
33270f3257 | ||
|
|
99d5a0343b | ||
|
|
3678da1b3c | ||
|
|
a8fdbf3573 | ||
|
|
351ba5fc63 | ||
|
|
6dfaf2c521 | ||
|
|
ae759477c7 | ||
|
|
921fd17221 | ||
|
|
81696c9e13 | ||
|
|
32b1d3ac16 | ||
|
|
e3b15da059 | ||
|
|
934ef7fb13 | ||
|
|
3ee785506c | ||
|
|
428f612bb3 | ||
|
|
95b7ee5bc8 | ||
|
|
4899a82b35 | ||
|
|
424981683e | ||
|
|
c3253a5731 | ||
|
|
a9be0d0b20 | ||
|
|
13111596b8 | ||
|
|
6cea10fcc5 | ||
|
|
58102f182a | ||
|
|
9e284f58cb | ||
|
|
a5dc045acc | ||
|
|
dd3e9dd2f4 | ||
|
|
6784a87e26 | ||
|
|
99637c86f9 | ||
|
|
3817525441 | ||
|
|
4b4331d394 | ||
|
|
aaafaf58d6 | ||
|
|
1b9bd9ceef | ||
|
|
e043f07b71 | ||
|
|
b20b21b5dd | ||
|
|
c3ced68bea | ||
|
|
905efeb53f | ||
|
|
a3795cd043 | ||
|
|
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 | ||
|
|
092ea88703 | ||
|
|
67d59bfc2c | ||
|
|
77a5dfacd6 | ||
|
|
1373c418b9 | ||
|
|
e82b450464 | ||
|
|
08818dbf01 | ||
|
|
0ed8814aef | ||
|
|
a86f1d2f31 | ||
|
|
c1b27ee818 | ||
|
|
7eb7b4450f | ||
|
|
5443078805 | ||
|
|
dcffbf9a71 | ||
|
|
85de00f374 | ||
|
|
9adc3fdf16 | ||
|
|
6cf31e2dcb | ||
|
|
08d3d7ec08 | ||
|
|
ed52ca5914 | ||
|
|
1d0609f753 | ||
|
|
56a43e4009 | ||
|
|
22c7c6ee05 | ||
|
|
3d0f00e7e4 | ||
|
|
bbd642af1a | ||
|
|
5215a601b9 | ||
|
|
9bac7fa4f7 | ||
|
|
06910bac87 | ||
|
|
85427c6424 | ||
|
|
cf9761e9a3 | ||
|
|
7d3647ac61 | ||
|
|
a466339092 | ||
|
|
6fb30f0cf2 | ||
|
|
9b41825c2c | ||
|
|
e9319b0460 | ||
|
|
49596fb5ab | ||
|
|
1d3552860b | ||
|
|
17a9488ba7 | ||
|
|
683008dac0 | ||
|
|
9ee4f46240 | ||
|
|
7735a33a59 | ||
|
|
aacbf56ee5 | ||
|
|
a7be6a58a4 | ||
|
|
3432dbbb63 | ||
|
|
c652796da1 | ||
|
|
8e46441a36 | ||
|
|
4d497ec8a7 | ||
|
|
752dbcbe2d | ||
|
|
0be331b28e | ||
|
|
fcfd1e4437 | ||
|
|
b9efd2b40f | ||
|
|
dd61f1da8c | ||
|
|
9e6a71c32d | ||
|
|
50fafcffdb | ||
|
|
b9f1d92564 | ||
|
|
dcde6bb47f | ||
|
|
d04fce7bbc | ||
|
|
39e5e1913f | ||
|
|
80ceacbb02 | ||
|
|
23e98aab6f | ||
|
|
6069bd8922 | ||
|
|
402d4012d1 | ||
|
|
22f16ee325 | ||
|
|
ac69b61c03 | ||
|
|
0ad051b394 | ||
|
|
103e051d96 | ||
|
|
17995b95a4 | ||
|
|
19cf6cca3c | ||
|
|
f996edf016 | ||
|
|
72d8cd07bc | ||
|
|
1441601ddf | ||
|
|
7fe37ffd24 | ||
|
|
e05c93aaeb | ||
|
|
5ed4e3610a | ||
|
|
b96a3ce762 | ||
|
|
b46a1e7055 | ||
|
|
927a57452c | ||
|
|
af17364730 | ||
|
|
46a465508a | ||
|
|
e0c406a344 | ||
|
|
db3b0024a6 | ||
|
|
c9535a0feb | ||
|
|
2a0a92f134 | ||
|
|
62b6226520 | ||
|
|
bd92419bf9 | ||
|
|
6281322fce | ||
|
|
538afe2fc6 |
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`: <!--should be latest stable version: https://github.com/neovim/neovim/releases/tag/stable -->
|
||||||
|
- 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.
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,4 +2,5 @@ tags
|
|||||||
en.utf-8.add.spl
|
en.utf-8.add.spl
|
||||||
*.exe
|
*.exe
|
||||||
.netrwhist
|
.netrwhist
|
||||||
packer_compiled.lua
|
*.log
|
||||||
|
.DS_Store
|
||||||
|
|||||||
6
.stylua.toml
Normal file
6
.stylua.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# config for stylua, ref: https://github.com/JohnnyMorganz/StyLua
|
||||||
|
line_endings = "Unix"
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
quote_style = "AutoPreferDouble"
|
||||||
|
no_call_parentheses = true
|
||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
145
README.md
145
README.md
@@ -1,34 +1,62 @@
|
|||||||
```
|
<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/network">
|
||||||
|
<img alt="Forks" src="https://badgen.net/github/forks/jdhao/nvim-config">
|
||||||
|
</a>
|
||||||
|
<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.2-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>
|
||||||
|
<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>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
# Introduction
|
# Introduction
|
||||||
|
|
||||||
This repo hosts my Nvim configuration for all the platforms I am using (Linux,
|
This repo hosts my Nvim configuration for Linux, macOS, and Windows.
|
||||||
Windows and macOS). `init.vim` is the config entry point for terminal Nvim,
|
`init.lua` is the config entry point for terminal Nvim,
|
||||||
and `ginit.vim` is the additional config file for GUI client of Nvim (I am
|
and `ginit.vim` is the additional config file for [GUI client of Nvim](https://github.com/neovim/neovim/wiki/Related-projects#gui).
|
||||||
using [neovim-qt](https://github.com/equalsraf/neovim-qt) for now on Windows).
|
|
||||||
|
|
||||||
My configurations are heavily documented to make it as clear as possible. While
|
My configurations are heavily documented to make it as clear as possible.
|
||||||
you can download the whole repository and use it, it is not recommended though.
|
While you can clone the whole repository and use it, it is not recommended though.
|
||||||
Good configurations are personal. Everyone should have his or her unique config
|
Good configurations are personal. Everyone should have his or her unique config file.
|
||||||
file. You are encouraged to copy from this repo the part you feel useful and
|
You are encouraged to copy from this repo the part you want and add it to your own config.
|
||||||
add it to your own Nvim config.
|
|
||||||
|
|
||||||
See [doc here](docs/README.md) on how to install Nvim's dependencies, Nvim
|
To reduce the possibility of breakage, **this config is only maintained for [the latest nvim stable release](https://github.com/neovim/neovim/releases/tag/stable).
|
||||||
itself, and how to set up on different platforms (Linux, macOS and Windows).
|
No effort is spent on maintaining backward compatibility.**
|
||||||
|
|
||||||
**This config is tested against Nvim 0.5.1 release. No backward compatibility
|
# Install and setup
|
||||||
is guaranteed.**
|
|
||||||
|
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).
|
||||||
|
|
||||||
# Features #
|
# Features #
|
||||||
|
|
||||||
+ Plugin management via [Packer.nvim](https://github.com/wbthomason/packer.nvim).
|
+ Plugin management via [Packer.nvim](https://github.com/wbthomason/packer.nvim).
|
||||||
+ Code auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) and [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
|
+ Code, snippet, word auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
|
||||||
|
+ Language server protocol (LSP) support via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig).
|
||||||
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
|
+ Git integration via [vim-fugitive](https://github.com/tpope/vim-fugitive).
|
||||||
+ Better escaping from insert mode via [better-escape.vim](https://github.com/jdhao/better-escape.vim).
|
+ Better escaping from insert mode via [better-escape.vim](https://github.com/jdhao/better-escape.vim).
|
||||||
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
|
+ Ultra-fast project-wide fuzzy searching via [LeaderF](https://github.com/Yggdroot/LeaderF).
|
||||||
@@ -36,42 +64,43 @@ is guaranteed.**
|
|||||||
+ Faster matching pair insertion and jump via [delimitMate](https://github.com/Raimondi/delimitMate).
|
+ Faster matching pair insertion and jump via [delimitMate](https://github.com/Raimondi/delimitMate).
|
||||||
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
|
+ Smarter and faster matching pair management (add, replace or delete) via [vim-sandwich](https://github.com/machakann/vim-sandwich).
|
||||||
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim).
|
+ Fast buffer jump via [hop.nvim](https://github.com/phaazon/hop.nvim).
|
||||||
+ Ultra fast snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips).
|
+ Powerful snippet insertion via [Ultisnips](https://github.com/SirVer/ultisnips).
|
||||||
+ Beautiful status line via [vim-airline](https://github.com/vim-airline/vim-airline).
|
+ Beautiful statusline 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).
|
+ 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).
|
+ 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).
|
+ Command line auto-completion via [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
||||||
+ Keymap display via [which-key.nvim](https://github.com/folke/which-key.nvim).
|
+ User-defined mapping hint via [which-key.nvim](https://github.com/folke/which-key.nvim).
|
||||||
+ Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim).
|
+ Asynchronous code execution via [asyncrun.vim](https://github.com/skywind3000/asyncrun.vim).
|
||||||
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
|
+ Code highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter).
|
||||||
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
|
+ Code editing using true nvim inside browser via [firenvim](https://github.com/glacambre/firenvim).
|
||||||
+ Color theme via [vim-gruvbox8](https://github.com/lifepillar/vim-gruvbox8) and other beautiful themes.
|
+ Color theme via [vim-gruvbox8](https://github.com/lifepillar/vim-gruvbox8) and other beautiful themes.
|
||||||
+ Markdown writing and previewing via [vim-markdown](https://github.com/plasticboy/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
+ Markdown writing and previewing via [vim-markdown](https://github.com/plasticboy/vim-markdown) and [markdown-preview.nvim](https://github.com/iamcco/markdown-preview.nvim).
|
||||||
|
+ LaTeX editing and previewing via [vimtex](https://github.com/lervag/vimtex) <sup id="a1">[1](#f1)</sup>.
|
||||||
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
+ Animated GUI style notification via [nvim-notify](https://github.com/rcarriga/nvim-notify).
|
||||||
+ Smooth scroll experience via [neoscroll](https://github.com/karb94/neoscroll.nvim).
|
+ Smooth scroll experience via [neoscroll](https://github.com/karb94/neoscroll.nvim).
|
||||||
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
+ Tags navigation via [vista](https://github.com/liuchengxu/vista.vim).
|
||||||
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
+ Code formatting via [Neoformat](https://github.com/sbdchd/neoformat).
|
||||||
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
|
+ Undo management via [vim-mundo](https://github.com/simnalamburt/vim-mundo)
|
||||||
+ LaTeX editing via [vimtex](https://github.com/lervag/vimtex) <sup id="a1">[1](#f1)</sup>.
|
|
||||||
+ ......
|
+ ......
|
||||||
|
|
||||||
# UI Demo
|
# UI Demo
|
||||||
|
|
||||||
For more UI demos, see [here](https://github.com/jdhao/nvim-config/issues/15).
|
For more UI demos, check [here](https://github.com/jdhao/nvim-config/issues/15).
|
||||||
|
|
||||||
## Start screen with alpha-nvim
|
## Start screen with dashboard-nvim
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/16662357/139459989-0537ded4-c119-4749-99bf-b551ca1ba118.jpg" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/183256752-fb23b215-a6b8-4646-beed-9999f52d53f1.png" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## fuzzy finding using LeaderF
|
## File fuzzy finding using LeaderF
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/16662357/139462025-7bce98c5-d2d5-413f-9659-20545865cdca.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/183257017-2d9d7605-3c4b-4e1d-8955-30998f9b6f28.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Autocompletion
|
## Code autocompletion with nvim-cmp
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/16662357/128590006-0fc1451f-fac1-49b2-bb95-8aba21bfa44e.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/128590006-0fc1451f-fac1-49b2-bb95-8aba21bfa44e.gif" width="800">
|
||||||
@@ -83,6 +112,12 @@ For more UI demos, see [here](https://github.com/jdhao/nvim-config/issues/15).
|
|||||||
<img src="https://user-images.githubusercontent.com/16662357/128590833-aaa05d53-19ef-441d-a5a9-ba1bbd3936c1.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/128590833-aaa05d53-19ef-441d-a5a9-ba1bbd3936c1.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
## Command-line autocompletion with wilder.nvim
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://user-images.githubusercontent.com/16662357/147677787-8e5d229a-a16a-420e-98f5-88f2a1be84a2.gif" width="800">
|
||||||
|
</p>
|
||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -97,20 +132,18 @@ Go to a string starting with `se`
|
|||||||
<img src="https://user-images.githubusercontent.com/16662357/139459219-8a7e6ac4-1d24-4008-a370-b56773d7cb85.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/139459219-8a7e6ac4-1d24-4008-a370-b56773d7cb85.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## GUI-style notification
|
## GUI-style notification with nvim-notify
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://user-images.githubusercontent.com/16662357/128589873-aadb8264-1098-4834-9876-fa66a309be05.gif" width="800">
|
<img src="https://user-images.githubusercontent.com/16662357/128589873-aadb8264-1098-4834-9876-fa66a309be05.gif" width="800">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
# Shortcuts
|
# Shortcuts
|
||||||
|
|
||||||
Some of the shortcuts I use frequently. In the following shortcuts, `<leader>`
|
Some of the shortcuts I use frequently are listed here. In the following shortcuts, `<leader>` represents ASCII character `,`.
|
||||||
represents ASCII character `,`.
|
|
||||||
|
|
||||||
| Shortcut | Mode | platform | Description |
|
| Shortcut | Mode | platform | Description |
|
||||||
|-------------------|---------------|-----------------|------------------------------------------------------------------|
|
|-------------------|---------------|-----------------|--------------------------------------------------------------------------|
|
||||||
| `<leader>ff` | Normal | Linux/macOS/Win | Fuzzy file searching in a floating window |
|
| `<leader>ff` | Normal | Linux/macOS/Win | Fuzzy file searching in a floating window |
|
||||||
| `<leader>fh` | Normal | Linux/macOS/Win | Fuzzy help file grepping in a floating window |
|
| `<leader>fh` | Normal | Linux/macOS/Win | Fuzzy help file grepping in a floating window |
|
||||||
| `<leader>fg` | Normal | Linux/macOS/Win | Fuzzy project-wide grepping in a floating window |
|
| `<leader>fg` | Normal | Linux/macOS/Win | Fuzzy project-wide grepping in a floating window |
|
||||||
@@ -124,19 +157,25 @@ represents ASCII character `,`.
|
|||||||
| `<leader>q` | Normal | Linux/macOS/Win | Quit current window |
|
| `<leader>q` | Normal | Linux/macOS/Win | Quit current window |
|
||||||
| `<leader>Q` | Normal | Linux/macOS/Win | Quit all window and close Nvim |
|
| `<leader>Q` | Normal | Linux/macOS/Win | Quit all window and close Nvim |
|
||||||
| `<leader>w` | Normal | Linux/macOS/Win | Save current buffer content |
|
| `<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>y` | Normal | Linux/macOS/Win | Copy the content of entire buffer to default register |
|
||||||
| `<leader>cl` | Normal | Linux/macOS/Win | Toggle cursor column |
|
| `<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 |
|
| `<leader>cd` | Normal | Linux/macOS/Win | Change current working directory to to the dir of current buffer |
|
||||||
| `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
|
| `<space>t` | Normal | Linux/macOS/Win | Toggle tag window (show project tags in the right window) |
|
||||||
| `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result |
|
| `<leader>gs` | Normal | Linux/macOS/Win | Show Git status result |
|
||||||
|
| `<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>gc` | Normal | Linux/macOS/Win | Run git commit |
|
||||||
| `<F9>` | Normal | Linux/macOS/Win | Run current source file (for Python, C++) |
|
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
|
||||||
|
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
|
||||||
|
| `<F9>` | Normal | Linux/macOS/Win | Compile&run current source file (for C++, LaTeX, Lua, Python) |
|
||||||
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
|
| `<F11>` | Normal | Linux/macOS/Win | Toggle spell checking |
|
||||||
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
|
| `<F12>` | Normal | Linux/macOS/Win | Toggle paste mode |
|
||||||
| `\x` | Normal | Linux/macOS/Win | Close location or quickfix window |
|
| `\x` | Normal | Linux/macOS/Win | Close location or quickfix window |
|
||||||
| `\d` | Normal | Linux/macOS/Win | Close current buffer and go to previous buffer |
|
| `\d` | Normal | Linux/macOS/Win | Close current buffer and go to previous buffer |
|
||||||
| `{count}gb` | Normal | Linux/macOS/Win | Go to buffer {count} or next buffer in the buffer list. |
|
| `{count}gb` | Normal | Linux/macOS/Win | Go to buffer `{count}` or next buffer in the buffer list. |
|
||||||
|
| `{operator}iB` | Normal | Linux/macOS/Win | Operate in the whole buffer, `{operator}` can be `v`, `y`, `c`, `d` etc. |
|
||||||
|
| `Alt-k` | Normal | Linux/macOS/Win | Move current line or selected lines up |
|
||||||
|
| `Alt-j` | Normal | Linux/macOS/Win | Move current line or selected lines down |
|
||||||
| `Alt-m` | Normal | macOS/Win | Markdown previewing in system browser |
|
| `Alt-m` | Normal | macOS/Win | Markdown previewing in system browser |
|
||||||
| `Alt-Shift-m` | Normal | macOS/Win | Stopping Markdown previewing in system browser |
|
| `Alt-Shift-m` | Normal | macOS/Win | Stopping Markdown previewing in system browser |
|
||||||
| `ob` | Normal/Visual | macOS/Win | Open link under cursor or search visual selection |
|
| `ob` | Normal/Visual | macOS/Win | Open link under cursor or search visual selection |
|
||||||
@@ -144,22 +183,34 @@ represents ASCII character `,`.
|
|||||||
| `ctrl-t` | Insert | Linux/macOS/Win | Turn word under cursor to title case |
|
| `ctrl-t` | Insert | Linux/macOS/Win | Turn word under cursor to title case |
|
||||||
| `jk` | Insert | Linux/macOS/Win | Return to Normal mode without lagging |
|
| `jk` | Insert | Linux/macOS/Win | Return to Normal mode without lagging |
|
||||||
|
|
||||||
# Trouble shooting
|
# Custom commands
|
||||||
|
|
||||||
If you come across an issue, you can first use `:checkhealth` command provided
|
In addition to commands provided by various plugins, I have also created some custom commands for personal use.
|
||||||
by `nvim` to trouble-shoot yourself. Please read carefully the messages
|
|
||||||
provided by health check.
|
| command | description | example |
|
||||||
|
|------------|-------------------------------------------------------------------------|--------------------------------|
|
||||||
|
| `Redir` | capture command output to a tabpage for easier inspection. | `Redir hi` |
|
||||||
|
| `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` |
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
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).
|
If you still have an issue, [open a new issue](https://github.com/jdhao/nvim-config/issues).
|
||||||
|
|
||||||
# Further readings
|
# Further readings
|
||||||
|
|
||||||
Some of the resources that I find helpful in mastering Vim is documented [here](docs/vim_resources.md).
|
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 post in configuring Vim on different platforms:
|
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/)
|
+ [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 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/)
|
+ [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)
|
||||||
|
|||||||
8
after/ftplugin/javascript.vim
Normal file
8
after/ftplugin/javascript.vim
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
" Disable inserting comment leader after hitting o or O or <Enter>
|
||||||
|
set formatoptions-=o
|
||||||
|
set formatoptions-=r
|
||||||
|
|
||||||
|
set tabstop=2 " number of visual spaces per TAB
|
||||||
|
set softtabstop=2 " number of spaces in tab when editing
|
||||||
|
set shiftwidth=2 " number of spaces to use for autoindent
|
||||||
|
set expandtab " expand tab to spaces so that tabs are spaces
|
||||||
@@ -6,3 +6,8 @@ set tabstop=2 " number of visual spaces per TAB
|
|||||||
set softtabstop=2 " number of spaces in tab when editing
|
set softtabstop=2 " number of spaces in tab when editing
|
||||||
set shiftwidth=2 " number of spaces to use for autoindent
|
set shiftwidth=2 " number of spaces to use for autoindent
|
||||||
set expandtab " expand tab to spaces so that tabs are spaces
|
set expandtab " expand tab to spaces so that tabs are spaces
|
||||||
|
|
||||||
|
nnoremap <silent> <F9> :luafile %<CR>
|
||||||
|
|
||||||
|
" For delimitMate
|
||||||
|
let b:delimitMate_matchpairs = "(:),[:],{:}"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
set concealcursor=c
|
set concealcursor=c
|
||||||
set synmaxcol=3000 " For long Chinese paragraphs
|
set synmaxcol=3000 " For long Chinese paragraphs
|
||||||
|
|
||||||
|
set wrap
|
||||||
|
|
||||||
" Fix minor issue with footnote, see https://github.com/vim-pandoc/vim-markdownfootnotes/issues/22
|
" Fix minor issue with footnote, see https://github.com/vim-pandoc/vim-markdownfootnotes/issues/22
|
||||||
if exists(':FootnoteNumber')
|
if exists(':FootnoteNumber')
|
||||||
nnoremap <buffer><silent> ^^ :<C-U>call markdownfootnotes#VimFootnotes('i')<CR>
|
nnoremap <buffer><silent> ^^ :<C-U>call markdownfootnotes#VimFootnotes('i')<CR>
|
||||||
@@ -43,3 +45,25 @@ function! AddListSymbol(type, ...) abort
|
|||||||
call setline(line, new_text)
|
call setline(line, new_text)
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
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 +0,0 @@
|
|||||||
set textwidth=79
|
|
||||||
@@ -6,8 +6,7 @@ set formatoptions-=r
|
|||||||
" modeline is annoying in that the modeline get executed each time the window
|
" modeline is annoying in that the modeline get executed each time the window
|
||||||
" focus is lost (see
|
" focus is lost (see
|
||||||
" https://github.com/tmux-plugins/vim-tmux-focus-events/issues/14)
|
" https://github.com/tmux-plugins/vim-tmux-focus-events/issues/14)
|
||||||
set foldmethod=expr foldlevel=0 foldlevelstart=-1
|
set foldmethod=expr foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
|
||||||
\ foldexpr=utils#VimFolds(v:lnum) foldtext=utils#MyFoldText()
|
|
||||||
|
|
||||||
" Use :help command for keyword when pressing `K` in vim file,
|
" Use :help command for keyword when pressing `K` in vim file,
|
||||||
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
" see `:h K` and https://stackoverflow.com/q/15867323/6064933
|
||||||
@@ -17,3 +16,5 @@ set tabstop=2 " number of visual spaces per TAB
|
|||||||
set softtabstop=2 " number of spaces in tab when editing
|
set softtabstop=2 " number of spaces in tab when editing
|
||||||
set shiftwidth=2 " number of spaces to use for autoindent
|
set shiftwidth=2 " number of spaces to use for autoindent
|
||||||
set expandtab " expand tab to spaces so that tabs are spaces
|
set expandtab " expand tab to spaces so that tabs are spaces
|
||||||
|
|
||||||
|
nnoremap <silent> <F9> :source %<CR>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function! buf_utils#GoToBuffer(count, direction) abort
|
|||||||
" we are essentially mixing Lua and vim script. We need to make sure that
|
" we are essentially mixing Lua and vim script. We need to make sure that
|
||||||
" args inside vim.notify() are valid vim values. The conversion from vim
|
" args inside vim.notify() are valid vim values. The conversion from vim
|
||||||
" value to lua value will be done by Nvim. See also https://github.com/neovim/neovim/pull/11338.
|
" value to lua value will be done by Nvim. See also https://github.com/neovim/neovim/pull/11338.
|
||||||
call v:lua.vim.notify('Invalid bufnr: ' . a:count, 'error', {'title': 'nvim-config'})
|
call v:lua.vim.notify('Invalid bufnr: ' . a:count, 4, {'title': 'nvim-config'})
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -27,27 +27,6 @@ function! utils#HasColorscheme(name) abort
|
|||||||
return !empty(globpath(&runtimepath, l:pat))
|
return !empty(globpath(&runtimepath, l:pat))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Check if an Airline theme exists in runtimepath.
|
|
||||||
function! utils#HasAirlinetheme(name) abort
|
|
||||||
let l:pat = printf('autoload/airline/themes/%s.vim', a:name)
|
|
||||||
return !empty(globpath(&runtimepath, l:pat))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Generate random integers in the range [Low, High] in pure vim script,
|
|
||||||
" adapted from https://stackoverflow.com/a/12739441/6064933
|
|
||||||
function! utils#RandInt(Low, High) abort
|
|
||||||
" Use lua to generate random int. It is faster. Ref: https://stackoverflow.com/a/20157671/6064933
|
|
||||||
call v:lua.math.randomseed(localtime())
|
|
||||||
return v:lua.math.random(a:Low, a:High)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Selection a random element from a sequence/list
|
|
||||||
function! utils#RandElement(seq) abort
|
|
||||||
let l:idx = utils#RandInt(0, len(a:seq)-1)
|
|
||||||
|
|
||||||
return a:seq[l:idx]
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
||||||
function! utils#VimFolds(lnum) abort
|
function! utils#VimFolds(lnum) abort
|
||||||
" get content of current line and the line below
|
" get content of current line and the line below
|
||||||
@@ -137,16 +116,22 @@ function! utils#Get_titlestr() abort
|
|||||||
if g:is_linux
|
if g:is_linux
|
||||||
let l:title_str = hostname() . ' '
|
let l:title_str = hostname() . ' '
|
||||||
endif
|
endif
|
||||||
let l:title_str = l:title_str . expand('%:p:~') . ' '
|
|
||||||
if &buflisted
|
let l:buf_path = expand('%:p:~')
|
||||||
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M',getftime(expand('%')))
|
let l:title_str = l:title_str . l:buf_path . ' '
|
||||||
|
if &buflisted && l:buf_path != ""
|
||||||
|
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M:%S%z', getftime(expand('%')))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:title_str
|
return l:title_str
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Output current time in ISO format.
|
" Output current time or unix timestamp in human-readable format.
|
||||||
function! utils#iso_time() abort
|
function! utils#iso_time(timestamp) abort
|
||||||
|
if a:timestamp
|
||||||
|
return strftime('%Y-%m-%d %H:%M:%S%z', a:timestamp)
|
||||||
|
endif
|
||||||
|
|
||||||
return strftime('%Y-%m-%d %H:%M:%S%z')
|
return strftime('%Y-%m-%d %H:%M:%S%z')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -156,7 +141,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 specical user autocmd InGitRepo (to use it for
|
" Manually trigger a special 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
|
||||||
@@ -176,13 +161,18 @@ endfunction
|
|||||||
" Redirect command output to a register for later processing.
|
" Redirect command output to a register for later processing.
|
||||||
" Ref: https://stackoverflow.com/q/2573021/6064933 and https://unix.stackexchange.com/q/8101/221410 .
|
" Ref: https://stackoverflow.com/q/2573021/6064933 and https://unix.stackexchange.com/q/8101/221410 .
|
||||||
function! utils#CaptureCommandOutput(command) abort
|
function! utils#CaptureCommandOutput(command) abort
|
||||||
|
let l:tmp = @m
|
||||||
redir @m
|
redir @m
|
||||||
execute a:command
|
silent! execute a:command
|
||||||
redir END
|
redir END
|
||||||
call v:lua.vim.notify("command output captured to register m", "info", {'title': 'nvim-config'})
|
|
||||||
"create a scratch buffer for dumping the text, ref: https://vi.stackexchange.com/a/11311/15292.
|
"create a scratch buffer for dumping the text, ref: https://vi.stackexchange.com/a/11311/15292.
|
||||||
tabnew | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
|
tabnew | setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile
|
||||||
call nvim_buf_set_lines(0, 0, 0, 0, [@m])
|
|
||||||
|
let l:lines = split(@m, '\n')
|
||||||
|
call nvim_buf_set_lines(0, 0, 0, 0, l:lines)
|
||||||
|
|
||||||
|
let @m = l:tmp
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Edit all files matching the given patterns.
|
" Edit all files matching the given patterns.
|
||||||
|
|||||||
@@ -19,32 +19,27 @@ augroup accurate_syn_highlight
|
|||||||
autocmd BufEnter * :syntax sync fromstart
|
autocmd BufEnter * :syntax sync fromstart
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Return to last edit position when opening a file
|
" Return to last cursor position when opening a file
|
||||||
augroup resume_edit_position
|
augroup resume_cursor_position
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufReadPost *
|
autocmd BufReadPost * call s:resume_cursor_position()
|
||||||
\ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' | execute "normal! g`\"zvzz" | endif
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Display a message when the current file is not in utf-8 format.
|
" Only resume last cursor position when there is no go-to-line command (something like '+23').
|
||||||
" Note that we need to use `unsilent` command here because of this issue:
|
function s:resume_cursor_position() abort
|
||||||
" https://github.com/vim/vim/issues/4379
|
if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
||||||
augroup non_utf8_file_warn
|
let l:args = v:argv " command line arguments
|
||||||
autocmd!
|
for l:cur_arg in l:args
|
||||||
" we can not use `lua vim.notify()`: it will error out E5107 parsing lua.
|
" Check if a go-to-line command is given.
|
||||||
autocmd BufRead * if &fileencoding != 'utf-8' | call v:lua.vim.notify('File not in UTF-8 format!', 'warn', {'title': 'nvim-config'}) | endif
|
let idx = match(l:cur_arg, '\v^\+(\d){1,}$')
|
||||||
augroup END
|
if idx != -1
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
" Automatically reload the file if it is changed outside of Nvim, see
|
execute "normal! g`\"zvzz"
|
||||||
" https://unix.stackexchange.com/a/383044/221410. It seems that `checktime`
|
endif
|
||||||
" command does not work in command line. We need to check if we are in command
|
endfunction
|
||||||
" line before executing this command. See also
|
|
||||||
" https://vi.stackexchange.com/a/20397/15292.
|
|
||||||
augroup auto_read
|
|
||||||
autocmd!
|
|
||||||
autocmd FileChangedShellPost * call v:lua.vim.notify("File changed on disk. Buffer reloaded!", 'warn', {'title': 'nvim-config'})
|
|
||||||
autocmd FocusGained,CursorHold * if getcmdwintype() == '' | checktime | endif
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup numbertoggle
|
augroup numbertoggle
|
||||||
autocmd!
|
autocmd!
|
||||||
@@ -70,15 +65,9 @@ function! s:custom_highlight() abort
|
|||||||
highlight FloatBorder guifg=LightGreen guibg=NONE
|
highlight FloatBorder guifg=LightGreen guibg=NONE
|
||||||
|
|
||||||
" highlight for matching parentheses
|
" highlight for matching parentheses
|
||||||
highlight MatchParen cterm=bold,reverse,underline gui=bold,reverse,underline
|
highlight MatchParen cterm=bold,underline gui=bold,underline
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" highlight yanked region, see `:h lua-highlight`
|
|
||||||
augroup highlight_yank
|
|
||||||
autocmd!
|
|
||||||
au TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankColor", timeout=300, on_visual=false}
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup auto_close_win
|
augroup auto_close_win
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufEnter * call s:quit_current_win()
|
autocmd BufEnter * call s:quit_current_win()
|
||||||
@@ -86,10 +75,22 @@ augroup END
|
|||||||
|
|
||||||
" Quit Nvim if we have only one window, and its filetype match our pattern.
|
" Quit Nvim if we have only one window, and its filetype match our pattern.
|
||||||
function! s:quit_current_win() abort
|
function! s:quit_current_win() abort
|
||||||
let quit_filetypes = ['qf', 'vista']
|
let l:quit_filetypes = ['qf', 'vista', 'NvimTree']
|
||||||
let buftype = getbufvar(bufnr(), '&filetype')
|
|
||||||
if winnr('$') == 1 && index(quit_filetypes, buftype) != -1
|
let l:should_quit = v:true
|
||||||
quit
|
|
||||||
|
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
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -98,14 +99,25 @@ augroup git_repo_check
|
|||||||
autocmd VimEnter,DirChanged * call utils#Inside_git_repo()
|
autocmd VimEnter,DirChanged * call utils#Inside_git_repo()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Auto-generate packer_compiled.lua file
|
" ref: https://vi.stackexchange.com/a/169/15292
|
||||||
augroup packer_auto_compile
|
function! s:handle_large_file() abort
|
||||||
|
let g:large_file = 10485760 " 10MB
|
||||||
|
let f = expand("<afile>")
|
||||||
|
|
||||||
|
if getfsize(f) > g:large_file || getfsize(f) == -2
|
||||||
|
set eventignore+=all
|
||||||
|
" turning off relative number helps a lot
|
||||||
|
set norelativenumber
|
||||||
|
setlocal noswapfile bufhidden=unload buftype=nowrite undolevels=-1
|
||||||
|
else
|
||||||
|
set eventignore-=all relativenumber
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup LargeFile
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePost */nvim/lua/plugins.lua source <afile> | PackerCompile
|
autocmd BufReadPre * call s:handle_large_file()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Remove trailing whitespaces
|
" Load auto-command defined in Lua
|
||||||
augroup strip_trailing_space
|
lua require("custom-autocmd")
|
||||||
autocmd!
|
|
||||||
autocmd BufWritePre,TextChanged * StripTrailingWhitespace
|
|
||||||
augroup END
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ let g:logging_level = 'info'
|
|||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ Builtin variables
|
"{{ Builtin variables
|
||||||
" Disable Python2 support
|
|
||||||
let g:loaded_python_provider = 0
|
|
||||||
|
|
||||||
" Disable perl provider
|
" Disable perl provider
|
||||||
let g:loaded_perl_provider = 0
|
let g:loaded_perl_provider = 0
|
||||||
|
|
||||||
@@ -34,17 +31,26 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Custom mapping <leader> (see `:h mapleader` for more info)
|
" Custom mapping <leader> (see `:h mapleader` for more info)
|
||||||
let mapleader = ','
|
let g:mapleader = ','
|
||||||
|
|
||||||
" Enable highlighting for lua HERE doc inside vim script
|
" Enable highlighting for lua HERE doc inside vim script
|
||||||
let g:vimsyn_embed = 'l'
|
let g:vimsyn_embed = 'l'
|
||||||
|
|
||||||
|
" Use English as main language
|
||||||
|
if !g:is_mac
|
||||||
|
language en_US.utf-8
|
||||||
|
endif
|
||||||
|
|
||||||
|
" use filetype.lua instead of filetype.vim
|
||||||
|
let g:do_filetype_lua = 1
|
||||||
|
let g:did_load_filetypes = 0
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
"{{ Disable loading certain plugins
|
"{{ Disable loading certain plugins
|
||||||
" Whether to load netrw by default, see
|
" Whether to load netrw by default, see
|
||||||
" https://github.com/bling/dotvim/issues/4
|
" https://github.com/bling/dotvim/issues/4
|
||||||
" let g:loaded_netrw = 0
|
let g:loaded_netrw = 1
|
||||||
" let g:loaded_netrwPlugin = 0
|
let g:loaded_netrwPlugin = 1
|
||||||
let g:netrw_liststyle = 3
|
let g:netrw_liststyle = 3
|
||||||
if g:is_win
|
if g:is_win
|
||||||
let g:netrw_http_cmd = 'curl --ssl-no-revoke -Lo'
|
let g:netrw_http_cmd = 'curl --ssl-no-revoke -Lo'
|
||||||
@@ -65,4 +71,7 @@ let g:loaded_tutor_mode_plugin = 1 " do not load the tutor plugin
|
|||||||
let g:loaded_matchit = 1
|
let g:loaded_matchit = 1
|
||||||
let g:loaded_matchparen = 1
|
let g:loaded_matchparen = 1
|
||||||
"}}
|
"}}
|
||||||
|
|
||||||
|
" Disable sql omni completion, it is broken.
|
||||||
|
let g:loaded_sql_completion = 1
|
||||||
"}
|
"}
|
||||||
|
|||||||
@@ -45,18 +45,12 @@ nnoremap <silent> \d :<C-U>bprevious <bar> bdelete #<CR>
|
|||||||
|
|
||||||
" Insert a blank line below or above current line (do not move the cursor),
|
" Insert a blank line below or above current line (do not move the cursor),
|
||||||
" see https://stackoverflow.com/a/16136133/6064933
|
" see https://stackoverflow.com/a/16136133/6064933
|
||||||
nnoremap oo :echo 'Please use <lt>space>o instead'<CR>
|
|
||||||
nnoremap OO :echo 'Please use <lt>space>O instead'<CR>
|
|
||||||
nnoremap <expr> <Space>o printf('m`%so<ESC>``', v:count1)
|
nnoremap <expr> <Space>o printf('m`%so<ESC>``', v:count1)
|
||||||
nnoremap <expr> <Space>O printf('m`%sO<ESC>``', v:count1)
|
nnoremap <expr> <Space>O printf('m`%sO<ESC>``', v:count1)
|
||||||
|
|
||||||
" Insert a space after current character
|
" Insert a space after current character
|
||||||
nnoremap <Space><Space> a<Space><ESC>h
|
nnoremap <Space><Space> a<Space><ESC>h
|
||||||
|
|
||||||
" Yank from current cursor position to the end of the line (make it
|
|
||||||
" consistent with the behavior of D, C)
|
|
||||||
nnoremap Y y$
|
|
||||||
|
|
||||||
" Move the cursor based on physical lines, not the actual lines.
|
" Move the cursor based on physical lines, not the actual lines.
|
||||||
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
|
nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
|
||||||
nnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
|
nnoremap <expr> k (v:count == 0 ? 'gk' : 'k')
|
||||||
@@ -93,21 +87,20 @@ xnoremap > >gv
|
|||||||
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
|
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
|
||||||
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
|
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"
|
||||||
|
|
||||||
" Edit and reload init.vim quickly
|
" Edit and reload nvim config file quickly
|
||||||
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
|
nnoremap <silent> <leader>ev :<C-U>tabnew $MYVIMRC <bar> tcd %:h<cr>
|
||||||
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
|
nnoremap <silent> <leader>sv :<C-U>silent update $MYVIMRC <bar> source $MYVIMRC <bar>
|
||||||
\ call v:lua.vim.notify("Nvim config successfully reloaded!", 'info', {'title': 'nvim-config'})<cr>
|
\ call v:lua.vim.notify("Nvim config successfully reloaded!", 2, {'title': 'nvim-config'})<cr>
|
||||||
|
|
||||||
" Reselect the text that has just been pasted, see also https://stackoverflow.com/a/4317090/6064933.
|
" Reselect the text that has just been pasted, see also https://stackoverflow.com/a/4317090/6064933.
|
||||||
nnoremap <expr> <leader>v printf('`[%s`]', getregtype()[0])
|
nnoremap <expr> <leader>v printf('`[%s`]', getregtype()[0])
|
||||||
|
|
||||||
|
" Always use very magic mode for searching
|
||||||
|
nnoremap / /\v
|
||||||
|
|
||||||
" Search in selected region
|
" Search in selected region
|
||||||
xnoremap / :<C-U>call feedkeys('/\%>'.(line("'<")-1).'l\%<'.(line("'>")+1)."l")<CR>
|
xnoremap / :<C-U>call feedkeys('/\%>'.(line("'<")-1).'l\%<'.(line("'>")+1)."l")<CR>
|
||||||
|
|
||||||
" Find and replace (like Sublime Text 3)
|
|
||||||
nnoremap <C-H> :%s/
|
|
||||||
xnoremap <C-H> :s/
|
|
||||||
|
|
||||||
" Change current working directory locally and print cwd after that,
|
" Change current working directory locally and print cwd after that,
|
||||||
" see https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file
|
" see https://vim.fandom.com/wiki/Set_working_directory_to_the_current_file
|
||||||
nnoremap <silent> <leader>cd :<C-U>lcd %:p:h<CR>:pwd<CR>
|
nnoremap <silent> <leader>cd :<C-U>lcd %:p:h<CR>:pwd<CR>
|
||||||
@@ -174,6 +167,7 @@ onoremap <silent> iB :<C-U>call text_obj#Buffer()<CR>
|
|||||||
|
|
||||||
" Do not move my cursor when joining lines.
|
" Do not move my cursor when joining lines.
|
||||||
nnoremap J mzJ`z
|
nnoremap J mzJ`z
|
||||||
|
nnoremap gJ mzgJ`z
|
||||||
|
|
||||||
" Break inserted text into smaller undo units.
|
" Break inserted text into smaller undo units.
|
||||||
for ch in [',', '.', '!', '?', ';', ':']
|
for ch in [',', '.', '!', '?', ';', ':']
|
||||||
@@ -196,3 +190,6 @@ function! s:restore_cursor() abort
|
|||||||
silent! normal `y
|
silent! normal `y
|
||||||
silent! delmarks y
|
silent! delmarks y
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" for mappings defined in lua
|
||||||
|
lua require('custom-map')
|
||||||
|
|||||||
@@ -35,10 +35,7 @@ set wildignore+=*.aux,*.bbl,*.blg,*.brf,*.fls,*.fdb_latexmk,*.synctex.gz,*.xdv
|
|||||||
set wildignorecase " ignore file and dir name cases in cmd-completion
|
set wildignorecase " ignore file and dir name cases in cmd-completion
|
||||||
|
|
||||||
" Set up backup directory
|
" Set up backup directory
|
||||||
let g:backupdir=expand(stdpath('data') . '/backup')
|
let g:backupdir=expand(stdpath('data') . '/backup//')
|
||||||
if !isdirectory(g:backupdir)
|
|
||||||
call mkdir(g:backupdir, 'p')
|
|
||||||
endif
|
|
||||||
let &backupdir=g:backupdir
|
let &backupdir=g:backupdir
|
||||||
|
|
||||||
" Skip backup for patterns in option wildignore
|
" Skip backup for patterns in option wildignore
|
||||||
@@ -79,13 +76,11 @@ set scrolloff=3
|
|||||||
set mouse=nic " Enable mouse in several mode
|
set mouse=nic " Enable mouse in several mode
|
||||||
set mousemodel=popup " Set the behaviour of mouse
|
set mousemodel=popup " Set the behaviour of mouse
|
||||||
|
|
||||||
" Do not show mode on command line since vim-airline can show it
|
" Disable showing current mode on command line since statusline plugins can show it.
|
||||||
set noshowmode
|
set noshowmode
|
||||||
|
|
||||||
set fileformats=unix,dos " Fileformats to use for new files
|
set fileformats=unix,dos " Fileformats to use for new files
|
||||||
|
|
||||||
set inccommand=nosplit " Show the result of substitution in real time for preview
|
|
||||||
|
|
||||||
" Ask for confirmation when handling unsaved or read-only files
|
" Ask for confirmation when handling unsaved or read-only files
|
||||||
set confirm
|
set confirm
|
||||||
|
|
||||||
@@ -117,6 +112,9 @@ set shortmess+=c
|
|||||||
" choice, IMHO.
|
" choice, IMHO.
|
||||||
set shortmess+=S
|
set shortmess+=S
|
||||||
|
|
||||||
|
" Disable showing intro message (:intro)
|
||||||
|
set shortmess+=I
|
||||||
|
|
||||||
" Completion behaviour
|
" Completion behaviour
|
||||||
" set completeopt+=noinsert " Auto select the first completion entry
|
" set completeopt+=noinsert " Auto select the first completion entry
|
||||||
set completeopt+=menuone " Show menu even if there is only one item
|
set completeopt+=menuone " Show menu even if there is only one item
|
||||||
@@ -125,7 +123,7 @@ set completeopt-=preview " Disable the preview window
|
|||||||
set pumheight=10 " Maximum number of items to show in popup menu
|
set pumheight=10 " Maximum number of items to show in popup menu
|
||||||
set pumblend=10 " pseudo transparency for completion menu
|
set pumblend=10 " pseudo transparency for completion menu
|
||||||
|
|
||||||
set winblend=5 " pseudo transparency for floating window
|
set winblend=0 " pseudo transparency for floating window
|
||||||
|
|
||||||
" Insert mode key word completion setting
|
" Insert mode key word completion setting
|
||||||
set complete+=kspell complete-=w complete-=b complete-=u complete-=t
|
set complete+=kspell complete-=w complete-=b complete-=u complete-=t
|
||||||
@@ -146,10 +144,6 @@ set formatoptions+=mM
|
|||||||
" Tilde (~) is an operator, thus must be followed by motions like `e` or `w`.
|
" Tilde (~) is an operator, thus must be followed by motions like `e` or `w`.
|
||||||
set tildeop
|
set tildeop
|
||||||
|
|
||||||
" Do not add two spaces after a period when joining lines or formatting texts,
|
|
||||||
" see https://stackoverflow.com/q/4760428/6064933
|
|
||||||
set nojoinspaces
|
|
||||||
|
|
||||||
set synmaxcol=200 " Text after this column number is not highlighted
|
set synmaxcol=200 " Text after this column number is not highlighted
|
||||||
set nostartofline
|
set nostartofline
|
||||||
|
|
||||||
@@ -181,3 +175,5 @@ set diffopt+=filler " show filler for deleted lines
|
|||||||
set diffopt+=closeoff " turn off diff when one file window is closed
|
set diffopt+=closeoff " turn off diff when one file window is closed
|
||||||
set diffopt+=context:3 " context for diff
|
set diffopt+=context:3 " context for diff
|
||||||
set diffopt+=internal,indent-heuristic,algorithm:histogram
|
set diffopt+=internal,indent-heuristic,algorithm:histogram
|
||||||
|
|
||||||
|
set nowrap " do no wrap
|
||||||
|
|||||||
137
core/plugins.vim
137
core/plugins.vim
@@ -12,6 +12,10 @@ call utils#Cabbrev('pud', 'PackerUpdate')
|
|||||||
call utils#Cabbrev('pc', 'PackerClean')
|
call utils#Cabbrev('pc', 'PackerClean')
|
||||||
call utils#Cabbrev('ps', 'PackerSync')
|
call utils#Cabbrev('ps', 'PackerSync')
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" configurations for vim script plugin "
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
"""""""""""""""""""""""""UltiSnips settings"""""""""""""""""""
|
"""""""""""""""""""""""""UltiSnips settings"""""""""""""""""""
|
||||||
" Trigger configuration. Do not use <tab> if you use YouCompleteMe
|
" Trigger configuration. Do not use <tab> if you use YouCompleteMe
|
||||||
let g:UltiSnipsExpandTrigger='<c-j>'
|
let g:UltiSnipsExpandTrigger='<c-j>'
|
||||||
@@ -27,25 +31,9 @@ let g:UltiSnipsJumpBackwardTrigger='<c-k>'
|
|||||||
" https://jdhao.github.io/2019/04/17/neovim_snippet_s1/ for details.
|
" https://jdhao.github.io/2019/04/17/neovim_snippet_s1/ for details.
|
||||||
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
|
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 """"""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
||||||
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
|
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
|
||||||
|
|
||||||
""""""""""""""""""""""""""""" settings for nvim-hlslens"""""""""""""""
|
|
||||||
noremap <silent> n <Cmd>execute('normal! ' . v:count1 . 'nzzzv')<CR>
|
|
||||||
\<Cmd>lua require('hlslens').start()<CR>
|
|
||||||
noremap <silent> N <Cmd>execute('normal! ' . v:count1 . 'Nzzzv')<CR>
|
|
||||||
\<Cmd>lua require('hlslens').start()<CR>
|
|
||||||
|
|
||||||
map * <Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>
|
|
||||||
map # <Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""LeaderF settings"""""""""""""""""""""
|
"""""""""""""""""""""""""""""LeaderF settings"""""""""""""""""""""
|
||||||
" Do not use cache file
|
" Do not use cache file
|
||||||
let g:Lf_UseCache = 0
|
let g:Lf_UseCache = 0
|
||||||
@@ -68,7 +56,7 @@ if g:is_linux
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Only fuzzy-search files names
|
" Only fuzzy-search files names
|
||||||
let g:Lf_DefaultMode = 'NameOnly'
|
let g:Lf_DefaultMode = 'FullPath'
|
||||||
|
|
||||||
" Popup window settings
|
" Popup window settings
|
||||||
let w = float2nr(&columns * 0.8)
|
let w = float2nr(&columns * 0.8)
|
||||||
@@ -84,6 +72,12 @@ let g:Lf_PopupPosition = [0, float2nr((&columns - g:Lf_PopupWidth)/2)]
|
|||||||
" submodules are not searched by default.
|
" submodules are not searched by default.
|
||||||
let g:Lf_UseVersionControlTool = 0
|
let g:Lf_UseVersionControlTool = 0
|
||||||
|
|
||||||
|
" Use rg as the default search tool
|
||||||
|
let g:Lf_DefaultExternalTool = "rg"
|
||||||
|
|
||||||
|
" show dot files
|
||||||
|
let g:Lf_ShowHidden = 1
|
||||||
|
|
||||||
" Disable default mapping
|
" Disable default mapping
|
||||||
let g:Lf_ShortcutF = ''
|
let g:Lf_ShortcutF = ''
|
||||||
let g:Lf_ShortcutB = ''
|
let g:Lf_ShortcutB = ''
|
||||||
@@ -95,21 +89,19 @@ let g:Lf_WorkingDirectoryMode = 'a'
|
|||||||
nnoremap <silent> <leader>ff :<C-U>Leaderf file --popup<CR>
|
nnoremap <silent> <leader>ff :<C-U>Leaderf file --popup<CR>
|
||||||
|
|
||||||
" Grep project files in popup window
|
" Grep project files in popup window
|
||||||
nnoremap <silent> <leader>fg :<C-U>Leaderf rg --popup<CR>
|
nnoremap <silent> <leader>fg :<C-U>Leaderf rg --no-messages --popup<CR>
|
||||||
|
|
||||||
" Search vim help files
|
" Search vim help files
|
||||||
nnoremap <silent> <leader>fh :<C-U>Leaderf help --popup<CR>
|
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
|
" Search tags in current buffer
|
||||||
nnoremap <silent> <leader>ft :<C-U>Leaderf bufTag --popup<CR>
|
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
|
" Switch buffers
|
||||||
nnoremap <silent> <leader>fb :<C-U>Leaderf buffer --popup<CR>
|
nnoremap <silent> <leader>fb :<C-U>Leaderf buffer --popup<CR>
|
||||||
|
|
||||||
" Search recent files
|
" Search recent files
|
||||||
nnoremap <silent> <leader>fr :<C-U>Leaderf mru --popup<CR>
|
nnoremap <silent> <leader>fr :<C-U>Leaderf mru --popup --absolute-path<CR>
|
||||||
|
|
||||||
let g:Lf_PopupColorscheme = 'gruvbox_material'
|
let g:Lf_PopupColorscheme = 'gruvbox_material'
|
||||||
|
|
||||||
@@ -127,14 +119,6 @@ if g:is_win || g:is_mac
|
|||||||
xmap ob <Plug>(openbrowser-smart-search)
|
xmap ob <Plug>(openbrowser-smart-search)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""""" gutentags settings """"""""""""""""""""""""""""""
|
|
||||||
" The path to store tags files, instead of in the project root.
|
|
||||||
let g:gutentags_cache_dir = stdpath('cache') . '/ctags'
|
|
||||||
let g:gutentags_ctags_extra_args = ['--fields=+niazS', '--extra=+q']
|
|
||||||
let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']
|
|
||||||
let g:gutentags_ctags_extra_args += ['--c-kinds=+px']
|
|
||||||
let g:gutentags_ctags_exclude = ['*.md', '*.html', '*.json', '*.toml', '*.css', '*.js',]
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""" vista settings """"""""""""""""""""""""""""""""""
|
||||||
let g:vista#renderer#icons = {
|
let g:vista#renderer#icons = {
|
||||||
\ 'member': '',
|
\ 'member': '',
|
||||||
@@ -209,9 +193,10 @@ let g:signify_sign_change = '~'
|
|||||||
nnoremap <silent> <leader>gs :Git<CR>
|
nnoremap <silent> <leader>gs :Git<CR>
|
||||||
nnoremap <silent> <leader>gw :Gwrite<CR>
|
nnoremap <silent> <leader>gw :Gwrite<CR>
|
||||||
nnoremap <silent> <leader>gc :Git commit<CR>
|
nnoremap <silent> <leader>gc :Git commit<CR>
|
||||||
|
nnoremap <silent> <leader>gd :Gdiffsplit<CR>
|
||||||
nnoremap <silent> <leader>gpl :Git pull<CR>
|
nnoremap <silent> <leader>gpl :Git pull<CR>
|
||||||
" Note that to use bar literally, we need backslash it, see also `:h :bar`.
|
" Note that to use bar literally, we need backslash it, see also `:h :bar`.
|
||||||
nnoremap <silent> <leader>gpu :15split \| term git push
|
nnoremap <silent> <leader>gpu :15split \| term git push<CR>
|
||||||
|
|
||||||
"""""""""""""""""""""""""plasticboy/vim-markdown settings"""""""""""""""""""
|
"""""""""""""""""""""""""plasticboy/vim-markdown settings"""""""""""""""""""
|
||||||
" Disable header folding
|
" Disable header folding
|
||||||
@@ -275,7 +260,7 @@ omap s <Nop>
|
|||||||
|
|
||||||
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
|
||||||
if ( g:is_win || g:is_mac ) && executable('latex')
|
if ( g:is_win || g:is_mac ) && executable('latex')
|
||||||
" Hacks for inverse serach to work semi-automatically,
|
" Hacks for inverse search to work semi-automatically,
|
||||||
" see https://jdhao.github.io/2021/02/20/inverse_search_setup_neovim_vimtex/.
|
" see https://jdhao.github.io/2021/02/20/inverse_search_setup_neovim_vimtex/.
|
||||||
function! s:write_server_name() abort
|
function! s:write_server_name() abort
|
||||||
let nvim_server_file = (has('win32') ? $TEMP : '/tmp') . '/vimtexserver.txt'
|
let nvim_server_file = (has('win32') ? $TEMP : '/tmp') . '/vimtexserver.txt'
|
||||||
@@ -307,7 +292,6 @@ if ( g:is_win || g:is_mac ) && executable('latex')
|
|||||||
" Viewer settings for different platforms
|
" Viewer settings for different platforms
|
||||||
if g:is_win
|
if g:is_win
|
||||||
let g:vimtex_view_general_viewer = 'SumatraPDF'
|
let g:vimtex_view_general_viewer = 'SumatraPDF'
|
||||||
let g:vimtex_view_general_options_latexmk = '-reuse-instance'
|
|
||||||
let g:vimtex_view_general_options = '-reuse-instance -forward-search @tex @line @pdf'
|
let g:vimtex_view_general_options = '-reuse-instance -forward-search @tex @line @pdf'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -336,58 +320,6 @@ if ( g:is_win || g:is_mac ) && executable('latex')
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"""""""""""""""""""""""""""vim-airline setting""""""""""""""""""""""""""""""
|
|
||||||
" Set airline theme to a random one if it exists
|
|
||||||
let s:candidate_airlinetheme = ['ayu_mirage', 'lucius', 'ayu_dark', 'base16_bright',
|
|
||||||
\ 'base16_adwaita', 'raven', 'term', 'deus', 'onedark']
|
|
||||||
let g:airline_theme = utils#RandElement(s:candidate_airlinetheme)
|
|
||||||
|
|
||||||
" Whether to show function or other tags on status line
|
|
||||||
let g:airline#extensions#vista#enabled = 0
|
|
||||||
let g:airline#extensions#gutentags#enabled = 1
|
|
||||||
|
|
||||||
" Do not show search index in statusline since it is shown on command line
|
|
||||||
let g:airline#extensions#anzu#enabled = 0
|
|
||||||
|
|
||||||
" Enable vim-airline extension for nvim-lsp
|
|
||||||
let g:airline#extensions#nvimlsp#enabled = 1
|
|
||||||
|
|
||||||
let g:airline#extensions#searchcount#enabled = 0
|
|
||||||
|
|
||||||
" Skip empty sections if there are nothing to show,
|
|
||||||
" extracted from https://vi.stackexchange.com/a/9637/15292
|
|
||||||
let g:airline_skip_empty_sections = 1
|
|
||||||
|
|
||||||
" Whether to use powerline symbols, see https://vi.stackexchange.com/q/3359/15292
|
|
||||||
let g:airline_powerline_fonts = 0
|
|
||||||
|
|
||||||
if !exists('g:airline_symbols')
|
|
||||||
let g:airline_symbols = {}
|
|
||||||
endif
|
|
||||||
let g:airline_symbols.paste = 'ρ'
|
|
||||||
let g:airline_symbols.linenr = " L:"
|
|
||||||
let g:airline_symbols.colnr = " C:"
|
|
||||||
|
|
||||||
if !g:is_linux
|
|
||||||
let g:airline_symbols.branch = ''
|
|
||||||
let g:airline_symbols.spell = 'Ꞩ'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Custom branch name
|
|
||||||
let g:airline#extensions#branch#custom_head = 'utils#GetGitBranch'
|
|
||||||
|
|
||||||
" Only show git hunks which are non-zero
|
|
||||||
let g:airline#extensions#hunks#non_zero_only = 1
|
|
||||||
|
|
||||||
" Speed up airline
|
|
||||||
let g:airline_highlighting_cache = 1
|
|
||||||
|
|
||||||
" 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,
|
|
||||||
" 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
|
|
||||||
let g:airline#extensions#xkblayout#short_codes = {'0': 'CN', '1': 'US'}
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""vim-startify settings""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vim-startify settings""""""""""""""""""""""""""""
|
||||||
" Do not change working directory when opening files.
|
" Do not change working directory when opening files.
|
||||||
let g:startify_change_to_dir = 0
|
let g:startify_change_to_dir = 0
|
||||||
@@ -439,9 +371,16 @@ if exists('g:started_by_firenvim') && g:started_by_firenvim
|
|||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
function! s:setup_firenvim() abort
|
||||||
|
set noruler noshowcmd
|
||||||
|
set laststatus=0 showtabline=0
|
||||||
|
endfunction
|
||||||
|
|
||||||
augroup firenvim
|
augroup firenvim
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufEnter *.txt setlocal filetype=markdown laststatus=0 nonumber noshowcmd noruler showtabline=1
|
autocmd FileType text call s:setup_firenvim()
|
||||||
|
autocmd BufNewFile github.com_*.txt set filetype=markdown
|
||||||
|
autocmd BufNewFile stackoverflow.com_*.txt set filetype=markdown
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -449,21 +388,17 @@ endif
|
|||||||
nnoremap <leader>dp :<C-U>GdbStartPDB python -m pdb %<CR>
|
nnoremap <leader>dp :<C-U>GdbStartPDB python -m pdb %<CR>
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""wilder.nvim settings""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""wilder.nvim settings""""""""""""""""""""""""""""""
|
||||||
augroup wilder_init
|
call timer_start(250, { -> s: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
|
|
||||||
|
|
||||||
function! s:wilder_init() abort
|
function! s:wilder_init() abort
|
||||||
try
|
try
|
||||||
call wilder#enable_cmdline_enter()
|
call wilder#setup({
|
||||||
set wildcharm=<Tab>
|
\ 'modes': [':', '/', '?'],
|
||||||
cmap <expr> <Tab> wilder#in_context() ? wilder#next() : "\<Tab>"
|
\ 'next_key': '<Tab>',
|
||||||
cmap <expr> <S-Tab> wilder#in_context() ? wilder#previous() : "\<S-Tab>"
|
\ 'previous_key': '<S-Tab>',
|
||||||
|
\ 'accept_key': '<C-y>',
|
||||||
" only / and ? are enabled by default
|
\ 'reject_key': '<C-e>'
|
||||||
call wilder#set_option('modes', ['/', '?', ':'])
|
\ })
|
||||||
|
|
||||||
call wilder#set_option('pipeline', [
|
call wilder#set_option('pipeline', [
|
||||||
\ wilder#branch(
|
\ wilder#branch(
|
||||||
@@ -485,14 +420,18 @@ function! s:wilder_init() abort
|
|||||||
let l:hl = wilder#make_hl('WilderAccent', 'Pmenu', [{}, {}, {'foreground': '#f4468f'}])
|
let l:hl = wilder#make_hl('WilderAccent', 'Pmenu', [{}, {}, {'foreground': '#f4468f'}])
|
||||||
call wilder#set_option('renderer', wilder#popupmenu_renderer({
|
call wilder#set_option('renderer', wilder#popupmenu_renderer({
|
||||||
\ 'highlighter': wilder#basic_highlighter(),
|
\ 'highlighter': wilder#basic_highlighter(),
|
||||||
\ 'winblend': 5,
|
|
||||||
\ 'max_height': 15,
|
\ 'max_height': 15,
|
||||||
\ 'highlights': {
|
\ 'highlights': {
|
||||||
\ 'accent': l:hl,
|
\ 'accent': l:hl,
|
||||||
\ },
|
\ },
|
||||||
|
\ 'left': [' ', wilder#popupmenu_devicons(),],
|
||||||
|
\ 'right': [' ', wilder#popupmenu_scrollbar(),],
|
||||||
\ 'apply_incsearch_fix': 0,
|
\ 'apply_incsearch_fix': 0,
|
||||||
\ }))
|
\ }))
|
||||||
catch /^Vim\%((\a\+)\)\=:E117/
|
catch /^Vim\%((\a\+)\)\=:E117/
|
||||||
echohl Error |echomsg "Wilder.nvim missing. Run :PackerInstall to install all plugins."|echohl None
|
echohl Error |echomsg "Wilder.nvim missing: run :PackerSync to fix."|echohl None
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""vim-auto-save settings""""""""""""""""""""""""""""""
|
||||||
|
let g:auto_save = 1 " enable AutoSave on Vim startup
|
||||||
|
|||||||
123
core/themes.lua
Normal file
123
core/themes.lua
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
local utils = require('utils')
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
-- Theme to directory name mapping, because theme repo name is not necessarily
|
||||||
|
-- the same as the theme name itself.
|
||||||
|
M.theme2dir = {
|
||||||
|
gruvbox8 = "vim-gruvbox8",
|
||||||
|
onedark = 'onedark.nvim',
|
||||||
|
edge = 'edge',
|
||||||
|
sonokai = 'sonokai',
|
||||||
|
gruvbox_material = 'gruvbox-material',
|
||||||
|
nord = 'nord.nvim',
|
||||||
|
doom_one = 'doom-one.nvim',
|
||||||
|
everforest = 'everforest',
|
||||||
|
nightfox = 'nightfox.nvim',
|
||||||
|
kanagawa = 'kanagawa.nvim',
|
||||||
|
catppuccin = 'catppuccin'
|
||||||
|
}
|
||||||
|
|
||||||
|
M.gruvbox8 = function()
|
||||||
|
-- Italic options should be put before colorscheme setting,
|
||||||
|
-- see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
|
||||||
|
vim.g.gruvbox_italics = 1
|
||||||
|
vim.g.gruvbox_italicize_strings = 1
|
||||||
|
vim.g.gruvbox_filetype_hi_groups = 1
|
||||||
|
vim.g.gruvbox_plugin_hi_groups = 1
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme gruvbox8_hard]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.onedark = function()
|
||||||
|
vim.cmd [[colorscheme onedark]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.edge = function()
|
||||||
|
vim.g.edge_enable_italic = 1
|
||||||
|
vim.g.edge_better_performance = 1
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme edge]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.sonokai = function()
|
||||||
|
vim.g.sonokai_enable_italic = 1
|
||||||
|
vim.g.sonokai_better_performance = 1
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme sonokai]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.gruvbox_material = function()
|
||||||
|
vim.g.gruvbox_material_enable_italic = 1
|
||||||
|
vim.g.gruvbox_material_better_performance = 1
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme gruvbox-material]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.nord = function()
|
||||||
|
vim.cmd [[colorscheme nord]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.doom_one = function()
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme doom-one]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.everforest = function()
|
||||||
|
vim.g.everforest_enable_italic = 1
|
||||||
|
vim.g.everforest_better_performance = 1
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme everforest]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.nightfox = function()
|
||||||
|
vim.cmd [[colorscheme nordfox]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
M.kanagawa = function()
|
||||||
|
vim.cmd [[colorscheme kanagawa]]
|
||||||
|
end
|
||||||
|
|
||||||
|
M.catppuccin = function()
|
||||||
|
-- available option: latte, frappe, macchiato, mocha
|
||||||
|
vim.g.catppuccin_flavour = "frappe"
|
||||||
|
|
||||||
|
require("catppuccin").setup()
|
||||||
|
|
||||||
|
vim.cmd [[colorscheme catppuccin]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Use a random theme from the pre-defined list of themes.
|
||||||
|
M.rand_theme = function ()
|
||||||
|
local theme = utils.rand_element(vim.tbl_keys(M.theme2dir))
|
||||||
|
|
||||||
|
if not vim.tbl_contains(vim.tbl_keys(M), theme) then
|
||||||
|
local msg = "Invalid theme: " .. theme
|
||||||
|
vim.notify(msg, vim.log.levels.ERROR, { title = 'nvim-config' })
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Load the theme, because all the themes are declared as opt plugins, the theme isn't loaded yet.
|
||||||
|
local status = utils.add_pack(M.theme2dir[theme])
|
||||||
|
|
||||||
|
if not status then
|
||||||
|
local msg = string.format("Theme %s is not installed. Run PackerSync to install.", theme)
|
||||||
|
vim.notify(msg, vim.log.levels.ERROR, { title = 'nvim-config' })
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set the theme.
|
||||||
|
M[theme]()
|
||||||
|
|
||||||
|
if vim.g.logging_level == 'debug' then
|
||||||
|
local msg = "Colorscheme: " .. theme
|
||||||
|
|
||||||
|
vim.notify(msg, vim.log.levels.DEBUG, { title = 'nvim-config' })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
M.rand_theme()
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
let s:my_theme_dict = {}
|
|
||||||
|
|
||||||
function! s:my_theme_dict.gruvbox8() dict abort
|
|
||||||
packadd! vim-gruvbox8
|
|
||||||
|
|
||||||
" Italic options should be put before colorscheme setting,
|
|
||||||
" see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled
|
|
||||||
let g:gruvbox_italics=1
|
|
||||||
let g:gruvbox_italicize_strings=1
|
|
||||||
let g:gruvbox_filetype_hi_groups = 1
|
|
||||||
let g:gruvbox_plugin_hi_groups = 1
|
|
||||||
colorscheme gruvbox8_hard
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.onedark() dict abort
|
|
||||||
packadd! onedark.nvim
|
|
||||||
|
|
||||||
colorscheme onedark
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.edge() dict abort
|
|
||||||
packadd! edge
|
|
||||||
|
|
||||||
let g:edge_enable_italic = 1
|
|
||||||
let g:edge_better_performance = 1
|
|
||||||
colorscheme edge
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.sonokai() dict abort
|
|
||||||
packadd! sonokai
|
|
||||||
|
|
||||||
let g:sonokai_enable_italic = 1
|
|
||||||
let g:sonokai_better_performance = 1
|
|
||||||
colorscheme sonokai
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.gruvbox_material() dict abort
|
|
||||||
packadd! gruvbox-material
|
|
||||||
|
|
||||||
let g:gruvbox_material_enable_italic = 1
|
|
||||||
let g:gruvbox_material_better_performance = 1
|
|
||||||
colorscheme gruvbox-material
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.nord() dict abort
|
|
||||||
packadd! nord.nvim
|
|
||||||
|
|
||||||
colorscheme nord
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.doom_one() dict abort
|
|
||||||
packadd! doom-one.nvim
|
|
||||||
colorscheme doom-one
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.everforest() dict abort
|
|
||||||
packadd! everforest
|
|
||||||
|
|
||||||
let g:everforest_enable_italic = 1
|
|
||||||
let g:everforest_better_performance = 1
|
|
||||||
colorscheme everforest
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:my_theme_dict.nightfox() dict abort
|
|
||||||
packadd! nightfox.nvim
|
|
||||||
|
|
||||||
colorscheme nordfox
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:candidate_theme = [
|
|
||||||
\ 'gruvbox8',
|
|
||||||
\ 'onedark',
|
|
||||||
\ 'edge',
|
|
||||||
\ 'sonokai',
|
|
||||||
\ 'gruvbox_material',
|
|
||||||
\ 'nord',
|
|
||||||
\ 'doom_one',
|
|
||||||
\ 'everforest',
|
|
||||||
\ 'nightfox'
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
let s:theme = utils#RandElement(s:candidate_theme)
|
|
||||||
let s:colorscheme_func = printf('s:my_theme_dict.%s()', s:theme)
|
|
||||||
|
|
||||||
if has_key(s:my_theme_dict, s:theme)
|
|
||||||
execute 'call ' . s:colorscheme_func
|
|
||||||
if g:logging_level == 'debug'
|
|
||||||
let s:msg1 = "Currently loaded theme: " . s:theme
|
|
||||||
call v:lua.vim.notify(s:msg1, 'info', {'title': 'nvim-config'})
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let s:msg = "Invalid colorscheme function: " . s:colorscheme_func
|
|
||||||
call v:lua.vim.notify(s:msg, 'error', {'title': 'nvim-config'})
|
|
||||||
endif
|
|
||||||
227
docs/README.md
227
docs/README.md
@@ -1,37 +1,81 @@
|
|||||||
|
This doc summarizes how to install and use this configuration in detail.
|
||||||
|
|
||||||
# Pre-requisite
|
# Pre-requisite
|
||||||
|
|
||||||
There are a few dependencies if we want to use Nvim for efficient editing and
|
## Terminal emulators
|
||||||
development work.
|
|
||||||
|
|
||||||
## Python
|
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).
|
||||||
|
|
||||||
A lot of Nvim plugins are mainly written in Python. To use auto-completion and
|
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).
|
||||||
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.
|
|
||||||
|
|
||||||
## Pynvim
|
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).
|
||||||
|
|
||||||
Nvim relies on [pynvim](https://github.com/neovim/pynvim) to communicate with
|
## Patched Fonts
|
||||||
plugins that utilize its Python binding. Pynvim is required by plugins such as
|
|
||||||
[Semshi](https://github.com/numirias/semshi).
|
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.
|
||||||
|
|
||||||
|
# Automatic installation
|
||||||
|
|
||||||
|
## Automatic Installation for Linux
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Automatic installation for Windows
|
||||||
|
|
||||||
|
Run the script [nvim_setup_windows.ps1](nvim_setup_windows.ps1) in PowerShell **with Administrator rights**:
|
||||||
|
|
||||||
|
```
|
||||||
|
.\docs\nvim_setup_windows.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
# Manual install
|
||||||
|
|
||||||
|
There are a few dependencies if we want to use Nvim for efficient editing and development work.
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
### Python
|
||||||
|
|
||||||
|
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 [wilder.nvim](https://github.com/gelguy/wilder.nvim).
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install -U pynvim
|
pip install -U pynvim
|
||||||
```
|
```
|
||||||
|
|
||||||
## python-lsp-server
|
### 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,
|
[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.
|
||||||
linting, go to definition, etc.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
||||||
```
|
```
|
||||||
|
|
||||||
## Node
|
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`
|
||||||
|
|
||||||
We need to install node.js from [here](https://nodejs.org/en/download/):
|
### Node
|
||||||
|
|
||||||
|
We need to install node.js from [here](https://nodejs.org/en/download/).
|
||||||
|
For Linux, you can use the following script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Ref: https://johnpapa.net/node-and-npm-without-sudo/
|
# Ref: https://johnpapa.net/node-and-npm-without-sudo/
|
||||||
@@ -55,32 +99,31 @@ source ~/.bash_profile
|
|||||||
# source ~/.zshrc
|
# source ~/.zshrc
|
||||||
```
|
```
|
||||||
|
|
||||||
## vim-language-server
|
### vim-language-server
|
||||||
|
|
||||||
[vim-language-server](https://github.com/iamcco/vim-language-server) provides
|
[vim-language-server](https://github.com/iamcco/vim-language-server) provides completion for vim script. We can install vim-language-server globally:
|
||||||
completion for vim script. We can install vim-language-server globally and set
|
|
||||||
its path:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install -g vim-language-server
|
npm install -g vim-language-server
|
||||||
|
|
||||||
export PATH="$HOME/.npm-packages/bin:$PATH"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Git
|
vim-language-server is installed in the same directory as the node executable.
|
||||||
|
|
||||||
Git is used by the plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) to clone plugins from GitHub or
|
### Git
|
||||||
other Git repositories.
|
|
||||||
|
|
||||||
Since Git is usually pre-installed on Linux and macOS, we do not need to worry
|
Git is required by plugin manager [packer.nvim](https://github.com/wbthomason/packer.nvim) and other git-related plugins.
|
||||||
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.
|
|
||||||
|
|
||||||
## ctags
|
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.
|
||||||
|
|
||||||
In order to use tags related plugins such as [vista.vim](https://github.com/liuchengxu/vista.vim) and [gutentags](https://github.com/ludovicchabant/vim-gutentags), we need to
|
### ctags
|
||||||
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):
|
To install ctags on macOS, use [Homebrew](https://github.com/universal-ctags/homebrew-universal-ctags):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -93,135 +136,99 @@ To install it Windows, use [chocolatey](https://chocolatey.org/) or [scoop](http
|
|||||||
choco install universal-ctags
|
choco install universal-ctags
|
||||||
|
|
||||||
# scoop bucket add extras
|
# 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)
|
Set its PATH properly and make sure you can run `ctags` from command line.
|
||||||
for the details.
|
|
||||||
|
|
||||||
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 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
|
For Windows and macOS, we can install it via chocolatey and homebrew respectively.
|
||||||
tool available for both Linux, Windows and macOS. It is used by several
|
For Linux, we can download the [binary release](https://github.com/BurntSushi/ripgrep/releases) and install it.
|
||||||
searching plugins.
|
|
||||||
|
|
||||||
For Windows and macOS, we can install it via chocolatey and homebrew
|
Set its PATH properly and make sure you can run `rg` from command line.
|
||||||
respectively. For Linux, we can download the executable file from its [release
|
|
||||||
page](https://github.com/BurntSushi/ripgrep/releases) and install it.
|
|
||||||
|
|
||||||
## Linters
|
### Linters
|
||||||
|
|
||||||
A linter is a tool to check the source code for possible style and syntax
|
A linter is a tool to check the source code for possible style and syntax issues.
|
||||||
issues. Based on the programming languages we use, we may need to install
|
Based on the programming languages we use, we may need to install various linters.
|
||||||
various linters.
|
|
||||||
|
|
||||||
+ Python: [pylint](https://github.com/PyCQA/pylint) and [flake8](https://github.com/PyCQA/flake8).
|
+ Python: [pylint](https://github.com/PyCQA/pylint) and [flake8](https://github.com/PyCQA/flake8).
|
||||||
+ Vim script: [vint](https://github.com/Kuniwak/vint).
|
+ Vim script: [vint](https://github.com/Kuniwak/vint).
|
||||||
|
|
||||||
## Terminal emulators
|
Set their PATH properly and make sure you can run `pylint`, `flake8` and `vint` from command line.
|
||||||
|
|
||||||
Which [terminal emulator](https://en.wikipedia.org/wiki/Terminal_emulator) we
|
## Install Nvim
|
||||||
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).
|
|
||||||
|
|
||||||
For macOS, we can use [kitty](https://sw.kovidgoyal.net/kitty/), [iterm2](https://www.iterm2.com/), or [Alacritty](https://github.com/jwilm/alacritty).
|
There are various ways to install Nvim depending on your system.
|
||||||
If you connect to Linux server on Windows, I recommend [wsltty](https://github.com/mintty/wsltty) and
|
This config is only maintained for [the latest nvim stable release](https://github.com/neovim/neovim/releases/tag/stable).
|
||||||
[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 the new [Windows
|
### Linux
|
||||||
Terminal](https://github.com/microsoft/terminal).
|
|
||||||
|
|
||||||
## Font
|
You 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 the latest version may not be available.
|
||||||
|
|
||||||
Since [Vim-airline](https://github.com/vim-airline/vim-airline) uses several
|
### Windows
|
||||||
Unicode symbols not available in normal font, we need to install [fonts
|
|
||||||
here](https://github.com/powerline/fonts) to make vim-airline look pretty. I am using [Hack](https://github.com/powerline/fonts/tree/master/Hack), and it looks
|
|
||||||
great. Another great resource for programming font is the [nerd-font](https://github.com/ryanoasis/nerd-fonts) project.
|
|
||||||
|
|
||||||
# Install Nvim
|
You may download from [nvim release](https://github.com/neovim/neovim/releases/download/stable/nvim-win64.zip) from GitHub and manually extract it.
|
||||||
|
|
||||||
There are various ways to install Nvim depending on your system. Current
|
Another way to install Nvim on Windows is via chocolatey or scoop:
|
||||||
configuration is tested against nvim 0.5.
|
|
||||||
|
|
||||||
## Linux
|
|
||||||
|
|
||||||
We can directly download the binary release from [here](https://github.com/neovim/neovim/releases/download/v0.5.1/nvim-linux64.tar.gz).
|
|
||||||
|
|
||||||
## Windows
|
|
||||||
|
|
||||||
The easiest way to install Nvim on Windows is via chocolatey:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
choco install neovim
|
choco install neovim
|
||||||
|
|
||||||
|
# via scoop
|
||||||
|
# scoop bucket add versions
|
||||||
|
# scoop install neovim
|
||||||
```
|
```
|
||||||
|
|
||||||
You may download from [nvim release](https://github.com/neovim/neovim/releases/download/v0.5.1/nvim-win64.zip) from GitHub and manually extract it.
|
### macOS
|
||||||
|
|
||||||
## 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
|
```bash
|
||||||
brew install neovim
|
brew install neovim
|
||||||
```
|
```
|
||||||
|
|
||||||
After installing Nvim, we need to add the directory where the Nvim executable
|
After installing Nvim, we need to set the path to nvim correctly.
|
||||||
(`nvim` on Linux and macOS, `nvim.exe` on Windows) resides to the system `PATH`.
|
**Make sure that you can run `nvim` from the command line after all these setups**.
|
||||||
|
|
||||||
Make sure that you can call `nvim` from the command line after all these
|
## Setting up Nvim
|
||||||
setups.
|
|
||||||
|
|
||||||
# Setting up Nvim
|
After installing nvim and all the dependencies, we will install plugin managers and set up this config.
|
||||||
|
|
||||||
## Install plugin manager packer.nvim
|
### Install plugin manager packer.nvim
|
||||||
|
|
||||||
I use packer.nvim to manage my plugins. We need to install packer.nvim on our
|
I use packer.nvim to manage my plugins. We need to install packer.nvim on our system first.
|
||||||
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"
|
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
|
```bash
|
||||||
git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
git clone --depth=1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to install this configuration
|
### How to install this configuration
|
||||||
|
|
||||||
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1]. On Linux
|
On Linux and macOS, the directory is `~/.config/nvim`.
|
||||||
and macOS, the directory is `~/.config/nvim`. First, we need to remove all the
|
On Windows, the config directory is `$HOME/AppData/Local/nvim`[^1].
|
||||||
files under the config directory (including dot files), then go to this
|
First, we need to remove all the files under the config directory (including dot files),
|
||||||
directory, and run the following command to install this configuration:
|
then go to this directory, and run the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone --depth=1 https://github.com/jdhao/nvim-config.git .
|
git clone --depth=1 https://github.com/jdhao/nvim-config.git .
|
||||||
```
|
```
|
||||||
|
|
||||||
After that, when we first open nvim, run command `:PackerInstall` to install
|
After that, when we first open nvim, run command `:PackerSync` to install all the plugins.
|
||||||
all the plugins. Since I use quite a lot of plugins (more than 60), it may take
|
Since I use quite a lot of plugins (more than 60), it may take some time to install all of them.
|
||||||
some time to install all of them, depending on your network condition.
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
Run script [nvim_setup_windows.ps1](nvim_setup_windows.ps1) under PowerShell.
|
|
||||||
|
|
||||||
[^1]: Use `echo %userprofile%` to see where your `$HOME` is.
|
[^1]: Use `echo %userprofile%` to see where your `$HOME` is.
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eux
|
set -eux
|
||||||
|
|
||||||
wget https://hub.fastgit.org/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
|
wget https://github.com/neovim/neovim/releases/download/stable/nvim-macos.tar.gz
|
||||||
|
|
||||||
if [[ ! -d "$HOME/tools/" ]]; then
|
if [[ ! -d "$HOME/tools/" ]]; then
|
||||||
mkdir -p "$HOME/tools"
|
mkdir -p "$HOME/tools"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete existing nvim installation.
|
# Delete existing nvim installation.
|
||||||
if [[ -d "$HOME/tools/nvim-osx64" ]]; then
|
# For newer release, the directory name is nvim-macos
|
||||||
rm -rf "$HOME/tools/nvim-osx64"
|
if [[ -d "$HOME/tools/nvim-macos" ]]; then
|
||||||
|
rm -rf "$HOME/tools/nvim-macos"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Extract the tar ball
|
# Extract the tar ball
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ fi
|
|||||||
if [[ "$INSTALL_ANACONDA" = true ]]; then
|
if [[ "$INSTALL_ANACONDA" = true ]]; then
|
||||||
CONDA_DIR=$HOME/tools/anaconda
|
CONDA_DIR=$HOME/tools/anaconda
|
||||||
CONDA_NAME=Anaconda.sh
|
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
|
else
|
||||||
CONDA_DIR=$HOME/tools/miniconda
|
CONDA_DIR=$HOME/tools/miniconda
|
||||||
CONDA_NAME=Miniconda.sh
|
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
|
fi
|
||||||
|
|
||||||
if [[ ! "$PYTHON_INSTALLED" = true ]]; then
|
if [[ ! "$PYTHON_INSTALLED" = true ]]; then
|
||||||
@@ -87,21 +87,21 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Install node and vim-language-server #
|
# Install node and js-based language server #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
NODE_DIR=$HOME/tools/nodejs
|
NODE_DIR=$HOME/tools/nodejs
|
||||||
NODE_SRC_NAME=$HOME/packages/nodejs.tar.gz
|
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/
|
# 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"
|
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
|
if [[ -z "$(command -v node)" ]]; then
|
||||||
echo "Install Nodejs"
|
echo "Install Node.js"
|
||||||
if [[ ! -f $NODE_SRC_NAME ]]; then
|
if [[ ! -f $NODE_SRC_NAME ]]; then
|
||||||
echo "Downloading nodejs and renaming"
|
echo "Downloading Node.js and renaming"
|
||||||
wget $NODE_LINK -O "$NODE_SRC_NAME"
|
wget $NODE_LINK -O "$NODE_SRC_NAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -d "$NODE_DIR" ]]; then
|
if [[ ! -d "$NODE_DIR" ]]; then
|
||||||
echo "Creating nodejs directory under tools directory"
|
echo "Creating Node.js directory under tools directory"
|
||||||
mkdir -p "$NODE_DIR"
|
mkdir -p "$NODE_DIR"
|
||||||
echo "Extracting to $HOME/tools/nodejs directory"
|
echo "Extracting to $HOME/tools/nodejs directory"
|
||||||
tar xvf "$NODE_SRC_NAME" -C "$NODE_DIR" --strip-components 1
|
tar xvf "$NODE_SRC_NAME" -C "$NODE_DIR" --strip-components 1
|
||||||
@@ -111,18 +111,50 @@ if [[ -z "$(command -v node)" ]]; then
|
|||||||
echo "export PATH=\"$NODE_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
|
echo "export PATH=\"$NODE_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Nodejs is already installed. Skip installing it."
|
echo "Node.js is already installed. Skip installing it."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install vim-language-server
|
# Install vim-language-server
|
||||||
"$NODE_DIR/bin/npm" install -g 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
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# lua-language-server #
|
||||||
|
#######################################################################
|
||||||
|
SUMNEKO_LUA_DIR=$HOME/tools/lua-language-server
|
||||||
|
SUMNEKO_LUA_SRC_NAME=$HOME/packages/lua-language-server.tar.gz
|
||||||
|
SUMNEKO_LUA_LINK="https://github.com/sumneko/lua-language-server/releases/download/3.5.3/lua-language-server-3.5.3-linux-x64.tar.gz"
|
||||||
|
|
||||||
|
if [[ -z "$(command -v lua-language-server)" ]] && [[ ! -f "$SUMNEKO_LUA_DIR/bin/lua-language-server" ]]; then
|
||||||
|
echo 'Install lua-language-server'
|
||||||
|
if [[ ! -f $SUMNEKO_LUA_SRC_NAME ]]; then
|
||||||
|
echo "Downloading lua-language-server and renaming"
|
||||||
|
wget $SUMNEKO_LUA_LINK -O "$SUMNEKO_LUA_SRC_NAME"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d "$SUMNEKO_LUA_DIR" ]]; then
|
||||||
|
echo "Creating lua-language-server directory under tools directory"
|
||||||
|
mkdir -p "$SUMNEKO_LUA_DIR"
|
||||||
|
echo "Extracting to directory $SUMNEKO_LUA_DIR"
|
||||||
|
|
||||||
|
tar zxvf "$SUMNEKO_LUA_SRC_NAME" -C "$SUMNEKO_LUA_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$ADD_TO_SYSTEM_PATH" = true ]] && [[ "$USE_BASH_SHELL" = true ]]; then
|
||||||
|
echo "export PATH=\"$SUMNEKO_LUA_DIR/bin:\$PATH\"" >> "$HOME/.bash_profile"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "lua-language-server is already installed. Skip installing it."
|
||||||
|
fi
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Ripgrep part #
|
# Ripgrep part #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
RIPGREP_DIR=$HOME/tools/ripgrep
|
RIPGREP_DIR=$HOME/tools/ripgrep
|
||||||
RIPGREP_SRC_NAME=$HOME/packages/ripgrep.tar.gz
|
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
|
if [[ -z "$(command -v rg)" ]] && [[ ! -f "$RIPGREP_DIR/rg" ]]; then
|
||||||
echo "Install ripgrep"
|
echo "Install ripgrep"
|
||||||
if [[ ! -f $RIPGREP_SRC_NAME ]]; then
|
if [[ ! -f $RIPGREP_SRC_NAME ]]; then
|
||||||
@@ -140,6 +172,17 @@ if [[ -z "$(command -v rg)" ]] && [[ ! -f "$RIPGREP_DIR/rg" ]]; then
|
|||||||
if [[ "$ADD_TO_SYSTEM_PATH" = true ]] && [[ "$USE_BASH_SHELL" = true ]]; then
|
if [[ "$ADD_TO_SYSTEM_PATH" = true ]] && [[ "$USE_BASH_SHELL" = true ]]; then
|
||||||
echo "export PATH=\"$RIPGREP_DIR:\$PATH\"" >> "$HOME/.bash_profile"
|
echo "export PATH=\"$RIPGREP_DIR:\$PATH\"" >> "$HOME/.bash_profile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# set up manpath and zsh completion for ripgrep
|
||||||
|
mkdir -p "$HOME/tools/ripgrep/doc/man/man1"
|
||||||
|
mv "$HOME/tools/ripgrep/doc/rg.1" "$HOME/tools/ripgrep/doc/man/man1"
|
||||||
|
|
||||||
|
if [[ "$USE_BASH_SHELL" = true ]]; then
|
||||||
|
echo 'export MANPATH=$HOME/tools/ripgrep/doc/man:$MANPATH' >> "$HOME/.bash_profile"
|
||||||
|
else
|
||||||
|
echo 'export MANPATH=$HOME/tools/ripgrep/doc/man:$MANPATH' >> "$HOME/.zshrc"
|
||||||
|
echo 'export FPATH=$HOME/tools/ripgrep/complete:$FPATH' >> "$HOME/.zshrc"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "ripgrep is already installed. Skip installing it."
|
echo "ripgrep is already installed. Skip installing it."
|
||||||
fi
|
fi
|
||||||
@@ -149,7 +192,7 @@ fi
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
CTAGS_SRC_DIR=$HOME/packages/ctags
|
CTAGS_SRC_DIR=$HOME/packages/ctags
|
||||||
CTAGS_DIR=$HOME/tools/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
|
if [[ ! -f "$CTAGS_DIR/bin/ctags" ]]; then
|
||||||
echo "Install ctags"
|
echo "Install ctags"
|
||||||
|
|
||||||
@@ -177,7 +220,7 @@ fi
|
|||||||
NVIM_DIR=$HOME/tools/nvim
|
NVIM_DIR=$HOME/tools/nvim
|
||||||
NVIM_SRC_NAME=$HOME/packages/nvim-linux64.tar.gz
|
NVIM_SRC_NAME=$HOME/packages/nvim-linux64.tar.gz
|
||||||
NVIM_CONFIG_DIR=$HOME/.config/nvim
|
NVIM_CONFIG_DIR=$HOME/.config/nvim
|
||||||
NVIM_LINK="https://hub.fastgit.org/neovim/neovim/releases/download/nightly/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
|
if [[ ! -f "$NVIM_DIR/bin/nvim" ]]; then
|
||||||
echo "Installing Nvim"
|
echo "Installing Nvim"
|
||||||
echo "Creating nvim directory under tools directory"
|
echo "Creating nvim directory under tools directory"
|
||||||
@@ -205,13 +248,15 @@ if [[ -d "$NVIM_CONFIG_DIR" ]]; then
|
|||||||
mv "$NVIM_CONFIG_DIR" "$NVIM_CONFIG_DIR.backup"
|
mv "$NVIM_CONFIG_DIR" "$NVIM_CONFIG_DIR.backup"
|
||||||
fi
|
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"
|
echo "Installing packer.nvim"
|
||||||
git clone --depth=1 https://hub.fastgit.org/wbthomason/packer.nvim \
|
if [[ ! -d ~/.local/share/nvim/site/pack/packer/opt/packer.nvim ]]; then
|
||||||
~/.local/share/nvim/site/pack/packer/start/packer.nvim
|
git clone --depth=1 https://github.com/wbthomason/packer.nvim \
|
||||||
|
~/.local/share/nvim/site/pack/packer/opt/packer.nvim
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing plugins"
|
echo "Installing nvim plugins, please wait"
|
||||||
"$NVIM_DIR/bin/nvim" +PackerInstall +qall
|
"$NVIM_DIR/bin/nvim" -c "autocmd User PackerComplete quitall" -c "PackerSync"
|
||||||
|
|
||||||
echo "Finished installing Nvim and its dependencies!"
|
echo "Finished installing Nvim and its dependencies!"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
# Install scoop
|
# Set policy to avoid errors
|
||||||
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
|
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
|
||||||
iwr -useb get.scoop.sh | iex
|
|
||||||
|
# Install scoop
|
||||||
|
Invoke-WebRequest -UseBasicParsing get.scoop.sh | Invoke-Expression
|
||||||
|
|
||||||
# Install node
|
# Install node
|
||||||
scoop install nodejs
|
scoop install nodejs
|
||||||
@@ -15,7 +17,10 @@ scoop install universal-ctags
|
|||||||
# Install vim-language-server
|
# Install vim-language-server
|
||||||
npm install -g vim-language-server
|
npm install -g vim-language-server
|
||||||
|
|
||||||
# Install miniconda3
|
# Install bash-language-server
|
||||||
|
npm install -g bash-language-server
|
||||||
|
|
||||||
|
# Install miniconda3 (for Python)
|
||||||
scoop install miniconda3
|
scoop install miniconda3
|
||||||
|
|
||||||
# Install pynvim
|
# Install pynvim
|
||||||
@@ -24,6 +29,27 @@ pip install -U pynvim
|
|||||||
# Install python-language-server
|
# Install python-language-server
|
||||||
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
pip install 'python-lsp-server[all]' pylsp-mypy pyls-isort
|
||||||
|
|
||||||
|
# Install visual c++ redistribution
|
||||||
|
scoop install vcredist2022
|
||||||
|
|
||||||
|
# Install 7zip
|
||||||
|
scoop install 7zip
|
||||||
|
|
||||||
|
# Install lua-language-server
|
||||||
|
$sumneko_lua_link = "https://github.com/sumneko/lua-language-server/releases/download/3.5.3/lua-language-server-3.5.3-win32-x64.zip"
|
||||||
|
$sumneko_lua_install_dir = "D:\portable_tools"
|
||||||
|
$sumneko_lua_src_dir = "$sumneko_lua_install_dir\lua-language-server.zip"
|
||||||
|
$sumneko_lua_dir = "$sumneko_lua_install_dir\lua-language-server"
|
||||||
|
|
||||||
|
# Download file, ref: https://stackoverflow.com/a/51225744/6064933
|
||||||
|
Invoke-WebRequest $sumneko_lua_link -OutFile "$sumneko_lua_src_dir"
|
||||||
|
|
||||||
|
# Extract the zip file using 7zip, ref: https://stackoverflow.com/a/41933215/6064933
|
||||||
|
7z x "$sumneko_lua_src_dir" -o"$sumneko_lua_dir"
|
||||||
|
|
||||||
|
# Setup PATH env variable, ref: https://stackoverflow.com/q/714877/6064933
|
||||||
|
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$sumneko_lua_dir\bin", "Machine")
|
||||||
|
|
||||||
# Install neovim nightly
|
# Install neovim nightly
|
||||||
scoop bucket add versions
|
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>+
|
cnoremap <S-Insert> <C-R>+
|
||||||
nnoremap <silent> <C-6> <C-^>
|
nnoremap <silent> <C-6> <C-^>
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" config for nvim-qt "
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" To check if neovim-qt is running, use `exists('g:GuiLoaded')`,
|
" To check if neovim-qt is running, use `exists('g:GuiLoaded')`,
|
||||||
" see https://github.com/equalsraf/neovim-qt/issues/219
|
" see https://github.com/equalsraf/neovim-qt/issues/219
|
||||||
if exists('g:GuiLoaded')
|
if exists('g:GuiLoaded')
|
||||||
@@ -13,6 +16,9 @@ if exists('g:GuiLoaded')
|
|||||||
GuiFont! Hack\ NF:h10:l
|
GuiFont! Hack\ NF:h10:l
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" config for fvim "
|
||||||
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
if exists('g:fvim_loaded')
|
if exists('g:fvim_loaded')
|
||||||
set termguicolors
|
set termguicolors
|
||||||
colorscheme gruvbox8_hard
|
colorscheme gruvbox8_hard
|
||||||
|
|||||||
37
init.lua
Normal file
37
init.lua
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
-- 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/
|
||||||
|
|
||||||
|
-- check if we have the latest stable version of nvim
|
||||||
|
local expected_ver = "0.7.2"
|
||||||
|
|
||||||
|
local utils = require "utils"
|
||||||
|
local nvim_ver = utils.get_nvim_version()
|
||||||
|
|
||||||
|
if nvim_ver ~= expected_ver then
|
||||||
|
local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver)
|
||||||
|
vim.api.nvim_echo({ { msg, "ErrorMsg" } }, false, {})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local core_conf_files = {
|
||||||
|
"globals.vim",
|
||||||
|
"options.vim",
|
||||||
|
"autocommands.vim",
|
||||||
|
"mappings.vim",
|
||||||
|
"plugins.vim",
|
||||||
|
"themes.lua",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- source all the core config files
|
||||||
|
for _, name in ipairs(core_conf_files) do
|
||||||
|
local path = string.format("%s/core/%s", vim.fn.stdpath('config'), name)
|
||||||
|
local source_cmd = "source " .. path
|
||||||
|
vim.cmd(source_cmd)
|
||||||
|
end
|
||||||
26
init.vim
26
init.vim
@@ -1,26 +0,0 @@
|
|||||||
"{ Header info
|
|
||||||
" 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,
|
|
||||||
" built over time with a lot of polish.
|
|
||||||
" Author: Jie-dong Hao
|
|
||||||
" Email: jdhao@hotmail.com
|
|
||||||
"}
|
|
||||||
|
|
||||||
"{ Main configurations
|
|
||||||
let g:config_files = [
|
|
||||||
\ 'globals.vim',
|
|
||||||
\ 'options.vim',
|
|
||||||
\ 'autocommands.vim',
|
|
||||||
\ 'mappings.vim',
|
|
||||||
\ 'plugins.vim',
|
|
||||||
\ 'themes.vim'
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
for s:fname in g:config_files
|
|
||||||
execute printf('source %s/core/%s', stdpath('config'), s:fname)
|
|
||||||
endfor
|
|
||||||
"}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
local alpha = require("alpha")
|
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
|
||||||
|
|
||||||
-- Set header
|
|
||||||
dashboard.section.header.val = {
|
|
||||||
" ",
|
|
||||||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
|
|
||||||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
|
|
||||||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
|
|
||||||
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
|
|
||||||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
|
||||||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
|
||||||
" ",
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Set menu
|
|
||||||
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( "e", " > New file" , ":enew <CR>"),
|
|
||||||
dashboard.button( "q", " > Quit NVIM", ":qa<CR>"),
|
|
||||||
}
|
|
||||||
|
|
||||||
local fortune = require("alpha.fortune")
|
|
||||||
dashboard.section.footer.val = fortune()
|
|
||||||
|
|
||||||
alpha.setup(dashboard.opts)
|
|
||||||
|
|
||||||
-- Send config to alpha
|
|
||||||
alpha.setup(dashboard.opts)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
require("autosave").setup({
|
|
||||||
enabled = true,
|
|
||||||
execution_message = "Autosaved at " .. vim.fn.strftime("%H:%M:%S"),
|
|
||||||
events = { "InsertLeave", "TextChanged" },
|
|
||||||
conditions = {
|
|
||||||
exists = true,
|
|
||||||
filename_is_not = {"plugins.lua"},
|
|
||||||
filetype_is_not = {},
|
|
||||||
modifiable = true,
|
|
||||||
},
|
|
||||||
write_all_buffers = false,
|
|
||||||
on_off_commands = true,
|
|
||||||
clean_command_line_interval = 1000,
|
|
||||||
debounce_delay = 135,
|
|
||||||
})
|
|
||||||
@@ -5,7 +5,10 @@ require("bufferline").setup({
|
|||||||
right_mouse_command = nil,
|
right_mouse_command = nil,
|
||||||
left_mouse_command = "buffer %d",
|
left_mouse_command = "buffer %d",
|
||||||
middle_mouse_command = nil,
|
middle_mouse_command = nil,
|
||||||
indicator_icon = "▎",
|
indicator = {
|
||||||
|
icon = '▎', -- this should be omitted if indicator style is not 'icon'
|
||||||
|
style = 'icon',
|
||||||
|
},
|
||||||
buffer_close_icon = "",
|
buffer_close_icon = "",
|
||||||
modified_icon = "●",
|
modified_icon = "●",
|
||||||
close_icon = "",
|
close_icon = "",
|
||||||
|
|||||||
65
lua/config/dashboard-nvim.lua
Normal file
65
lua/config/dashboard-nvim.lua
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
local dashboard = require("dashboard")
|
||||||
|
|
||||||
|
dashboard.custom_header = {
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗",
|
||||||
|
" ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║",
|
||||||
|
" ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║",
|
||||||
|
" ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║",
|
||||||
|
" ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║",
|
||||||
|
" ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
}
|
||||||
|
|
||||||
|
dashboard.custom_center = {
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Find File ",
|
||||||
|
action = "Leaderf file --popup",
|
||||||
|
shortcut = "<Leader> f f",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Recently opened files ",
|
||||||
|
action = "Leaderf mru --popup",
|
||||||
|
shortcut = "<Leader> f r",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Project grep ",
|
||||||
|
action = "Leaderf rg --popup",
|
||||||
|
shortcut = "<Leader> f g",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Open Nvim config ",
|
||||||
|
action = "tabnew $MYVIMRC | tcd %:p:h",
|
||||||
|
shortcut = "<Leader> e v",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "New file ",
|
||||||
|
action = "enew",
|
||||||
|
shortcut = "e ",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon = " ",
|
||||||
|
desc = "Quit Nvim ",
|
||||||
|
-- desc = "Quit Nvim ",
|
||||||
|
action = "qa",
|
||||||
|
shortcut = "q "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
augroup dashboard_enter
|
||||||
|
au!
|
||||||
|
autocmd FileType dashboard nnoremap <buffer> q :qa<CR>
|
||||||
|
autocmd FileType dashboard nnoremap <buffer> e :enew<CR>
|
||||||
|
augroup END
|
||||||
|
]])
|
||||||
1
lua/config/fidget-nvim.lua
Normal file
1
lua/config/fidget-nvim.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
require"fidget".setup{}
|
||||||
34
lua/config/hlslens.lua
Normal file
34
lua/config/hlslens.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
require('hlslens').setup({
|
||||||
|
calm_down = true,
|
||||||
|
nearest_only = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
local activate_hlslens = function(direction)
|
||||||
|
local cmd = string.format("normal! %s%szzzv", vim.v.count1, direction)
|
||||||
|
local status, msg = pcall(vim.fn.execute, cmd)
|
||||||
|
-- 13 is the index where real error message starts
|
||||||
|
msg = msg:sub(13)
|
||||||
|
|
||||||
|
if not status then
|
||||||
|
vim.api.nvim_echo({{msg, "ErrorMsg"}}, false, {})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
require('hlslens').start()
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'n', '',
|
||||||
|
{
|
||||||
|
noremap = true,
|
||||||
|
silent = true,
|
||||||
|
callback = function() activate_hlslens('n') end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'N', '',
|
||||||
|
{
|
||||||
|
noremap = true,
|
||||||
|
silent = true,
|
||||||
|
callback = function() activate_hlslens('N') end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set('n', '*', "<Plug>(asterisk-z*)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
||||||
|
vim.keymap.set('n', '#', "<Plug>(asterisk-z#)<Cmd>lua require('hlslens').start()<CR>", { silent = true })
|
||||||
@@ -1,16 +1,23 @@
|
|||||||
require("indent_blankline").setup {
|
require("indent_blankline").setup({
|
||||||
-- U+2502 may also be a good choice, it will be on the middle of cursor.
|
-- U+2502 may also be a good choice, it will be on the middle of cursor.
|
||||||
|
-- U+250A is also a good choice
|
||||||
char = "▏",
|
char = "▏",
|
||||||
show_end_of_line = false,
|
show_end_of_line = false,
|
||||||
disable_with_nolist = true,
|
disable_with_nolist = true,
|
||||||
buftype_exclude = {"terminal"},
|
buftype_exclude = { "terminal" },
|
||||||
filetype_exclude = { "help", "git", "markdown", "snippets", "text" },
|
filetype_exclude = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha" },
|
||||||
}
|
})
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
function! Should_activate_indentblankline() abort
|
||||||
|
if index(g:indent_blankline_filetype_exclude, &filetype) == -1
|
||||||
|
IndentBlanklineEnable
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
vim.cmd[[
|
|
||||||
augroup indent_blankline
|
augroup indent_blankline
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd InsertEnter * IndentBlanklineDisable
|
autocmd InsertEnter * IndentBlanklineDisable
|
||||||
autocmd InsertLeave * IndentBlanklineEnable
|
autocmd InsertLeave * call Should_activate_indentblankline()
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]])
|
||||||
|
|||||||
@@ -1,58 +1,66 @@
|
|||||||
local M = {}
|
local fn = vim.fn
|
||||||
|
local api = vim.api
|
||||||
|
local lsp = vim.lsp
|
||||||
|
|
||||||
function M.show_line_diagnostics()
|
local utils = require("utils")
|
||||||
local opts = {
|
|
||||||
focusable = false,
|
|
||||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
|
||||||
border = 'single'
|
|
||||||
}
|
|
||||||
vim.lsp.diagnostic.show_line_diagnostics(opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
local custom_attach = function(client, bufnr)
|
local custom_attach = function(client, bufnr)
|
||||||
local function buf_set_keymap(...)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
|
||||||
end
|
|
||||||
local function buf_set_option(...)
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { silent = true, buffer = bufnr }
|
||||||
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
buf_set_keymap("n", "<C-]>", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
vim.keymap.set("n", "<C-]>", vim.lsp.buf.definition, opts)
|
||||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
vim.keymap.set("n", "<space>wl", function() inspect(vim.lsp.buf.list_workspace_folders()) end, opts)
|
||||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
vim.keymap.set("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, opts)
|
||||||
buf_set_keymap("n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts)
|
||||||
|
|
||||||
vim.cmd([[
|
api.nvim_create_autocmd("CursorHold", {
|
||||||
autocmd CursorHold <buffer> lua require('config.lsp').show_line_diagnostics()
|
buffer=bufnr,
|
||||||
]])
|
callback = function()
|
||||||
|
local float_opts = {
|
||||||
|
focusable = false,
|
||||||
|
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||||
|
border = 'rounded',
|
||||||
|
source = 'always', -- show source in diagnostic popup window
|
||||||
|
prefix = ' '
|
||||||
|
}
|
||||||
|
|
||||||
|
if not vim.b.diagnostics_pos then
|
||||||
|
vim.b.diagnostics_pos = { nil, nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
local cursor_pos = api.nvim_win_get_cursor(0)
|
||||||
|
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and
|
||||||
|
#vim.diagnostic.get() > 0
|
||||||
|
then
|
||||||
|
vim.diagnostic.open_float(nil, float_opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.b.diagnostics_pos = cursor_pos
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- Set some key bindings 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)
|
vim.keymap.set("n", "<space>f", vim.lsp.buf.formatting_sync, opts)
|
||||||
end
|
end
|
||||||
if client.resolved_capabilities.document_range_formatting then
|
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
|
end
|
||||||
|
|
||||||
-- The blow command will highlight the current variable and its usages in the buffer.
|
-- The blow command will highlight the current variable and its usages in the buffer.
|
||||||
if client.resolved_capabilities.document_highlight then
|
if client.resolved_capabilities.document_highlight then
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
hi link LspReferenceRead Visual
|
hi! link LspReferenceRead Visual
|
||||||
hi link LspReferenceText Visual
|
hi! link LspReferenceText Visual
|
||||||
hi link LspReferenceWrite Visual
|
hi! link LspReferenceWrite Visual
|
||||||
augroup lsp_document_highlight
|
augroup lsp_document_highlight
|
||||||
autocmd! * <buffer>
|
autocmd! * <buffer>
|
||||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||||
@@ -63,16 +71,18 @@ local custom_attach = function(client, bufnr)
|
|||||||
|
|
||||||
if vim.g.logging_level == 'debug' then
|
if vim.g.logging_level == 'debug' then
|
||||||
local msg = string.format("Language server %s started!", client.name)
|
local msg = string.format("Language server %s started!", client.name)
|
||||||
vim.notify(msg, 'info', {title = 'Nvim-config'})
|
vim.notify(msg, vim.log.levels.DEBUG, {title = 'Nvim-config'})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.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
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
lspconfig.pylsp.setup({
|
if utils.executable('pylsp') then
|
||||||
|
lspconfig.pylsp.setup({
|
||||||
on_attach = custom_attach,
|
on_attach = custom_attach,
|
||||||
settings = {
|
settings = {
|
||||||
pylsp = {
|
pylsp = {
|
||||||
@@ -90,61 +100,78 @@ lspconfig.pylsp.setup({
|
|||||||
debounce_text_changes = 200,
|
debounce_text_changes = 200,
|
||||||
},
|
},
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
vim.notify("pylsp not found!", vim.log.levels.WARN, {title = 'Nvim-config'})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if utils.executable('pyright') then
|
||||||
-- lspconfig.pyright.setup{
|
-- lspconfig.pyright.setup{
|
||||||
-- on_attach = custom_attach,
|
-- on_attach = custom_attach,
|
||||||
-- capabilities = capabilities
|
-- capabilities = capabilities
|
||||||
-- }
|
-- }
|
||||||
|
-- else
|
||||||
|
-- vim.notify("pyright not found!", vim.log.levels.WARN, {title = 'Nvim-config'})
|
||||||
|
-- end
|
||||||
|
|
||||||
lspconfig.clangd.setup({
|
if utils.executable('clangd') then
|
||||||
|
lspconfig.clangd.setup({
|
||||||
on_attach = custom_attach,
|
on_attach = custom_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
filetypes = { "c", "cpp", "cc" },
|
filetypes = { "c", "cpp", "cc" },
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 500,
|
debounce_text_changes = 500,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
vim.notify("clangd not found!", vim.log.levels.WARN, {title = 'Nvim-config'})
|
||||||
|
end
|
||||||
|
|
||||||
-- set up vim-language-server
|
-- set up vim-language-server
|
||||||
lspconfig.vimls.setup({
|
if utils.executable('vim-language-server') then
|
||||||
|
lspconfig.vimls.setup({
|
||||||
on_attach = custom_attach,
|
on_attach = custom_attach,
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 500,
|
debounce_text_changes = 500,
|
||||||
},
|
},
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
else
|
||||||
|
vim.notify("vim-language-server not found!", vim.log.levels.WARN, {title = 'Nvim-config'})
|
||||||
|
end
|
||||||
|
|
||||||
local sumneko_binary_path = vim.fn.exepath("lua-language-server")
|
-- set up bash-language-server
|
||||||
if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then
|
if utils.executable('bash-language-server') then
|
||||||
local sumneko_root_path = vim.fn.fnamemodify(sumneko_binary_path, ":h:h:h")
|
lspconfig.bashls.setup({
|
||||||
|
on_attach = custom_attach,
|
||||||
local runtime_path = vim.split(package.path, ";")
|
capabilities = capabilities,
|
||||||
table.insert(runtime_path, "lua/?.lua")
|
})
|
||||||
table.insert(runtime_path, "lua/?/init.lua")
|
end
|
||||||
|
|
||||||
require("lspconfig").sumneko_lua.setup({
|
if utils.executable("lua-language-server") then
|
||||||
|
-- settings for lua-language-server can be found on https://github.com/sumneko/lua-language-server/wiki/Settings .
|
||||||
|
lspconfig.sumneko_lua.setup({
|
||||||
on_attach = custom_attach,
|
on_attach = custom_attach,
|
||||||
cmd = { sumneko_binary_path, "-E", sumneko_root_path .. "/main.lua" },
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
-- Setup your lua path
|
|
||||||
path = runtime_path,
|
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = { "vim" },
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files,
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
-- see also https://github.com/sumneko/lua-language-server/wiki/Libraries#link-to-workspace .
|
||||||
|
-- Lua-dev.nvim also has similar settings for sumneko lua, https://github.com/folke/lua-dev.nvim/blob/main/lua/lua-dev/sumneko.lua .
|
||||||
|
library = {
|
||||||
|
fn.stdpath('data') .. "/site/pack/packer/opt/emmylua-nvim",
|
||||||
|
fn.stdpath('config'),
|
||||||
},
|
},
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
maxPreload = 2000,
|
||||||
telemetry = {
|
preloadFileSize = 50000,
|
||||||
enable = false,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -153,54 +180,27 @@ if vim.g.is_mac or vim.g.is_linux and sumneko_binary_path ~= "" then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Change diagnostic signs.
|
-- Change diagnostic signs.
|
||||||
vim.fn.sign_define("LspDiagnosticsSignError", { text = "✗", texthl = "LspDiagnosticsDefaultError" })
|
fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" })
|
||||||
vim.fn.sign_define("LspDiagnosticsSignWarning", { text = "!", texthl = "LspDiagnosticsDefaultWarning" })
|
fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" })
|
||||||
vim.fn.sign_define("LspDiagnosticsSignInformation", { text = "", texthl = "LspDiagnosticsDefaultInformation" })
|
fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" })
|
||||||
vim.fn.sign_define("LspDiagnosticsSignHint", { text = "", texthl = "LspDiagnosticsDefaultHint" })
|
fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
-- global config for diagnostic
|
||||||
|
vim.diagnostic.config({
|
||||||
underline = false,
|
underline = false,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
signs = true,
|
signs = true,
|
||||||
update_in_insert = false,
|
severity_sort = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Refs: https://github.com/neovim/nvim-lspconfig/wiki/UI-customization#show-source-in-diagnostics
|
-- lsp.handlers["textDocument/publishDiagnostics"] = lsp.with(lsp.diagnostic.on_publish_diagnostics, {
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = function(_, result, context, _)
|
-- underline = false,
|
||||||
-- result contains diagnostics and uri
|
-- virtual_text = false,
|
||||||
-- context contains client_id and method, but not always buf_nr
|
-- signs = true,
|
||||||
local client_id = context.client_id
|
-- update_in_insert = false,
|
||||||
local diagnostics = result.diagnostics
|
-- })
|
||||||
local uri = result.uri
|
|
||||||
|
|
||||||
local bufnr = vim.uri_to_bufnr(uri)
|
-- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998.
|
||||||
if not bufnr then
|
lsp.handlers["textDocument/hover"] = lsp.with(vim.lsp.handlers.hover, {
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if not vim.api.nvim_buf_is_loaded(bufnr) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- change diagnostics format
|
|
||||||
for i, v in ipairs(diagnostics) do
|
|
||||||
diagnostics[i].message = string.format("%s: %s", v.source, v.message)
|
|
||||||
end
|
|
||||||
vim.lsp.diagnostic.save(diagnostics, bufnr, client_id)
|
|
||||||
|
|
||||||
local config = {
|
|
||||||
underline = false,
|
|
||||||
virtual_text = false,
|
|
||||||
signs = true,
|
|
||||||
update_in_insert = false,
|
|
||||||
}
|
|
||||||
vim.lsp.diagnostic.display(diagnostics, bufnr, client_id, config)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The following settings works with the bleeding edge neovim.
|
|
||||||
-- See https://github.com/neovim/neovim/pull/13998.
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
})
|
})
|
||||||
|
|
||||||
return M
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ cmp.setup({
|
|||||||
vim.fn["UltiSnips#Anon"](args.body)
|
vim.fn["UltiSnips#Anon"](args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<Tab>'] = function(fallback)
|
['<Tab>'] = function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
@@ -24,39 +24,60 @@ cmp.setup({
|
|||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
['<Esc>'] = cmp.mapping.close(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<Esc>'] = cmp.mapping.close(),
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
},
|
}),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
||||||
{ name = 'ultisnips' }, -- For ultisnips user.
|
{ name = 'ultisnips' }, -- For ultisnips user.
|
||||||
{ name = 'nvim_lua' }, -- for nvim lua function
|
|
||||||
{ name = 'path' }, -- for path completion
|
{ name = 'path' }, -- for path completion
|
||||||
{ name = 'buffer', keyword_length = 4 }, -- for buffer word completion
|
{ name = 'buffer', keyword_length = 4 }, -- for buffer word completion
|
||||||
|
{ name = 'omni' },
|
||||||
{ name = 'emoji', insert = true, } -- emoji completion
|
{ name = 'emoji', insert = true, } -- emoji completion
|
||||||
},
|
},
|
||||||
completion = {
|
completion = {
|
||||||
keyword_length = 1,
|
keyword_length = 1,
|
||||||
completeopt = "menu,noselect"
|
completeopt = "menu,noselect"
|
||||||
},
|
},
|
||||||
experimental = {
|
view = {
|
||||||
ghost_text = false
|
entries = 'custom',
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
with_text = false,
|
mode = "symbol_text",
|
||||||
menu = {
|
menu = ({
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
ultisnips = "[US]",
|
ultisnips = "[US]",
|
||||||
nvim_lua = "[Lua]",
|
nvim_lua = "[Lua]",
|
||||||
path = "[Path]",
|
path = "[Path]",
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buffer]",
|
||||||
emoji = "[Emoji]",
|
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
|
||||||
|
]]
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ nvim_notify.setup({
|
|||||||
stages = "fade_in_slide_out",
|
stages = "fade_in_slide_out",
|
||||||
-- Default timeout for notifications
|
-- Default timeout for notifications
|
||||||
timeout = 1500,
|
timeout = 1500,
|
||||||
|
background_colour = "#2E3440",
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.notify = nvim_notify
|
vim.notify = nvim_notify
|
||||||
|
|||||||
119
lua/config/nvim-tree.lua
Normal file
119
lua/config/nvim-tree.lua
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
local nvim_tree = require("nvim-tree")
|
||||||
|
|
||||||
|
nvim_tree.setup({
|
||||||
|
auto_reload_on_write = true,
|
||||||
|
disable_netrw = false,
|
||||||
|
hijack_cursor = false,
|
||||||
|
hijack_netrw = true,
|
||||||
|
hijack_unnamed_buffer_when_opening = false,
|
||||||
|
ignore_buffer_on_setup = false,
|
||||||
|
open_on_setup = false,
|
||||||
|
open_on_setup_file = false,
|
||||||
|
open_on_tab = false,
|
||||||
|
sort_by = "name",
|
||||||
|
update_cwd = false,
|
||||||
|
view = {
|
||||||
|
width = 30,
|
||||||
|
height = 30,
|
||||||
|
hide_root_folder = false,
|
||||||
|
side = "left",
|
||||||
|
preserve_window_proportions = false,
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
|
signcolumn = "yes",
|
||||||
|
mappings = {
|
||||||
|
custom_only = false,
|
||||||
|
list = {
|
||||||
|
-- user mappings go here
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
indent_markers = {
|
||||||
|
enable = false,
|
||||||
|
icons = {
|
||||||
|
corner = "└ ",
|
||||||
|
edge = "│ ",
|
||||||
|
none = " ",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
webdev_colors = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hijack_directories = {
|
||||||
|
enable = true,
|
||||||
|
auto_open = true,
|
||||||
|
},
|
||||||
|
update_focused_file = {
|
||||||
|
enable = false,
|
||||||
|
update_cwd = false,
|
||||||
|
ignore_list = {},
|
||||||
|
},
|
||||||
|
ignore_ft_on_setup = {},
|
||||||
|
system_open = {
|
||||||
|
cmd = "",
|
||||||
|
args = {},
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
enable = false,
|
||||||
|
show_on_dirs = false,
|
||||||
|
icons = {
|
||||||
|
hint = "",
|
||||||
|
info = "",
|
||||||
|
warning = "",
|
||||||
|
error = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = false,
|
||||||
|
custom = {},
|
||||||
|
exclude = {},
|
||||||
|
},
|
||||||
|
git = {
|
||||||
|
enable = true,
|
||||||
|
ignore = true,
|
||||||
|
timeout = 400,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
use_system_clipboard = true,
|
||||||
|
change_dir = {
|
||||||
|
enable = true,
|
||||||
|
global = false,
|
||||||
|
restrict_above_cwd = false,
|
||||||
|
},
|
||||||
|
open_file = {
|
||||||
|
quit_on_open = false,
|
||||||
|
resize_window = false,
|
||||||
|
window_picker = {
|
||||||
|
enable = true,
|
||||||
|
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
|
||||||
|
exclude = {
|
||||||
|
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||||
|
buftype = { "nofile", "terminal", "help" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
trash = {
|
||||||
|
cmd = "trash",
|
||||||
|
require_confirm = true,
|
||||||
|
},
|
||||||
|
log = {
|
||||||
|
enable = false,
|
||||||
|
truncate = false,
|
||||||
|
types = {
|
||||||
|
all = false,
|
||||||
|
config = false,
|
||||||
|
copy_paste = false,
|
||||||
|
diagnostics = false,
|
||||||
|
git = false,
|
||||||
|
profile = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<space>s', function()
|
||||||
|
return require('nvim-tree').toggle(false, true)
|
||||||
|
end,
|
||||||
|
{ noremap = true, silent = true, desc = "toggle nvim-tree"})
|
||||||
@@ -1,6 +1,14 @@
|
|||||||
vim.cmd[[ hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff ]]
|
vim.cmd[[ hi HopNextKey cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff ]]
|
||||||
|
vim.cmd[[ hi HopNextKey1 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff ]]
|
||||||
|
vim.cmd[[ hi HopNextKey2 cterm=bold ctermfg=176 gui=bold guibg=#ff00ff guifg=#ffffff ]]
|
||||||
|
|
||||||
require('hop').setup({
|
require('hop').setup({
|
||||||
case_insensitive = true,
|
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})
|
vim.keymap.set('n', 'f', function()
|
||||||
|
return require('hop').hint_char2()
|
||||||
|
end,
|
||||||
|
{ silent = true, noremap = true, desc = "nvim-hop char2" })
|
||||||
|
|||||||
142
lua/config/statusline.lua
Normal file
142
lua/config/statusline.lua
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
|
local function spell()
|
||||||
|
if vim.o.spell then
|
||||||
|
return string.format("[SPELL]")
|
||||||
|
end
|
||||||
|
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ime_state()
|
||||||
|
if vim.g.is_mac then
|
||||||
|
-- ref: https://github.com/vim-airline/vim-airline/blob/master/autoload/airline/extensions/xkblayout.vim#L11
|
||||||
|
local layout = fn.libcall(vim.g.XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||||
|
if layout == '0' then
|
||||||
|
return '[CN]'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local function trailing_space()
|
||||||
|
if not vim.o.modifiable then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local line_num = nil
|
||||||
|
|
||||||
|
for i=1, fn.line('$') do
|
||||||
|
local linetext = fn.getline(i)
|
||||||
|
-- To prevent invalid escape error, we wrap the regex string with `[[]]`.
|
||||||
|
local idx = fn.match(linetext, [[\v\s+$]])
|
||||||
|
|
||||||
|
if idx ~= -1 then
|
||||||
|
line_num = i
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local msg = ""
|
||||||
|
if line_num ~= nil then
|
||||||
|
msg = string.format("[%d]trailing", line_num)
|
||||||
|
end
|
||||||
|
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
|
||||||
|
local function mixed_indent()
|
||||||
|
if not vim.o.modifiable then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local space_pat = [[\v^ +]]
|
||||||
|
local tab_pat = [[\v^\t+]]
|
||||||
|
local space_indent = fn.search(space_pat, 'nwc')
|
||||||
|
local tab_indent = fn.search(tab_pat, 'nwc')
|
||||||
|
local mixed = (space_indent > 0 and tab_indent > 0)
|
||||||
|
local mixed_same_line
|
||||||
|
if not mixed then
|
||||||
|
mixed_same_line = fn.search([[\v^(\t+ | +\t)]], 'nwc')
|
||||||
|
mixed = mixed_same_line > 0
|
||||||
|
end
|
||||||
|
if not mixed then return '' end
|
||||||
|
if mixed_same_line ~= nil and mixed_same_line > 0 then
|
||||||
|
return 'MI:'..mixed_same_line
|
||||||
|
end
|
||||||
|
local space_indent_cnt = fn.searchcount({pattern=space_pat, max_count=1e3}).total
|
||||||
|
local tab_indent_cnt = fn.searchcount({pattern=tab_pat, max_count=1e3}).total
|
||||||
|
if space_indent_cnt > tab_indent_cnt then
|
||||||
|
return 'MI:'..tab_indent
|
||||||
|
else
|
||||||
|
return 'MI:'..space_indent
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = "auto",
|
||||||
|
-- component_separators = { left = "", right = "" },
|
||||||
|
-- section_separators = { left = "", right = "" },
|
||||||
|
section_separators = "",
|
||||||
|
component_separators = "",
|
||||||
|
disabled_filetypes = {},
|
||||||
|
always_divide_middle = true,
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { "mode" },
|
||||||
|
lualine_b = { "branch", "diff" },
|
||||||
|
lualine_c = {
|
||||||
|
"filename",
|
||||||
|
{
|
||||||
|
ime_state,
|
||||||
|
color = {fg = 'black', bg = '#f46868'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
spell,
|
||||||
|
color = {fg = 'black', bg = '#a7c080'}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
"encoding",
|
||||||
|
{
|
||||||
|
"fileformat",
|
||||||
|
symbols = {
|
||||||
|
unix = "unix",
|
||||||
|
dos = "win",
|
||||||
|
mac = "mac",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"filetype",
|
||||||
|
},
|
||||||
|
lualine_y = { "progress" },
|
||||||
|
lualine_z = {
|
||||||
|
"location",
|
||||||
|
{
|
||||||
|
"diagnostics",
|
||||||
|
sources = { "nvim_diagnostic" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
trailing_space,
|
||||||
|
color = "WarningMsg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
mixed_indent,
|
||||||
|
color = "WarningMsg"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {},
|
||||||
|
lualine_c = { "filename" },
|
||||||
|
lualine_x = { "location" },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
extensions = {'quickfix', 'fugitive', 'nvim-tree'},
|
||||||
|
})
|
||||||
|
|
||||||
89
lua/custom-autocmd.lua
Normal file
89
lua/custom-autocmd.lua
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
local api = vim.api
|
||||||
|
|
||||||
|
local utils = require("utils")
|
||||||
|
|
||||||
|
|
||||||
|
-- Display a message when the current file is not in utf-8 format.
|
||||||
|
-- Note that we need to use `unsilent` command here because of this issue:
|
||||||
|
-- https://github.com/vim/vim/issues/4379
|
||||||
|
api.nvim_create_augroup("non_utf8_file", {
|
||||||
|
clear = true
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "BufRead" }, {
|
||||||
|
pattern = "*",
|
||||||
|
group = "non_utf8_file",
|
||||||
|
callback = function()
|
||||||
|
if vim.bo.fileencoding ~= 'utf-8' then
|
||||||
|
vim.notify("File not in UTF-8 format!", vim.log.levels.WARN, { title = "nvim-config" })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- highlight yanked region, see `:h lua-highlight`
|
||||||
|
api.nvim_create_augroup("highlight_yank", {
|
||||||
|
clear = true
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "TextYankPost" }, {
|
||||||
|
pattern = "*",
|
||||||
|
group = "highlight_yank",
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank { higroup = "YankColor", timeout = 300, on_visual = false }
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Auto-generate packer_compiled.lua file
|
||||||
|
api.nvim_create_augroup("packer_auto_compile", {
|
||||||
|
clear = true
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||||
|
pattern = "*/nvim/lua/plugins.lua",
|
||||||
|
group = "packer_auto_compile",
|
||||||
|
callback = function(ctx)
|
||||||
|
local cmd = "source " .. ctx.file
|
||||||
|
vim.cmd(cmd)
|
||||||
|
vim.cmd("PackerCompile")
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Auto-create dir when saving a file, in case some intermediate directory does not exist
|
||||||
|
api.nvim_create_augroup("auto_create_dir", {
|
||||||
|
clear = true
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
|
pattern = "*",
|
||||||
|
group = "auto_create_dir",
|
||||||
|
callback = function(ctx)
|
||||||
|
local dir = fn.fnamemodify(ctx.file, ":p:h")
|
||||||
|
utils.may_create_dir(dir)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Automatically reload the file if it is changed outside of Nvim, see https://unix.stackexchange.com/a/383044/221410.
|
||||||
|
-- It seems that `checktime` does not work in command line. We need to check if we are in command
|
||||||
|
-- line before executing this command, see also https://vi.stackexchange.com/a/20397/15292 .
|
||||||
|
api.nvim_create_augroup("auto_read", {
|
||||||
|
clear = true
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "FileChangedShellPost" }, {
|
||||||
|
pattern = "*",
|
||||||
|
group = "auto_read",
|
||||||
|
callback = function()
|
||||||
|
vim.notify("File changed on disk. Buffer reloaded!", vim.log.levels.WARN, { title = "nvim-config" })
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
api.nvim_create_autocmd({ "FocusGained", "CursorHold" }, {
|
||||||
|
pattern = "*",
|
||||||
|
group = "auto_read",
|
||||||
|
callback = function()
|
||||||
|
if fn.getcmdwintype() == '' then
|
||||||
|
vim.cmd("checktime")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
11
lua/custom-map.lua
Normal file
11
lua/custom-map.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local keymap = vim.keymap
|
||||||
|
|
||||||
|
-- Go to the beginning and end of current line in insert mode quickly
|
||||||
|
keymap.set('i', '<C-A>', '<HOME>')
|
||||||
|
keymap.set('i', '<C-E>', '<END>')
|
||||||
|
|
||||||
|
-- Go to beginning of command in command-line mode
|
||||||
|
keymap.set('c', '<C-A>', '<HOME>')
|
||||||
|
|
||||||
|
-- Delete the character to the right of the cursor
|
||||||
|
keymap.set('i', '<C-D>', '<DEL>')
|
||||||
155
lua/plugins.lua
155
lua/plugins.lua
@@ -1,21 +1,23 @@
|
|||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
|
|
||||||
vim.g.package_home = fn.stdpath("data") .. "/site/pack/packer/"
|
-- The root dir to install all plugins. Plugins are under opt/ or start/ sub-directory.
|
||||||
local packer_install_dir = vim.g.package_home .. "/opt/packer.nvim"
|
vim.g.plugin_home = fn.stdpath("data") .. "/site/pack/packer"
|
||||||
|
|
||||||
local plug_url_format = ""
|
-- Where to install packer.nvim -- the package manager (we make it opt)
|
||||||
if vim.g.is_linux then
|
local packer_dir = vim.g.plugin_home .. "/opt/packer.nvim"
|
||||||
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")
|
-- Whether this is a fresh install, i.e., packer itself and plugins have not been installed.
|
||||||
local install_cmd = string.format("10split |term git clone --depth=1 %s %s", packer_repo, packer_install_dir)
|
local fresh_install = false
|
||||||
|
|
||||||
-- Auto-install packer in case it hasn't been installed.
|
-- Auto-install packer in case it hasn't been installed.
|
||||||
if fn.glob(packer_install_dir) == "" then
|
if fn.glob(packer_dir) == "" then
|
||||||
|
fresh_install = true
|
||||||
|
|
||||||
|
-- Now we need to install packer.nvim first.
|
||||||
|
local packer_repo = "https://github.com/wbthomason/packer.nvim"
|
||||||
|
local install_cmd = string.format("!git clone --depth=1 %s %s", packer_repo, packer_dir)
|
||||||
|
|
||||||
vim.api.nvim_echo({ { "Installing packer.nvim", "Type" } }, true, {})
|
vim.api.nvim_echo({ { "Installing packer.nvim", "Type" } }, true, {})
|
||||||
vim.cmd(install_cmd)
|
vim.cmd(install_cmd)
|
||||||
end
|
end
|
||||||
@@ -23,38 +25,40 @@ end
|
|||||||
-- Load packer.nvim
|
-- Load packer.nvim
|
||||||
vim.cmd("packadd packer.nvim")
|
vim.cmd("packadd packer.nvim")
|
||||||
|
|
||||||
require("packer").startup({
|
local packer = require("packer")
|
||||||
|
local packer_util = require('packer.util')
|
||||||
|
|
||||||
|
packer.startup({
|
||||||
function(use)
|
function(use)
|
||||||
|
-- it is recommended to put impatient.nvim before any other plugins
|
||||||
|
use {'lewis6991/impatient.nvim', config = [[require('impatient')]]}
|
||||||
|
|
||||||
use({"wbthomason/packer.nvim", opt = true})
|
use({"wbthomason/packer.nvim", opt = true})
|
||||||
|
|
||||||
use {"onsails/lspkind-nvim", event = "BufEnter"}
|
use({"onsails/lspkind-nvim", event = "VimEnter"})
|
||||||
-- auto-completion engine
|
-- auto-completion engine
|
||||||
use {"hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]]}
|
use {"hrsh7th/nvim-cmp", after = "lspkind-nvim", config = [[require('config.nvim-cmp')]]}
|
||||||
|
|
||||||
-- nvim-cmp completion sources
|
-- nvim-cmp completion sources
|
||||||
use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}
|
use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}
|
||||||
|
-- use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
|
||||||
-- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
|
|
||||||
use({ "neovim/nvim-lspconfig", after = "cmp-nvim-lsp", config = [[require('config.lsp')]] })
|
|
||||||
|
|
||||||
use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
|
|
||||||
use {"hrsh7th/cmp-path", after = "nvim-cmp"}
|
use {"hrsh7th/cmp-path", after = "nvim-cmp"}
|
||||||
use {"hrsh7th/cmp-buffer", 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 {"hrsh7th/cmp-cmdline", after = "nvim-cmp"}
|
||||||
use {"quangnguyen30192/cmp-nvim-ultisnips", after = {'nvim-cmp', 'ultisnips'}}
|
use {"quangnguyen30192/cmp-nvim-ultisnips", after = {'nvim-cmp', 'ultisnips'}}
|
||||||
if vim.g.is_mac then
|
if vim.g.is_mac then
|
||||||
use {"hrsh7th/cmp-emoji", after = 'nvim-cmp'}
|
use {"hrsh7th/cmp-emoji", after = 'nvim-cmp'}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- nvim-lsp configuration (it relies on cmp-nvim-lsp, so it should be loaded after cmp-nvim-lsp).
|
||||||
|
use({ "neovim/nvim-lspconfig", after = "cmp-nvim-lsp", config = [[require('config.lsp')]] })
|
||||||
|
|
||||||
if vim.g.is_mac then
|
if vim.g.is_mac then
|
||||||
use({ "nvim-treesitter/nvim-treesitter", event = 'BufEnter', run = ":TSUpdate", config = [[require('config.treesitter')]] })
|
use({ "nvim-treesitter/nvim-treesitter", event = 'BufEnter', run = ":TSUpdate", config = [[require('config.treesitter')]] })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Python syntax highlighting and more
|
|
||||||
if vim.g.is_win then
|
|
||||||
use({ "numirias/semshi", ft = "python", config = "vim.cmd [[UpdateRemotePlugins]]" })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Python indent (follows the PEP8 style)
|
-- Python indent (follows the PEP8 style)
|
||||||
use({ "Vimjas/vim-python-pep8-indent", ft = { "python" } })
|
use({ "Vimjas/vim-python-pep8-indent", ft = { "python" } })
|
||||||
|
|
||||||
@@ -70,16 +74,24 @@ require("packer").startup({
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Super fast buffer jump
|
-- Super fast buffer jump
|
||||||
use { 'phaazon/hop.nvim', event = "VimEnter", config = [[require('config.nvim_hop')]] }
|
use {
|
||||||
|
'phaazon/hop.nvim',
|
||||||
|
event = "VimEnter",
|
||||||
|
config = function()
|
||||||
|
vim.defer_fn(function() require('config.nvim_hop') end, 2000)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
-- Clear highlight search automatically for you
|
-- Clear highlight search automatically for you
|
||||||
use({"romainl/vim-cool", event = "VimEnter"})
|
-- use({"romainl/vim-cool", event = "VimEnter"})
|
||||||
|
|
||||||
-- Show current search term in different color
|
-- Show match number and index for searching
|
||||||
use({"PeterRincker/vim-searchlight", event = "VimEnter"})
|
use {
|
||||||
|
'kevinhwang91/nvim-hlslens',
|
||||||
-- Show match number for search
|
branch = 'main',
|
||||||
use({"kevinhwang91/nvim-hlslens", event = 'VimEnter'})
|
keys = {{'n', '*'}, {'n', '#'}, {'n', 'n'}, {'n', 'N'}},
|
||||||
|
config = [[require('config.hlslens')]]
|
||||||
|
}
|
||||||
|
|
||||||
-- Stay after pressing * and search selected text
|
-- Stay after pressing * and search selected text
|
||||||
use({"haya14busa/vim-asterisk", event = 'VimEnter'})
|
use({"haya14busa/vim-asterisk", event = 'VimEnter'})
|
||||||
@@ -92,11 +104,11 @@ require("packer").startup({
|
|||||||
end
|
end
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim', cmd = 'Telescope',
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
}
|
}
|
||||||
-- search emoji and other symbols
|
-- search emoji and other symbols
|
||||||
use 'nvim-telescope/telescope-symbols.nvim'
|
use {'nvim-telescope/telescope-symbols.nvim', after = 'telescope.nvim'}
|
||||||
|
|
||||||
-- Another similar plugin is command-t
|
-- Another similar plugin is command-t
|
||||||
-- use 'wincent/command-t'
|
-- use 'wincent/command-t'
|
||||||
@@ -117,27 +129,44 @@ require("packer").startup({
|
|||||||
use({"NTBBloodbath/doom-one.nvim", opt = true})
|
use({"NTBBloodbath/doom-one.nvim", opt = true})
|
||||||
use({"sainnhe/everforest", opt = true})
|
use({"sainnhe/everforest", opt = true})
|
||||||
use({"EdenEast/nightfox.nvim", opt = true})
|
use({"EdenEast/nightfox.nvim", opt = true})
|
||||||
|
use({"rebelot/kanagawa.nvim", opt = true})
|
||||||
|
use({"catppuccin/nvim", as = "catppuccin", opt = true})
|
||||||
|
|
||||||
-- Show git change (change, delete, add) signs in vim sign column
|
-- Show git change (change, delete, add) signs in vim sign column
|
||||||
use({"mhinz/vim-signify", event = 'BufEnter'})
|
use({"mhinz/vim-signify", event = 'BufEnter'})
|
||||||
-- Another similar plugin
|
-- Another similar plugin
|
||||||
-- use 'airblade/vim-gitgutter'
|
-- use 'airblade/vim-gitgutter'
|
||||||
|
|
||||||
-- colorful status line and theme
|
use {'kyazdani42/nvim-web-devicons', event = 'VimEnter'}
|
||||||
use({"vim-airline/vim-airline-themes", after = 'vim-signify',})
|
|
||||||
use({"vim-airline/vim-airline", after = 'vim-airline-themes',})
|
use {
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
event = 'VimEnter',
|
||||||
|
config = [[require('config.statusline')]]
|
||||||
|
}
|
||||||
|
|
||||||
use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] })
|
use({ "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] })
|
||||||
|
|
||||||
use { 'goolord/alpha-nvim', config = [[require('config.alpha-nvim')]] }
|
|
||||||
-- fancy start screen
|
-- fancy start screen
|
||||||
use({ "lukas-reineke/indent-blankline.nvim", event = "VimEnter", config = [[require('config.indent-blankline')]] })
|
use { 'glepnir/dashboard-nvim', event = "VimEnter", config = [[require('config.dashboard-nvim')]] }
|
||||||
|
|
||||||
|
use({
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
event = 'VimEnter',
|
||||||
|
config = [[require('config.indent-blankline')]]
|
||||||
|
})
|
||||||
|
|
||||||
-- Highlight URLs inside vim
|
-- Highlight URLs inside vim
|
||||||
use({"itchyny/vim-highlighturl", event = "VimEnter"})
|
use({"itchyny/vim-highlighturl", event = "VimEnter"})
|
||||||
|
|
||||||
-- notification plugin
|
-- notification plugin
|
||||||
use({ "rcarriga/nvim-notify", event = "BufEnter", config = [[require('config.nvim-notify')]] })
|
use({
|
||||||
|
"rcarriga/nvim-notify",
|
||||||
|
event = "BufEnter",
|
||||||
|
config = function()
|
||||||
|
vim.defer_fn(function() require('config.nvim-notify') end, 2000)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
-- For Windows and Mac, we can open an URL in the browser. For Linux, it may
|
||||||
-- not be possible since we maybe in a server which disables GUI.
|
-- not be possible since we maybe in a server which disables GUI.
|
||||||
@@ -148,8 +177,6 @@ require("packer").startup({
|
|||||||
|
|
||||||
-- Only install these plugins if ctags are installed on the system
|
-- Only install these plugins if ctags are installed on the system
|
||||||
if utils.executable("ctags") then
|
if utils.executable("ctags") then
|
||||||
-- plugin to manage your tags
|
|
||||||
use({"ludovicchabant/vim-gutentags", event = "VimEnter"})
|
|
||||||
-- show file tags in vim window
|
-- show file tags in vim window
|
||||||
use({"liuchengxu/vista.vim", cmd = "Vista"})
|
use({"liuchengxu/vista.vim", cmd = "Vista"})
|
||||||
end
|
end
|
||||||
@@ -168,7 +195,7 @@ require("packer").startup({
|
|||||||
-- use 'mg979/vim-visual-multi'
|
-- use 'mg979/vim-visual-multi'
|
||||||
|
|
||||||
-- Autosave files on certain events
|
-- Autosave files on certain events
|
||||||
use({"Pocco81/AutoSave.nvim", event = "VimEnter", config = [[require('config.autosave')]]})
|
use({"907th/vim-auto-save", event = "InsertEnter"})
|
||||||
|
|
||||||
-- Show undo history visually
|
-- Show undo history visually
|
||||||
use({"simnalamburt/vim-mundo", cmd = {"MundoToggle", "MundoShow"}})
|
use({"simnalamburt/vim-mundo", cmd = {"MundoToggle", "MundoShow"}})
|
||||||
@@ -207,7 +234,9 @@ require("packer").startup({
|
|||||||
-- Better git log display
|
-- Better git log display
|
||||||
use({ "rbong/vim-flog", requires = "tpope/vim-fugitive", cmd = { "Flog" } })
|
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
|
-- Better git commit experience
|
||||||
use({"rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]]})
|
use({"rhysd/committia.vim", opt = true, setup = [[vim.cmd('packadd committia.vim')]]})
|
||||||
@@ -274,7 +303,13 @@ require("packer").startup({
|
|||||||
|
|
||||||
-- Smoothie motions
|
-- Smoothie motions
|
||||||
-- use 'psliwka/vim-smoothie'
|
-- use 'psliwka/vim-smoothie'
|
||||||
use({ "karb94/neoscroll.nvim", event = "VimEnter", config = [[require('config.neoscroll')]] })
|
use({
|
||||||
|
"karb94/neoscroll.nvim",
|
||||||
|
event = "VimEnter",
|
||||||
|
config = function()
|
||||||
|
vim.defer_fn(function() require('config.neoscroll') end, 2000)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
use({"tpope/vim-scriptease", cmd = {"Scriptnames", "Message", "Verbose"}})
|
use({"tpope/vim-scriptease", cmd = {"Scriptnames", "Message", "Verbose"}})
|
||||||
|
|
||||||
@@ -311,15 +346,41 @@ require("packer").startup({
|
|||||||
use({"gelguy/wilder.nvim", opt = true, setup = [[vim.cmd('packadd wilder.nvim')]]})
|
use({"gelguy/wilder.nvim", opt = true, setup = [[vim.cmd('packadd wilder.nvim')]]})
|
||||||
|
|
||||||
-- showing keybindings
|
-- showing keybindings
|
||||||
use {"folke/which-key.nvim", event = "VimEnter", config = [[require('config.which-key')]]}
|
use {"folke/which-key.nvim",
|
||||||
|
event = "VimEnter",
|
||||||
|
config = function()
|
||||||
|
vim.defer_fn(function() require('config.which-key') end, 2000)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
-- show and trim trailing whitespaces
|
-- show and trim trailing whitespaces
|
||||||
use {'jdhao/whitespace.nvim', event = 'VimEnter'}
|
use {'jdhao/whitespace.nvim', event = 'VimEnter'}
|
||||||
|
|
||||||
|
-- file explorer
|
||||||
|
use {
|
||||||
|
'kyazdani42/nvim-tree.lua',
|
||||||
|
requires = { 'kyazdani42/nvim-web-devicons' },
|
||||||
|
config = [[require('config.nvim-tree')]]
|
||||||
|
}
|
||||||
|
|
||||||
|
use { 'ii14/emmylua-nvim', ft = 'lua' }
|
||||||
|
|
||||||
|
use { 'j-hui/fidget.nvim', after = 'nvim-lspconfig', config = [[require('config.fidget-nvim')]]}
|
||||||
end,
|
end,
|
||||||
config = {
|
config = {
|
||||||
max_jobs = 16,
|
max_jobs = 16,
|
||||||
git = {
|
compile_path = packer_util.join_paths(fn.stdpath('data'), 'site', 'lua', 'packer_compiled.lua'),
|
||||||
default_url_format = plug_url_format,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- For fresh install, we need to install plugins. Otherwise, we just need to require `packer_compiled.lua`.
|
||||||
|
if fresh_install then
|
||||||
|
-- We can command `PackerSync` here, because only after packer.startup, we can know what plugins to install.
|
||||||
|
-- So plugin install should be done after the startup process.
|
||||||
|
vim.cmd("PackerSync")
|
||||||
|
else
|
||||||
|
local status, _ = pcall(require, 'packer_compiled')
|
||||||
|
if not status then
|
||||||
|
vim.notify("Error requiring packer_compiled.lua: run PackerSync to fix!", vim.log.levels.ERROR, { title = 'nvim-config' })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,17 +1,60 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
-- inspect something
|
-- inspect something
|
||||||
-- Taken from https://github.com/jamestthompson3/vimConfig/blob/eeef4a8eeb5a24938f8a0969a35f69c78643fb66/lua/tt/nvim_utils.lua#L106
|
function _G.inspect(item)
|
||||||
function inspect(item)
|
vim.pretty_print(item)
|
||||||
print(vim.inspect(item))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.executable(name)
|
function M.executable(name)
|
||||||
if vim.fn.executable(name) > 0 then
|
if fn.executable(name) > 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Create a dir if it does not exist
|
||||||
|
function M.may_create_dir(dir)
|
||||||
|
local res = fn.isdirectory(dir)
|
||||||
|
|
||||||
|
if res == 0 then
|
||||||
|
fn.mkdir(dir, 'p')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_nvim_version()
|
||||||
|
local actual_ver = vim.version()
|
||||||
|
|
||||||
|
local nvim_ver_str = string.format("%d.%d.%d", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
||||||
|
return nvim_ver_str
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Generate random integers in the range [Low, High], inclusive,
|
||||||
|
--- adapted from https://stackoverflow.com/a/12739441/6064933
|
||||||
|
--- @low: the lower value for this range
|
||||||
|
--- @high: the upper value for this range
|
||||||
|
function M.rand_int(low, high)
|
||||||
|
-- Use lua to generate random int, see also: https://stackoverflow.com/a/20157671/6064933
|
||||||
|
math.randomseed(os.time())
|
||||||
|
|
||||||
|
return math.random(low, high)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Select a random element from a sequence/list.
|
||||||
|
--- @seq: the sequence to choose an element
|
||||||
|
function M.rand_element(seq)
|
||||||
|
local idx = M.rand_int(1, #seq)
|
||||||
|
|
||||||
|
return seq[idx]
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.add_pack(name)
|
||||||
|
local status, error = pcall(vim.cmd, "packadd " .. name)
|
||||||
|
|
||||||
|
return status
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ snippet bare "barebone code template"
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
@@ -23,6 +24,7 @@ using std::pair;
|
|||||||
using std::make_pair;
|
using std::make_pair;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -41,8 +43,9 @@ void printList(const T& arr, const string& desc){
|
|||||||
std::cout << desc << ": [";
|
std::cout << desc << ": [";
|
||||||
|
|
||||||
for (auto it = arr.begin(); it != arr.end(); it++){
|
for (auto it = arr.begin(); it != arr.end(); it++){
|
||||||
std::cout << *it << ((std::next(it) != arr.end()) ? ", " : "]\n");
|
std::cout << *it << ((std::next(it) != arr.end()) ? ", " : "");
|
||||||
}
|
}
|
||||||
|
std::cout << "]\n";
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
@@ -53,13 +56,25 @@ void printMat(const vector<vector<T>>& mat, const string& desc){
|
|||||||
|
|
||||||
for (auto it1 = mat.begin(); it1 != mat.end(); it1++){
|
for (auto it1 = mat.begin(); it1 != mat.end(); it1++){
|
||||||
auto cur_vec = *it1;
|
auto cur_vec = *it1;
|
||||||
|
cout << "[";
|
||||||
for (auto it2 = cur_vec.begin(); it2 != cur_vec.end(); it2++){
|
for (auto it2 = cur_vec.begin(); it2 != cur_vec.end(); it2++){
|
||||||
cout << *it2 << ((std::next(it2) != cur_vec.end()) ? ", " : "\n");
|
cout << *it2 << ((std::next(it2) != cur_vec.end()) ? ", " : "]\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet pqueue "print queue"
|
||||||
|
template <class T>
|
||||||
|
void printQueue(T q){
|
||||||
|
while(!q.empty()){
|
||||||
|
std::cout << q.top() << " ";
|
||||||
|
q.pop();
|
||||||
|
}
|
||||||
|
std::cout << '\n';
|
||||||
|
}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet cout "print a variable" w
|
snippet cout "print a variable" w
|
||||||
cout << "$1: " << $2 << endl;
|
cout << "$1: " << $2 << endl;
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ snippet k3 "Three key strokes shortcut"
|
|||||||
<kbd>${1:KEY}</kbd> + <kbd>${2:KEY}</kbd> + <kbd>${3:KEY}</kbd>
|
<kbd>${1:KEY}</kbd> + <kbd>${2:KEY}</kbd> + <kbd>${3:KEY}</kbd>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet "meta" "Markdown front matter (YAML format)" b
|
snippet meta "Markdown front matter (YAML format)" b
|
||||||
---
|
---
|
||||||
title: "$1"
|
title: "$1"
|
||||||
date: `!p from datetime import datetime
|
date: `!p from datetime import datetime
|
||||||
@@ -47,7 +47,7 @@ $0
|
|||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet font "HTML font tag"
|
snippet font "HTML font tag"
|
||||||
<font color="${1:red}">${2:TEXT}</font>
|
<font color="${1:blue}">${2:TEXT}</font>
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet link "Markdown links"
|
snippet link "Markdown links"
|
||||||
@@ -70,3 +70,99 @@ endsnippet
|
|||||||
snippet yh "直角引号" w
|
snippet yh "直角引号" w
|
||||||
「$1」
|
「$1」
|
||||||
endsnippet
|
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
|
||||||
|
|||||||
@@ -24,3 +24,7 @@ def main():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet sol "solution" b
|
||||||
|
solution = Solution()
|
||||||
|
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"
|
snippet use "usepackage" b
|
||||||
\frac{${1:NUM}}{${2:DEN}} $0
|
\usepackage{${1:package}}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet eqa "equation environment" b
|
||||||
|
\begin{equation}\label{$1}
|
||||||
|
$2
|
||||||
|
\end{equation}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|||||||
@@ -3,3 +3,45 @@ command! -nargs=1 -complete=command Redir call utils#CaptureCommandOutput(<q-arg
|
|||||||
|
|
||||||
command! -bar -bang -nargs=+ -complete=file Edit call utils#MultiEdit([<f-args>])
|
command! -bar -bang -nargs=+ -complete=file Edit call utils#MultiEdit([<f-args>])
|
||||||
call utils#Cabbrev('edit', 'Edit')
|
call utils#Cabbrev('edit', 'Edit')
|
||||||
|
|
||||||
|
call utils#Cabbrev('man', 'Man')
|
||||||
|
|
||||||
|
" show current date and time in human readable format
|
||||||
|
command! -nargs=? Datetime echo utils#iso_time(<q-args>)
|
||||||
|
|
||||||
|
" Convert Markdown file to PDF
|
||||||
|
command! ToPDF call s:md_to_pdf()
|
||||||
|
|
||||||
|
function! s:md_to_pdf() abort
|
||||||
|
" check if pandoc is installed
|
||||||
|
if executable('pandoc') != 1
|
||||||
|
echoerr "pandoc not found"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:md_path = expand("%:p")
|
||||||
|
let l:pdf_path = fnamemodify(l:md_path, ":r") .. ".pdf"
|
||||||
|
|
||||||
|
let l:header_path = stdpath('config') . '/resources/head.tex'
|
||||||
|
|
||||||
|
let l:cmd = "pandoc --pdf-engine=xelatex --highlight-style=zenburn --table-of-content " .
|
||||||
|
\ "--include-in-header=" . l:header_path . " -V fontsize=10pt -V colorlinks -V toccolor=NavyBlue " .
|
||||||
|
\ "-V linkcolor=red -V urlcolor=teal -V filecolor=magenta -s " .
|
||||||
|
\ l:md_path . " -o " . l:pdf_path
|
||||||
|
|
||||||
|
if g:is_mac
|
||||||
|
let l:cmd = l:cmd . '&& open ' . l:pdf_path
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:is_win
|
||||||
|
let l:cmd = l:cmd . '&& start ' . l:pdf_path
|
||||||
|
endif
|
||||||
|
|
||||||
|
" echomsg l:cmd
|
||||||
|
|
||||||
|
let l:id = jobstart(l:cmd)
|
||||||
|
|
||||||
|
if l:id == 0 || l:id == -1
|
||||||
|
echoerr "Error running command"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|||||||
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',
|
||||||
|
\ ]
|
||||||
|
|
||||||
78
resources/head.tex
Normal file
78
resources/head.tex
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
\usepackage{fancyvrb,newverbs}
|
||||||
|
\usepackage[top=2cm, bottom=1.5cm, left=2cm, right=2cm]{geometry}
|
||||||
|
|
||||||
|
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
|
||||||
|
% begin a new page for each section (first level header),
|
||||||
|
% we need to combine this with `-V subparagraph` when invoking pandc
|
||||||
|
% \usepackage{titlesec}
|
||||||
|
% \newcommand{\sectionbreak}{\clearpage}
|
||||||
|
|
||||||
|
% change background color for inline code in markdown files.
|
||||||
|
% The following code does not work well for long text, because the text will exceed the page boundary.
|
||||||
|
\definecolor{bgcolor}{HTML}{DADADA}
|
||||||
|
\let\oldtexttt\texttt
|
||||||
|
|
||||||
|
\renewcommand{\texttt}[1]{
|
||||||
|
\colorbox{bgcolor}{\oldtexttt{#1}}
|
||||||
|
}
|
||||||
|
|
||||||
|
% change style of quote, see also https://tex.stackexchange.com/a/436253/114857
|
||||||
|
\usepackage[most]{tcolorbox}
|
||||||
|
|
||||||
|
\definecolor{linequote}{RGB}{224,215,188}
|
||||||
|
\definecolor{backquote}{RGB}{249,245,233}
|
||||||
|
\definecolor{bordercolor}{RGB}{221,221,221}
|
||||||
|
|
||||||
|
% change left border: https://tex.stackexchange.com/a/475716/114857
|
||||||
|
% change left margin: https://tex.stackexchange.com/a/457936/114857
|
||||||
|
\newtcolorbox{myquote}[1][]{%
|
||||||
|
enhanced,
|
||||||
|
breakable,
|
||||||
|
size=minimal,
|
||||||
|
left=10pt,
|
||||||
|
top=5pt,
|
||||||
|
bottom=5pt,
|
||||||
|
frame hidden,
|
||||||
|
boxrule=0pt,
|
||||||
|
sharp corners=all,
|
||||||
|
colback=backquote,
|
||||||
|
borderline west={2pt}{0pt}{bordercolor},
|
||||||
|
#1
|
||||||
|
}
|
||||||
|
|
||||||
|
% redefine quote environment to use the myquote environment, see https://tex.stackexchange.com/a/337587/114857
|
||||||
|
\renewenvironment{quote}{\begin{myquote}}{\end{myquote}}
|
||||||
|
|
||||||
|
% start a new page after toc, we need to save the old command before defining
|
||||||
|
% new one to avoid recursive command calls,
|
||||||
|
% see https://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself
|
||||||
|
\let\oldtoc\tableofcontents
|
||||||
|
\renewcommand{\tableofcontents}{\oldtoc\newpage}
|
||||||
|
|
||||||
|
% fix header level issue
|
||||||
|
\usepackage{enumitem}
|
||||||
|
\setlistdepth{9}
|
||||||
|
|
||||||
|
\setlist[itemize,1]{label=$\bullet$}
|
||||||
|
\setlist[itemize,2]{label=$\bullet$}
|
||||||
|
\setlist[itemize,3]{label=$\bullet$}
|
||||||
|
\setlist[itemize,4]{label=$\bullet$}
|
||||||
|
\setlist[itemize,5]{label=$\bullet$}
|
||||||
|
\setlist[itemize,6]{label=$\bullet$}
|
||||||
|
\setlist[itemize,7]{label=$\bullet$}
|
||||||
|
\setlist[itemize,8]{label=$\bullet$}
|
||||||
|
\setlist[itemize,9]{label=$\bullet$}
|
||||||
|
\renewlist{itemize}{itemize}{9}
|
||||||
|
|
||||||
|
\setlist[enumerate,1]{label=$\arabic*.$}
|
||||||
|
\setlist[enumerate,2]{label=$\alph*.$}
|
||||||
|
\setlist[enumerate,3]{label=$\roman*.$}
|
||||||
|
\setlist[enumerate,4]{label=$\arabic*.$}
|
||||||
|
\setlist[enumerate,5]{label=$\alpha*$}
|
||||||
|
\setlist[enumerate,6]{label=$\roman*.$}
|
||||||
|
\setlist[enumerate,7]{label=$\arabic*.$}
|
||||||
|
\setlist[enumerate,8]{label=$\alph*.$}
|
||||||
|
\setlist[enumerate,9]{label=$\roman*.$}
|
||||||
|
\renewlist{enumerate}{enumerate}{9}
|
||||||
@@ -323,3 +323,111 @@ zshrc
|
|||||||
pdftoppm
|
pdftoppm
|
||||||
pdf2image
|
pdf2image
|
||||||
pdffonts
|
pdffonts
|
||||||
|
myers
|
||||||
|
difftool
|
||||||
|
vimdiff
|
||||||
|
softmax
|
||||||
|
lib64
|
||||||
|
toolset
|
||||||
|
sym
|
||||||
|
ffmpeg
|
||||||
|
PyAV
|
||||||
|
mp4
|
||||||
|
vint
|
||||||
|
npm
|
||||||
|
js
|
||||||
|
sudo
|
||||||
|
ps1
|
||||||
|
tpm
|
||||||
|
hacky
|
||||||
|
PCRE
|
||||||
|
teardown
|
||||||
|
github
|
||||||
|
fastgit
|
||||||
|
EOL
|
||||||
|
PyCharm
|
||||||
|
deduplication
|
||||||
|
STL
|
||||||
|
delimitMate
|
||||||
|
lspconfig
|
||||||
|
lualine
|
||||||
|
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
|
||||||
|
overfitting
|
||||||
|
PCA
|
||||||
|
SVM
|
||||||
|
KNN
|
||||||
|
leetcode
|
||||||
|
Logitech
|
||||||
|
WTF
|
||||||
|
tensorboard
|
||||||
|
Nvidia
|
||||||
|
GPG
|
||||||
|
manpage
|
||||||
|
metatable
|
||||||
|
open3d
|
||||||
|
pyntcloud
|
||||||
|
param
|
||||||
|
reddit
|
||||||
|
|||||||
Reference in New Issue
Block a user