I should probably make this a git repo

This commit is contained in:
gnat 2024-07-30 10:06:43 -07:00
commit ecfa4a1774
45 changed files with 1100 additions and 0 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# my neovim configuration
it works.

19
colors.vim Normal file
View File

@ -0,0 +1,19 @@
set background=dark
colorscheme oxocarbon
hi MyNormalMode guibg=#33b1ff guifg=#161616
hi MyInsertMode guibg=#42be65 guifg=#161616
hi MyVisualMode guibg=#be95ff guifg=#161616
hi MyDefaultMode guibg=#FF7EB6 guifg=#161616
hi CustomErrorHl guifg=#FF7EB6 guibg=#161616
hi CustomWarnHl guifg=#FFE97B guibg=#161616
hi tabActive guibg=#FF7EB6 guifg=#161616
hi tabInactive guibg=#3c3836 guifg=#dde1e6
hi tabSepActive guibg=#262626 guifg=#FF7EB6
hi tabSepActive2 guifg=#FF7EB6 guibg=#3c3836
hi tabSepInactive guibg=#262626 guifg=#3c3836
hi tabSepInactive2 guifg=#3c3836 guibg=#262626
hi tabSepSpecial guifg=#FF7EB6 guibg=#262626
hi tabSepSpecial2 guifg=#262626 guibg=#262626
hi tabSepSpecial3 guifg=#262626 guibg=#262626
luafile ~/.config/nvim/lua/core/statusline.lua
luafile ~/.config/nvim/lua/core/tabline.lua

16
init.lua Normal file
View File

@ -0,0 +1,16 @@
require 'core.keys'
require 'core.lazy'
require 'core.opts'
vim.api.nvim_command("source ~/.config/nvim/colors.vim")
require 'core.statusline'
require 'core.tabline'
require 'core.diagnostics'
local function set_terminal_title()
local filepath = vim.fn.expand("%:p")
local title = "vim - " .. filepath
vim.fn.system(string.format("printf '\27]2;%s\7'", title))
end
-- vim.cmd([[autocmd BufEnter * lua set_terminal_title()]])

45
lua/core/diagnostics.lua Normal file
View File

@ -0,0 +1,45 @@
function capitalize_head_exclusive(str)
str = string.lower(str)
str = string.gsub(str, "^%l", string.upper)
return str
end
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
local max_width = math.min(math.floor(vim.o.columns * 0.7), 100)
local max_height = math.min(math.floor(vim.o.lines * 0.3), 30)
vim.diagnostic.config({
underline = true,
update_in_insert = true,
severity_sort = true,
virtual_text = false and {
spacing = 1,
prefix = '', -- TODO: in nvim-0.10.0 this can be a function, so format won't be necessary
format = function(d)
local level = vim.diagnostic.severity[d.severity]
return string.format('%s %s', signs[capitalize_head_exclusive(level)], d.message)
end,
},
float = {
max_width = max_width,
max_height = max_height,
border = border_style,
title = { { '', 'DiagnosticFloatTitleIcon' }, { 'Problems ', 'DiagnosticFloatTitle' } },
focusable = false,
scope = 'line',
source = 'if_many',
prefix = function(diag)
local level = vim.diagnostic.severity[diag.severity]
local prefix = string.format('%s ', signs[capitalize_head_exclusive(level)])
return prefix, 'Diagnostic' .. level:gsub('^%l', string.upper)
end,
},
})
vim.cmd [[ autocmd! CursorHold * lua vim.diagnostic.open_float()]]

89
lua/core/keys.lua Normal file
View File

