mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
33 Commits
89effe8b17
...
v0.8.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d40d87cb61 | ||
|
|
81663c8f3c | ||
|
|
2c7e4aa87a | ||
|
|
07dd60206b | ||
|
|
c3d4eb371b | ||
|
|
597a2aba80 | ||
|
|
f1f6d0b351 | ||
|
|
e1930ba153 | ||
|
|
a8db734e75 | ||
|
|
4026baef19 | ||
|
|
f63152f79b | ||
|
|
5229c460ea | ||
|
|
f308ccad7b | ||
|
|
09dd81bf67 | ||
|
|
5ecb74ad85 | ||
|
|
773003b71b | ||
|
|
f5097b44b9 | ||
|
|
238886c136 | ||
|
|
2fccb59293 | ||
|
|
830297a973 | ||
|
|
1f3fcc604a | ||
|
|
7f5bf5a1b2 | ||
|
|
81bc5e46f1 | ||
|
|
b4c3b7eba0 | ||
|
|
4203410878 | ||
|
|
9f58c3b7a5 | ||
|
|
45d0d68b9e | ||
|
|
74a9767018 | ||
|
|
ab25bfc9c4 | ||
|
|
ebbdb27d01 | ||
|
|
1b1f0199da | ||
|
|
40fa9aab1c | ||
|
|
6e8e61e53a |
@@ -58,7 +58,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ Code, snippet, word auto-completion via [nvim-cmp](https://github.com/hrsh7th/nvim-cmp).
|
+ 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).
|
+ 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/nvim-zh/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).
|
||||||
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
|
+ Faster code commenting via [vim-commentary](https://github.com/tpope/vim-commentary).
|
||||||
+ 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).
|
||||||
@@ -75,7 +75,7 @@ and how to set up on different platforms (Linux, macOS, and Windows).
|
|||||||
+ 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).
|
||||||
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
|
+ Beautiful colorscheme via [sainnhe/gruvbox-material](https://github.com/sainnhe/gruvbox-material) and other colorschemes.
|
||||||
+ 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/preservim/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>.
|
+ 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).
|
||||||
@@ -167,6 +167,8 @@ Some of the shortcuts I use frequently are listed here. In the following shortcu
|
|||||||
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
|
| `<leader>gc` | Normal | Linux/macOS/Win | Run git commit |
|
||||||
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
|
| `<leader>gpl` | Normal | Linux/macOS/Win | Run git pull |
|
||||||
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
|
| `<leader>gpu` | Normal | Linux/macOS/Win | Run git push |
|
||||||
|
| `<leader>gl` | Normal/Visual | Linux/macOS/Win | Get perm link for current/visually-select lines
|
||||||
|
| `<leader>gb` | Normal | macOS | Browse current git repo in browser
|
||||||
| `<F9>` | Normal | Linux/macOS/Win | Compile&run current source file (for C++, LaTeX, Lua, Python) |
|
| `<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 |
|
||||||
|
|||||||
1
after/ftplugin/sql.vim
Normal file
1
after/ftplugin/sql.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
set commentstring=--\ %s
|
||||||
77
core/globals.lua
Normal file
77
core/globals.lua
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
local api = vim.api
|
||||||
|
|
||||||
|
local utils = require('utils')
|
||||||
|
|
||||||
|
-- Inspect something
|
||||||
|
function _G.inspect(item)
|
||||||
|
vim.pretty_print(item)
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- custom variables --
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
vim.g.is_win = (utils.has("win32") or utils.has("win64")) and true or false
|
||||||
|
vim.g.is_linux = (utils.has("unix") and (not utils.has("macunix"))) and true or false
|
||||||
|
vim.g.is_mac = utils.has("macunix") and true or false
|
||||||
|
|
||||||
|
vim.g.logging_level = "info"
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
-- builtin variables --
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
vim.g.loaded_perl_provider = 0 -- Disable perl provider
|
||||||
|
vim.g.loaded_ruby_provider = 0 -- Disable ruby provider
|
||||||
|
vim.g.loaded_node_provider = 0 -- Disable node provider
|
||||||
|
vim.g.did_install_default_menus = 1 -- do not load menu
|
||||||
|
|
||||||
|
if utils.executable('python3') then
|
||||||
|
if vim.g.is_win then
|
||||||
|
vim.g.python3_host_prog = fn.substitute(fn.exepath("python3"), ".exe$", '', 'g')
|
||||||
|
else
|
||||||
|
vim.g.python3_host_prog = fn.exepath("python3")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
api.nvim_err_writeln("Python3 executable not found! You must install Python3 and set its PATH correctly!")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Custom mapping <leader> (see `:h mapleader` for more info)
|
||||||
|
vim.g.mapleader = ','
|
||||||
|
|
||||||
|
-- Enable highlighting for lua HERE doc inside vim script
|
||||||
|
vim.g.vimsyn_embed = 'l'
|
||||||
|
|
||||||
|
-- Use English as main language
|
||||||
|
if not vim.g.is_mac then
|
||||||
|
vim.cmd [[language en_US.utf-8]]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Disable loading certain plugins
|
||||||
|
|
||||||
|
-- Whether to load netrw by default, see https://github.com/bling/dotvim/issues/4
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
vim.g.netrw_liststyle = 3
|
||||||
|
if vim.g.is_win then
|
||||||
|
vim.g.netrw_http_cmd = "curl --ssl-no-revoke -Lo"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Do not load tohtml.vim
|
||||||
|
vim.g.loaded_2html_plugin = 1
|
||||||
|
|
||||||
|
-- Do not load zipPlugin.vim, gzip.vim and tarPlugin.vim (all these plugins are
|
||||||
|
-- related to checking files inside compressed files)
|
||||||
|
vim.g.loaded_zipPlugin = 1
|
||||||
|
vim.g.loaded_gzip = 1
|
||||||
|
vim.g.loaded_tarPlugin = 1
|
||||||
|
|
||||||
|
-- Do not load the tutor plugin
|
||||||
|
vim.g.loaded_tutor_mode_plugin = 1
|
||||||
|
|
||||||
|
-- Do not use builtin matchit.vim and matchparen.vim since we use vim-matchup
|
||||||
|
vim.g.loaded_matchit = 1
|
||||||
|
vim.g.loaded_matchparen = 1
|
||||||
|
|
||||||
|
-- Disable sql omni completion, it is broken.
|
||||||
|
vim.g.loaded_sql_completion = 1
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
"{ Global Variable
|
|
||||||
"{{ Custom variables
|
|
||||||
let g:is_win = (has('win32') || has('win64')) ? v:true : v:false
|
|
||||||
let g:is_linux = (has('unix') && !has('macunix')) ? v:true : v:false
|
|
||||||
let g:is_mac = has('macunix') ? v:true : v:false
|
|
||||||
let g:logging_level = 'info'
|
|
||||||
"}}
|
|
||||||
|
|
||||||
"{{ Builtin variables
|
|
||||||
" Disable perl provider
|
|
||||||
let g:loaded_perl_provider = 0
|
|
||||||
|
|
||||||
" Disable ruby provider
|
|
||||||
let g:loaded_ruby_provider = 0
|
|
||||||
|
|
||||||
" Disable node provider
|
|
||||||
let g:loaded_node_provider = 0
|
|
||||||
|
|
||||||
let g:did_install_default_menus = 1 " do not load menu
|
|
||||||
|
|
||||||
" Path to Python 3 interpreter (must be an absolute path), make startup
|
|
||||||
" faster. See https://neovim.io/doc/user/provider.html.
|
|
||||||
if executable('python')
|
|
||||||
if g:is_win
|
|
||||||
let g:python3_host_prog=substitute(exepath('python'), '.exe$', '', 'g')
|
|
||||||
elseif g:is_linux || g:is_mac
|
|
||||||
let g:python3_host_prog=exepath('python')
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
echoerr 'Python 3 executable not found! You must install Python 3 and set its PATH correctly!'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Custom mapping <leader> (see `:h mapleader` for more info)
|
|
||||||
let g:mapleader = ','
|
|
||||||
|
|
||||||
" Enable highlighting for lua HERE doc inside vim script
|
|
||||||
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
|
|
||||||
" Whether to load netrw by default, see
|
|
||||||
" https://github.com/bling/dotvim/issues/4
|
|
||||||
let g:loaded_netrw = 1
|
|
||||||
let g:loaded_netrwPlugin = 1
|
|
||||||
let g:netrw_liststyle = 3
|
|
||||||
if g:is_win
|
|
||||||
let g:netrw_http_cmd = 'curl --ssl-no-revoke -Lo'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Do not load tohtml.vim
|
|
||||||
let g:loaded_2html_plugin = 1
|
|
||||||
|
|
||||||
" Do not load zipPlugin.vim, gzip.vim and tarPlugin.vim (all these plugins are
|
|
||||||
" related to checking files inside compressed files)
|
|
||||||
let g:loaded_zipPlugin = 1
|
|
||||||
let loaded_gzip = 1
|
|
||||||
let g:loaded_tarPlugin = 1
|
|
||||||
|
|
||||||
let g:loaded_tutor_mode_plugin = 1 " do not load the tutor plugin
|
|
||||||
|
|
||||||
" Do not use builtin matchit.vim and matchparen.vim since we use vim-matchup
|
|
||||||
let g:loaded_matchit = 1
|
|
||||||
let g:loaded_matchparen = 1
|
|
||||||
"}}
|
|
||||||
|
|
||||||
" Disable sql omni completion, it is broken.
|
|
||||||
let g:loaded_sql_completion = 1
|
|
||||||
"}
|
|
||||||
@@ -8,7 +8,7 @@ keymap.set({ "n", "x" }, ";", ":")
|
|||||||
keymap.set("i", "<c-u>", "<Esc>viwUea")
|
keymap.set("i", "<c-u>", "<Esc>viwUea")
|
||||||
|
|
||||||
-- Turn the current word into title case
|
-- Turn the current word into title case
|
||||||
keymap.set("i", "<c-u>", "<Esc>b~lea")
|
keymap.set("i", "<c-t>", "<Esc>b~lea")
|
||||||
|
|
||||||
-- Paste non-linewise text above or below current line, see https://stackoverflow.com/a/1346777/6064933
|
-- Paste non-linewise text above or below current line, see https://stackoverflow.com/a/1346777/6064933
|
||||||
keymap.set("n", "<leader>p", "m`o<ESC>p``", { desc = "paste below current line" })
|
keymap.set("n", "<leader>p", "m`o<ESC>p``", { desc = "paste below current line" })
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ set termguicolors
|
|||||||
" https://github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-color-in-the-terminal
|
" https://github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-color-in-the-terminal
|
||||||
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor20
|
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor20
|
||||||
|
|
||||||
set signcolumn=auto:2
|
set signcolumn=yes:1
|
||||||
|
|
||||||
" Remove certain character from file name pattern matching
|
" Remove certain character from file name pattern matching
|
||||||
set isfname-==
|
set isfname-==
|
||||||
@@ -177,3 +177,4 @@ 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
|
set nowrap " do no wrap
|
||||||
|
set noruler
|
||||||
|
|||||||
@@ -182,14 +182,7 @@ let g:neoformat_c_clangformat = {
|
|||||||
let g:neoformat_enabled_cpp = ['clangformat']
|
let g:neoformat_enabled_cpp = ['clangformat']
|
||||||
let g:neoformat_enabled_c = ['clangformat']
|
let g:neoformat_enabled_c = ['clangformat']
|
||||||
|
|
||||||
"""""""""""""""""""""""""vim-signify settings""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""vim-markdown settings"""""""""""""""""""
|
||||||
" The VCS to use
|
|
||||||
let g:signify_vcs_list = [ 'git' ]
|
|
||||||
|
|
||||||
" Change the sign for certain operations
|
|
||||||
let g:signify_sign_change = '~'
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""plasticboy/vim-markdown settings"""""""""""""""""""
|
|
||||||
" Disable header folding
|
" Disable header folding
|
||||||
let g:vim_markdown_folding_disabled = 1
|
let g:vim_markdown_folding_disabled = 1
|
||||||
|
|
||||||
@@ -311,11 +304,6 @@ if ( g:is_win || g:is_mac ) && executable('latex')
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
""""""""""""""""""""""""""""vim-startify settings""""""""""""""""""""""""""""
|
|
||||||
" Do not change working directory when opening files.
|
|
||||||
let g:startify_change_to_dir = 0
|
|
||||||
let g:startify_fortune_use_unicode = 1
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""vim-matchup settings"""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""vim-matchup settings"""""""""""""""""""""""""""""
|
||||||
" Improve performance
|
" Improve performance
|
||||||
let g:matchup_matchparen_deferred = 1
|
let g:matchup_matchparen_deferred = 1
|
||||||
@@ -362,16 +350,20 @@ if exists('g:started_by_firenvim') && g:started_by_firenvim
|
|||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
function! s:setup_firenvim() abort
|
function s:setup_firenvim() abort
|
||||||
set noruler noshowcmd
|
set signcolumn=no
|
||||||
set laststatus=0 showtabline=0
|
set noruler
|
||||||
|
set noshowcmd
|
||||||
|
set laststatus=0
|
||||||
|
set showtabline=0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup firenvim
|
augroup firenvim
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType text call s:setup_firenvim()
|
autocmd BufEnter * call s:setup_firenvim()
|
||||||
autocmd BufNewFile github.com_*.txt set filetype=markdown
|
autocmd BufEnter sqlzoo*.txt set filetype=sql
|
||||||
autocmd BufNewFile stackoverflow.com_*.txt set filetype=markdown
|
autocmd BufEnter github.com_*.txt set filetype=markdown
|
||||||
|
autocmd BufEnter stackoverflow.com_*.txt set filetype=markdown
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ fi
|
|||||||
|
|
||||||
# Install some Python packages used by Nvim plugins.
|
# Install some Python packages used by Nvim plugins.
|
||||||
echo "Installing Python packages"
|
echo "Installing Python packages"
|
||||||
declare -a py_packages=("pynvim" 'python-lsp-server[all]' "black" "vim-vint" "pyls-isort" "pylsp-mypy")
|
declare -a PY_PACKAGES=("pynvim" 'python-lsp-server[all]' "black" "vim-vint" "pyls-isort" "pylsp-mypy")
|
||||||
|
|
||||||
if [[ "$SYSTEM_PYTHON" = true ]]; then
|
if [[ "$SYSTEM_PYTHON" = true ]]; then
|
||||||
echo "Using system Python to install $(PY_PACKAGES)"
|
echo "Using system Python to install $(PY_PACKAGES)"
|
||||||
@@ -76,12 +76,12 @@ if [[ "$SYSTEM_PYTHON" = true ]]; then
|
|||||||
# If we use system Python, we need to install these Python packages under
|
# If we use system Python, we need to install these Python packages under
|
||||||
# user HOME, since we do not have permissions to install them under system
|
# user HOME, since we do not have permissions to install them under system
|
||||||
# directories.
|
# directories.
|
||||||
for p in "${py_packages[@]}"; do
|
for p in "${PY_PACKAGES[@]}"; do
|
||||||
pip install --user "$p"
|
pip install --user "$p"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Using custom Python to install $(PY_PACKAGES)"
|
echo "Using custom Python to install $(PY_PACKAGES)"
|
||||||
for p in "${py_packages[@]}"; do
|
for p in "${PY_PACKAGES[@]}"; do
|
||||||
"$CONDA_DIR/bin/pip" install "$p"
|
"$CONDA_DIR/bin/pip" install "$p"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
4
init.lua
4
init.lua
@@ -12,7 +12,7 @@ local api = vim.api
|
|||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
|
|
||||||
-- check if we have the latest stable version of nvim
|
-- check if we have the latest stable version of nvim
|
||||||
local expected_ver = "0.7.2"
|
local expected_ver = "0.8.0"
|
||||||
local nvim_ver = utils.get_nvim_version()
|
local nvim_ver = utils.get_nvim_version()
|
||||||
|
|
||||||
if nvim_ver ~= expected_ver then
|
if nvim_ver ~= expected_ver then
|
||||||
@@ -22,7 +22,7 @@ if nvim_ver ~= expected_ver then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local core_conf_files = {
|
local core_conf_files = {
|
||||||
"globals.vim", -- some global settings
|
"globals.lua", -- some global settings
|
||||||
"options.vim", -- setting options in nvim
|
"options.vim", -- setting options in nvim
|
||||||
"autocommands.vim", -- various autocommands
|
"autocommands.vim", -- various autocommands
|
||||||
"mappings.lua", -- all the user-defined mappings
|
"mappings.lua", -- all the user-defined mappings
|
||||||
|
|||||||
@@ -6,3 +6,6 @@ keymap.set("n", "<leader>gc", "<cmd>Git commit<cr>", { desc = "Git commit" })
|
|||||||
keymap.set("n", "<leader>gd", "<cmd>Gdiffsplit<cr>", { desc = "Git diff" })
|
keymap.set("n", "<leader>gd", "<cmd>Gdiffsplit<cr>", { desc = "Git diff" })
|
||||||
keymap.set("n", "<leader>gpl", "<cmd>Git pull<cr>", { desc = "Git pull" })
|
keymap.set("n", "<leader>gpl", "<cmd>Git pull<cr>", { desc = "Git pull" })
|
||||||
keymap.set("n", "<leader>gpu", "<cmd>15 split|term git push<cr>", { desc = "Git push" })
|
keymap.set("n", "<leader>gpu", "<cmd>15 split|term git push<cr>", { desc = "Git push" })
|
||||||
|
|
||||||
|
-- convert git to Git in command line mode
|
||||||
|
vim.fn['utils#Cabbrev']('git', 'Git')
|
||||||
|
|||||||
@@ -13,3 +13,13 @@ keymap.set({ "n", "v" }, "<leader>gl", "", {
|
|||||||
gitlinker.get_buf_range_url(mode)
|
gitlinker.get_buf_range_url(mode)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
keymap.set("n", "<leader>gb", "", {
|
||||||
|
silent = true,
|
||||||
|
desc = "browse repo in browser",
|
||||||
|
callback = function()
|
||||||
|
gitlinker.get_repo_url({
|
||||||
|
action_callback = gitlinker.actions.open_in_browser
|
||||||
|
})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ gs.setup {
|
|||||||
topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||||
changedelete = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
changedelete = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||||
},
|
},
|
||||||
word_diff = true, -- Toggle with `:Gitsigns toggle_word_diff`
|
word_diff = true,
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local function map(mode, l, r, opts)
|
local function map(mode, l, r, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
@@ -44,3 +44,14 @@ gs.setup {
|
|||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('ColorScheme', {
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
vim.cmd [[
|
||||||
|
hi GitSignsChangeInline guibg=fg guifg=bg
|
||||||
|
hi GitSignsAddInline guibg=fg guifg=bg
|
||||||
|
hi GitSignsDeleteInline guibg=fg guifg=bg
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|||||||
@@ -33,11 +33,8 @@ local custom_attach = function(client, bufnr)
|
|||||||
end, { desc = "list workspace folder" })
|
end, { desc = "list workspace folder" })
|
||||||
|
|
||||||
-- 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.server_capabilities.documentFormattingProvider then
|
||||||
map("n", "<space>f", vim.lsp.buf.formatting_sync, { desc = "format code" })
|
map("n", "<space>f", vim.lsp.buf.format, { desc = "format code" })
|
||||||
end
|
|
||||||
if client.resolved_capabilities.document_range_formatting then
|
|
||||||
map("x", "<space>f", vim.lsp.buf.range_formatting, { desc = "range format" })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
api.nvim_create_autocmd("CursorHold", {
|
api.nvim_create_autocmd("CursorHold", {
|
||||||
@@ -56,9 +53,8 @@ local custom_attach = function(client, bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local cursor_pos = api.nvim_win_get_cursor(0)
|
local cursor_pos = api.nvim_win_get_cursor(0)
|
||||||
if
|
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
||||||
(cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2])
|
and #vim.diagnostic.get() > 0
|
||||||
and #vim.diagnostic.get() > 0
|
|
||||||
then
|
then
|
||||||
vim.diagnostic.open_float(nil, float_opts)
|
vim.diagnostic.open_float(nil, float_opts)
|
||||||
end
|
end
|
||||||
@@ -68,7 +64,7 @@ local custom_attach = function(client, bufnr)
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- 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.server_capabilities.documentHighlightProvider then
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
hi! link LspReferenceRead Visual
|
hi! link LspReferenceRead Visual
|
||||||
hi! link LspReferenceText Visual
|
hi! link LspReferenceText Visual
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ nvim_tree.setup {
|
|||||||
update_cwd = false,
|
update_cwd = false,
|
||||||
view = {
|
view = {
|
||||||
width = 30,
|
width = 30,
|
||||||
height = 30,
|
|
||||||
hide_root_folder = false,
|
hide_root_folder = false,
|
||||||
side = "left",
|
side = "left",
|
||||||
preserve_window_proportions = false,
|
preserve_window_proportions = false,
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ require("nvim-treesitter.configs").setup {
|
|||||||
ignore_install = {}, -- List of parsers to ignore installing
|
ignore_install = {}, -- List of parsers to ignore installing
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true, -- false will disable the whole extension
|
enable = true, -- false will disable the whole extension
|
||||||
disable = {}, -- list of language that will be disabled
|
disable = { 'help' }, -- list of language that will be disabled
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ vim.cmd("packadd packer.nvim")
|
|||||||
local packer = require("packer")
|
local packer = require("packer")
|
||||||
local packer_util = require("packer.util")
|
local packer_util = require("packer.util")
|
||||||
|
|
||||||
|
-- check if firenvim is active
|
||||||
|
local firenvim_not_active = function()
|
||||||
|
return not vim.g.started_by_firenvim
|
||||||
|
end
|
||||||
|
|
||||||
packer.startup {
|
packer.startup {
|
||||||
function(use)
|
function(use)
|
||||||
-- it is recommended to put impatient.nvim before any other plugins
|
-- it is recommended to put impatient.nvim before any other plugins
|
||||||
@@ -130,13 +135,19 @@ packer.startup {
|
|||||||
use {
|
use {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
|
cond = firenvim_not_active,
|
||||||
config = [[require('config.statusline')]],
|
config = [[require('config.statusline')]],
|
||||||
}
|
}
|
||||||
|
|
||||||
use { "akinsho/bufferline.nvim", event = "VimEnter", config = [[require('config.bufferline')]] }
|
use { "akinsho/bufferline.nvim", event = "VimEnter",
|
||||||
|
cond = firenvim_not_active,
|
||||||
|
config = [[require('config.bufferline')]] }
|
||||||
|
|
||||||
-- fancy start screen
|
-- fancy start screen
|
||||||
use { "glepnir/dashboard-nvim", event = "VimEnter", config = [[require('config.dashboard-nvim')]] }
|
use { "glepnir/dashboard-nvim", event = "VimEnter",
|
||||||
|
cond = firenvim_not_active,
|
||||||
|
config = [[require('config.dashboard-nvim')]]
|
||||||
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
@@ -236,7 +247,7 @@ packer.startup {
|
|||||||
use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
|
use { "kevinhwang91/nvim-bqf", ft = "qf", config = [[require('config.bqf')]] }
|
||||||
|
|
||||||
-- Another markdown plugin
|
-- Another markdown plugin
|
||||||
use { "plasticboy/vim-markdown", ft = { "markdown" } }
|
use { "preservim/vim-markdown", ft = { "markdown" } }
|
||||||
|
|
||||||
-- Faster footnote generation
|
-- Faster footnote generation
|
||||||
use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
|
use { "vim-pandoc/vim-markdownfootnotes", ft = { "markdown" } }
|
||||||
@@ -251,9 +262,7 @@ packer.startup {
|
|||||||
if vim.g.is_win or vim.g.is_mac then
|
if vim.g.is_win or vim.g.is_mac then
|
||||||
use {
|
use {
|
||||||
"iamcco/markdown-preview.nvim",
|
"iamcco/markdown-preview.nvim",
|
||||||
run = function()
|
run = "cd app && npm install",
|
||||||
fn["mkdp#util#install"]()
|
|
||||||
end,
|
|
||||||
ft = { "markdown" },
|
ft = { "markdown" },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
|
|
||||||
-- inspect something
|
|
||||||
function _G.inspect(item)
|
|
||||||
vim.pretty_print(item)
|
|
||||||
end
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.executable(name)
|
function M.executable(name)
|
||||||
@@ -15,6 +10,18 @@ function M.executable(name)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- check whether a feature exists in Nvim
|
||||||
|
--- @feat: string
|
||||||
|
--- the feature name, like `nvim-0.7` or `unix`.
|
||||||
|
--- return: bool
|
||||||
|
M.has = function(feat)
|
||||||
|
if fn.has(feat) == 1 then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
--- Create a dir if it does not exist
|
--- Create a dir if it does not exist
|
||||||
function M.may_create_dir(dir)
|
function M.may_create_dir(dir)
|
||||||
local res = fn.isdirectory(dir)
|
local res = fn.isdirectory(dir)
|
||||||
|
|||||||
@@ -436,3 +436,7 @@ PostgreSQL
|
|||||||
CNY
|
CNY
|
||||||
wechat
|
wechat
|
||||||
ziroom
|
ziroom
|
||||||
|
Postgres
|
||||||
|
plpgsql
|
||||||
|
postgres
|
||||||
|
PySpark
|
||||||
|
|||||||
Reference in New Issue
Block a user