nvim
This commit is contained in:
parent
aa1f89c172
commit
2f6925561b
10 changed files with 206 additions and 254 deletions
|
@ -1,60 +0,0 @@
|
|||
local ok, lualine = pcall(require, "lualine")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
local function diff_source()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
lualine.setup {
|
||||
options = {
|
||||
theme = "auto",
|
||||
globalstatus = true,
|
||||
section_separators = "",
|
||||
},
|
||||
sections = {
|
||||
lualine_b = {
|
||||
{ "branch" },
|
||||
{
|
||||
"diff",
|
||||
source = diff_source,
|
||||
},
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
"filetype",
|
||||
colored = true,
|
||||
icon_only = true,
|
||||
separator = "",
|
||||
},
|
||||
{ "filename" },
|
||||
{
|
||||
function()
|
||||
return vim.fn.search([[\s\+$]], "nw") ~= 0 and "trailing" or ""
|
||||
end,
|
||||
color = "WarningMsg",
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
{ "encoding" },
|
||||
{ "fileformat" },
|
||||
{
|
||||
function()
|
||||
if vim.bo.expandtab then
|
||||
return "Space " .. vim.bo.shiftwidth
|
||||
else
|
||||
return "Tab " .. vim.bo.shiftwidth
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
local ok, cmp = pcall(require, "cmp")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
local luasnip_ok, luasnip = pcall(require, "luasnip")
|
||||
if not luasnip_ok then
|
||||
vim.notify("Luasnip is required for nvim-cmp to work", vim.log.levels.WARN)
|
||||
end
|
||||
|
||||
local lspkind = require "lspkind"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4, { "i", "c" })),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4, { "i", "c" })),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete {}, { "i", "c" }),
|
||||
["<C-c>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format(),
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
|
@ -57,6 +57,7 @@ vim.opt.signcolumn = "yes"
|
|||
vim.opt.smartcase = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.title = true
|
||||
vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo"
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
local ok, lspconfig = pcall(require, "lspconfig")
|
||||
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
local lspconfig = require "lspconfig"
|
||||
require "neodev".setup()
|
||||
|
||||
local root_dir
|
||||
for dir in vim.fs.parents(vim.api.nvim_buf_get_name(0)) do
|
||||
|
@ -30,11 +27,11 @@ local on_attach = function(client, bufnr)
|
|||
require("my.keymaps").lsp_keymaps(client, bufnr)
|
||||
|
||||
if client.server_capabilities.completionProvider then
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr })
|
||||
end
|
||||
|
||||
if client.server_capabilities.definitionProvider then
|
||||
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = bufnr })
|
||||
end
|
||||
|
||||
-- Highlight on cursor hold
|
|
@ -1,8 +1,5 @@
|
|||
local _, telescope = pcall(require, "telescope")
|
||||
local ok, builtin = pcall(require, "telescope.builtin")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
local telescope = require "telescope"
|
||||
local builtin = require "telescope.builtin"
|
||||
|
||||
telescope.setup {
|
||||
extensions = {
|
|
@ -1,138 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
flavour = "mocha", -- latte, frappe, macchiato, mocha
|
||||
transparent_background = false,
|
||||
dim_inactive = {
|
||||
enabled = true,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
fidget = true,
|
||||
gitsigns = true,
|
||||
indent_blankline = {
|
||||
enabled = true,
|
||||
colored_indent_levels = false,
|
||||
},
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "underline" },
|
||||
hints = { "underline" },
|
||||
warnings = { "underline" },
|
||||
information = { "underline" },
|
||||
},
|
||||
},
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
},
|
||||
},
|
||||
config = function(_LazyPlugin, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
"nvim-lua/plenary.nvim",
|
||||
}
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
}
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
},
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
tag = "legacy",
|
||||
event = "LspAttach",
|
||||
opts = {
|
||||
window = {
|
||||
blend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
branch = "v3",
|
||||
config = function()
|
||||
require("ibl").setup {
|
||||
scope = { enabled = false }
|
||||
}
|
||||
end
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
tag = "v2.1.0",
|
||||
opts = {
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-v>"] = "actions.select_vsplit",
|
||||
["<C-s>"] = "actions.select_split",
|
||||
["<C-t>"] = "actions.select_tab",
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = "actions.close",
|
||||
["r"] = "actions.refresh",
|
||||
["-"] = "actions.parent",
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = "actions.tcd",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
},
|
||||
use_default_keymaps = false,
|
||||
}
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
delay = 300,
|
||||
},
|
||||
on_attach = require "my.keymaps".gitsigns_keymaps,
|
||||
}
|
||||
},
|
||||
{ "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" },
|
||||
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp"
|
||||
},
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-lualine/lualine.nvim",
|
||||
"onsails/lspkind.nvim",
|
||||
}
|
61
nvim/lua/plugins/cmp.lua
Normal file
61
nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
return {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"onsails/lspkind.nvim",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require "cmp"
|
||||
local lspkind = require "lspkind"
|
||||
local luasnip = require "luasnip"
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4, { "i", "c" })),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4, { "i", "c" })),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete {}, { "i", "c" }),
|
||||
["<C-c>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" })
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format(),
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
74
nvim/lua/plugins/init.lua
Normal file
74
nvim/lua/plugins/init.lua
Normal file
|
@ -0,0 +1,74 @@
|
|||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VeryLazy",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
require "my.telescope"
|
||||
end
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {}
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
tag = "v2.1.0",
|
||||
opts = {
|
||||
keymaps = {
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.select",
|
||||
["<C-v>"] = "actions.select_vsplit",
|
||||
["<C-s>"] = "actions.select_split",
|
||||
["<C-t>"] = "actions.select_tab",
|
||||
["<C-p>"] = "actions.preview",
|
||||
["<C-c>"] = "actions.close",
|
||||
["r"] = "actions.refresh",
|
||||
["-"] = "actions.parent",
|
||||
["_"] = "actions.open_cwd",
|
||||
["`"] = "actions.cd",
|
||||
["~"] = "actions.tcd",
|
||||
["g."] = "actions.toggle_hidden",
|
||||
},
|
||||
use_default_keymaps = false,
|
||||
}
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
delay = 300,
|
||||
},
|
||||
on_attach = require "my.keymaps".gitsigns_keymaps,
|
||||
}
|
||||
},
|
||||
{ "lukas-reineke/lsp-format.nvim", tag = "v2.5.1" },
|
||||
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp"
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.nvim',
|
||||
version = '*',
|
||||
config = function()
|
||||
require "mini.statusline".setup()
|
||||
end
|
||||
},
|
||||
}
|
17
nvim/lua/plugins/lspconfig.lua
Normal file
17
nvim/lua/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"folke/neodev.nvim",
|
||||
},
|
||||
config = function()
|
||||
require "my.lsp"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
tag = "v1.4.0",
|
||||
opts = {},
|
||||
event = "LspAttach"
|
||||
},
|
||||
}
|
47
nvim/lua/plugins/theme.lua
Normal file
47
nvim/lua/plugins/theme.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
flavour = "latte", -- latte, frappe, macchiato, mocha
|
||||
transparent_background = false,
|
||||
dim_inactive = {
|
||||
enabled = true,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
fidget = true,
|
||||
gitsigns = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "underline" },
|
||||
hints = { "underline" },
|
||||
warnings = { "underline" },
|
||||
information = { "underline" },
|
||||
},
|
||||
},
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
mini = {
|
||||
enabled = true,
|
||||
indentscope_color = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
end
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue