-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nvim): rework the configuration, bump nvim from 0.7 to 0.10
- Loading branch information
Showing
16 changed files
with
518 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | ||
if not vim.loop.fs_stat(lazypath) then | ||
vim.fn.system({ | ||
"git", | ||
"clone", | ||
"--filter=blob:none", | ||
"https://github.com/folke/lazy.nvim.git", | ||
"--branch=stable", -- latest stable release | ||
lazypath, | ||
}) | ||
end | ||
vim.opt.rtp:prepend(lazypath) | ||
|
||
-- Example using a list of specs with the default options | ||
vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct | ||
|
||
require("option") | ||
require("remap") | ||
require("lazy").setup("plugins") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, | ||
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" }, | ||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, | ||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, | ||
"cmp-rg": { "branch": "master", "commit": "677a7874ee8f1afc648c2e7d63a97bc21a7663c5" }, | ||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, | ||
"friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, | ||
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, | ||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, | ||
"neo-tree.nvim": { "branch": "v3.x", "commit": "e578fe7a5832421b0d2c5b3c0a7a1e40e0f6a47a" }, | ||
"nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, | ||
"nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" }, | ||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, | ||
"nvim-treesitter": { "branch": "master", "commit": "ba6454783493ac3a5dd209c25e491640b07bd8de" }, | ||
"nvim-ts-autotag": { "branch": "main", "commit": "a65b202cfd08e0e69e531eab737205ff5bc082a4" }, | ||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" }, | ||
"nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" }, | ||
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, | ||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, | ||
"telescope.nvim": { "branch": "0.1.x", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, | ||
"tokyonight.nvim": { "branch": "main", "commit": "e3301873c1e96903daebb98cc9b5926810bf73dd" }, | ||
"vim-illuminate": { "branch": "master", "commit": "97c1265ff0b67064b6cfdc15bafc50202a537ae2" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Credits to https://github.com/Lujeni/settings/tree/master/roles/settings/files/nvim/lua/lujeni |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
local opt = vim.opt | ||
opt.autoindent = true | ||
opt.autowrite = true -- Enable auto write | ||
opt.clipboard = "unnamedplus" -- Sync with system clipboard | ||
opt.completeopt = "menu,menuone,noselect" | ||
opt.conceallevel = 3 -- Hide * markup for bold and italic | ||
opt.confirm = true -- Confirm to save changes before exiting modified buffer | ||
opt.cursorline = true -- Enable highlighting of the current line | ||
opt.expandtab = true -- Use spaces instead of tabs | ||
opt.formatoptions = "jcroqlnt" -- tcqj | ||
opt.grepformat = "%f:%l:%c:%m" | ||
opt.grepprg = "rg --vimgrep" | ||
opt.guicursor = "a:block" | ||
opt.hidden = true | ||
opt.hlsearch = false | ||
opt.ignorecase = true -- Ignore case | ||
opt.inccommand = "nosplit" -- preview incremental substitute | ||
opt.incsearch = true | ||
opt.laststatus = 0 | ||
opt.list = true -- Show some invisible characters (tabs... | ||
opt.mouse = "a" -- Enable mouse mode | ||
opt.number = true -- Print line number | ||
opt.pumblend = 10 -- Popup blend | ||
opt.pumheight = 10 -- Maximum number of entries in a popup | ||
opt.relativenumber = false -- Relative line numbers | ||
opt.scrolloff = 4 -- Lines of context | ||
opt.sessionoptions = {"buffers", "curdir", "tabpages", "winsize"} | ||
opt.shiftround = true -- Round indent | ||
opt.shiftwidth = 2 -- Size of an indent | ||
opt.shortmess:append({W = true, I = true, c = true}) | ||
opt.showmode = false -- Dont show mode since we have a statusline | ||
opt.sidescrolloff = 8 -- Columns of context | ||
opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time | ||
opt.smartcase = true -- Don't ignore case with capitals | ||
opt.smartindent = true -- Insert indents automatically | ||
opt.spelllang = {"en"} | ||
opt.splitbelow = true -- Put new windows below current | ||
opt.splitright = true -- Put new windows right of current | ||
opt.tabstop = 2 -- Number of spaces tabs count for | ||
opt.termguicolors = true -- True color support | ||
opt.timeoutlen = 300 | ||
opt.undodir = os.getenv("HOME") .. "/.vim/undodir" | ||
opt.undofile = true | ||
opt.undolevels = 10000 | ||
opt.updatetime = 200 -- Save swap file and trigger CursorHold | ||
opt.wildmode = "longest:full,full" -- Command-line completion mode | ||
opt.winminwidth = 5 -- Minimum window width | ||
opt.wrap = true -- Disable line wrap | ||
|
||
vim.g.markdown_recommended_style = 0 | ||
vim.g.mapleader = "," | ||
vim.g.loaded_netrw = 1 | ||
vim.g.loaded_netrwPlugin = 1 | ||
|
||
vim.loader.enable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
return { | ||
"windwp/nvim-autopairs", | ||
event = { "InsertEnter" }, | ||
dependencies = { | ||
"hrsh7th/nvim-cmp", | ||
}, | ||
config = function() | ||
local autopairs = require("nvim-autopairs") | ||
autopairs.setup({ | ||
check_ts = true, | ||
ts_config = { | ||
lua = { "string" }, | ||
javascript = { "template_string" }, | ||
java = false, | ||
}, | ||
}) | ||
local cmp_autopairs = require("nvim-autopairs.completion.cmp") | ||
local cmp = require("cmp") | ||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
return { | ||
"hrsh7th/nvim-cmp", | ||
event = "InsertEnter", | ||
dependencies = { | ||
"L3MON4D3/LuaSnip", | ||
"hrsh7th/cmp-buffer", | ||
"hrsh7th/cmp-path", | ||
"onsails/lspkind.nvim", | ||
"rafamadriz/friendly-snippets", | ||
"saadparwaiz1/cmp_luasnip", | ||
"lukas-reineke/cmp-rg" | ||
}, | ||
config = function() | ||
local cmp = require("cmp") | ||
local luasnip = require("luasnip") | ||
local lspkind = require("lspkind") | ||
|
||
require("luasnip.loaders.from_vscode").lazy_load() | ||
|
||
cmp.setup({ | ||
completion = { | ||
completeopt = "menu,menuone,preview,noselect", | ||
}, | ||
snippet = { | ||
expand = function(args) | ||
luasnip.lsp_expand(args.body) | ||
end, | ||
}, | ||
mapping = cmp.mapping.preset.insert({ | ||
["<C-k>"] = cmp.mapping.select_prev_item(), | ||
["<C-j>"] = cmp.mapping.select_next_item(), | ||
["<C-b>"] = cmp.mapping.scroll_docs(-4), | ||
["<C-f>"] = cmp.mapping.scroll_docs(4), | ||
["<C-Space>"] = cmp.mapping.complete(), | ||
["<C-e>"] = cmp.mapping.abort(), | ||
["<CR>"] = cmp.mapping.confirm({ select = false }), | ||
}), | ||
sources = cmp.config.sources({ | ||
{ name = "buffer" }, | ||
{ name = "luasnip" }, | ||
{ name = "nvim_lsp" }, | ||
{ name = "path" }, | ||
{ name = "rg" }, | ||
}), | ||
-- configure lspkind for vs-code like pictograms in completion menu | ||
formatting = { | ||
format = lspkind.cmp_format({ | ||
maxwidth = 50, | ||
ellipsis_char = "...", | ||
}), | ||
}, | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
return { | ||
"folke/tokyonight.nvim", | ||
priority = 1000, | ||
config = function() | ||
vim.cmd([[colorscheme tokyonight-storm]]) | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
return { | ||
"numToStr/Comment.nvim", | ||
event = { "BufReadPre", "BufNewFile" }, | ||
dependencies = { | ||
"JoosepAlviste/nvim-ts-context-commentstring", | ||
}, | ||
config = function() | ||
local comment = require("Comment") | ||
local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") | ||
comment.setup({ | ||
pre_hook = ts_context_commentstring.create_pre_hook(), | ||
}) | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
return { | ||
{ | ||
"RRethy/vim-illuminate", | ||
event = {"BufReadPost", "BufNewFile"}, | ||
opts = { | ||
delay = 200, | ||
large_file_cutoff = 2000, | ||
large_file_overrides = {providers = {"lsp"}} | ||
}, | ||
config = function(_, opts) | ||
require("illuminate").configure(opts) | ||
|
||
local function map(key, dir, buffer) | ||
vim.keymap.set("n", key, function() | ||
require("illuminate")["goto_" .. dir .. "_reference"](false) | ||
end, { | ||
desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", | ||
buffer = buffer | ||
}) | ||
end | ||
|
||
map("]]", "next") | ||
map("[[", "prev") | ||
|
||
-- also set it after loading ftplugins, since a lot overwrite [[ and ]] | ||
vim.api.nvim_create_autocmd("FileType", { | ||
callback = function() | ||
local buffer = vim.api.nvim_get_current_buf() | ||
map("]]", "next", buffer) | ||
map("[[", "prev", buffer) | ||
end | ||
}) | ||
end, | ||
keys = { | ||
{"]]", desc = "Next Reference"}, {"[[", desc = "Prev Reference"} | ||
} | ||
} | ||
} |
Oops, something went wrong.