aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-10-02 00:02:38 +0800
committercrupest <crupest@outlook.com>2023-10-02 20:04:32 +0800
commit412ad3daceb6d3bcd5c5c2832a5d87a622556477 (patch)
treefd1baf14c79b937a779b9100f0884fe564cf2da1
parent34b7b5540c28f503f40d67169c327dc3a902764d (diff)
downloadcrupest-412ad3daceb6d3bcd5c5c2832a5d87a622556477.tar.gz
crupest-412ad3daceb6d3bcd5c5c2832a5d87a622556477.tar.bz2
crupest-412ad3daceb6d3bcd5c5c2832a5d87a622556477.zip
Update nvim configs.
-rwxr-xr-xconfigs/copy-nvim-config.sh5
-rw-r--r--configs/nvim/cspell.yaml13
-rw-r--r--configs/nvim/init.lua58
-rw-r--r--configs/nvim/lazy-lock.json44
-rw-r--r--configs/nvim/lua/crupest/nvim/lsp/c.lua9
-rw-r--r--configs/nvim/lua/crupest/nvim/lsp/lua.lua31
-rw-r--r--configs/nvim/lua/plugins.lua1
-rw-r--r--configs/nvim/nvim-words.txt45
8 files changed, 136 insertions, 70 deletions
diff --git a/configs/copy-nvim-config.sh b/configs/copy-nvim-config.sh
new file mode 100755
index 0000000..2b2e75c
--- /dev/null
+++ b/configs/copy-nvim-config.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env sh
+
+MYDIR="$(dirname "$(realpath "$0")")"
+
+cp -R ~/.config/nvim ${MYDIR}
diff --git a/configs/nvim/cspell.yaml b/configs/nvim/cspell.yaml
new file mode 100644
index 0000000..2a716e2
--- /dev/null
+++ b/configs/nvim/cspell.yaml
@@ -0,0 +1,13 @@
+dictionaryDefinitions:
+ - name: nvim-words
+ path: './nvim-words.txt'
+ addWords: true
+
+dictionaries:
+ - nvim-words
+
+words:
+ - crupest
+
+ignorePaths:
+ - lazy-lock.json
diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua
index ef73320..ad41c20 100644
--- a/configs/nvim/init.lua
+++ b/configs/nvim/init.lua
@@ -3,6 +3,7 @@ if not vim.uv then
end
if vim.g.neovide then
+ -- spellchecker: disable-next-line
vim.opt.guifont = "CaskaydiaCove Nerd Font";
vim.g.neovide_transparency = 0.98;
vim.g.neovide_input_ime = false;
@@ -11,6 +12,7 @@ end
local is_win = vim.fn.has("win32") ~= 0
+-- spellchecker: disable
if is_win then
vim.cmd([[
let &shell = executable('pwsh') ? 'pwsh' : 'powershell'
@@ -20,9 +22,11 @@ if is_win then
set shellquote= shellxquote=
]])
end
+-- spellchecker: enable
vim.cmd.cd("~")
+-- spellchecker: disable
vim.opt.termguicolors = true;
vim.opt.fileformats = "unix,dos";
vim.opt.softtabstop = 4;
@@ -30,24 +34,26 @@ vim.opt.shiftwidth = 4;
vim.opt.expandtab = true;
vim.opt.wrap = false;
vim.opt.number = true;
+-- spellchecker: enable
if is_win then
+ -- spellchecker: disable-next-line
vim.opt.completeslash = 'slash'
end
-- Init lazy.nvim
-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
-if not vim.uv.fs_stat(lazypath) then
+local lazy_path = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not vim.uv.fs_stat(lazy_path) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
- lazypath,
+ lazy_path,
})
end
-vim.opt.rtp:prepend(lazypath)
+vim.opt.rtp:prepend(lazy_path)
-- Use lazy.nvim
require("lazy").setup("plugins")
@@ -159,44 +165,10 @@ cmp.setup({
})
})
--- setup lsp
-local capabilities = require("cmp_nvim_lsp").default_capabilities()
-local lspconfig = require("lspconfig")
--- setup lsp clangd
-lspconfig.clangd.setup {
- capabilities = capabilities
-}
-
--- setup lsp lua
-lspconfig.lua_ls.setup {
- capabilities = capabilities,
- settings = {
- Lua = {
- runtime = {
- version = "LuaJIT"
- },
- diagnostics = {
- globals = { "vim" },
- },
- workspace = {
- library = {
- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
- [vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
- [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
- },
- maxPreload = 100000,
- preloadFileSize = 10000,
- },
- },
- },
-}
-
--- setup lsp frontend
+require("crupest.nvim.lsp.c").setup_lsp_c()
+require("crupest.nvim.lsp.lua").setup_lsp_lua()
require("crupest.nvim.lsp.frontend").setup_lsp_frontend()
-
--- setup lsp csharp
require("crupest.nvim.lsp.csharp").setup_lsp_csharp()
-- Use LspAttach autocommand to only map the following keys
@@ -242,15 +214,15 @@ vim.keymap.set('n', '<leader>g', builtin.live_grep, {})
vim.keymap.set('n', '<leader>b', builtin.buffers, {})
vim.keymap.set('n', '<leader>h', builtin.help_tags, {})
--- setup ketmap for tree
+-- setup keymap for tree
vim.keymap.set('n', '<leader>t', "<cmd>Neotree toggle<cr>", {})
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
vim.keymap.set('n', '<leader>le', vim.diagnostic.open_float)
vim.keymap.set('n', '<leader>l[', vim.diagnostic.goto_prev)
vim.keymap.set('n', '<leader>l]', vim.diagnostic.goto_next)
-vim.keymap.set('n', '<leader>lt', vim.diagnostic.setloclist)
-vim.keymap.set('n', '<leader>ll', lint.run_lint)
+vim.keymap.set('n', '<leader>ll', vim.diagnostic.setloclist)
+vim.keymap.set('n', '<leader>lr', lint.run_lint)
vim.keymap.set("n", "<c-tab>", "<cmd>bnext<cr>")
diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json
index a7ee4b6..f07db1f 100644
--- a/configs/nvim/lazy-lock.json
+++ b/configs/nvim/lazy-lock.json
@@ -1,23 +1,23 @@
-{
- "LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" },
- "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
- "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
- "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
- "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
- "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
- "everforest": { "branch": "master", "commit": "83b666410d7ae0eccf96dbbe3b4b6ac5b8172d38" },
- "formatter.nvim": { "branch": "master", "commit": "34dcdfa0c75df667743b2a50dd99c84a557376f0" },
- "lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" },
- "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
- "neo-tree.nvim": { "branch": "main", "commit": "7e2a3caf999e2028abb643eb0472f351b2777591" },
- "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
- "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
- "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
- "nvim-lint": { "branch": "master", "commit": "1065763f115a7765ef237347ad676ba348d7193a" },
- "nvim-lspconfig": { "branch": "master", "commit": "7ec2ab0cb8f529708dba55964fb0a59d3cc21853" },
- "nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
- "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" },
- "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
- "telescope.nvim": { "branch": "master", "commit": "ffe90fac32122f401429b14d383137bd92a685d0" },
- "toggleterm.nvim": { "branch": "main", "commit": "61e8ad370d4da5d84c77e31671027bc094ac06ca" }
+{
+ "LuaSnip": { "branch": "master", "commit": "480b032f6708573334f4437d3f83307d143f1a72" },
+ "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
+ "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
+ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
+ "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
+ "everforest": { "branch": "master", "commit": "83b666410d7ae0eccf96dbbe3b4b6ac5b8172d38" },
+ "formatter.nvim": { "branch": "master", "commit": "34dcdfa0c75df667743b2a50dd99c84a557376f0" },
+ "lazy.nvim": { "branch": "main", "commit": "59335c5b9d116f5d3948f833288a89e2a829a005" },
+ "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
+ "neo-tree.nvim": { "branch": "main", "commit": "7e2a3caf999e2028abb643eb0472f351b2777591" },
+ "nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
+ "nvim-autopairs": { "branch": "master", "commit": "de4f7138a68d5d5063170f2182fd27faf06b0b54" },
+ "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
+ "nvim-lint": { "branch": "master", "commit": "1065763f115a7765ef237347ad676ba348d7193a" },
+ "nvim-lspconfig": { "branch": "master", "commit": "ac478757efcde1ac346f7044ab774e7cbb482533" },
+ "nvim-web-devicons": { "branch": "master", "commit": "45d0237c427baba8cd05e0ab26d30e2ee58c2c82" },
+ "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" },
+ "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
+ "telescope.nvim": { "branch": "master", "commit": "7d51950854a3f8853c5c0d570757095e9a5af313" },
+ "toggleterm.nvim": { "branch": "main", "commit": "c80844fd52ba76f48fabf83e2b9f9b93273f418d" }
} \ No newline at end of file
diff --git a/configs/nvim/lua/crupest/nvim/lsp/c.lua b/configs/nvim/lua/crupest/nvim/lsp/c.lua
index c855af3..053f8ce 100644
--- a/configs/nvim/lua/crupest/nvim/lsp/c.lua
+++ b/configs/nvim/lua/crupest/nvim/lsp/c.lua
@@ -2,11 +2,10 @@ local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig")
local function setup_lsp_c()
-
--- setup lsp clangd
-lspconfig.clangd.setup {
- capabilities = capabilities
-}
+ -- setup lsp clangd
+ lspconfig.clangd.setup {
+ capabilities = capabilities
+ }
end
return {
diff --git a/configs/nvim/lua/crupest/nvim/lsp/lua.lua b/configs/nvim/lua/crupest/nvim/lsp/lua.lua
new file mode 100644
index 0000000..97478d9
--- /dev/null
+++ b/configs/nvim/lua/crupest/nvim/lsp/lua.lua
@@ -0,0 +1,31 @@
+local capabilities = require("cmp_nvim_lsp").default_capabilities()
+local lspconfig = require("lspconfig")
+
+local function setup_lsp_lua()
+ lspconfig.lua_ls.setup {
+ capabilities = capabilities,
+ settings = {
+ Lua = {
+ runtime = {
+ version = "LuaJIT"
+ },
+ diagnostics = {
+ globals = { "vim" },
+ },
+ workspace = {
+ library = {
+ [vim.fn.expand "$VIMRUNTIME/lua"] = true,
+ [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
+ [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
+ },
+ maxPreload = 100000,
+ preloadFileSize = 10000,
+ },
+ },
+ },
+ }
+end
+
+return {
+ setup_lsp_lua = setup_lsp_lua
+}
diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua
index 42038a7..f692a3d 100644
--- a/configs/nvim/lua/plugins.lua
+++ b/configs/nvim/lua/plugins.lua
@@ -1,3 +1,4 @@
+-- spellchecker: disable
return {
"neovim/nvim-lspconfig",
"Hoffs/omnisharp-extended-lsp.nvim",
diff --git a/configs/nvim/nvim-words.txt b/configs/nvim/nvim-words.txt
new file mode 100644
index 0000000..9a38b6c
--- /dev/null
+++ b/configs/nvim/nvim-words.txt
@@ -0,0 +1,45 @@
+nvim
+neovide
+lspconfig
+keymap
+libuv
+omnifunc
+autocommand
+autocmd
+augroup
+stdpath
+setloclist
+bnext
+bufs
+buflisted
+bufexists
+getjumplist
+bufnr
+fnamemodify
+isfile
+isdir
+fargs
+nargs
+vimruntime
+copyfile
+isdirectory
+lnum
+
+# plugins
+dotfiles
+lualine
+luasnip
+toggleterm
+everforest
+autopairs
+neotree
+
+# languages
+clangd
+omnisharp
+omni
+codebases
+rulesets
+unimported
+prereleases
+cssls