mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bc89df708 | ||
|
|
27d6d596dc | ||
|
|
7ebdbf3d7f | ||
| 34da568c87 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,3 +11,4 @@
|
|||||||
**/completions/*
|
**/completions/*
|
||||||
**/.netrwhist
|
**/.netrwhist
|
||||||
**/.zshrc-local
|
**/.zshrc-local
|
||||||
|
nvim/lazy-lock.json
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
-- Plugins
|
|
||||||
require('plugins')
|
require('plugins')
|
||||||
|
|
||||||
-- Key maps
|
-- Key maps
|
||||||
|
|||||||
@@ -2,10 +2,6 @@ local keymap = vim.api.nvim_set_keymap
|
|||||||
local default_options = {noremap = true, silent = true}
|
local default_options = {noremap = true, silent = true}
|
||||||
-- local expr_options = {noremap = true, expr = true, silent = true}
|
-- local expr_options = {noremap = true, expr = true, silent = true}
|
||||||
|
|
||||||
-- map the leader key
|
|
||||||
keymap('n', '<Space>', '<NOP>', default_options)
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
|
|
||||||
-- easier escape key mapping
|
-- easier escape key mapping
|
||||||
keymap('i', 'jk', '<ESC>', default_options)
|
keymap('i', 'jk', '<ESC>', default_options)
|
||||||
|
|
||||||
@@ -32,4 +28,5 @@ keymap("x", "K", ":move '<-2<CR>gv-gv", default_options)
|
|||||||
keymap("x", "J", ":move '>+1<CR>gv-gv", default_options)
|
keymap("x", "J", ":move '>+1<CR>gv-gv", default_options)
|
||||||
|
|
||||||
-- Toggle nvim-tree open or closed
|
-- Toggle nvim-tree open or closed
|
||||||
keymap("n", "<c-n>", "<CMD>NvimTreeToggle<CR>", default_options)
|
keymap("n", "<c-n>", "<CMD>:Neotree toggle<CR>", default_options)
|
||||||
|
|
||||||
|
|||||||
134
nvim/lua/plugin-config/cmp.lua
Normal file
134
nvim/lua/plugin-config/cmp.lua
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
return {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
enabled = true,
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"hrsh7th/cmp-vsnip",
|
||||||
|
"f3fora/cmp-spell",
|
||||||
|
"hrsh7th/cmp-calc",
|
||||||
|
"hrsh7th/cmp-emoji"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Setup nvim-cmp.
|
||||||
|
local cmp = require "cmp"
|
||||||
|
local lspkind = require("lspkind")
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
local has_words_before = function()
|
||||||
|
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 feedkey = function(key, mode)
|
||||||
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true),
|
||||||
|
mode, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
require('lspconfig').sourcekit.setup {
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
|
||||||
|
lspkind.init({
|
||||||
|
symbol_map = {
|
||||||
|
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 = ""
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format {
|
||||||
|
with_text = false,
|
||||||
|
maxwidth = 50,
|
||||||
|
menu = {
|
||||||
|
buffer = "BUF",
|
||||||
|
nvim_lsp = "LSP",
|
||||||
|
path = "PATH",
|
||||||
|
vsnip = "SNIP",
|
||||||
|
calc = "CALC",
|
||||||
|
spell = "SPELL",
|
||||||
|
emoji = "EMOJI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
experimental = {native_menu = false, ghost_text = false},
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
end
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.close(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = false
|
||||||
|
},
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||||
|
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||||
|
end
|
||||||
|
end, {"i", "s"}),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function()
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||||
|
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||||
|
end
|
||||||
|
end, {"i", "s"})
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{name = "nvim_lsp"}, {name = "buffer", keyword_length = 5},
|
||||||
|
{name = "vsnip"}, {name = "calc"}, {name = "emoji"}, {name = "spell"},
|
||||||
|
{name = "path"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/`.
|
||||||
|
cmp.setup.cmdline("/", {sources = {{name = "buffer"}}})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':'.
|
||||||
|
cmp.setup.cmdline(":", {
|
||||||
|
sources = cmp.config.sources({{name = "path"}}, {{name = "cmdline"}})
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
48
nvim/lua/plugin-config/diffview.lua
Normal file
48
nvim/lua/plugin-config/diffview.lua
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
return {
|
||||||
|
"sindrets/diffview.nvim",
|
||||||
|
cmd = {
|
||||||
|
"DiffviewOpen",
|
||||||
|
"DiffviewClose",
|
||||||
|
"DiffviewToggleFiles",
|
||||||
|
"DiffviewFocusFiles"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cb = require('diffview.config').diffview_callback
|
||||||
|
|
||||||
|
require('diffview').setup {
|
||||||
|
diff_binaries = false, -- Show diffs for binaries
|
||||||
|
use_icons = true, -- Requires nvim-web-devicons
|
||||||
|
file_panel = {
|
||||||
|
width = 35,
|
||||||
|
},
|
||||||
|
key_bindings = {
|
||||||
|
disable_defaults = false, -- Disable the default key bindings
|
||||||
|
-- The `view` bindings are active in the diff buffers, only when the current
|
||||||
|
-- tabpage is a Diffview.
|
||||||
|
view = {
|
||||||
|
["<tab>"] = cb("select_next_entry"), -- Open the diff for the next file
|
||||||
|
["<s-tab>"] = cb("select_prev_entry"), -- Open the diff for the previous file
|
||||||
|
["<leader>e"] = cb("focus_files"), -- Bring focus to the files panel
|
||||||
|
["<leader>b"] = cb("toggle_files"), -- Toggle the files panel.
|
||||||
|
},
|
||||||
|
file_panel = {
|
||||||
|
["j"] = cb("next_entry"), -- Bring the cursor to the next file entry
|
||||||
|
["<down>"] = cb("next_entry"),
|
||||||
|
["k"] = cb("prev_entry"), -- Bring the cursor to the previous file entry.
|
||||||
|
["<up>"] = cb("prev_entry"),
|
||||||
|
["<cr>"] = cb("select_entry"), -- Open the diff for the selected entry.
|
||||||
|
["o"] = cb("select_entry"),
|
||||||
|
["<2-LeftMouse>"] = cb("select_entry"),
|
||||||
|
["-"] = cb("toggle_stage_entry"), -- Stage / unstage the selected entry.
|
||||||
|
["S"] = cb("stage_all"), -- Stage all entries.
|
||||||
|
["U"] = cb("unstage_all"), -- Unstage all entries.
|
||||||
|
["R"] = cb("refresh_files"), -- Update stats and entries in the file list.
|
||||||
|
["<tab>"] = cb("select_next_entry"),
|
||||||
|
["<s-tab>"] = cb("select_prev_entry"),
|
||||||
|
["<leader>e"] = cb("focus_files"),
|
||||||
|
["<leader>b"] = cb("toggle_files"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
9
nvim/lua/plugin-config/init.lua
Normal file
9
nvim/lua/plugin-config/init.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
-- This file contains plugin's that don't require much configuration.
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"hrsh7th/vim-vsnip",
|
||||||
|
config = function()
|
||||||
|
vim.g.vsnip_snippet_dir = os.getenv('HOME') .. '/.config/nvim/snippets/'
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
6
nvim/lua/plugin-config/lsp-installer.lua
Normal file
6
nvim/lua/plugin-config/lsp-installer.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
return {
|
||||||
|
"williamboman/nvim-lsp-installer",
|
||||||
|
config = function()
|
||||||
|
require("nvim-lsp-installer").setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
158
nvim/lua/plugin-config/lspconfig.lua
Normal file
158
nvim/lua/plugin-config/lspconfig.lua
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
return {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
local nvim_lsp = require("lspconfig")
|
||||||
|
|
||||||
|
-- Use an on_attach function to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local on_attach = function(bufnr)
|
||||||
|
local function buf_set_keymap(...)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
local opts = {noremap = true, silent = true}
|
||||||
|
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gT", vim.lsp.buf.type_definition, opts)
|
||||||
|
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
|
buf_set_keymap("n", "<space>wa",
|
||||||
|
"<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wr",
|
||||||
|
"<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wl",
|
||||||
|
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
|
||||||
|
opts)
|
||||||
|
buf_set_keymap("n", "<space>D",
|
||||||
|
"<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>",
|
||||||
|
opts)
|
||||||
|
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||||
|
|
||||||
|
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
|
-- map buffer local keybindings when the language server attaches
|
||||||
|
--local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
|
|
||||||
|
local servers = {
|
||||||
|
"gopls", "bashls", "jedi_language_server", "dockerls", "terraformls",
|
||||||
|
"tsserver", "texlab", "yamlls", "jsonls", "clangd", "sourcekit"
|
||||||
|
}
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
nvim_lsp[lsp].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
gopls = {analyses = {unusedparams = false}, staticcheck = true},
|
||||||
|
json = {
|
||||||
|
format = {enabled = false},
|
||||||
|
schemas = {
|
||||||
|
{
|
||||||
|
description = "ESLint config",
|
||||||
|
fileMatch = {".eslintrc.json", ".eslintrc"},
|
||||||
|
url = "http://json.schemastore.org/eslintrc"
|
||||||
|
}, {
|
||||||
|
description = "Package config",
|
||||||
|
fileMatch = {"package.json"},
|
||||||
|
url = "https://json.schemastore.org/package"
|
||||||
|
}, {
|
||||||
|
description = "Packer config",
|
||||||
|
fileMatch = {"packer.json"},
|
||||||
|
url = "https://json.schemastore.org/packer"
|
||||||
|
}, {
|
||||||
|
description = "Renovate config",
|
||||||
|
fileMatch = {
|
||||||
|
"renovate.json", "renovate.json5",
|
||||||
|
".github/renovate.json", ".github/renovate.json5",
|
||||||
|
".renovaterc", ".renovaterc.json"
|
||||||
|
},
|
||||||
|
url = "https://docs.renovatebot.com/renovate-schema"
|
||||||
|
}, {
|
||||||
|
description = "OpenApi config",
|
||||||
|
fileMatch = {"*api*.json"},
|
||||||
|
url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
redhat = {telemetry = {enabled = false}},
|
||||||
|
texlab = {
|
||||||
|
auxDirectory = ".",
|
||||||
|
bibtexFormatter = "texlab",
|
||||||
|
build = {
|
||||||
|
args = {
|
||||||
|
"--keep-intermediates", "--keep-logs", "--synctex", "%f"
|
||||||
|
},
|
||||||
|
executable = "tectonic",
|
||||||
|
forwardSearchAfter = false,
|
||||||
|
onSave = false
|
||||||
|
},
|
||||||
|
chktex = {onEdit = false, onOpenAndSave = false},
|
||||||
|
diagnosticsDelay = 300,
|
||||||
|
formatterLineLength = 80,
|
||||||
|
forwardSearch = {args = {}},
|
||||||
|
latexFormatter = "latexindent",
|
||||||
|
latexindent = {modifyLineBreaks = false}
|
||||||
|
},
|
||||||
|
yaml = {
|
||||||
|
schemaStore = {
|
||||||
|
enable = true,
|
||||||
|
url = "https://www.schemastore.org/api/json/catalog.json"
|
||||||
|
},
|
||||||
|
schemas = {
|
||||||
|
kubernetes = "/*.yaml",
|
||||||
|
["http://json.schemastore.org/github-workflow"] = ".github/workflows/*.{yml,yaml}",
|
||||||
|
["http://json.schemastore.org/github-action"] = ".github/action.{yml,yaml}",
|
||||||
|
["http://json.schemastore.org/ansible-stable-2.9"] = "roles/tasks/*.{yml,yaml}",
|
||||||
|
["http://json.schemastore.org/prettierrc"] = ".prettierrc.{yml,yaml}",
|
||||||
|
["http://json.schemastore.org/kustomization"] = "kustomization.{yml,yaml}",
|
||||||
|
["http://json.schemastore.org/ansible-playbook"] = "*play*.{yml,yaml}",
|
||||||
|
["http://json.schemastore.org/chart"] = "Chart.{yml,yaml}",
|
||||||
|
["https://json.schemastore.org/dependabot-v2"] = ".github/dependabot.{yml,yaml}",
|
||||||
|
["https://json.schemastore.org/gitlab-ci"] = "*gitlab-ci*.{yml,yaml}",
|
||||||
|
["https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json"] = "*api*.{yml,yaml}",
|
||||||
|
["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose.{yml,yaml}",
|
||||||
|
["https://raw.githubusercontent.com/argoproj/argo-workflows/master/api/jsonschema/schema.json"] = "*flow*.{yml,yaml}"
|
||||||
|
},
|
||||||
|
format = {enabled = false},
|
||||||
|
validate = false, -- TODO: conflicts between Kubernetes resources and kustomization.yaml
|
||||||
|
completion = true,
|
||||||
|
hover = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
flags = {debounce_text_changes = 150}
|
||||||
|
}
|
||||||
|
require"lsp_signature".setup({
|
||||||
|
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||||
|
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
|
||||||
|
doc_lines = 2, -- Set to 0 for not showing doc
|
||||||
|
hint_prefix = "🐼 ",
|
||||||
|
-- use_lspsaga = false, -- set to true if you want to use lspsaga popup
|
||||||
|
handler_opts = {
|
||||||
|
border = "shadow" -- double, single, shadow, none
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Test source-kit
|
||||||
|
require('lspconfig').sourcekit.setup{}
|
||||||
|
|
||||||
|
end
|
||||||
|
}
|
||||||
119
nvim/lua/plugin-config/lualine.lua
Normal file
119
nvim/lua/plugin-config/lualine.lua
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
config = function()
|
||||||
|
local colors = {
|
||||||
|
red = '#ca1243',
|
||||||
|
grey = '#a0a1a7',
|
||||||
|
black = '#383a42',
|
||||||
|
white = '#f3f3f3',
|
||||||
|
light_green = '#83a598',
|
||||||
|
orange = '#fe8019',
|
||||||
|
green = '#8ec07c',
|
||||||
|
}
|
||||||
|
|
||||||
|
local empty = require('lualine.component'):extend()
|
||||||
|
function empty:draw(default_highlight)
|
||||||
|
self.status = ''
|
||||||
|
self.applied_separator = ''
|
||||||
|
self:apply_highlights(default_highlight)
|
||||||
|
self:apply_section_separators()
|
||||||
|
return self.status
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Put proper separators and gaps between components in sections
|
||||||
|
local function process_sections(sections)
|
||||||
|
for name, section in pairs(sections) do
|
||||||
|
local left = name:sub(9, 10) < 'x'
|
||||||
|
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
||||||
|
table.insert(section, pos * 2, { empty, color = { fg = colors.white, bg = colors.white } })
|
||||||
|
end
|
||||||
|
for id, comp in ipairs(section) do
|
||||||
|
if type(comp) ~= 'table' then
|
||||||
|
comp = { comp }
|
||||||
|
section[id] = comp
|
||||||
|
end
|
||||||
|
comp.separator = left and { right = '' } or { left = '' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return sections
|
||||||
|
end
|
||||||
|
|
||||||
|
local function search_result()
|
||||||
|
if vim.v.hlsearch == 0 then
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
local last_search = vim.fn.getreg '/'
|
||||||
|
if not last_search or last_search == '' then
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||||
|
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||||
|
end
|
||||||
|
|
||||||
|
local function modified()
|
||||||
|
if vim.bo.modified then
|
||||||
|
return '+'
|
||||||
|
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||||
|
return '-'
|
||||||
|
end
|
||||||
|
return ''
|
||||||
|
end
|
||||||
|
|
||||||
|
require('lualine').setup {
|
||||||
|
options = {
|
||||||
|
theme = 'auto',
|
||||||
|
component_separators = '',
|
||||||
|
section_separators = { left = '', right = '' },
|
||||||
|
},
|
||||||
|
sections = process_sections {
|
||||||
|
lualine_a = { 'mode' },
|
||||||
|
lualine_b = {
|
||||||
|
'branch',
|
||||||
|
'diff',
|
||||||
|
{
|
||||||
|
'diagnostics',
|
||||||
|
source = { 'nvim' },
|
||||||
|
sections = { 'error' },
|
||||||
|
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'diagnostics',
|
||||||
|
source = { 'nvim' },
|
||||||
|
sections = { 'warn' },
|
||||||
|
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||||
|
},
|
||||||
|
{ 'filename', file_status = false, path = 1 },
|
||||||
|
{ modified, color = { bg = colors.red } },
|
||||||
|
{
|
||||||
|
'%w',
|
||||||
|
cond = function()
|
||||||
|
return vim.wo.previewwindow
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'%r',
|
||||||
|
cond = function()
|
||||||
|
return vim.bo.readonly
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'%q',
|
||||||
|
cond = function()
|
||||||
|
return vim.bo.buftype == 'quickfix'
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_c = {},
|
||||||
|
lualine_x = {},
|
||||||
|
lualine_y = { search_result, 'filetype' },
|
||||||
|
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_c = { '%f %y %m' },
|
||||||
|
lualine_x = {},
|
||||||
|
},
|
||||||
|
tabline = {},
|
||||||
|
extensions = {"nvim-tree"}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
25
nvim/lua/plugin-config/mason.lua
Normal file
25
nvim/lua/plugin-config/mason.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
return {
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"onsails/lspkind-nvim",
|
||||||
|
"famiu/bufdelete.nvim",
|
||||||
|
"ray-x/lsp_signature.nvim",
|
||||||
|
"neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"bashls",
|
||||||
|
"clangd",
|
||||||
|
"dockerls",
|
||||||
|
"gopls",
|
||||||
|
"jsonls",
|
||||||
|
"jedi_language_server",
|
||||||
|
"lua_ls",
|
||||||
|
"terraformls",
|
||||||
|
"tsserver",
|
||||||
|
"texlab",
|
||||||
|
"yamlls",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
nvim/lua/plugin-config/neo-tree.lua
Normal file
16
nvim/lua/plugin-config/neo-tree.lua
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
return {
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("neo-tree").setup({
|
||||||
|
close_if_last_window = false,
|
||||||
|
enable_git_status = true,
|
||||||
|
enable_diagnostics = true
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
38
nvim/lua/plugin-config/neogit.lua
Normal file
38
nvim/lua/plugin-config/neogit.lua
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
return {
|
||||||
|
"TimUntersberger/neogit",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim", -- optional
|
||||||
|
"sindrets/diffview.nvim", -- optional
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
disable_signs = false,
|
||||||
|
disable_context_highlighting = false,
|
||||||
|
disable_commit_confirmation = true,
|
||||||
|
-- customize displayed signs
|
||||||
|
signs = {
|
||||||
|
-- { CLOSED, OPENED }
|
||||||
|
section = { ">", "v" },
|
||||||
|
item = { ">", "v" },
|
||||||
|
hunk = { "", "" },
|
||||||
|
},
|
||||||
|
integrations = {
|
||||||
|
diffview = true
|
||||||
|
},
|
||||||
|
-- override/add mappings
|
||||||
|
mappings = {
|
||||||
|
-- modify status buffer mappings
|
||||||
|
status = {
|
||||||
|
-- Adds a mapping with "B" as key that does the "BranchPopup" command
|
||||||
|
["B"] = "BranchPopup",
|
||||||
|
["C"] = "CommitPopup",
|
||||||
|
-- ["P"] = "PullPopup",
|
||||||
|
["S"] = "Stage",
|
||||||
|
-- ["D"] = "Discard",
|
||||||
|
-- Removes the default mapping of "s"
|
||||||
|
-- ["s"] = "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cmd = "Neogit",
|
||||||
|
}
|
||||||
29
nvim/lua/plugin-config/nightfox.lua
Normal file
29
nvim/lua/plugin-config/nightfox.lua
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
return {
|
||||||
|
'EdenEast/nightfox.nvim',
|
||||||
|
lazy = false, -- make sure we load this during startup
|
||||||
|
priority = 1000, -- make sure to load this before all other plugins.
|
||||||
|
opts = {
|
||||||
|
fox = "terafox", -- change the colorscheme to use terafox
|
||||||
|
styles = {
|
||||||
|
comments = "italic", -- change style of comments to be italic
|
||||||
|
keywords = "bold", -- change style of keywords to be bold
|
||||||
|
functions = "italic,bold" -- styles can be a comma separated list
|
||||||
|
},
|
||||||
|
inverse = {
|
||||||
|
match_paren = true, -- inverse the highlighting of match_parens
|
||||||
|
},
|
||||||
|
colors = {
|
||||||
|
red = "#FF000", -- Override the red color for MAX POWER
|
||||||
|
--bg_alt = "#000000",
|
||||||
|
},
|
||||||
|
hlgroups = {
|
||||||
|
TSPunctDelimiter = { fg = "${red}" }, -- Override a highlight group with the color red
|
||||||
|
LspCodeLens = { bg = "#000000", style = "italic" },
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('nightfox').load()
|
||||||
|
vim.cmd("colorscheme terafox")
|
||||||
|
end
|
||||||
|
}
|
||||||
78
nvim/lua/plugin-config/telescope.lua
Normal file
78
nvim/lua/plugin-config/telescope.lua
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
return {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
branch = '0.1.x',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim'
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local actions = require('telescope.actions')
|
||||||
|
|
||||||
|
require('telescope').setup({
|
||||||
|
defaults = {
|
||||||
|
file_ignore_patterns = {"node_modules", "%.jpg", "%.png"},
|
||||||
|
vimgrep_arguments = {
|
||||||
|
'rg',
|
||||||
|
'--follow',
|
||||||
|
'--color=never',
|
||||||
|
'--no-heading',
|
||||||
|
'--with-filename',
|
||||||
|
'--line-number',
|
||||||
|
'--column',
|
||||||
|
'--smart-case'
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
-- Close on first esc instead of gonig to normal mode
|
||||||
|
["<esc>"] = actions.close,
|
||||||
|
["<A-q>"] = actions.send_selected_to_qflist,
|
||||||
|
["<C-q>"] = actions.send_to_qflist,
|
||||||
|
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
||||||
|
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<s-tab>"] = actions.toggle_selection + actions.move_selection_next,
|
||||||
|
["<tab>"] = actions.toggle_selection + actions.move_selection_previous,
|
||||||
|
["<A-q>"] = actions.send_selected_to_qflist,
|
||||||
|
["<C-q>"] = actions.send_to_qflist,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prompt_prefix = " ",
|
||||||
|
selection_caret = " ",
|
||||||
|
entry_prefix = " ",
|
||||||
|
initial_mode = "insert",
|
||||||
|
selection_strategy = "reset",
|
||||||
|
sorting_strategy = "descending",
|
||||||
|
layout_strategy = "flex",
|
||||||
|
layout_config = {
|
||||||
|
width = 0.75,
|
||||||
|
prompt_position = "bottom",
|
||||||
|
preview_cutoff = 120,
|
||||||
|
horizontal = { mirror = false },
|
||||||
|
vertical = { mirror = true },
|
||||||
|
},
|
||||||
|
file_sorter = require'telescope.sorters'.get_fuzzy_file,
|
||||||
|
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
||||||
|
-- path_display = true, -- strange behaviour not showing the files in result window
|
||||||
|
winblend = 0,
|
||||||
|
border = {},
|
||||||
|
borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' },
|
||||||
|
color_devicons = true,
|
||||||
|
use_less = true,
|
||||||
|
set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil,
|
||||||
|
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
||||||
|
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
||||||
|
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
||||||
|
|
||||||
|
-- Developer configurations: Not meant for general override
|
||||||
|
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
-- Telescope keymaps
|
||||||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -34,7 +34,7 @@ g.nvim_tree_icons = {
|
|||||||
}
|
}
|
||||||
g.loaded_netrw = 1
|
g.loaded_netrw = 1
|
||||||
g.loaded_netrwPlugin = 1
|
g.loaded_netrwPlugin = 1
|
||||||
local tree_cb = require"nvim-tree.config".nvim_tree_callback
|
local tree_cb = require("nvim-tree.config").nvim_tree_callback
|
||||||
|
|
||||||
-- This function has been generated from your
|
-- This function has been generated from your
|
||||||
-- view.mappings.list
|
-- view.mappings.list
|
||||||
69
nvim/lua/plugin-config/treesitter.lua
Normal file
69
nvim/lua/plugin-config/treesitter.lua
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
dependencies = {
|
||||||
|
'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
ensure_installed = {
|
||||||
|
"bash",
|
||||||
|
"cmake",
|
||||||
|
"dockerfile",
|
||||||
|
"go",
|
||||||
|
"hcl",
|
||||||
|
"html",
|
||||||
|
"java",
|
||||||
|
"javascript",
|
||||||
|
"json",
|
||||||
|
"latex",
|
||||||
|
"ledger",
|
||||||
|
"lua",
|
||||||
|
"python",
|
||||||
|
"toml",
|
||||||
|
"yaml"
|
||||||
|
}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||||
|
ignore_install = {}, -- List of parsers to ignore installing
|
||||||
|
highlight = {
|
||||||
|
enable = true, -- false will disable the whole extension
|
||||||
|
disable = {} -- list of language that will be disabled
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<CR>",
|
||||||
|
scope_incremental = "<CR>",
|
||||||
|
node_incremental = "<TAB>",
|
||||||
|
node_decremental = "<S-TAB>"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
indent = {enable = true},
|
||||||
|
autopairs = {{enable = true}},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
-- Automatically jump forward to textobj, similar to targets.vim
|
||||||
|
lookahead = true,
|
||||||
|
keymaps = {
|
||||||
|
-- You can use the capture groups defined in textobjects.scm
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
["ac"] = "@class.outer",
|
||||||
|
["ic"] = "@class.inner",
|
||||||
|
["al"] = "@loop.outer",
|
||||||
|
["il"] = "@loop.inner",
|
||||||
|
["ib"] = "@block.inner",
|
||||||
|
["ab"] = "@block.outer",
|
||||||
|
["ir"] = "@parameter.inner",
|
||||||
|
["ar"] = "@parameter.outer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
|
||||||
|
max_file_lines = 2000 -- Do not enable for files with more than specified lines
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
8
nvim/lua/plugin-config/which-key.lua
Normal file
8
nvim/lua/plugin-config/which-key.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
init = function()
|
||||||
|
vim.o.timeout = true
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -1,121 +1,18 @@
|
|||||||
-- Plugins
|
-- Plugins
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
local execute = vim.api.nvim_command
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
local fn = vim.fn
|
vim.fn.system({
|
||||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
-- returns the require for use in `config` parameter of packer's use
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
-- expects the name of the config file
|
"--branch=stable", -- latest stable release
|
||||||
function get_config(name)
|
lazypath,
|
||||||
return string.format("require(\"config/%s\")", name)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Install packer if not available
|
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
|
||||||
fn.system({
|
|
||||||
"git", "clone", "https://github.com/wbthomason/packer.nvim",
|
|
||||||
install_path
|
|
||||||
})
|
})
|
||||||
execute "packadd packer.nvim"
|
|
||||||
end
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
-- Initialize and configure packer
|
vim.g.mapleader = ' '
|
||||||
local packer = require("packer")
|
vim.g.maplocalleader = ' '
|
||||||
packer.init {
|
|
||||||
enable = true, -- enable profiling via :PackerCompile profile=true
|
|
||||||
threshold = 0 -- the amount in ms that a plugins load time must be over for it to be included in the profile
|
|
||||||
}
|
|
||||||
local use = packer.use
|
|
||||||
packer.reset()
|
|
||||||
|
|
||||||
-- actual plugins list
|
require("lazy").setup('plugin-config')
|
||||||
use "wbthomason/packer.nvim"
|
|
||||||
|
|
||||||
use {"kyazdani42/nvim-tree.lua", config = get_config("nvim-tree")}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
config = get_config("lualine"),
|
|
||||||
requires = {"kyazdani42/nvim-web-devicons", opt = true}
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
config = get_config("telescope"),
|
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
|
||||||
}
|
|
||||||
|
|
||||||
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
|
||||||
|
|
||||||
use {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
config = get_config("treesitter"),
|
|
||||||
run = ":TSUpdate"
|
|
||||||
}
|
|
||||||
|
|
||||||
use "nvim-treesitter/nvim-treesitter-textobjects"
|
|
||||||
|
|
||||||
use {
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
requires = {
|
|
||||||
{"hrsh7th/cmp-nvim-lsp"}, {"hrsh7th/cmp-buffer"}, {"hrsh7th/cmp-path"},
|
|
||||||
{"hrsh7th/cmp-cmdline"}, {"hrsh7th/cmp-vsnip"},
|
|
||||||
{"f3fora/cmp-spell", {"hrsh7th/cmp-calc"}, {"hrsh7th/cmp-emoji"}}
|
|
||||||
},
|
|
||||||
config = get_config("cmp")
|
|
||||||
}
|
|
||||||
|
|
||||||
use {"onsails/lspkind-nvim", requires = {{"famiu/bufdelete.nvim"}}}
|
|
||||||
|
|
||||||
-- LSP
|
|
||||||
use {"ray-x/lsp_signature.nvim", requires = {{"neovim/nvim-lspconfig"}}}
|
|
||||||
|
|
||||||
use { "williamboman/mason.nvim" }
|
|
||||||
use { "williamboman/mason-lspconfig.nvim" }
|
|
||||||
use {
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
config = get_config("lsp")
|
|
||||||
}
|
|
||||||
use {
|
|
||||||
"williamboman/nvim-lsp-installer",
|
|
||||||
config = get_config("lsp-installer")
|
|
||||||
}
|
|
||||||
|
|
||||||
use {"folke/which-key.nvim", event = "VimEnter", config = get_config("which")}
|
|
||||||
|
|
||||||
-- requirement for Neogit
|
|
||||||
use {
|
|
||||||
"sindrets/diffview.nvim",
|
|
||||||
cmd = {
|
|
||||||
"DiffviewOpen", "DiffviewClose", "DiffviewToggleFiles",
|
|
||||||
"DiffviewFocusFiles"
|
|
||||||
},
|
|
||||||
config = get_config("diffview")
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
|
||||||
"TimUntersberger/neogit",
|
|
||||||
requires = {
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
"nvim-telescope/telescope.nvim", -- optional
|
|
||||||
"sindrets/diffview.nvim", -- optional
|
|
||||||
},
|
|
||||||
cmd = "Neogit",
|
|
||||||
config = get_config("neogit")
|
|
||||||
}
|
|
||||||
|
|
||||||
use {"hrsh7th/vim-vsnip", config = get_config("vsnip")}
|
|
||||||
|
|
||||||
use({
|
|
||||||
"andrewferrier/wrapping.nvim",
|
|
||||||
config = function()
|
|
||||||
require("wrapping").setup()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Theme
|
|
||||||
use {
|
|
||||||
'EdenEast/nightfox.nvim',
|
|
||||||
config = get_config("nightfox")
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user