add nvim config
This commit is contained in:
parent
f9fa2b97cd
commit
89aac722fc
1
configs/nvim/after/plugin/auto-pair.lua
Normal file
1
configs/nvim/after/plugin/auto-pair.lua
Normal file
@ -0,0 +1 @@
|
||||
require("nvim-autopairs").setup()
|
43
configs/nvim/after/plugin/comment.lua
Normal file
43
configs/nvim/after/plugin/comment.lua
Normal file
@ -0,0 +1,43 @@
|
||||
require('Comment').setup({
|
||||
---Add a space b/w comment and the line
|
||||
padding = true,
|
||||
---Whether the cursor should stay at its position
|
||||
sticky = true,
|
||||
---Lines to be ignored while (un)comment
|
||||
ignore = nil,
|
||||
---LHS of toggle mappings in NORMAL mode
|
||||
toggler = {
|
||||
---Line-comment toggle keymap
|
||||
line = '<leader>/',
|
||||
---Block-comment toggle keymap
|
||||
block = 'gbc',
|
||||
},
|
||||
---LHS of operator-pending mappings in NORMAL and VISUAL mode
|
||||
opleader = {
|
||||
---Line-comment keymap
|
||||
line = '<leader>/',
|
||||
---Block-comment keymap
|
||||
block = 'gb',
|
||||
},
|
||||
---LHS of extra mappings
|
||||
extra = {
|
||||
---Add comment on the line above
|
||||
above = 'gcO',
|
||||
---Add comment on the line below
|
||||
below = 'gco',
|
||||
---Add comment at the end of line
|
||||
eol = 'gcA',
|
||||
},
|
||||
---Enable keybindings
|
||||
---NOTE: If given `false` then the plugin won't create any mappings
|
||||
mappings = {
|
||||
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
|
||||
basic = true,
|
||||
---Extra mapping; `gco`, `gcO`, `gcA`
|
||||
extra = true,
|
||||
},
|
||||
---Function to call before (un)comment
|
||||
pre_hook = nil,
|
||||
---Function to call after (un)comment
|
||||
post_hook = nil,
|
||||
})
|
446
configs/nvim/after/plugin/feline.lua
Normal file
446
configs/nvim/after/plugin/feline.lua
Normal file
@ -0,0 +1,446 @@
|
||||
-- require('feline').setup()
|
||||
|
||||
local fmt = string.format
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Colors
|
||||
|
||||
---Convert color number to hex string
|
||||
---@param n number
|
||||
---@return string
|
||||
local hex = function(n)
|
||||
if n then
|
||||
return fmt("#%06x", n)
|
||||
end
|
||||
end
|
||||
|
||||
---Parse `style` string into nvim_set_hl options
|
||||
---@param style string
|
||||
---@return table
|
||||
local function parse_style(style)
|
||||
if not style or style == "NONE" then
|
||||
return {}
|
||||
end
|
||||
|
||||
local result = {}
|
||||
for token in string.gmatch(style, "([^,]+)") do
|
||||
result[token] = true
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
---Get highlight opts for a given highlight group name
|
||||
---@param name string
|
||||
---@return table
|
||||
local function get_highlight(name)
|
||||
local hl = vim.api.nvim_get_hl_by_name(name, true)
|
||||
if hl.link then
|
||||
return get_highlight(hl.link)
|
||||
end
|
||||
|
||||
local result = parse_style(hl.style)
|
||||
result.fg = hl.foreground and hex(hl.foreground)
|
||||
result.bg = hl.background and hex(hl.background)
|
||||
result.sp = hl.special and hex(hl.special)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
---Set highlight group from provided table
|
||||
---@param groups table
|
||||
local function set_highlights(groups)
|
||||
for group, opts in pairs(groups) do
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
end
|
||||
|
||||
---Generate a color palette from the current applied colorscheme
|
||||
---@return table
|
||||
local function generate_pallet_from_colorscheme()
|
||||
-- stylua: ignore
|
||||
local color_map = {
|
||||
black = { index = 0, default = "#393b44" },
|
||||
red = { index = 1, default = "#c94f6d" },
|
||||
green = { index = 2, default = "#81b29a" },
|
||||
yellow = { index = 3, default = "#dbc074" },
|
||||
blue = { index = 4, default = "#719cd6" },
|
||||
magenta = { index = 5, default = "#9d79d6" },
|
||||
cyan = { index = 6, default = "#63cdcf" },
|
||||
white = { index = 7, default = "#dfdfe0" },
|
||||
}
|
||||
|
||||
local diagnostic_map = {
|
||||
hint = { hl = "DiagnosticHint", default = color_map.green.default },
|
||||
info = { hl = "DiagnosticInfo", default = color_map.blue.default },
|
||||
warn = { hl = "DiagnosticWarn", default = color_map.yellow.default },
|
||||
error = { hl = "DiagnosticError", default = color_map.red.default },
|
||||
}
|
||||
|
||||
local pallet = {}
|
||||
for name, value in pairs(color_map) do
|
||||
local global_name = "terminal_color_" .. value.index
|
||||
pallet[name] = vim.g[global_name] and vim.g[global_name] or value.default
|
||||
end
|
||||
|
||||
for name, value in pairs(diagnostic_map) do
|
||||
pallet[name] = get_highlight(value.hl).fg or value.default
|
||||
end
|
||||
|
||||
pallet.sl = get_highlight("StatusLine")
|
||||
pallet.sel = get_highlight("TabLineSel")
|
||||
|
||||
return pallet
|
||||
end
|
||||
|
||||
---Generate user highlight groups based on the curent applied colorscheme
|
||||
---
|
||||
---NOTE: This is a global because I dont known where this file will be in your config
|
||||
---and it is needed for the autocmd below
|
||||
_G._generate_user_statusline_highlights = function()
|
||||
local pal = generate_pallet_from_colorscheme()
|
||||
|
||||
-- stylua: ignore
|
||||
local sl_colors = {
|
||||
Black = { fg = pal.black, bg = pal.white },
|
||||
Red = { fg = pal.red, bg = pal.sl.bg },
|
||||
Green = { fg = pal.green, bg = pal.sl.bg },
|
||||
Yellow = { fg = pal.yellow, bg = pal.sl.bg },
|
||||
Blue = { fg = pal.blue, bg = pal.sl.bg },
|
||||
Magenta = { fg = pal.magenta, bg = pal.sl.bg },
|
||||
Cyan = { fg = pal.cyan, bg = pal.sl.bg },
|
||||
White = { fg = pal.white, bg = pal.black },
|
||||
}
|
||||
|
||||
local colors = {}
|
||||
for name, value in pairs(sl_colors) do
|
||||
colors["User" .. name] = { fg = value.fg, bg = value.bg, bold = true }
|
||||
colors["UserRv" .. name] = { fg = value.bg, bg = value.fg, bold = true }
|
||||
end
|
||||
|
||||
local status = vim.o.background == "dark" and { fg = pal.black, bg = pal.white } or { fg = pal.white, bg = pal.black }
|
||||
|
||||
local groups = {
|
||||
-- statusline
|
||||
UserSLHint = { fg = pal.sl.bg, bg = pal.hint, bold = true },
|
||||
UserSLInfo = { fg = pal.sl.bg, bg = pal.info, bold = true },
|
||||
UserSLWarn = { fg = pal.sl.bg, bg = pal.warn, bold = true },
|
||||
UserSLError = { fg = pal.sl.bg, bg = pal.error, bold = true },
|
||||
UserSLStatus = { fg = status.fg, bg = status.bg, bold = true },
|
||||
|
||||
UserSLFtHint = { fg = pal.sel.bg, bg = pal.hint },
|
||||
UserSLHintInfo = { fg = pal.hint, bg = pal.info },
|
||||
UserSLInfoWarn = { fg = pal.info, bg = pal.warn },
|
||||
UserSLWarnError = { fg = pal.warn, bg = pal.error },
|
||||
UserSLErrorStatus = { fg = pal.error, bg = status.bg },
|
||||
UserSLStatusBg = { fg = status.bg, bg = pal.sl.bg },
|
||||
|
||||
UserSLAlt = pal.sel,
|
||||
UserSLAltSep = { fg = pal.sl.bg, bg = pal.sel.bg },
|
||||
UserSLGitBranch = { fg = pal.yellow, bg = pal.sl.bg },
|
||||
}
|
||||
|
||||
set_highlights(vim.tbl_extend("force", colors, groups))
|
||||
end
|
||||
|
||||
_generate_user_statusline_highlights()
|
||||
|
||||
vim.api.nvim_create_augroup("UserStatuslineHighlightGroups", { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "SessionLoadPost", "ColorScheme" }, {
|
||||
callback = function()
|
||||
_generate_user_statusline_highlights()
|
||||
end,
|
||||
})
|
||||
|
||||
----------------------------------------------------------------------------------------------------
|
||||
-- Feline
|
||||
|
||||
local vi = {
|
||||
-- Map vi mode to text name
|
||||
text = {
|
||||
n = "NORMAL",
|
||||
no = "NORMAL",
|
||||
i = "INSERT",
|
||||
v = "VISUAL",
|
||||
V = "V-LINE",
|
||||
[""] = "V-BLOCK",
|
||||
c = "COMMAND",
|
||||
cv = "COMMAND",
|
||||
ce = "COMMAND",
|
||||
R = "REPLACE",
|
||||
Rv = "REPLACE",
|
||||
s = "SELECT",
|
||||
S = "SELECT",
|
||||
[""] = "SELECT",
|
||||
t = "TERMINAL",
|
||||
},
|
||||
|
||||
-- Maps vi mode to highlight group color defined above
|
||||
colors = {
|
||||
n = "UserRvCyan",
|
||||
no = "UserRvCyan",
|
||||
i = "UserSLStatus",
|
||||
v = "UserRvMagenta",
|
||||
V = "UserRvMagenta",
|
||||
[""] = "UserRvMagenta",
|
||||
R = "UserRvRed",
|
||||
Rv = "UserRvRed",
|
||||
r = "UserRvBlue",
|
||||
rm = "UserRvBlue",
|
||||
s = "UserRvMagenta",
|
||||
S = "UserRvMagenta",
|
||||
[""] = "FelnMagenta",
|
||||
c = "UserRvYellow",
|
||||
["!"] = "UserRvBlue",
|
||||
t = "UserRvBlue",
|
||||
},
|
||||
|
||||
-- Maps vi mode to seperator highlight goup defined above
|
||||
sep = {
|
||||
n = "UserCyan",
|
||||
no = "UserCyan",
|
||||
i = "UserSLStatusBg",
|
||||
v = "UserMagenta",
|
||||
V = "UserMagenta",
|
||||
[""] = "UserMagenta",
|
||||
R = "UserRed",
|
||||
Rv = "UserRed",
|
||||
r = "UserBlue",
|
||||
rm = "UserBlue",
|
||||
s = "UserMagenta",
|
||||
S = "UserMagenta",
|
||||
[""] = "FelnMagenta",
|
||||
c = "UserYellow",
|
||||
["!"] = "UserBlue",
|
||||
t = "UserBlue",
|
||||
},
|
||||
}
|
||||
|
||||
local icons = {
|
||||
locker = "", -- #f023
|
||||
page = "☰", -- 2630
|
||||
line_number = "", -- e0a1
|
||||
connected = "", -- f817
|
||||
dos = "", -- e70f
|
||||
unix = "", -- f17c
|
||||
mac = "", -- f179
|
||||
mathematical_L = "𝑳",
|
||||
vertical_bar = "┃",
|
||||
vertical_bar_thin = "│",
|
||||
left = "",
|
||||
right = "",
|
||||
block = "█",
|
||||
left_filled = "",
|
||||
right_filled = "",
|
||||
slant_left = "",
|
||||
slant_left_thin = "",
|
||||
slant_right = "",
|
||||
slant_right_thin = "",
|
||||
slant_left_2 = "",
|
||||
slant_left_2_thin = "",
|
||||
slant_right_2 = "",
|
||||
slant_right_2_thin = "",
|
||||
left_rounded = "",
|
||||
left_rounded_thin = "",
|
||||
right_rounded = "",
|
||||
right_rounded_thin = "",
|
||||
circle = "●",
|
||||
}
|
||||
|
||||
---Get the number of diagnostic messages for the provided severity
|
||||
---@param str string [ERROR | WARN | INFO | HINT]
|
||||
---@return string
|
||||
local function get_diag(str)
|
||||
local diagnostics = vim.diagnostic.get(0, { severity = vim.diagnostic.severity[str] })
|
||||
local count = #diagnostics
|
||||
|
||||
return (count > 0) and " " .. count .. " " or ""
|
||||
end
|
||||
|
||||
---Get highlight group from vi mode
|
||||
---@return string
|
||||
local function vi_mode_hl()
|
||||
return vi.colors[vim.fn.mode()] or "UserSLViBlack"
|
||||
end
|
||||
|
||||
---Get sep highlight group from vi mode
|
||||
local function vi_sep_hl()
|
||||
return vi.sep[vim.fn.mode()] or "UserSLBlack"
|
||||
end
|
||||
|
||||
---Get the path of the file relative to the cwd
|
||||
---@return string
|
||||
local function file_info()
|
||||
local list = {}
|
||||
if vim.bo.readonly then
|
||||
table.insert(list, "🔒")
|
||||
end
|
||||
|
||||
if vim.bo.modified then
|
||||
table.insert(list, "●")
|
||||
end
|
||||
|
||||
table.insert(list, vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":~:."))
|
||||
|
||||
return table.concat(list, " ")
|
||||
end
|
||||
|
||||
-- Create a table that contians every status line commonent
|
||||
local c = {
|
||||
vimode = {
|
||||
provider = function()
|
||||
return fmt(" %s ", vi.text[vim.fn.mode()])
|
||||
end,
|
||||
hl = vi_mode_hl,
|
||||
right_sep = { str = " ", hl = vi_sep_hl },
|
||||
},
|
||||
gitbranch = {
|
||||
provider = "git_branch",
|
||||
icon = " ",
|
||||
hl = "UserSLGitBranch",
|
||||
right_sep = { str = " ", hl = "UserSLGitBranch" },
|
||||
enabled = function()
|
||||
return vim.b.gitsigns_status_dict ~= nil
|
||||
end,
|
||||
},
|
||||
file_type = {
|
||||
provider = function()
|
||||
return fmt(" %s ", vim.bo.filetype:upper())
|
||||
end,
|
||||
hl = "UserSLAlt",
|
||||
},
|
||||
fileinfo = {
|
||||
provider = { name = "file_info", opts = { type = "relative" } },
|
||||
hl = "UserSLAlt",
|
||||
left_sep = { str = " ", hl = "UserSLAltSep" },
|
||||
right_sep = { str = " ", hl = "UserSLAltSep" },
|
||||
},
|
||||
file_enc = {
|
||||
provider = function()
|
||||
local os = icons[vim.bo.fileformat] or ""
|
||||
return fmt(" %s %s ", os, vim.bo.fileencoding)
|
||||
end,
|
||||
hl = "StatusLine",
|
||||
left_sep = { str = icons.left_filled, hl = "UserSLAltSep" },
|
||||
},
|
||||
cur_position = {
|
||||
provider = function()
|
||||
-- TODO: What about 4+ diget line numbers?
|
||||
return fmt(" %3d:%-2d ", unpack(vim.api.nvim_win_get_cursor(0)))
|
||||
end,
|
||||
hl = vi_mode_hl,
|
||||
left_sep = { str = icons.left_filled, hl = vi_sep_hl },
|
||||
},
|
||||
cur_percent = {
|
||||
provider = function()
|
||||
return " " .. require("feline.providers.cursor").line_percentage() .. " "
|
||||
end,
|
||||
hl = vi_mode_hl,
|
||||
left_sep = { str = icons.left, hl = vi_mode_hl },
|
||||
},
|
||||
default = { -- needed to pass the parent StatusLine hl group to right hand side
|
||||
provider = "",
|
||||
hl = "StatusLine",
|
||||
},
|
||||
lsp_status = {
|
||||
provider = function()
|
||||
return vim.tbl_count(vim.lsp.buf_get_clients(0)) == 0 and "" or " ◦ "
|
||||
end,
|
||||
hl = "UserSLStatus",
|
||||
left_sep = { str = "", hl = "UserSLStatusBg", always_visible = true },
|
||||
right_sep = { str = "", hl = "UserSLErrorStatus", always_visible = true },
|
||||
},
|
||||
lsp_error = {
|
||||
provider = function()
|
||||
return get_diag("ERROR")
|
||||
end,
|
||||
hl = "UserSLError",
|
||||
right_sep = { str = "", hl = "UserSLWarnError", always_visible = true },
|
||||
},
|
||||
lsp_warn = {
|
||||
provider = function()
|
||||
return get_diag("WARN")
|
||||
end,
|
||||
hl = "UserSLWarn",
|
||||
right_sep = { str = "", hl = "UserSLInfoWarn", always_visible = true },
|
||||
},
|
||||
lsp_info = {
|
||||
provider = function()
|
||||
return get_diag("INFO")
|
||||
end,
|
||||
hl = "UserSLInfo",
|
||||
right_sep = { str = "", hl = "UserSLHintInfo", always_visible = true },
|
||||
},
|
||||
lsp_hint = {
|
||||
provider = function()
|
||||
return get_diag("HINT")
|
||||
end,
|
||||
hl = "UserSLHint",
|
||||
right_sep = { str = "", hl = "UserSLFtHint", always_visible = true },
|
||||
},
|
||||
|
||||
in_fileinfo = {
|
||||
provider = "file_info",
|
||||
hl = "StatusLine",
|
||||
},
|
||||
in_position = {
|
||||
provider = "position",
|
||||
hl = "StatusLine",
|
||||
},
|
||||
file_winbar = {
|
||||
provider = file_info,
|
||||
hl = "Comment",
|
||||
},
|
||||
}
|
||||
|
||||
local active = {
|
||||
{ -- left
|
||||
c.vimode,
|
||||
c.gitbranch,
|
||||
c.fileinfo,
|
||||
c.default, -- must be last
|
||||
},
|
||||
{ -- right
|
||||
c.lsp_status,
|
||||
c.lsp_error,
|
||||
c.lsp_warn,
|
||||
c.lsp_info,
|
||||
c.lsp_hint,
|
||||
c.file_type,
|
||||
c.file_enc,
|
||||
c.cur_position,
|
||||
c.cur_percent,
|
||||
},
|
||||
}
|
||||
|
||||
local inactive = {
|
||||
{ c.in_fileinfo }, -- left
|
||||
{ c.in_position }, -- right
|
||||
}
|
||||
|
||||
require("feline").setup({
|
||||
components = { active = active, inactive = inactive },
|
||||
highlight_reset_triggers = {},
|
||||
force_inactive = {
|
||||
filetypes = {
|
||||
"NvimTree",
|
||||
"packer",
|
||||
"dap-repl",
|
||||
"dapui_scopes",
|
||||
"dapui_stacks",
|
||||
"dapui_watches",
|
||||
"dapui_repl",
|
||||
"LspTrouble",
|
||||
"qf",
|
||||
"help",
|
||||
},
|
||||
buftypes = { "terminal" },
|
||||
bufnames = {},
|
||||
},
|
||||
disable = {
|
||||
filetypes = {
|
||||
"dashboard",
|
||||
"startify",
|
||||
},
|
||||
},
|
||||
})
|
24
configs/nvim/after/plugin/files.lua
Normal file
24
configs/nvim/after/plugin/files.lua
Normal file
@ -0,0 +1,24 @@
|
||||
-- function ColorMyPencils(color)
|
||||
-- color = color or "rose-pine"
|
||||
-- vim.cmd.colorscheme(color)
|
||||
--
|
||||
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none"})
|
||||
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none"})
|
||||
-- end
|
||||
--
|
||||
-- ColorMyPencils()
|
||||
require("transparent").setup({
|
||||
enable = true, -- boolean: enable transparent
|
||||
extra_groups = { -- table/string: additional groups that should be cleared
|
||||
-- In particular, when you set it to 'all', that means all available groups
|
||||
|
||||
-- example of akinsho/nvim-bufferline.lua
|
||||
"BufferLineTabClose",
|
||||
"BufferlineBufferSelected",
|
||||
"BufferLineFill",
|
||||
"BufferLineBackground",
|
||||
"BufferLineSeparator",
|
||||
"BufferLineIndicatorSelected",
|
||||
},
|
||||
exclude = {}, -- table: groups you don't want to clear
|
||||
})
|
1
configs/nvim/after/plugin/fugitive.lua
Normal file
1
configs/nvim/after/plugin/fugitive.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
|
11
configs/nvim/after/plugin/harpoon.lua
Normal file
11
configs/nvim/after/plugin/harpoon.lua
Normal file
@ -0,0 +1,11 @@
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
|
87
configs/nvim/after/plugin/lsp.lua
Normal file
87
configs/nvim/after/plugin/lsp.lua
Normal file
@ -0,0 +1,87 @@
|
||||
local lsp = require('lsp-zero')
|
||||
|
||||
lsp.preset('recommended')
|
||||
|
||||
lsp.ensure_installed({
|
||||
'tsserver',
|
||||
'eslint',
|
||||
'pyright',
|
||||
'sumneko_lua',
|
||||
'rust_analyzer',
|
||||
})
|
||||
|
||||
-- Fix Undefined global 'vim'
|
||||
lsp.configure('sumneko_lua', {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
-- disable completion with tab
|
||||
-- this helps with copilot setup
|
||||
cmp_mappings['<Tab>'] = nil
|
||||
cmp_mappings['<S-Tab>'] = nil
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings
|
||||
})
|
||||
|
||||
lsp.set_preferences({
|
||||
suggest_lsp_servers = false,
|
||||
sign_icons = {
|
||||
error = 'E',
|
||||
warn = 'W',
|
||||
hint = 'H',
|
||||
info = 'I'
|
||||
}
|
||||
})
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = {buffer = bufnr, remap = false}
|
||||
|
||||
if client.name == "eslint" then
|
||||
vim.cmd.LspStop('eslint')
|
||||
return
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
|
||||
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||
end)
|
||||
|
||||
lsp.setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
})
|
||||
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.completion.spell,
|
||||
},
|
||||
})
|
30
configs/nvim/after/plugin/null.lua
Normal file
30
configs/nvim/after/plugin/null.lua
Normal file
@ -0,0 +1,30 @@
|
||||
local null_ls = require("null-ls")
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local format = null_ls.builtins.formatting
|
||||
|
||||
null_ls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
||||
vim.lsp.buf.format({ bufnr = bufnr})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
sources = {
|
||||
format.stylua,
|
||||
format.rustfmt,
|
||||
format.autopep8,
|
||||
format.fourmolu,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.completion.spell,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
6
configs/nvim/after/plugin/telescope.lua
Normal file
6
configs/nvim/after/plugin/telescope.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||
end)
|
1
configs/nvim/after/plugin/tree.lua
Normal file
1
configs/nvim/after/plugin/tree.lua
Normal file
@ -0,0 +1 @@
|
||||
require("nvim-tree").setup()
|
21
configs/nvim/after/plugin/treesitter.lua
Normal file
21
configs/nvim/after/plugin/treesitter.lua
Normal file
@ -0,0 +1,21 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "help", "python", "javascript", "c", "lua", "rust", "bash" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
1
configs/nvim/after/plugin/undotree.lua
Normal file
1
configs/nvim/after/plugin/undotree.lua
Normal file
@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
1
configs/nvim/init.lua
Normal file
1
configs/nvim/init.lua
Normal file
@ -0,0 +1 @@
|
||||
require("jabuxas")
|
43
configs/nvim/lua/jabuxas/bar.lua
Normal file
43
configs/nvim/lua/jabuxas/bar.lua
Normal file
@ -0,0 +1,43 @@
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Move to previous/next
|
||||
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
|
||||
map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
|
||||
-- Re-order to previous/next
|
||||
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
|
||||
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
|
||||
-- Goto buffer in position...
|
||||
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
|
||||
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
|
||||
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
|
||||
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
|
||||
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
|
||||
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
|
||||
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
|
||||
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
|
||||
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
|
||||
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
|
||||
-- Pin/unpin buffer
|
||||
map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
|
||||
-- Close buffer
|
||||
map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
|
||||
-- Wipeout buffer
|
||||
-- :BufferWipeout
|
||||
-- Close commands
|
||||
-- :BufferCloseAllButCurrent
|
||||
-- :BufferCloseAllButPinned
|
||||
-- :BufferCloseAllButCurrentOrPinned
|
||||
-- :BufferCloseBuffersLeft
|
||||
-- :BufferCloseBuffersRight
|
||||
-- Magic buffer-picking mode
|
||||
map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
|
||||
-- Sort automatically by...
|
||||
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
|
||||
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
|
||||
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
|
||||
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
|
||||
|
||||
-- Other:
|
||||
-- :BarbarEnable - enables barbar (enabled by default)
|
||||
-- :BarbarDisable - very bad command, should never be used
|
3
configs/nvim/lua/jabuxas/init.lua
Normal file
3
configs/nvim/lua/jabuxas/init.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require("jabuxas.remap")
|
||||
require("jabuxas.set")
|
||||
require("jabuxas.bar")
|
88
configs/nvim/lua/jabuxas/packer.lua
Normal file
88
configs/nvim/lua/jabuxas/packer.lua
Normal file
@ -0,0 +1,88 @@
|
||||
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
|
||||
|
||||
-- Only required if you have packer configured as `opt`
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Simple plugins can be specified as strings
|
||||
use 'rstacruz/vim-closer'
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.0',
|
||||
-- or , branch = '0.1.x',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
|
||||
use({
|
||||
'rose-pine/neovim',
|
||||
as = 'rose-pine',
|
||||
config = function()
|
||||
vim.cmd('colorscheme rose-pine')
|
||||
end
|
||||
})
|
||||
|
||||
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||
|
||||
use('nvim-treesitter/playground')
|
||||
use('theprimeagen/harpoon')
|
||||
use('mbbill/undotree')
|
||||
use('tpope/vim-fugitive')
|
||||
|
||||
use({
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
config = function()
|
||||
require("null-ls").setup()
|
||||
end,
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
})
|
||||
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons', -- optional, for file icons
|
||||
},
|
||||
tag = 'nightly' -- optional, updated every week. (see issue #1193)
|
||||
}
|
||||
|
||||
use {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
requires = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'},
|
||||
{'williamboman/mason.nvim'},
|
||||
{'williamboman/mason-lspconfig.nvim'},
|
||||
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'},
|
||||
{'hrsh7th/cmp-buffer'},
|
||||
{'hrsh7th/cmp-path'},
|
||||
{'saadparwaiz1/cmp_luasnip'},
|
||||
{'hrsh7th/cmp-nvim-lsp'},
|
||||
{'hrsh7th/cmp-nvim-lua'},
|
||||
|
||||
-- Snippets
|
||||
{'L3MON4D3/LuaSnip'},
|
||||
-- Snippet Collection (Optional)
|
||||
{'rafamadriz/friendly-snippets'},
|
||||
}
|
||||
}
|
||||
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
|
||||
use 'nvim-tree/nvim-web-devicons'
|
||||
use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'}
|
||||
|
||||
use 'feline-nvim/feline.nvim'
|
||||
use 'xiyaowong/nvim-transparent'
|
||||
|
||||
use 'windwp/nvim-autopairs'
|
||||
|
||||
end)
|
33
configs/nvim/lua/jabuxas/remap.lua
Normal file
33
configs/nvim/lua/jabuxas/remap.lua
Normal file
@ -0,0 +1,33 @@
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
vim.keymap.set("i", "jk", "<Esc>")
|
||||
|
||||
vim.g.mapleader = " "
|
||||
-- vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
vim.keymap.set("n", "<leader>e", vim.cmd.NvimTreeToggle)
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
37
configs/nvim/lua/jabuxas/set.lua
Normal file
37
configs/nvim/lua/jabuxas/set.lua
Normal file
@ -0,0 +1,37 @@
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
-- vim.opt.colorcolumn = "80"
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
Loading…
Reference in New Issue
Block a user