@ -0,0 +1,89 @@
vim.g.mapleader = " "
local opts = { noremap = true, silent = true }
local term_opts = { silent = true }
local keymap = vim.keymap.set
keymap('t', '<S-Esc>', '<C-\\><C-n>', { noremap = true })
-- window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
-- window resizing
keymap("n", "<C-S-k>", ":resize -2<CR>", opts)
keymap("n", "<C-S-j>", ":resize +2<CR>", opts)
keymap("n", "<C-S-h>", ":vertical resize -2<CR>", opts)
keymap("n", "<C-S-l>", ":vertical resize +2<CR>", opts)
-- buffer navigation
keymap("n", "<C-8>", ":bnext<CR>", opts)
keymap("n", "<C-9>", ":bprevious<CR>", opts)
-- move selection up or down
keymap("n", "<A-j>", ":m .+1<CR>==", opts)
keymap("n", "<A-k>", ":m .-2<CR>==", opts)
-- don't exit visual mode
keymap("v", "<", "<gv^", opts)
keymap("v", ">", ">gv^", opts)
-- Move text up and down
keymap("v", "<A-j>", ":m '>+1<CR>gv=gv", opts)
keymap("v", "<A-k>", ":m '<-2<CR>gv=gv", opts)
keymap("v", "p", '"_dP', opts)
-- Move text up and down
keymap("x", "J", ":m '>+1<CR>gv=gv", opts)
keymap("x", "K", ":m '<-2<CR>gv=gv", opts)
keymap("x", "<A-j>", ":m '>+1<CR>gv=gv", opts)
keymap("x", "<A-k>", ":m '<-2<CR>gv=gv", opts)
-- force me to use vim keys
keymap('n', '<Up>', '<Nop>', opts)
keymap('n', '<Down>', '<Nop>', opts)
keymap('n', '<Left>', '<Nop>', opts)
keymap('n', '<Right>', '<Nop>', opts)
keymap('i', '<Up>', '<Nop>', opts)
keymap('i', '<Down>', '<Nop>', opts)
keymap('i', '<Left>', '<Nop>', opts)
keymap('i', '<Right>', '<Nop>', opts)
keymap('i', '<A-h>', '<Left>', opts)
keymap('i', '<A-j>', '<Down>', opts)
keymap('i', '<A-k>', '<Up>', opts)
keymap('i', '<A-l>', '<Right>', opts)
keymap('x', '<Up>', '<Nop>', opts)
keymap('x', '<Down>', '<Nop>', opts)
keymap('x', '<Left>', '<Nop>', opts)
keymap('x', '<Right>', '<Nop>', opts)
-- split windows
keymap('n', '<C-s>v', ':vsplit<CR>', opts)
keymap('n', '<C-s>h', ':split<CR>', opts)
keymap('n', '<A-l>', ':nohlsearch<CR>', opts)
keymap('n', '<C-space>s', ':lua if vim.o.spell then vim.o.spell = false else vim.o.spell = true end<CR>',
{ noremap = true, silent = true })
keymap('n', '<C-space>c', ':ColorizerToggle<CR>', opts)
-- Tabs
keymap('n', '<C-t>', ':tabnew<CR>', opts)
keymap('n', '<C-w>', ':tabclose<CR>', opts)
keymap('n', '<A-j>', ':tabp<CR>', opts)
keymap('n', '<A-k>', ':tabn<CR>', opts)
-- Trouble.lua
keymap('n', '<C-space>t', ':TroubleToggle<CR>', opts)
-- lsp diagnostic movement
keymap('n', '>d', ':lua vim.diagnostic.goto_next()<CR>', opts)
keymap('n', '<d', ':lua vim.diagnostic.goto_prev()<CR>', opts)
-- source init
keymap('n', 'ri', ':luafile ~/.config/nvim/init.lua<CR>', opts) -- ri: reload init

17
lua/core/lazy.lua Normal file
View File

@ -0,0 +1,17 @@
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",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
import='plugins',
})

33
lua/core/opts.lua Normal file
View File

@ -0,0 +1,33 @@
local opt = vim.opt
opt.expandtab = true
opt.smarttab = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.hlsearch = true
opt.incsearch = true
opt.ignorecase = true
opt.smartcase = true
opt.splitbelow = true
opt.splitright = true
opt.wrap = false
opt.scrolloff = 5
opt.fileencoding = 'utf-8'
opt.termguicolors = true
opt.relativenumber = true
opt.cursorline = true
opt.number = true
opt.spelllang = { 'en_us' }
opt.background = 'light'
opt.updatetime = 50
border_style = 'rounded'
vim.cmd('set showtabline=2')
vim.cmd('colorscheme gruvbox')
vim.cmd('hi SpellBad gui=undercurl guifg=#cc241c')

123
lua/core/statusline.lua Normal file
View File

@ -0,0 +1,123 @@
function get_mode_highlight(mode)
local mode_highlights = {
n = "%#MyNormalMode#",
i = "%#MyInsertMode#",
t = "%#MyInsertMode#",
v = "%#MyVisualMode#",
V = "%#MyVisualMode#",
[""] = "%#MyVisualMode#",
c = "%#MyDefaultMode#",
s = "%#MyDefaultMode#",
S = "%#MyDefaultMode#",
[""] = "%#MyDefaultMode#",
R = "%#MyDefaultMode#",
Rv = "%#yDefaultMode#",
}
return mode_highlights[mode] or "MyDefaultMode"
end
function get_mode_name(mode)
local mode_map = {
n = "Normal",
i = "Insert",
t = "Terminal",
v = "Visual",
V = "V-Line",
[""] = "V-Block",
c = "Command",
s = "Select",
S = "S-Line",
[""] = "S-Block",
R = "Replace",
Rv = "V-Replace",
}
return mode_map[mode]
end
function format_filename()
return vim.fn.expand('%:t') ~= '' and vim.fn.expand('%:t') or 'nil'
end
function get_line_chars()
return string.format('%s:%s', vim.fn.col('.')-1, vim.fn.col('$')-1)
end
function get_diagnostic_count()
local bufnr = vim.api.nvim_get_current_buf()
local diagnostics = vim.diagnostic.get(bufnr)
local warning_count = 0
local error_count = 0
for _, diagnostic in ipairs(diagnostics) do
if diagnostic.severity == vim.lsp.protocol.DiagnosticSeverity.Warning then
warning_count = warning_count + 1
elseif diagnostic.severity == vim.lsp.protocol.DiagnosticSeverity.Error then
error_count = error_count + 1
end
end
if warning_count + error_count == 0 then
return ''
elseif error_count == 0 then
return '[%#CustomWarnHl#' .. '' .. warning_count .. '%*]'
elseif warning_count == 0 then
return "[%#CustomErrorHl# " .. error_count .. '%*]'
end
return "[%#CustomErrorHl# " .. error_count .. '%*] [%#CustomWarnHl#' .. '' .. warning_count .. '%*]'
end
function get_buffer_perms()
local readable = vim.loop.fs_access(vim.fn.expand('%'), 'R')
local writable = vim.loop.fs_access(vim.fn.expand('%'), 'W')
local executable = vim.loop.fs_access(vim.fn.expand('%'), 'X')
local permissions = ""
if readable then
permissions = permissions .. "r"
end
if writable then
permissions = permissions .. "w"
end
if executable then
permissions = permissions .. "x"
end
return permissions
end
local function statusline()
local file_name = " %f"
local modified = "%m"
local align_right = "%="
local fileencoding = " %{&fileencoding?&fileencoding:&encoding}"
local filetype = " %y"
local percentage = "(%p%%)"
local linecol = "[%l:%L][%{luaeval('get_line_chars()')}]"
local perms = ' %{luaeval("get_buffer_perms()")}'
local diagnostics = ' %{% luaeval("get_diagnostic_count()")%}'
local mode_name = '%{luaeval("get_mode_name(vim.fn.mode())")}'
local buffer = " %{luaeval('format_filename()')}" -- vim.fn.expand('%:t') ~= '' and vim.fn.expand('%:t') or 'nil'
local mode_highlight = '%{%(luaeval("get_mode_highlight(vim.fn.mode())"))%}'
local rm_highlight = '%*'
return string.format(
"%s [%s] %s%s%s%s%s%s%s%s%s ",
mode_highlight,
mode_name,
rm_highlight,
buffer,
modified,
linecol,
percentage,
diagnostics,
align_right,
filetype,
fileencoding,
perms
)
end
vim.opt.statusline = statusline()

23
lua/core/tabline.lua Normal file
View File

