initial commit
This commit is contained in:
commit
48bd259cd8
29 changed files with 1107 additions and 0 deletions
4
ftplugin/netrw.lua
Normal file
4
ftplugin/netrw.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<C-l>", "<C-w>l", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<C-k>", "<C-w>k", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<C-j>", "<C-w>j", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<C-h>", "<C-w>h", {})
|
3
ftplugin/python.lua
Normal file
3
ftplugin/python.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
setlocal tabstop = 4
|
||||||
|
setlocal softtabstop = 4
|
||||||
|
setlocal shiftwidth = 4
|
10
ftplugin/tex.lua
Normal file
10
ftplugin/tex.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
-- Compile LaTeX from file
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<leader>cc", ":exec 'w' <bar> :exec '!xelatex %'<cr>", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<F5>", ":exec 'w' <bar> :exec 'w' <bar> :exec '!xelatex %'<cr>", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "i", "<F5>", "<esc> :exec 'w' <bar> :exec '!xelatex %'<cr>", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "v", "<F5>", "<esc> :exec 'w' <bar> :exec '!xelatex %'<cr>", {})
|
||||||
|
|
||||||
|
-- Open PDF-Viewer from LaTeX-file
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "n", "<F6>", ":silent !zathura --fork %:r.pdf& <cr>", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "i", "<F6>", "<esc> :silent !zathura --fork %:r.pdf& <cr>", {})
|
||||||
|
vim.api.nvim_buf_set_keymap(0, "v", "<F6>", "<esc> :silent !zathura --fork %:r.pdf& <cr>", {})
|
31
init.lua
Normal file
31
init.lua
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
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)
|
||||||
|
|
||||||
|
require("core.settings")
|
||||||
|
require("core.remap")
|
||||||
|
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
import = "plugin",
|
||||||
|
},
|
||||||
|
ui = {
|
||||||
|
border = "rounded",
|
||||||
|
},
|
||||||
|
install = {
|
||||||
|
colorscheme = { "gruvbox-material" }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
require("core.autocmd")
|
||||||
|
require("core.statusline")
|
13
lua/core/autocmd.lua
Normal file
13
lua/core/autocmd.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
-- autocmd
|
||||||
|
|
||||||
|
-- Disable autocommenting on new lines under commented ones
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("Filetype", {
|
||||||
|
pattern = "*",
|
||||||
|
command = "setlocal formatoptions-=c formatoptions-=r formatoptions-=o"
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FocusLost", {
|
||||||
|
pattern = "*",
|
||||||
|
command = ":wa"
|
||||||
|
})
|
51
lua/core/remap.lua
Normal file
51
lua/core/remap.lua
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
-- remaps
|
||||||
|
|
||||||
|
-- leaderkey
|
||||||
|
vim.keymap.set("n", "<Space>", "", {})
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
-- movements in commandmode
|
||||||
|
vim.api.nvim_set_keymap("c", "<C-h>", "<Left>", {})
|
||||||
|
vim.api.nvim_set_keymap("c", "<C-l>", "<Right>", {})
|
||||||
|
vim.api.nvim_set_keymap("c", "<C-j>", "<Down>", {})
|
||||||
|
vim.api.nvim_set_keymap("c", "<C-k>", "<Up>", {})
|
||||||
|
|
||||||
|
-- split switching
|
||||||
|
vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", {})
|
||||||
|
|
||||||
|
-- buffer operations
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader><tab>", "<C-^>", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>on", "<cmd>w <bar> %bd <bar> e#<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>bd", "<cmd>bd<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<S-h>", "<cmd>bprevious<cr>", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<S-l>", "<cmd>bnext<cr>", {})
|
||||||
|
|
||||||
|
-- moving visual blocks
|
||||||
|
vim.api.nvim_set_keymap("v", "J", ":m '>+1<cr>gv=gv", {})
|
||||||
|
vim.api.nvim_set_keymap("v", "K", ":m '<-2<cr>gv=gv", {})
|
||||||
|
|
||||||
|
-- delete without overwriting the '+'-register
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>d", "\"_d", {})
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>d", "\"_d", {})
|
||||||
|
|
||||||
|
-- copy to system clipboard
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>y", "\"+y", {})
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>y", "\"+y", {})
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>Y", "\"+Y", {})
|
||||||
|
|
||||||
|
-- paste from system clipboard
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>p", "\"+p", {})
|
||||||
|
|
||||||
|
-- opening explorer
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>E", ":20Lexplore<cr>", {})
|
||||||
|
|
||||||
|
-- make current file (un)executable
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>mx", ":exec 'w'<cr> <bar> <cmd>!chmod +x %<cr>", { silent = true })
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>mX", ":exec 'w'<cr> <bar> <cmd>!chmod -x %<cr>", { silent = true })
|
||||||
|
|
||||||
|
-- mk- and loadview for view-persistance
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>vm", ":exec 'w'<cr> <bar> <cmd>mkview <cr>", {silent = true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>vl", ":exec 'w'<cr> <bar> <cmd>loadview <cr>", {silent = true})
|
63
lua/core/settings.lua
Normal file
63
lua/core/settings.lua
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
-- Settings
|
||||||
|
|
||||||
|
-- cursor
|
||||||
|
vim.api.nvim_set_option("guicursor","n-v-c-sm:hor20-Cursor,i-ci-ve:ver80-iCursor,r-cr-o:hor40,a:blinkwait700-blinkoff400-blinkon250")
|
||||||
|
|
||||||
|
-- disable mouse
|
||||||
|
vim.api.nvim_set_option("mouse","")
|
||||||
|
|
||||||
|
-- relative numbers
|
||||||
|
vim.opt.nu = true
|
||||||
|
vim.opt.rnu = true
|
||||||
|
vim.opt.signcolumn = 'yes'
|
||||||
|
|
||||||
|
-- setting completion menu for autocompletion
|
||||||
|
vim.opt.completeopt = 'menu,menuone,noselect'
|
||||||
|
vim.opt.list = true
|
||||||
|
|
||||||
|
-- correct tabbing
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.softtabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
-- enable foldcolumn
|
||||||
|
vim.wo.foldcolumn = "2"
|
||||||
|
|
||||||
|
-- smart indenting by vim
|
||||||
|
vim.api.nvim_set_option("smartindent",true)
|
||||||
|
|
||||||
|
-- highlightsearch off but incsearch on with smartcase and ignorecase
|
||||||
|
vim.api.nvim_set_option("hlsearch", false)
|
||||||
|
vim.api.nvim_set_option("incsearch", true)
|
||||||
|
vim.api.nvim_set_option("smartcase", true)
|
||||||
|
vim.api.nvim_set_option("ignorecase", true)
|
||||||
|
|
||||||
|
-- colors with gui-terminal and dark background
|
||||||
|
vim.api.nvim_set_option("termguicolors", true)
|
||||||
|
vim.api.nvim_set_option("background", "dark")
|
||||||
|
|
||||||
|
-- always center
|
||||||
|
-- vim.api.nvim_set_option("scrolloff",999)
|
||||||
|
vim.api.nvim_set_option("scrolloff",15)
|
||||||
|
|
||||||
|
-- spellchecking
|
||||||
|
vim.wo.spell = true
|
||||||
|
vim.bo.spelllang = "de"
|
||||||
|
|
||||||
|
-- highlight the current linenumber
|
||||||
|
vim.wo.cursorline = true
|
||||||
|
vim.wo.cursorlineopt = "both"
|
||||||
|
|
||||||
|
-- splitting below and right
|
||||||
|
vim.api.nvim_set_option("splitbelow",true)
|
||||||
|
vim.api.nvim_set_option("splitright",true)
|
||||||
|
|
||||||
|
-- disable Netrw-Banner
|
||||||
|
vim.g.netrw_banner = 0
|
||||||
|
|
||||||
|
-- undotree file management
|
||||||
|
vim.opt.swapfile = false
|
||||||
|
vim.opt.backup = false
|
||||||
|
vim.opt.undodir = os.getenv("HOME") .. "/.local/share/nvim/undodir"
|
||||||
|
vim.opt.undofile = true
|
7
lua/core/statusline.lua
Normal file
7
lua/core/statusline.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
-- statusline
|
||||||
|
vim.api.nvim_set_option("laststatus", 2)
|
||||||
|
vim.api.nvim_set_option("statusline", " ")
|
||||||
|
|
||||||
|
-- tabline
|
||||||
|
-- always show tabline (0 = never, 1 = only with at least 2 tabs, 2 = always) and colors
|
||||||
|
vim.api.nvim_set_option("showtabline", 2)
|
10
lua/plugin/autopairs.lua
Normal file
10
lua/plugin/autopairs.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"echasnovski/mini.pairs",
|
||||||
|
event = "VeryLazy",
|
||||||
|
version = false,
|
||||||
|
config = function()
|
||||||
|
require("mini.pairs").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
27
lua/plugin/bufferline.lua
Normal file
27
lua/plugin/bufferline.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
config = function()
|
||||||
|
require("bufferline").setup({
|
||||||
|
options = {
|
||||||
|
offsets = {
|
||||||
|
{
|
||||||
|
filetype = "netrw",
|
||||||
|
text = "File Explorer",
|
||||||
|
highlight = "Directory",
|
||||||
|
text_align = 'center',
|
||||||
|
separator = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
show_buffer_close_icons = false,
|
||||||
|
},
|
||||||
|
highlights = {
|
||||||
|
buffer_selected = {
|
||||||
|
fg = "#d8a657",
|
||||||
|
bg = "#141617",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
8
lua/plugin/commenting.lua
Normal file
8
lua/plugin/commenting.lua
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"echasnovski/mini.comment",
|
||||||
|
config = function()
|
||||||
|
require("mini.comment").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
4
lua/plugin/devicons.lua
Normal file
4
lua/plugin/devicons.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
return {
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
lazy = true,
|
||||||
|
}
|
64
lua/plugin/everforest.lua
Normal file
64
lua/plugin/everforest.lua
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"sainnhe/everforest",
|
||||||
|
lazy = true,
|
||||||
|
config = function()
|
||||||
|
-- Settings for colorscheme
|
||||||
|
vim.api.nvim_set_var("everforest_background", "hard")
|
||||||
|
vim.api.nvim_set_var("everforest_transparent_background", "1")
|
||||||
|
vim.api.nvim_set_var("everforest_ui_contrast", "low")
|
||||||
|
vim.api.nvim_set_var("everforest_show_eob", "0")
|
||||||
|
vim.api.nvim_set_var("everforest_enable_bold", "1")
|
||||||
|
vim.api.nvim_set_var("everforest_enable_italic", "1")
|
||||||
|
vim.api.nvim_set_var("everforest_better_performance", "1")
|
||||||
|
vim.cmd([[colo everforest]])
|
||||||
|
|
||||||
|
-- Settings to override colorscheme
|
||||||
|
-- vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, fg = "#d8a657"})
|
||||||
|
-- colors of tabline
|
||||||
|
vim.api.nvim_set_hl(0, "TabLine", { bg = "#3c3836", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineFil", { bg = "#1d2021" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineSel", { bold = true, bg = "none", fg = "#d8a657" })
|
||||||
|
-- color of statusline
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLine", { bold = false, bg = "#1d2021", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "#1d2021", fg = "#5b534d" })
|
||||||
|
-- color of vertical split line
|
||||||
|
vim.api.nvim_set_hl(0, "VertSplit", { bg = "#141617", fg = "#141617" })
|
||||||
|
-- color of the cursorline and cursorlinenumber
|
||||||
|
vim.api.nvim_set_hl(0, "Cursorline", { bg = "#141617" })
|
||||||
|
vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true, bg = "#141617", fg = "#d8a657" })
|
||||||
|
-- color of Floats and FloatBorders
|
||||||
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = none, fg = none })
|
||||||
|
vim.api.nvim_set_hl(0, "FloatBorder", { bg = none, fg = "#d4be98" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", { bg = none, fg = "#d8a657" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingError", { bg = none, fg = "#ea6962" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", { bg = none, fg = "#a9b665" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", { bg = none, fg = "#d4be98" })
|
||||||
|
|
||||||
|
-- autocommand for overrides
|
||||||
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
|
pattern = "everforest",
|
||||||
|
callback = function()
|
||||||
|
vim.api.nvim_set_hl(0, "TabLine", { bg = "#3c3836", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineFil", { bg = "#1d2021" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineSel", { bold = true, bg = "none", fg = "#d8a657" })
|
||||||
|
-- color of statusline
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLine", { bold = false, bg = "#1d2021", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "#1d2021", fg = "#5b534d" })
|
||||||
|
-- color of vertical split line
|
||||||
|
vim.api.nvim_set_hl(0, "VertSplit", { bg = "#141617", fg = "#141617" })
|
||||||
|
-- color of the cursorline and cursorlinenumber
|
||||||
|
vim.api.nvim_set_hl(0, "Cursorline", { bg = "#141617" })
|
||||||
|
vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true, bg = "#141617", fg = "#d8a657" })
|
||||||
|
-- color of Floats and FloatBorders
|
||||||
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = none, fg = none })
|
||||||
|
vim.api.nvim_set_hl(0, "FloatBorder", { bg = none, fg = "#d4be98" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", { bg = none, fg = "#d8a657" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingError", { bg = none, fg = "#ea6962" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", { bg = none, fg = "#a9b665" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", { bg = none, fg = "#d4be98" })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
18
lua/plugin/fugitive.lua
Normal file
18
lua/plugin/fugitive.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
keys = {
|
||||||
|
{ "<leader>GG", "<cmd>Git <cr>", desc = "git" },
|
||||||
|
{ "<leader>Gs", "<cmd>Git status <cr>", desc = "git status" },
|
||||||
|
{ "<leader>Gd", "<cmd>Git diff <cr>", desc = "git diff" },
|
||||||
|
{ "<leader>GD", "<cmd>Git diff --staged <cr>", desc = "git diff --staged" },
|
||||||
|
{ "<leader>Gl", "<cmd>Git log --graph <cr>", desc = "git log --graph" },
|
||||||
|
{ "<leader>Ga", "<cmd>Git add --interactive <cr>", desc = "git add" },
|
||||||
|
{ "<leader>GA", "<cmd>Git add -A <cr>", desc = "git add -A " },
|
||||||
|
{ "<leader>Gc", "<cmd>Git commit <cr>", desc = "git commit" },
|
||||||
|
{ "<leader>GC", "<cmd>Git commit --amend <cr>", desc = "git commit --amend " },
|
||||||
|
{ "<leader>Gp", "<cmd>Git push <cr>", desc = "git push" },
|
||||||
|
{ "<leader>GP", "<cmd>Git pull <cr>", desc = "git pull" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
51
lua/plugin/gitsigns.lua
Normal file
51
lua/plugin/gitsigns.lua
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'lewis6991/gitsigns.nvim',
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
require('gitsigns').setup({
|
||||||
|
preview_config = {
|
||||||
|
border = 'rounded',
|
||||||
|
},
|
||||||
|
on_attach = function(bufnr)
|
||||||
|
local gs = package.loaded.gitsigns
|
||||||
|
|
||||||
|
local function map(mode, l, r, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.buffer = bufnr
|
||||||
|
vim.keymap.set(mode, l, r, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Navigation
|
||||||
|
map('n', ']c', function()
|
||||||
|
if vim.wo.diff then return ']c' end
|
||||||
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, { expr = true })
|
||||||
|
|
||||||
|
map('n', '[c', function()
|
||||||
|
if vim.wo.diff then return '[c' end
|
||||||
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
|
return '<Ignore>'
|
||||||
|
end, { expr = true })
|
||||||
|
|
||||||
|
-- Actions
|
||||||
|
map({ 'n', 'v' }, '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||||
|
map({ 'n', 'v' }, '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||||
|
map('n', '<leader>hS', gs.stage_buffer)
|
||||||
|
map('n', '<leader>hu', gs.undo_stage_hunk)
|
||||||
|
map('n', '<leader>hR', gs.reset_buffer)
|
||||||
|
map('n', '<leader>hp', gs.preview_hunk)
|
||||||
|
map('n', '<leader>hb', function() gs.blame_line { full = true } end)
|
||||||
|
map('n', '<leader>tb', gs.toggle_current_line_blame)
|
||||||
|
map('n', '<leader>hd', gs.diffthis)
|
||||||
|
map('n', '<leader>hD', function() gs.diffthis('~') end)
|
||||||
|
map('n', '<leader>td', gs.toggle_deleted)
|
||||||
|
|
||||||
|
-- Text object
|
||||||
|
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
64
lua/plugin/gruvbox-material.lua
Normal file
64
lua/plugin/gruvbox-material.lua
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"sainnhe/gruvbox-material",
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
-- Settings for colorscheme
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_background", "hard")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_transparent_background", "1")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_ui_contrast", "low")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_show_eob", "0")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_enable_bold", "1")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_enable_italic", "1")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_better_performance", "1")
|
||||||
|
vim.cmd([[colo gruvbox-material]])
|
||||||
|
|
||||||
|
-- Settings to override colorscheme
|
||||||
|
-- vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, fg = "#d8a657"})
|
||||||
|
-- colors of tabline
|
||||||
|
vim.api.nvim_set_hl(0, "TabLine", { bg = "#3c3836", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineFil", { bg = "#1d2021" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineSel", { bold = true, bg = "none", fg = "#d8a657" })
|
||||||
|
-- color of statusline
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLine", { bold = false, bg = "#1d2021", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "#1d2021", fg = "#5b534d" })
|
||||||
|
-- color of vertical split line
|
||||||
|
vim.api.nvim_set_hl(0, "VertSplit", { bg = "#141617", fg = "#141617" })
|
||||||
|
-- color of the cursorline and cursorlinenumber
|
||||||
|
vim.api.nvim_set_hl(0, "Cursorline", { bg = "#141617" })
|
||||||
|
vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true, bg = "#141617", fg = "#d8a657" })
|
||||||
|
-- color of Floats and FloatBorders
|
||||||
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = none, fg = none })
|
||||||
|
vim.api.nvim_set_hl(0, "FloatBorder", { bg = none, fg = "#d4be98" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", { bg = none, fg = "#d8a657" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingError", { bg = none, fg = "#ea6962" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", { bg = none, fg = "#a9b665" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", { bg = none, fg = "#d4be98" })
|
||||||
|
|
||||||
|
-- autocommand for overrides
|
||||||
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||||
|
pattern = "gruvbox-material",
|
||||||
|
callback = function()
|
||||||
|
vim.api.nvim_set_hl(0, "TabLine", { bg = "#3c3836", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineFil", { bg = "#1d2021" })
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineSel", { bold = true, bg = "none", fg = "#d8a657" })
|
||||||
|
-- color of statusline
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLine", { bold = false, bg = "#1d2021", fg = "#89b482" })
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLineNC", { bg = "#1d2021", fg = "#5b534d" })
|
||||||
|
-- color of vertical split line
|
||||||
|
vim.api.nvim_set_hl(0, "VertSplit", { bg = "#141617", fg = "#141617" })
|
||||||
|
-- color of the cursorline and cursorlinenumber
|
||||||
|
vim.api.nvim_set_hl(0, "Cursorline", { bg = "#141617" })
|
||||||
|
vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true, bg = "#141617", fg = "#d8a657" })
|
||||||
|
-- color of Floats and FloatBorders
|
||||||
|
vim.api.nvim_set_hl(0, "NormalFloat", { bg = none, fg = none })
|
||||||
|
vim.api.nvim_set_hl(0, "FloatBorder", { bg = none, fg = "#d4be98" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", { bg = none, fg = "#d8a657" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingError", { bg = none, fg = "#ea6962" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", { bg = none, fg = "#a9b665" })
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", { bg = none, fg = "#d4be98" })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
24
lua/plugin/indent-blankline.lua
Normal file
24
lua/plugin/indent-blankline.lua
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
-- event = "BufReadPre",
|
||||||
|
main = 'ibl',
|
||||||
|
config = function()
|
||||||
|
require("ibl").setup({
|
||||||
|
enabled = true,
|
||||||
|
indent = {
|
||||||
|
char = "│",
|
||||||
|
smart_indent_cap = true
|
||||||
|
},
|
||||||
|
whitespace = {
|
||||||
|
remove_blankline_trail = true,
|
||||||
|
},
|
||||||
|
scope = {
|
||||||
|
exclude = {
|
||||||
|
language = { "help", "lazy" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
117
lua/plugin/lspconfig.lua
Normal file
117
lua/plugin/lspconfig.lua
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
-- event = "BufReadPre",
|
||||||
|
config = function()
|
||||||
|
require('lspconfig.ui.windows').default_options.border = 'rounded'
|
||||||
|
vim.api.nvim_set_hl(0, "LspInfoBorder", { bg = none, fg = "#d4be98" })
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
vim.keymap.set('n', '<space>cd', vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set('n', '<space>cl', "<cmd>LspInfo<cr>", opts)
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
|
-- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
-- enable completion triggered by <c-x><c-o>
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader>k', vim.lsp.buf.hover, bufopts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||||
|
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
|
vim.keymap.set('n', 'gK', vim.lsp.buf.signature_help, bufopts)
|
||||||
|
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>gt', vim.lsp.buf.type_definition, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>cw', vim.lsp.buf.rename, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>cf', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
|
vim.keymap.set('v', '<space>cf', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local signs = { Error = "✘ ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
-- local signs = { Error = "✘ ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
-- local signs = { Error = "✘ ", Warn = "⚠ ", Hint = " ", Info = " " } -- Unicode
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local border = {
|
||||||
|
{ "╭", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╮", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
{ "╯", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╰", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
float = { border = border },
|
||||||
|
virtual_text = {
|
||||||
|
prefix = '●', -- Could be '●', '■', 'x', '▎'
|
||||||
|
},
|
||||||
|
update_in_insert = true
|
||||||
|
})
|
||||||
|
|
||||||
|
-- LSP settings (for overriding per client)
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signatureHelp, { border = border })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
lazy = true,
|
||||||
|
cmd = "Mason",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup({
|
||||||
|
ui = {
|
||||||
|
border = "rounded",
|
||||||
|
icons = {
|
||||||
|
package_installed = "✔",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✘"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
-- event = "BufReadPre",
|
||||||
|
config = function()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"lua_ls",
|
||||||
|
"clangd",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup_handlers {
|
||||||
|
-- The first entry (without a key) will be the default handler
|
||||||
|
-- and will be called for each installed server that doesn't have
|
||||||
|
-- a dedicated handler.
|
||||||
|
function(server_name) -- default handler (optional)
|
||||||
|
require("lspconfig")[server_name].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
handlers = handlers,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
152
lua/plugin/lualine.lua
Normal file
152
lua/plugin/lualine.lua
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
config = function()
|
||||||
|
vim.api.nvim_set_option("showmode", false)
|
||||||
|
local custom_gruvbox = require 'lualine.themes.gruvbox-material'
|
||||||
|
custom_gruvbox.normal.a.bg = '#89b482'
|
||||||
|
custom_gruvbox.normal.c.bg = '#141617'
|
||||||
|
custom_gruvbox.insert.a.bg = '#d8a657'
|
||||||
|
custom_gruvbox.visual.a.bg = '#a9b665'
|
||||||
|
custom_gruvbox.replace.a.bg = '#ea6962'
|
||||||
|
require('lualine').setup {
|
||||||
|
options = {
|
||||||
|
theme = custom_gruvbox,
|
||||||
|
component_separators = { left = '', right = '' },
|
||||||
|
section_separators = { left = '', right = '' },
|
||||||
|
disabled_filetypes = { 'netrw', 'Trouble' }
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = {
|
||||||
|
{
|
||||||
|
'mode',
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_b = {
|
||||||
|
{
|
||||||
|
'branch',
|
||||||
|
icon = '',
|
||||||
|
color = { fg = '#d8a657', bg = '#141617', gui = 'bold' },
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
'filename',
|
||||||
|
color = { gui = 'italic', fg = '#d3869b', bg = '#1d2021' },
|
||||||
|
padding = 1,
|
||||||
|
path = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
'filetype',
|
||||||
|
color = { bg = '#1d2021', fg = '#d4be98', gui = 'italic' },
|
||||||
|
padding = 1,
|
||||||
|
fmt = function(str)
|
||||||
|
return (str:gsub("^%l", string.upper))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'fileformat',
|
||||||
|
color = {gui = 'italic'},
|
||||||
|
symbols = {
|
||||||
|
unix = '(unix)',
|
||||||
|
dos = '(dos)',
|
||||||
|
mac = '(mac)',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
lualine_y = {
|
||||||
|
{
|
||||||
|
'diagnostics',
|
||||||
|
color = { gui = 'bold', bg = '#141617' },
|
||||||
|
sections = { 'error', 'warn', 'info', 'hint' },
|
||||||
|
symbols = { error = "✘ ", warn = " ", info = " ", hint = " " },
|
||||||
|
padding = 1,
|
||||||
|
update_in_insert = true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'diff',
|
||||||
|
icon = { ' ', color = { bg = '#141617', fg = '#d8a657', gui = 'bold' } },
|
||||||
|
color = { gui = 'bold', bg = '#141617' },
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_z = {
|
||||||
|
{
|
||||||
|
'location',
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {
|
||||||
|
{
|
||||||
|
'mode',
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_b = {
|
||||||
|
{
|
||||||
|
'branch',
|
||||||
|
icon = '',
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
'filename',
|
||||||
|
padding = 1,
|
||||||
|
path = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
'filetype',
|
||||||
|
color = { gui = 'italic' },
|
||||||
|
padding = 1,
|
||||||
|
fmt = function(str)
|
||||||
|
return (str:gsub("^%l", string.upper))
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'fileformat',
|
||||||
|
color = {gui = 'italic'},
|
||||||
|
symbols = {
|
||||||
|
unix = 'Unix',
|
||||||
|
dos = 'Dos',
|
||||||
|
mac = 'Mac',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_y = {
|
||||||
|
{
|
||||||
|
'diagnostics',
|
||||||
|
color = { gui = 'bold', bg = '#141617' },
|
||||||
|
sections = { 'error', 'warn', 'info', 'hint' },
|
||||||
|
symbols = { error = "✘ ", warn = " ", info = " ", hint = " " },
|
||||||
|
padding = 1,
|
||||||
|
update_in_insert = true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'diff',
|
||||||
|
icon = { ' ', color = { bg = '#141617', gui = 'bold' } },
|
||||||
|
color = { gui = 'bold', bg = '#141617' },
|
||||||
|
padding = 1,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lualine_z = {
|
||||||
|
{
|
||||||
|
'location',
|
||||||
|
padding = 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
59
lua/plugin/null-ls.lua
Normal file
59
lua/plugin/null-ls.lua
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
-- event = "BufReadPost",
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-ui-select.nvim",
|
||||||
|
lazy = true,
|
||||||
|
config = function()
|
||||||
|
-- This is your opts table
|
||||||
|
require("telescope").setup {
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
-- require("telescope.themes").get_dropdown {
|
||||||
|
-- -- even more opts
|
||||||
|
-- }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local null_ls = require('null-ls')
|
||||||
|
return {
|
||||||
|
border = 'rounded',
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader>k', vim.lsp.buf.hover, bufopts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>gt', vim.lsp.buf.type_definition, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>cw', vim.lsp.buf.rename, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
|
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>cf', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
|
vim.keymap.set('v', '<space>cf', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
|
end,
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.diagnostics.trail_space.with {
|
||||||
|
disabled_filetypes = { "lua" }
|
||||||
|
},
|
||||||
|
null_ls.builtins.diagnostics.shellcheck,
|
||||||
|
null_ls.builtins.code_actions.shellcheck,
|
||||||
|
null_ls.builtins.formatting.jq,
|
||||||
|
null_ls.builtins.code_actions.gitsigns,
|
||||||
|
null_ls.builtins.diagnostics.flake8,
|
||||||
|
null_ls.builtins.diagnostics.yamllint,
|
||||||
|
null_ls.builtins.formatting.yamlfmt,
|
||||||
|
null_ls.builtins.formatting.shfmt,
|
||||||
|
null_ls.builtins.formatting.shellharden,
|
||||||
|
null_ls.builtins.formatting.beautysh,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
196
lua/plugin/nvim-cmp.lua
Normal file
196
lua/plugin/nvim-cmp.lua
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- snippets
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
lazy = true,
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
config = function()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
vim.api.nvim_set_hl(0, "PmenuSel", { fg = 'NONE', bg = '#141617' })
|
||||||
|
vim.api.nvim_set_hl(0, "Pmenu", { fg = 'NONE', bg = '#1d2021' })
|
||||||
|
vim.api.nvim_set_hl(0, "CmpItemMenu", { fg = 'NONE', bg = '#141617' })
|
||||||
|
vim.api.nvim_set_hl(0, "CmpItemMenuDefault", { fg = 'NONE', bg = '#141617' })
|
||||||
|
vim.api.nvim_set_hl(0, "CmpItemKindFunction", { fg = '#d3869b', bg = 'NONE', italic = true })
|
||||||
|
vim.api.nvim_set_hl(0, "CmpItemKindSnippet", { fg = '#d8a657', bg = 'NONE', italic = true })
|
||||||
|
vim.api.nvim_set_hl(0, "CmpItemKindText", { fg = '#ddc7a1', bg = 'NONE', italic = true })
|
||||||
|
vim.api.nvim_set_hl(0, "CmpItemKindVariable", { fg = '#7daea3', bg = 'NONE', italic = true })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
version = false,
|
||||||
|
event = {
|
||||||
|
-- "InsertEnter",
|
||||||
|
-- "CmdlineEnter",
|
||||||
|
"BufWinEnter",
|
||||||
|
},
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
-- Set up nvim-cmp with luasnip
|
||||||
|
local kind_icons = {
|
||||||
|
Text = "",
|
||||||
|
Method = "",
|
||||||
|
Function = "",
|
||||||
|
Constructor = "",
|
||||||
|
Field = "",
|
||||||
|
Variable = "",
|
||||||
|
Class = "ﴯ",
|
||||||
|
Interface = "",
|
||||||
|
Module = "",
|
||||||
|
Property = "ﰠ",
|
||||||
|
Unit = "",
|
||||||
|
Value = "",
|
||||||
|
Enum = "",
|
||||||
|
Keyword = "",
|
||||||
|
Snippet = "",
|
||||||
|
Color = "",
|
||||||
|
File = "",
|
||||||
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
|
EnumMember = "",
|
||||||
|
Constant = "",
|
||||||
|
Struct = "",
|
||||||
|
Event = "",
|
||||||
|
Operator = "",
|
||||||
|
TypeParameter = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
local has_words_before = function()
|
||||||
|
unpack = unpack or table.unpack
|
||||||
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and
|
||||||
|
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
return {
|
||||||
|
formatting = {
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
-- Kind icons
|
||||||
|
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||||
|
-- Source
|
||||||
|
vim_item.menu = ({
|
||||||
|
-- buffer = "[Buffer]",
|
||||||
|
-- nvim_lsp = "[LSP]",
|
||||||
|
-- luasnip = "[LuaSnip]",
|
||||||
|
-- nvim_lua = "[Lua]",
|
||||||
|
-- latex_symbols = "[LaTeX]",
|
||||||
|
buffer = "",
|
||||||
|
nvim_lsp = "",
|
||||||
|
luasnip = "",
|
||||||
|
nvim_lua = "",
|
||||||
|
latex_symbols = "",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- completion = {
|
||||||
|
-- autocomplete = false,
|
||||||
|
-- },
|
||||||
|
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
-- ['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<C-e>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.abort()
|
||||||
|
else
|
||||||
|
cmp.complete()
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||||
|
-- they way you will only jump inside the snippet region
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
-- { name = 'vsnip' }, -- For vsnip users.
|
||||||
|
{ name = 'luasnip' }, -- For luasnip users.
|
||||||
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
|
{
|
||||||
|
name = 'buffer',
|
||||||
|
option = {
|
||||||
|
get_bufnrs = function()
|
||||||
|
return vim.api.nvim_list_bufs()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
}),
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
6
lua/plugin/plenary.lua
Normal file
6
lua/plugin/plenary.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
}
|
20
lua/plugin/surround.lua
Normal file
20
lua/plugin/surround.lua
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"echasnovski/mini.surround",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
mappings = {
|
||||||
|
add = "<leader>sa",
|
||||||
|
delete = "<leader>sd",
|
||||||
|
find = "<leader>sf",
|
||||||
|
find_left = "<leader>sF",
|
||||||
|
highlight = "<leader>sh",
|
||||||
|
replace = "<leader>sr",
|
||||||
|
update_n_lines = "<leader>sn",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("mini.surround").setup(opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
21
lua/plugin/telescope.lua
Normal file
21
lua/plugin/telescope.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
lazy = true,
|
||||||
|
cmd = "Telescope",
|
||||||
|
version = false,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||||
|
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||||
|
-- find
|
||||||
|
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
|
||||||
|
{ "<leader>fb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Find Strings in current Buffer" },
|
||||||
|
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Grep Content in Files" },
|
||||||
|
{ "<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Grep Content in Files" },
|
||||||
|
{ "<leader>fl", "<cmd>Telescope grep_string<cr>", desc = "Grep currently hovered String" },
|
||||||
|
{ "<leader>fG", "<cmd>Telescope git_files<cr>", desc = "Find Git Files" },
|
||||||
|
{ "<leader>fk", "<cmd>Telescope keymaps<cr>", desc = "Find Git Files" },
|
||||||
|
{ "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Find Recent Files" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
11
lua/plugin/todo-comments.lua
Normal file
11
lua/plugin/todo-comments.lua
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
lua/plugin/treesitter-context.lua
Normal file
14
lua/plugin/treesitter-context.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function ()
|
||||||
|
require('treesitter-context').setup{
|
||||||
|
enable = true,
|
||||||
|
max_lines = 0,
|
||||||
|
min_window_height = 0,
|
||||||
|
line_numbers = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
32
lua/plugin/treesitter.lua
Normal file
32
lua/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
version = false,
|
||||||
|
build = ":TSUpdate",
|
||||||
|
-- event = "BufReadPre",
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"c",
|
||||||
|
"lua",
|
||||||
|
"rust",
|
||||||
|
"latex",
|
||||||
|
"bibtex",
|
||||||
|
"python",
|
||||||
|
"vim",
|
||||||
|
"yaml",
|
||||||
|
"json",
|
||||||
|
},
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
disable = {
|
||||||
|
"markdown",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
13
lua/plugin/trouble.lua
Normal file
13
lua/plugin/trouble.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
vim.keymap.set("n", "<leader>xx", function() require("trouble").toggle() end)
|
||||||
|
vim.keymap.set("n", "<leader>xw", function() require("trouble").toggle("workspace_diagnostics") end)
|
||||||
|
vim.keymap.set("n", "<leader>xd", function() require("trouble").toggle("document_diagnostics") end)
|
||||||
|
vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end)
|
||||||
|
vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end)
|
||||||
|
vim.keymap.set("n", "gr", function() require("trouble").open("lsp_references") end)
|
||||||
|
end
|
||||||
|
}
|
14
lua/plugin/undotree.lua
Normal file
14
lua/plugin/undotree.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"mbbill/undotree",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>u", "<cmd>UndotreeToggle<cr>", desc = "toggle undotree" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
vim.g.undotree_WindowLayout = 4
|
||||||
|
vim.g.undotree_SplitWidth = 40
|
||||||
|
vim.g.undotree_SetFocusWhenToggle = 1
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue