summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
authorleiyu3 <s444814187@gmail.com>2026-02-24 15:26:45 -0500
committerleiyu3 <s444814187@gmail.com>2026-02-24 15:26:45 -0500
commit25bc82f7acde5fe11ee41ed3530607c219083d9a (patch)
tree2267899fa85ead83e8cbc14a53621540c6d70d28 /.config/nvim
parentb8fcc11c9b7f77b88e0880ececa735536d938f8d (diff)
downloaddotfiles-25bc82f7acde5fe11ee41ed3530607c219083d9a.tar.gz
dotfiles-25bc82f7acde5fe11ee41ed3530607c219083d9a.zip
neovim, footHEADmaster
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/init.lua221
-rw-r--r--.config/nvim/lazy-lock.json16
-rw-r--r--.config/nvim/lua/config/lazy.lua35
-rw-r--r--.config/nvim/lua/plugins/cmp-hledger.lua3
-rw-r--r--.config/nvim/lua/plugins/cmp-nvim-lsp.lua3
-rw-r--r--.config/nvim/lua/plugins/lualine.lua4
-rw-r--r--.config/nvim/lua/plugins/mason-lspconfig.lua11
-rw-r--r--.config/nvim/lua/plugins/mason.lua4
-rw-r--r--.config/nvim/lua/plugins/nvim-cmp.lua3
-rw-r--r--.config/nvim/lua/plugins/nvim-lspconfig.lua13
-rw-r--r--.config/nvim/lua/plugins/telescope.lua8
-rw-r--r--.config/nvim/lua/plugins/tokyonight.lua6
-rw-r--r--.config/nvim/lua/plugins/tree-sitter.lua5
13 files changed, 332 insertions, 0 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..36ad9d3
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1,221 @@
1-- hi Normal guibg=NONE ctermbg=NONE
2--
3require("config.lazy")
4
5vim.g.mapleader = ' '
6
7vim.o.number = true
8vim.o.relativenumber = true
9vim.o.ignorecase = true
10vim.o.smartcase = true
11vim.o.tabstop = 2
12vim.o.shiftwidth = 2
13vim.o.expandtab = true
14vim.o.scrolloff = 5
15
16vim.keymap.set('n', '<leader>a', ':keepjumps normal! ggVG<cr>')
17
18vim.o.clipboard = "unnamedplus"
19
20
21require("nvim-treesitter").setup{
22 indent = { enable = true },
23 highlight = {
24 enable = true,
25 additional_vim_regex_highlighting = false,
26 },
27 auto_install = false,
28 ensure_installed = {
29 "bash",
30 "c",
31 "diff",
32 "html",
33 "javascript",
34 "json",
35 "lua",
36 "markdown",
37 "markdown_inline",
38 "python",
39 "toml",
40 "yaml",
41 },
42}
43
44vim.api.nvim_create_autocmd('FileType', {
45 pattern = { '<filetype>' },
46 callback = function() vim.treesitter.start() end,
47})
48
49
50local builtin = require('telescope.builtin')
51vim.keymap.set('n', '<C-p>', builtin.find_files, { desc = 'Telescope find files' })
52vim.keymap.set('n', '<leader>s', builtin.live_grep, { desc = 'Telescope live grep' })
53vim.keymap.set('n', '<leader>f', builtin.git_files, { desc = 'Telescope git files' })
54
55vim.cmd[[colorscheme tokyonight-night]]
56
57require('lualine').setup {
58 options = {
59 icons_enabled = true,
60 theme = 'auto',
61 component_separators = { left = '', right = ''},
62 section_separators = { left = '', right = ''},
63 disabled_filetypes = {
64 statusline = {},
65 winbar = {},
66 },
67 ignore_focus = {},
68 always_divide_middle = true,
69 always_show_tabline = true,
70 globalstatus = false,
71 refresh = {
72 statusline = 1000,
73 tabline = 1000,
74 winbar = 1000,
75 refresh_time = 16, -- ~60fps
76 events = {
77 'WinEnter',
78 'BufEnter',
79 'BufWritePost',
80 'SessionLoadPost',
81 'FileChangedShellPost',
82 'VimResized',
83 'Filetype',
84 'CursorMoved',
85 'CursorMovedI',
86 'ModeChanged',
87 },
88 }
89 },
90 sections = {
91 lualine_a = {'mode'},
92 lualine_b = {'branch', 'diff', 'diagnostics'},
93 lualine_c = {'filename'},
94 lualine_x = {'encoding', 'fileformat', 'filetype'},
95 lualine_y = {'progress'},
96 lualine_z = {'location'}
97 },
98 inactive_sections = {
99 lualine_a = {},
100 lualine_b = {},
101 lualine_c = {'filename'},
102 lualine_x = {'location'},
103 lualine_y = {},
104 lualine_z = {}
105 },
106 tabline = {},
107 winbar = {},
108 inactive_winbar = {},
109 extensions = {}
110}
111
112-- An example nvim-lspconfig capabilities setting
113
114vim.lsp.enable("pyright")
115vim.lsp.enable("lua_ls")
116vim.lsp.enable("ts_ls")
117vim.lsp.enable("clangd")
118
119vim.keymap.set('n', '<space>d', vim.diagnostic.open_float)
120
121
122-- Set up nvim-cmp.
123local cmp = require'cmp'
124
125cmp.setup({
126snippet = {
127-- REQUIRED - you must specify a snippet engine
128expand = function(args)
129-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
130-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
131-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
132-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
133vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
134
135-- For `mini.snippets` users:
136-- local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
137-- insert({ body = args.body }) -- Insert at cursor
138-- cmp.resubscribe({ "TextChangedI", "TextChangedP" })
139-- require("cmp.config").set_onetime({ sources = {} })
140end,
141},
142window = {
143completion = cmp.config.window.bordered(),
144documentation = cmp.config.window.bordered(),
145},
146mapping = cmp.mapping.preset.insert({
147['<C-b>'] = cmp.mapping.scroll_docs(-4),
148['<C-f>'] = cmp.mapping.scroll_docs(4),
149['<C-Space>'] = cmp.mapping.complete(),
150['<C-e>'] = cmp.mapping.abort(),
151['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
152}),
153sources = cmp.config.sources({
154{ name = 'nvim_lsp' },
155-- { name = 'vsnip' }, -- For vsnip users.
156-- { name = 'luasnip' }, -- For luasnip users.
157-- { name = 'ultisnips' }, -- For ultisnips users.
158-- { name = 'snippy' }, -- For snippy users.
159}, {
160{ name = 'buffer' },
161})
162})
163
164-- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below
165-- Set configuration for specific filetype.
166--[[ cmp.setup.filetype('gitcommit', {
167sources = cmp.config.sources({
168{ name = 'git' },
169}, {
170{ name = 'buffer' },
171})
172})
173require("cmp_git").setup() ]]--
174
175-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
176cmp.setup.cmdline({ '/', '?' }, {
177mapping = cmp.mapping.preset.cmdline(),
178sources = {
179{ name = 'buffer' }
180}
181})
182
183-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
184cmp.setup.cmdline(':', {
185mapping = cmp.mapping.preset.cmdline(),
186sources = cmp.config.sources({
187{ name = 'path' }
188}, {
189{ name = 'cmdline' }
190}),
191matching = { disallow_symbol_nonprefix_matching = false }
192})
193
194-- Set up lspconfig.
195local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
196-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
197vim.lsp.config("markdown_oxide", {
198 -- Ensure that dynamicRegistration is enabled! This allows the LS to take into account actions like the
199 -- Create Unresolved File code action, resolving completions for unindexed code blocks, ...
200 capabilities = vim.tbl_deep_extend(
201 'force',
202 capabilities,
203 {
204 workspace = {
205 didChangeWatchedFiles = {
206 dynamicRegistration = true,
207 },
208 },
209 }
210 ),
211 on_attach = on_attach -- configure your on attach config
212})
213vim.lsp.enable('markdown_oxide')
214
215require('cmp').setup {
216 sources = {
217 {
218 name = 'hledger',
219 }
220 }
221}
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
new file mode 100644
index 0000000..f6a474c
--- /dev/null
+++ b/.config/nvim/lazy-lock.json
@@ -0,0 +1,16 @@
1{
2 "cmp-hledger": { "branch": "main", "commit": "ea2211cdd4f5d171ad2bdb0d66197173ce384ddd" },
3 "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
4 "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
5 "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
6 "mason-lspconfig.nvim": { "branch": "main", "commit": "6c4830e37743b060d13c9269394176aea6a0fbc8" },
7 "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
8 "nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
9 "nvim-lspconfig": { "branch": "master", "commit": "b7dcde3e6195b43476ae799720b177aedc16d44c" },
10 "nvim-treesitter": { "branch": "main", "commit": "d660b7c002f3922b6bb3da47206645488a698426" },
11 "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
12 "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
13 "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
14 "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" },
15 "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }
16}
diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua
new file mode 100644
index 0000000..f5ee74c
--- /dev/null
+++ b/.config/nvim/lua/config/lazy.lua
@@ -0,0 +1,35 @@
1-- Bootstrap lazy.nvim
2local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3if not (vim.uv or vim.loop).fs_stat(lazypath) then
4 local lazyrepo = "https://github.com/folke/lazy.nvim.git"
5 local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
6 if vim.v.shell_error ~= 0 then
7 vim.api.nvim_echo({
8 { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
9 { out, "WarningMsg" },
10 { "\nPress any key to exit..." },
11 }, true, {})
12 vim.fn.getchar()
13 os.exit(1)
14 end
15end
16vim.opt.rtp:prepend(lazypath)
17
18-- Make sure to setup `mapleader` and `maplocalleader` before
19-- loading lazy.nvim so that mappings are correct.
20-- This is also a good place to setup other settings (vim.opt)
21vim.g.mapleader = " "
22vim.g.maplocalleader = "\\"
23
24-- Setup lazy.nvim
25require("lazy").setup({
26 spec = {
27 -- import your plugins
28 { import = "plugins" },
29 },
30 -- Configure any other settings here. See the documentation for more details.
31 -- colorscheme that will be used when installing plugins.
32 install = { colorscheme = { "habamax" } },
33 -- automatically check for plugin updates
34 checker = { enabled = true },
35})
diff --git a/.config/nvim/lua/plugins/cmp-hledger.lua b/.config/nvim/lua/plugins/cmp-hledger.lua
new file mode 100644
index 0000000..d8b406d
--- /dev/null
+++ b/.config/nvim/lua/plugins/cmp-hledger.lua
@@ -0,0 +1,3 @@
1return {
2 'kirasok/cmp-hledger'
3}
diff --git a/.config/nvim/lua/plugins/cmp-nvim-lsp.lua b/.config/nvim/lua/plugins/cmp-nvim-lsp.lua
new file mode 100644
index 0000000..cbebd75
--- /dev/null
+++ b/.config/nvim/lua/plugins/cmp-nvim-lsp.lua
@@ -0,0 +1,3 @@
1return {
2 'hrsh7th/cmp-nvim-lsp'
3}
diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua
new file mode 100644
index 0000000..5f69610
--- /dev/null
+++ b/.config/nvim/lua/plugins/lualine.lua
@@ -0,0 +1,4 @@
1return {
2 'nvim-lualine/lualine.nvim',
3 dependencies = { 'nvim-tree/nvim-web-devicons' }
4}
diff --git a/.config/nvim/lua/plugins/mason-lspconfig.lua b/.config/nvim/lua/plugins/mason-lspconfig.lua
new file mode 100644
index 0000000..b5512e6
--- /dev/null
+++ b/.config/nvim/lua/plugins/mason-lspconfig.lua
@@ -0,0 +1,11 @@
1return {
2 "mason-org/mason-lspconfig.nvim",
3 opts = {
4 ensure_installed = {
5 "lua_ls",
6 -- "pyright",
7 "clangd",
8 -- "ts_ls",
9 },
10 },
11}
diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua
new file mode 100644
index 0000000..0949c15
--- /dev/null
+++ b/.config/nvim/lua/plugins/mason.lua
@@ -0,0 +1,4 @@
1return {
2 "mason-org/mason.nvim",
3 opts = {},
4}
diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua
new file mode 100644
index 0000000..e9d946a
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-cmp.lua
@@ -0,0 +1,3 @@
1return {
2 "hrsh7th/nvim-cmp"
3}
diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua
new file mode 100644
index 0000000..2088263
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua
@@ -0,0 +1,13 @@
1return {
2 "neovim/nvim-lspconfig",
3 config = function()
4 local lspconfig = require("lspconfig")
5
6 -- lspconfig.lua_ls.setup({})
7 -- lspconfig.pyright.setup({})
8 -- lspconfig.ts_ls.setup({})
9 -- lspconfig.rust_analyzer.setup({})
10 -- lspconfig.clangd.setup({})
11 -- lspconfig.markdown_oxide.setup({})
12 end
13}
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
new file mode 100644
index 0000000..fef8e18
--- /dev/null
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,8 @@
1return {
2 'nvim-telescope/telescope.nvim', version = '*',
3 dependencies = {
4 'nvim-lua/plenary.nvim',
5 -- optional but recommended
6 { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
7 }
8}
diff --git a/.config/nvim/lua/plugins/tokyonight.lua b/.config/nvim/lua/plugins/tokyonight.lua
new file mode 100644
index 0000000..3e6a862
--- /dev/null
+++ b/.config/nvim/lua/plugins/tokyonight.lua
@@ -0,0 +1,6 @@
1return {
2 "folke/tokyonight.nvim",
3 lazy = false,
4 priority = 1000,
5 opts = {},
6}
diff --git a/.config/nvim/lua/plugins/tree-sitter.lua b/.config/nvim/lua/plugins/tree-sitter.lua
new file mode 100644
index 0000000..e78bd71
--- /dev/null
+++ b/.config/nvim/lua/plugins/tree-sitter.lua
@@ -0,0 +1,5 @@
1return {
2 "nvim-treesitter/nvim-treesitter",
3 lazy = false,
4 build = ":TSUpdate",
5}