@ -0,0 +1,23 @@
function custom_tabline()
local current_tab = vim.fn.tabpagenr()
local tabline = ''
for t = 1, vim.fn.tabpagenr('$') do
local win_count = vim.fn.tabpagewinnr(t, '$')
local buflist = vim.fn.tabpagebuflist(t)
local bufnr = buflist[1]
tabline = tabline .. (t == current_tab and '%#tabSepInactive2#' or '%#tabSepInactive2#')
tabline = tabline .. (t == current_tab and '%#tabSepSpecial#' or '')
tabline = tabline .. (t == current_tab and '%#tabActive#' or '%#tabInactive#')
tabline = tabline .. ' ' .. (t-1)..': '
--tabline = tabline .. ' '
tabline = tabline .. ' ' .. vim.fn.fnamemodify(vim.fn.bufname(bufnr), ':t') .. ' '
tabline = tabline .. ' '
tabline = tabline .. (t == current_tab and '%#tabSepActive#' or '%#tabSepInactive#')
tabline = tabline .. '%*'
end
return tabline .. '%*'
end
-- vim.o.tabline = '%{%luaeval("custom_tabline()")%}'

View File

@ -0,0 +1 @@
return {} -- return {'jiangmiao/auto-pairs'}

11
lua/plugins/barbecue.lua Normal file
View File

@ -0,0 +1,11 @@
return {
"utilyre/barbecue.nvim",
name = "barbecue",
version = "*",
event = { 'LspAttach' },
dependencies = {
"SmiteshP/nvim-navic",
"nvim-tree/nvim-web-devicons", -- optional dependency
},
opts = {}
}

1
lua/plugins/biscuit.lua Normal file
View File

@ -0,0 +1 @@
return { 'Biscuit-Colorscheme/nvim', name = 'biscuit' }

View File

@ -0,0 +1,6 @@
return {
'catppuccin/nvim',
lazy=false,
priority = 1000,
}

View File

@ -0,0 +1 @@
return {'sainnhe/everforest'}

55
lua/plugins/gitsigns.lua Normal file
View File

@ -0,0 +1,55 @@
return {
'lewis6991/gitsigns.nvim',
event = { 'BufEnter' },
config = function()
require('gitsigns').setup {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
untracked = { text = '' },
},
signs_staged = {
add = { text = '' },
change = { text = '' },
delete = { text = '' },
topdelete = { text = '' },
changedelete = { text = '' },
untracked = { text = '' },
},
signs_staged_enable = true,
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
virt_text_priority = 100,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
end
}

1
lua/plugins/gruvbox.lua Normal file
View File

@ -0,0 +1 @@
return { "ellisonleao/gruvbox.nvim", priority = 1000}

6
lua/plugins/hy.lua Normal file
View File

@ -0,0 +1,6 @@
return {
'hylang/vim-hy',
config=function()
vim.g.hy_enable_conceal = 1
end
}

View File

@ -0,0 +1,7 @@
return {
-- "lukas-reineke/indent-blankline.nvim",
-- main = "ibl",
-- config = function()
-- require("ibl").setup()
-- end
}

View File

@ -0,0 +1 @@
return {'williamboman/mason-lspconfig.nvim'}

7
lua/plugins/mason.lua Normal file
View File

@ -0,0 +1,7 @@
return {
'williamboman/mason.nvim',
lazy = true,
config = function()
require('mason').setup()
end
}

View File

@ -0,0 +1 @@
return { 'echasnovski/mini.files', version = false }

View File

@ -0,0 +1 @@
return { 'echasnovski/mini.notify', version = false }

View File

@ -0,0 +1 @@
return { 'echasnovski/mini.pairs', version = false }

14
lua/plugins/neotree.lua Normal file
View File

@ -0,0 +1,14 @@
return {
"nvim-neo-tree/neo-tree.nvim",
event = { "VeryLazy" },
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
config = function()
vim.api.nvim_set_keymap('n', '<leader><tab>', ':UndotreeHide<CR>:Neotree toggle<CR>', {})
end
}

1
lua/plugins/nui.lua Normal file
View File

@ -0,0 +1 @@
return {'MunifTanjim/nui.nvim'}

210
lua/plugins/nvim-cmp.lua Normal file
View File

@ -0,0 +1,210 @@
return {
"hrsh7th/nvim-cmp",
event = { "InsertEnter" },
dependencies = {
"hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths
"L3MON4D3/LuaSnip", -- snippet engine
"saadparwaiz1/cmp_luasnip", -- for autocompletion
"rafamadriz/friendly-snippets", -- useful snippets
"onsails/lspkind.nvim", -- vs-code like pictograms
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-omni",
"hrsh7th/cmp-emoji",
'hrsh7th/cmp-nvim-lsp-signature-help',
'f3fora/cmp-spell',
'hrsh7th/cmp-calc',
'ray-x/cmp-treesitter',
'hrsh7th/cmp-cmdline',
'tzachar/cmp-ai'
},
config = function()
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
require("luasnip.loaders.from_vscode").lazy_load()
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
return
end
require("luasnip/loaders/from_vscode").lazy_load()
local check_backspace = function()
local col = vim.fn.col "." - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
end
local cmp_ai = require('cmp_ai.config')
cmp_ai:setup({
max_lines = 100,
provider = 'Ollama',
provider_options = {
model = 'codellama:7b-code',
},
notify = true,
notify_callback = function(msg)
vim.notify(msg)
end,
run_on_every_keystroke = false,
ignored_file_types = {
-- default is not to ignore
-- uncomment to ignore in lua:
-- lua = true
},
})
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 = "",
Misc = "",
}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Tab>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm { select = true },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
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",
}),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
-- 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
vim_item.menu = ({
nvim_lsp = "[LSP]",
luasnip = "[Snip]",
buffer = "[Buf]",
path = "[Path]",
cmp_ai = '[AI]',
})[entry.source.name]
return vim_item
end,
},
completion = {
autocomplete = {
require('cmp.types').cmp.TriggerEvent.TextChanged,
},
completeopt = 'menu,menuone,noselect',
keyword_pattern = ".*",
keyword_length = 1, -- Set to 1 for immediate as-you-type completion
},
sources = {
{ name = 'nvim_lsp_signature_help' },
{ name = "nvim_lsp" },
-- { name = 'cmp_ai' },
{ name = "treesitter" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "spell" },
{ name = 'calc' },
{ name = 'omni' },
{ name = 'emoji' }
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
experimental = {
ghost_text = true,
native_menu = false,
},
}
-- `/` cmdline setup.
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- `:` cmdline setup.
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
end,
}

View File

@ -0,0 +1,5 @@
return {
"NvChad/nvim-colorizer.lua",
event = { "BufReadPre", "BufNewFile" },
config = true,
}

View File

@ -0,0 +1,7 @@
return {
"olrtg/nvim-emmet",
lazy=false,
config = function()
vim.keymap.set({ "n", "v" }, '<leader>xe', require('nvim-emmet').wrap_with_abbreviation)
end,
}

10
lua/plugins/nvim-lint.lua Normal file
View File

@ -0,0 +1,10 @@
return {
'mfussenegger/nvim-lint',
event = { "VeryLazy" },
config = function()
require('lint').linters_by_ft = {
markdown = {'vale',},
python = {'pylint',},
}
end
}

View File

@ -0,0 +1,100 @@
local function on_attach(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, {})
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, {})
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, {})
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, {})
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, {})
vim.keymap.set('n', '<C-l>h', vim.lsp.buf.hover, {})
end
local servers = {
'asm_lsp',
'bashls',
'clojure_lsp',
'cmake',
'cssls',
'fennel_language_server',
'html',
'jqls',
'jsonls',
'pyright',
'rust_analyzer',
'clangd',
'verible',
'vimls',
'luau_lsp',
'lua_ls',
'emmet_language_server',
}
local border = 'rounded'
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {border = border, focus = false}),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {border = border, focus = false}),
}
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
-- group = vim.api.nvim_create_augroup("float_diagnostic", { clear = true }),
-- callback = function ()
-- vim.lsp.buf.hover(nil, {focus=false, scope='line'})
-- end
-- })
return {
event={ "VeryLazy" },
'neovim/nvim-lspconfig',
config = function()
local nvim_lsp = require('lspconfig')
require('mason')
require('mason-lspconfig').setup({
ensure_installed = servers
})
for _, lsp in ipairs(servers) do
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
if lsp ~= 'emmet-language-server' then
nvim_lsp[lsp].setup {
on_attach = on_attach,
autostart = true,
capabilities = lsp_capabilities,
handlers = handlers,
flags = {
debounce_text_changes = 150,
}
}
else
nvim_lsp.emmet_language_server.setup({
filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "pug", "typescriptreact" },
-- Read more about this options in the [vscode docs](https://code.visualstudio.com/docs/editor/emmet#_emmet-configuration).
-- **Note:** only the options listed in the table are supported.
init_options = {
---@type table<string, string>
includeLanguages = {},
--- @type string[]
excludeLanguages = {},
--- @type string[]
extensionsPath = {},
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/preferences/)
preferences = {},
--- @type boolean Defaults to `true`
showAbbreviationSuggestions = true,
--- @type "always" | "never" Defaults to `"always"`
showExpandedAbbreviation = "always",
--- @type boolean Defaults to `false`
showSuggestionsAsSnippets = false,
--- @type table<string, any> [Emmet Docs](https://docs.emmet.io/customization/syntax-profiles/)
syntaxProfiles = {},
--- @type table<string, string> [Emmet Docs](https://docs.emmet.io/customization/snippets/#variables)
variables = {},
},
})
end
end
vim.cmd([[LspStart]])
end
}

View File

@ -0,0 +1,51 @@
return {
'SmiteshP/nvim-navic',
event = { 'LspAttach' },
config = function()
local navic = require('nvim-navic')
navic.setup {
icons = {
File = '',
Module = '',
Namespace = '',
Package = '',
Class = '',
Method = '',
Property = '',
Field = '',
Constructor = '',
Enum = '',
Interface = '',
Function = '',
Variable = '',
Constant = '',
String = '',
Number = '',
Boolean = '',
Array = '',
Object = '',
Key = '',
Null = '',
EnumMember = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = ''
},
lsp = {
auto_attach = true,
preference = nil,
},
highlight = true,
separator = " > ",
depth_limit = 0,
depth_limit_indicator = "..",
safe_output = true,
lazy_update_context = false,
click = true,
format_text = function(text)
return text
end,
}
end
}

View File

@ -0,0 +1,54 @@
return {
lazy = true,
'nvim-telescope/telescope.nvim',
tag = '0.1.4',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local actions = require("telescope.actions")
local keymap = vim.api.nvim_set_keymap
require('telescope').setup({
extensions = {
media = {
backend = "ueberzug",
backend_options = {
xmove = -1,
ymove = -2,
warnings = true,
supress_backend_warning = false
},
}
},
defaults = {
prompt_prefix = "λ ",
selection_caret = "-> ",
mappings = {
i = {
["<C-h>"] = actions.which_key,
["<C-k>"] = actions.move_selection_next,
["<C-j>"] = actions.move_selection_previous,
}
}
},
pickers = {
buffers = {
sort_lastused = true,
previewer = false,
layout_config = {
width = 0.3,
height = 0.4,
},
},
planets = {
show_pluto = true,
},
},
extensions = {}
})
keymap('n', '<leader><leader>', ':Telescope find_files<CR>', {})
keymap('n', '<leader>m', ':Telescope media<CR>', {})
keymap('n', '<leader>b', ':Telescope buffers<CR>', {})
keymap('n', '<leader>t', ':Telescope<CR>', {})
keymap('n', '<leader>g', ':Telescope live_grep<CR>', {})
end,
}

View File

@ -0,0 +1,72 @@
return {
"nvim-treesitter/nvim-treesitter",
event = { "InsertEnter" },
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
-- configure treesitter
treesitter.setup({ -- enable syntax highlighting
auto_install = true,
highlight = {
enable = true,
},
-- enable indentation
indent = { enable = true },
-- enable autotagging (w/ nvim-ts-autotag plugin)
autotag = {
enable = true,
},
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"yaml",
"html",
"markdown",
"markdown_inline",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"query",
"latex",
"python",
"c",
"cpp",
"css",
"commonlisp",
"fennel",
"haskell",
"ini",
"jq",
"perl",
"scss",
"verilog",
"awk"
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
-- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
context_commentstring = {
enable = true,
enable_autocmd = false,
},
})
vim.api.nvim_set_keymap('n', '<space>jd', ':TSD<CR>', { noremap = true, silent = true })
end,
}

View File

@ -0,0 +1 @@
return { 'nyoom-engineering/oxocarbon.nvim' }

1
lua/plugins/rosepine.lua Normal file
View File

@ -0,0 +1 @@
return { 'rose-pine/neovim', name = 'rose-pine' }

51
lua/plugins/tabby.lua Normal file
View File

@ -0,0 +1,51 @@
return {
'nanozuki/tabby.nvim',
dependencies = 'nvim-tree/nvim-web-devicons',
config = function()
local theme = {
fill = 'TabLineFill',
-- Also you can do this: fill = { fg='#f2e9de', bg='#907aa9', style='italic' }
head = 'TabLine',
current_tab = 'tabActive',
tab = 'TabLine',
win = 'TabLine',
tail = 'TabLine',
}
require('tabby').setup({
line = function(line)
return {
{
line.sep(' ', theme.head, theme.fill),
},
line.tabs().foreach(function(tab)
local hl = tab.is_current() and theme.current_tab or theme.tab
return {
tab.number(),
tab.name(),
tab.close_btn(''),
line.sep(' ', hl, theme.fill),
hl = hl,
margin = ' ',
}
end),
line.spacer(),
line.wins_in_tab(line.api.get_current_tab()).foreach(function(win)
return {
line.sep(' ', theme.win, theme.fill),
win.buf_name(),
line.sep(' ', theme.win, theme.fill),
hl = theme.win,
margin = ' ',
}
end),
{
line.sep(' ', theme.tail, theme.fill),
{ '', hl = theme.tail },
},
hl = theme.fill,
}
end,
-- option = {}, -- setup modules' option,
})
end,
}

6
lua/plugins/tagbar.lua Normal file
View File

@ -0,0 +1,6 @@
return {
'preservim/tagbar',
config = function()
vim.keymap.set('n', '<leader>o', ':TagbarToggle<CR>', {})
end
}

View File

@ -0,0 +1,7 @@
return {
"dharmx/telescope-media.nvim",
event={ "VeryLazy" },
config = function()
require("telescope").load_extension("media")
end,
}

View File

@ -0,0 +1,10 @@
return {
'akinsho/toggleterm.nvim',
version = "*",
event = { "VeryLazy" },
config = function()
require('toggleterm').setup({
open_mapping = [[<c-\>]],
})
end
}

16
lua/plugins/trouble.lua Normal file
View File

@ -0,0 +1,16 @@
return {
"folke/trouble.nvim",
event = { "LspAttach" },
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "",
},
},
}

6
lua/plugins/undotree.lua Normal file
View File

@ -0,0 +1,6 @@
return {
'mbbill/undotree',
config=function()
vim.keymap.set('n', '<C-u>', ':Neotree close<CR>:UndotreeToggle<CR>', {})
end,
}

View File

@ -0,0 +1 @@
return {'tpope/vim-commentary'}

View File

@ -0,0 +1 @@
return { 'tpope/vim-sleuth', event = { 'BufEnter' }}

View File

@ -0,0 +1 @@
return {'tpope/vim-surround'}

8
lua/plugins/vimtex.lua Normal file
View File

@ -0,0 +1,8 @@
return {
'lervag/vimtex',
config = function()
vim.g.vimtex_view_method = 'zathura'
vim.api.nvim_set_keymap('n', '<leader>ll', [[:VimtexCompile<CR>]], { noremap = true, silent = true })
end,
event = "FileType tex"
}