more stuff too lazy to seperate
This commit is contained in:
@ -1,2 +1 @@
|
|||||||
vim.cmd('set spell!')
|
|
||||||
vim.cmd('startinsert | 1')
|
vim.cmd('startinsert | 1')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
-- IMPORTANT: Make sure you're $JAVA_HOME is correct (prob should be 17 or higher)
|
-- NOTE: Make sure you're $JAVA_HOME is correct (prob should be 17 or higher)
|
||||||
local java_cmds = vim.api.nvim_create_augroup('java_cmds', {clear = true})
|
local java_cmds = vim.api.nvim_create_augroup('java_cmds', {clear = true})
|
||||||
local cache_vars = {}
|
local cache_vars = {}
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ local features = {
|
|||||||
|
|
||||||
-- change this to `true` if you have `nvim-dap`,
|
-- change this to `true` if you have `nvim-dap`,
|
||||||
-- `java-test` and `java-debug-adapter` installed
|
-- `java-test` and `java-debug-adapter` installed
|
||||||
debugger = false,
|
debugger = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function get_jdtls_paths()
|
local function get_jdtls_paths()
|
||||||
|
@ -12,6 +12,5 @@ actions.setup {
|
|||||||
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
|
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
|
||||||
},
|
},
|
||||||
layout_strategy = 'cursor',
|
layout_strategy = 'cursor',
|
||||||
winblend = 10,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,34 +3,6 @@ if not status_ok then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local lspicons = {
|
|
||||||
Text = 'Tx',
|
|
||||||
Snippet = '<>',
|
|
||||||
Method = '{}',
|
|
||||||
Function = '{}',
|
|
||||||
Constructor = '{}',
|
|
||||||
Field = '""',
|
|
||||||
Variable = 'i=',
|
|
||||||
Class = '{}',
|
|
||||||
Interface = '.h',
|
|
||||||
Module = '{}',
|
|
||||||
Property = '@p',
|
|
||||||
Unit = ' ',
|
|
||||||
Value = 'x=',
|
|
||||||
Enum = 'E#',
|
|
||||||
Keyword = '$1',
|
|
||||||
Color = ' ',
|
|
||||||
File = '#`',
|
|
||||||
Reference = ' ',
|
|
||||||
Folder = '[/',
|
|
||||||
EnumMember = ' ',
|
|
||||||
Constant = 'c=',
|
|
||||||
Struct = ' ',
|
|
||||||
Event = ' ',
|
|
||||||
Operator = '%*',
|
|
||||||
TypeParameter = ' ',
|
|
||||||
}
|
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
unpack = unpack or table.unpack
|
unpack = unpack or table.unpack
|
||||||
local line, col = unpack(a.nvim_win_get_cursor(0))
|
local line, col = unpack(a.nvim_win_get_cursor(0))
|
||||||
@ -38,11 +10,9 @@ local has_words_before = function()
|
|||||||
[1]:sub(col, col):match("%s") == nil
|
[1]:sub(col, col):match("%s") == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- insert '(' after completing a function
|
-- insert '()' after completing a function
|
||||||
cmp.event:on(
|
cmp.event:on('confirm_done',
|
||||||
'confirm_done',
|
require('nvim-autopairs.completion.cmp').on_confirm_done())
|
||||||
require('nvim-autopairs.completion.cmp').on_confirm_done()
|
|
||||||
)
|
|
||||||
|
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require('luasnip')
|
||||||
local neogen = require('neogen')
|
local neogen = require('neogen')
|
||||||
@ -57,7 +27,7 @@ cmp.setup {
|
|||||||
|
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp', keyword_length = 3 },
|
{ name = 'nvim_lsp', keyword_length = 3 },
|
||||||
{ name = 'luasnip', keyword_length = 3 },
|
{ name = 'luasnip_choice' },
|
||||||
{ name = 'async_path' },
|
{ name = 'async_path' },
|
||||||
{ name = 'buffer', keyword_length = 3, max_item_count = 7 },
|
{ name = 'buffer', keyword_length = 3, max_item_count = 7 },
|
||||||
{ name = 'calc' },
|
{ name = 'calc' },
|
||||||
@ -80,12 +50,17 @@ cmp.setup {
|
|||||||
-- mappings -----------------------------------------------------------------
|
-- mappings -----------------------------------------------------------------
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if #cmp.get_entries() == 1 then
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
elseif cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif luasnip.expand_or_locally_jumpable() then
|
elseif luasnip.expand_or_locally_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
elseif has_words_before() then
|
elseif has_words_before() then
|
||||||
cmp.complete()
|
cmp.complete()
|
||||||
|
if #cmp.get_entries() == 1 then
|
||||||
|
cmp.confirm({ select = true })
|
||||||
|
end
|
||||||
elseif neogen.jumpable() then
|
elseif neogen.jumpable() then
|
||||||
neogen.jump_next()
|
neogen.jump_next()
|
||||||
else
|
else
|
||||||
@ -103,7 +78,7 @@ cmp.setup {
|
|||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
['<CR>'] = cmp.mapping({
|
['<CR>'] = cmp.mapping {
|
||||||
i = function(fallback)
|
i = function(fallback)
|
||||||
if cmp.visible() and cmp.get_active_entry() then
|
if cmp.visible() and cmp.get_active_entry() then
|
||||||
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||||
@ -112,9 +87,13 @@ cmp.setup {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
s = cmp.mapping.confirm({ select = true }),
|
s = cmp.mapping.confirm({ select = true }),
|
||||||
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace,
|
||||||
}),
|
select = true }),
|
||||||
|
},
|
||||||
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||||
['<ESC>'] = cmp.mapping.close(),
|
['<ESC>'] = cmp.mapping.close(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
sorting = {
|
sorting = {
|
||||||
@ -122,12 +101,12 @@ cmp.setup {
|
|||||||
cmp.config.compare.offset,
|
cmp.config.compare.offset,
|
||||||
cmp.config.compare.exact,
|
cmp.config.compare.exact,
|
||||||
cmp.config.compare.score,
|
cmp.config.compare.score,
|
||||||
require "cmp-under-comparator".under,
|
require("cmp-under-comparator").under,
|
||||||
cmp.config.compare.kind,
|
cmp.config.compare.kind,
|
||||||
cmp.config.compare.sort_text,
|
cmp.config.compare.sort_text,
|
||||||
cmp.config.compare.length,
|
cmp.config.compare.length,
|
||||||
cmp.config.compare.order,
|
cmp.config.compare.order,
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
enabled = function()
|
enabled = function()
|
||||||
local context = require 'cmp.config.context'
|
local context = require 'cmp.config.context'
|
||||||
|
16
after/plugin/dressing.lua
Normal file
16
after/plugin/dressing.lua
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
local status_ok, dressing = pcall(require, "dressing")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
dressing.setup {
|
||||||
|
input = {
|
||||||
|
enabled = true,
|
||||||
|
title_pos = "center",
|
||||||
|
border = 'single',
|
||||||
|
relative = "win"
|
||||||
|
},
|
||||||
|
select = {
|
||||||
|
enabled = true,
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,6 @@ if not status_ok then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local actions = glance.actions
|
|
||||||
glance.setup {
|
glance.setup {
|
||||||
detached = function(winid)
|
detached = function(winid)
|
||||||
return vim.api.nvim_win_get_width(winid) < 100
|
return vim.api.nvim_win_get_width(winid) < 100
|
||||||
|
17
after/plugin/headlines.lua
Normal file
17
after/plugin/headlines.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
local status_ok, headlines = pcall(require, "headlines")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
headlines.setup {
|
||||||
|
norg = {
|
||||||
|
headline_highlights = {
|
||||||
|
"@neorg.headings.1.title",
|
||||||
|
"@neorg.headings.2.title",
|
||||||
|
"@neorg.headings.3.title",
|
||||||
|
"@neorg.headings.4.title",
|
||||||
|
"@neorg.headings.5.title",
|
||||||
|
"@neorg.headings.6.title"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -1,8 +0,0 @@
|
|||||||
local status_ok, hypersonic = pcall(require, "hypersonic")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
hypersonic.setup {
|
|
||||||
border = 'shadow'
|
|
||||||
}
|
|
@ -4,7 +4,12 @@ if not status_ok then
|
|||||||
end
|
end
|
||||||
|
|
||||||
ibl.setup {
|
ibl.setup {
|
||||||
|
indent = {
|
||||||
|
char = '▏',
|
||||||
|
},
|
||||||
scope = {
|
scope = {
|
||||||
enabled = false,
|
enabled = true,
|
||||||
|
show_start = false,
|
||||||
|
show_end = false
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
6
after/plugin/luasnip-choice.lua
Normal file
6
after/plugin/luasnip-choice.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
local status_ok, lschoice = pcall(require, "cmp_luasnip_choice")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
lschoice.setup {}
|
@ -17,16 +17,16 @@ notify.setup {
|
|||||||
max_height = function() return math.floor(vim.o.lines * 0.75) end,
|
max_height = function() return math.floor(vim.o.lines * 0.75) end,
|
||||||
max_width = function() return math.floor(vim.o.columns * 0.5) end,
|
max_width = function() return math.floor(vim.o.columns * 0.5) end,
|
||||||
on_open = function(win, record)
|
on_open = function(win, record)
|
||||||
|
if record.title[1] == '' then record.title[1] = 'Unkown' end
|
||||||
vim.api.nvim_win_set_config(win, {
|
vim.api.nvim_win_set_config(win, {
|
||||||
title = {
|
title = {
|
||||||
{ " "..record.title[1].." ", "Notify"..record.level.."Title" },
|
{ ' '..record.title[1]..' ', 'Notify'..record.level..'Title' }
|
||||||
},
|
},
|
||||||
title_pos = "center",
|
title_pos = 'center',
|
||||||
border = "single",
|
border = 'single'
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
render = function(bufnr, notif)
|
render = function(bufnr, notif)
|
||||||
notif.message[1] = string.format("%s", notif.message[1])
|
|
||||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
|
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ alpha.setup {
|
|||||||
button('f', '? Find files', '<cmd>Telescope find_files<CR>'),
|
button('f', '? Find files', '<cmd>Telescope find_files<CR>'),
|
||||||
button('r', '↺ Recent files', '<cmd>Telescope oldfiles <CR>'),
|
button('r', '↺ Recent files', '<cmd>Telescope oldfiles <CR>'),
|
||||||
button('n', '▣ Neorg workspace', '<cmd>Telescope neorg switch_workspace<CR>'),
|
button('n', '▣ Neorg workspace', '<cmd>Telescope neorg switch_workspace<CR>'),
|
||||||
button('m', '≡ Menu', '<cmd>ConfigMenu<CR>'),
|
button('m', '≡ Menu', '<cmd>lua require("core.conf").configmenu()<CR>'),
|
||||||
button('q', '✖ Quit', '<cmd>wqa<CR>'),
|
button('q', '✖ Quit', '<cmd>wqa<CR>'),
|
||||||
} },
|
} },
|
||||||
{ type = 'text', val = footer, opts = {
|
{ type = 'text', val = footer, opts = {
|
||||||
|
@ -7,13 +7,13 @@ el.reset_windows()
|
|||||||
|
|
||||||
local builtin = require("el.builtin")
|
local builtin = require("el.builtin")
|
||||||
local sections = require("el.sections")
|
local sections = require("el.sections")
|
||||||
local c = require "components"
|
local c = require("core.statusbar.components")
|
||||||
|
|
||||||
local function hl(fg, b)
|
local function hl(fg, b)
|
||||||
b = b or false
|
b = b or false
|
||||||
return c.extract_hl({
|
return c.extract_hl({
|
||||||
bg = {["StatusLine"] = "bg"},
|
bg = { ["StatusLine"] = "bg" },
|
||||||
fg = {[fg] = "fg"},
|
fg = { [fg] = "fg" },
|
||||||
bold = b,
|
bold = b,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
11
after/plugin/tabline.lua
Normal file
11
after/plugin/tabline.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
local status_ok, tabline = pcall(require, "tar")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
tabline.setup {
|
||||||
|
layout = {
|
||||||
|
{ type = 'taglist' },
|
||||||
|
},
|
||||||
|
seperator = '|',
|
||||||
|
}
|
@ -9,16 +9,28 @@ local function telescopew()
|
|||||||
if vim.o.columns <= 80 then
|
if vim.o.columns <= 80 then
|
||||||
return vim.o.columns
|
return vim.o.columns
|
||||||
else
|
else
|
||||||
return 80
|
return 0.8
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
telescope.setup {
|
telescope.setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
borderchars = {
|
borderchars = {
|
||||||
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
|
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
|
||||||
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
|
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
|
||||||
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
|
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
|
||||||
|
},
|
||||||
|
winblend = 0,
|
||||||
|
layout_strategy = 'horizontal',
|
||||||
|
sorting_strategy = 'descending',
|
||||||
|
scroll_strategy = 'limit',
|
||||||
|
layout_config = {
|
||||||
|
horizontal = {
|
||||||
|
width = telescopew(),
|
||||||
|
height = 20,
|
||||||
|
prompt_position = 'bottom',
|
||||||
|
anchor = 'N',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
preview = {
|
preview = {
|
||||||
-- add image previews via chafa
|
-- add image previews via chafa
|
||||||
@ -30,7 +42,7 @@ telescope.setup {
|
|||||||
'jpe',
|
'jpe',
|
||||||
'jpeg',
|
'jpeg',
|
||||||
'webp',
|
'webp',
|
||||||
'gif',
|
'gif'
|
||||||
}
|
}
|
||||||
local split_path = vim.split(filepath:lower(), '.', { plain=true })
|
local split_path = vim.split(filepath:lower(), '.', { plain=true })
|
||||||
local extension = split_path[#split_path]
|
local extension = split_path[#split_path]
|
||||||
@ -38,39 +50,22 @@ telescope.setup {
|
|||||||
end
|
end
|
||||||
if is_image(filepath) then
|
if is_image(filepath) then
|
||||||
local term = vim.api.nvim_open_term(bufnr, {})
|
local term = vim.api.nvim_open_term(bufnr, {})
|
||||||
local function send_output(_, data, _ )
|
local function send_output(_, data, _)
|
||||||
for _, d in ipairs(data) do
|
for _, d in ipairs(data) do
|
||||||
vim.api.nvim_chan_send(term, d..'\r\n')
|
vim.api.nvim_chan_send(term, d..'\r\n')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.fn.jobstart({
|
vim.fn.jobstart({
|
||||||
'chafa',
|
'chafa', '-C', 'on', '--animate', 'off', '-s',
|
||||||
'-C',
|
(telescopew() - 10)..'x20', '--clear', filepath
|
||||||
'on',
|
|
||||||
'--animate',
|
|
||||||
'off',
|
|
||||||
'-s',
|
|
||||||
(telescopew() - 10)..'x25',
|
|
||||||
'--clear',
|
|
||||||
filepath
|
|
||||||
}, { on_stdout = send_output, stdout_buffered = true, pty = true })
|
}, { on_stdout = send_output, stdout_buffered = true, pty = true })
|
||||||
a.nvim_set_option_value("number", false, {buf = bufnr})
|
a.nvim_set_option_value("number", false, { buf = bufnr })
|
||||||
else
|
else
|
||||||
require("telescope.previewers.utils").set_preview_message(bufnr, opts.winid, "File cannot be previewed")
|
require("telescope.previewers.utils").set_preview_message(bufnr,
|
||||||
|
opts.winid, "File cannot be previewed")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
|
||||||
winblend = 0,
|
|
||||||
-- 'horizontal', 'vertical', 'bottom_pane', or 'cursor'
|
|
||||||
layout_strategy = 'vertical',
|
|
||||||
sorting_strategy = 'ascending',
|
|
||||||
layout_config = {
|
|
||||||
vertical = {
|
|
||||||
width = telescopew(),
|
|
||||||
prompt_position = "top",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<esc>"] = actions.close,
|
["<esc>"] = actions.close,
|
||||||
@ -90,8 +85,8 @@ telescope.setup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
telescope.load_extension('file_browser')
|
telescope.load_extension('file_browser')
|
||||||
telescope.load_extension('ui-select')
|
|
||||||
telescope.load_extension('projects')
|
telescope.load_extension('projects')
|
||||||
|
telescope.load_extension('fzf')
|
||||||
|
|
||||||
a.nvim_create_autocmd('User', {
|
a.nvim_create_autocmd('User', {
|
||||||
pattern = 'TelescopePreviewerLoaded',
|
pattern = 'TelescopePreviewerLoaded',
|
||||||
|
@ -44,8 +44,7 @@ highlight('EndOfBuffer', { fg = vim.g.terminal_color_background })
|
|||||||
|
|
||||||
-- plugin highlights ----------------------------------------------------------
|
-- plugin highlights ----------------------------------------------------------
|
||||||
-- telescope
|
-- telescope
|
||||||
highlight('TelescopeMatching', { bg = c.gray01 })
|
highlight('TelescopeMatching', { bg = c.gray01, fg = c.blue })
|
||||||
highlight('TelescopeNormal', { bg = c.bg_dark })
|
|
||||||
|
|
||||||
highlight('TelescopePreviewBorder', { bg = c.bg_dark })
|
highlight('TelescopePreviewBorder', { bg = c.bg_dark })
|
||||||
highlight('TelescopePreviewNormal', { bg = c.bg_dark })
|
highlight('TelescopePreviewNormal', { bg = c.bg_dark })
|
||||||
@ -61,7 +60,7 @@ highlight('TelescopeResultsNormal', { bg = c.bg_dark })
|
|||||||
highlight('TelescopeResultsTitle', { bg = c.bg_dark, fg = c.bg_dark })
|
highlight('TelescopeResultsTitle', { bg = c.bg_dark, fg = c.bg_dark })
|
||||||
|
|
||||||
highlight('TelescopeSelection', { bg = vim.g.terminal_color_background })
|
highlight('TelescopeSelection', { bg = vim.g.terminal_color_background })
|
||||||
highlight('TelescopeSelectionCaret', { bg = vim.g.terminal_color_background, fg = c.red})
|
highlight('TelescopeSelectionCaret', { bg = vim.g.terminal_color_background, fg = c.cyan, bold = true })
|
||||||
|
|
||||||
-- alpha
|
-- alpha
|
||||||
highlight('AlphaHeader', { fg = colors.blue })
|
highlight('AlphaHeader', { fg = colors.blue })
|
||||||
@ -71,3 +70,17 @@ highlight('AlphaFooter', { fg = colors.blue })
|
|||||||
|
|
||||||
-- fidget
|
-- fidget
|
||||||
highlight('FidgetTask', { fg = vim.g.terminal_color_foreground })
|
highlight('FidgetTask', { fg = vim.g.terminal_color_foreground })
|
||||||
|
|
||||||
|
-- norg + headings
|
||||||
|
highlight({ "@neorg.headings.1.title", "@neorg.headings.1.icon" },
|
||||||
|
{ fg = colors.yellow, bg = '#2a211c' })
|
||||||
|
highlight({ "@neorg.headings.2.title", "@neorg.headings.2.icon" },
|
||||||
|
{ fg = colors.blue, bg = '#201e25' })
|
||||||
|
highlight({ "@neorg.headings.3.title", "@neorg.headings.3.icon" },
|
||||||
|
{ fg = colors.cyan, bg = '#2b1b20' })
|
||||||
|
highlight({ "@neorg.headings.4.title", "@neorg.headings.4.icon" },
|
||||||
|
{ fg = colors.green, bg = '#1d201e' })
|
||||||
|
highlight({ "@neorg.headings.5.title", "@neorg.headings.5.icon" },
|
||||||
|
{ fg = colors.magenta, bg = '#251a21' })
|
||||||
|
highlight({ "@neorg.headings.6.title", "@neorg.headings.6.icon" },
|
||||||
|
{ fg = colors.white, bg = '#212126' })
|
9
init.lua
9
init.lua
@ -8,8 +8,12 @@ c = vim.cmd
|
|||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
|
|
||||||
-- main lua files -------------------------------------------------------------
|
-- main lua files -------------------------------------------------------------
|
||||||
|
misc = require('core.misc')
|
||||||
require('bootstrap')
|
require('bootstrap')
|
||||||
require('core.handler')
|
require('conf')
|
||||||
|
|
||||||
|
-- core lua files -------------------------------------------------------------
|
||||||
|
require('core.conf')
|
||||||
|
|
||||||
-- call all snippets in the lua/snippets directory ----------------------------
|
-- call all snippets in the lua/snippets directory ----------------------------
|
||||||
if pcall(require, "luasnip") then
|
if pcall(require, "luasnip") then
|
||||||
@ -19,6 +23,3 @@ if pcall(require, "luasnip") then
|
|||||||
require('snippet.'..file:gsub('%.lua$', ''))
|
require('snippet.'..file:gsub('%.lua$', ''))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- call the config manager ----------------------------------------------------
|
|
||||||
require('cfgmenu')
|
|
||||||
|
9
lua/.luarc.json
Normal file
9
lua/.luarc.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"diagnostics.globals": [
|
||||||
|
"g",
|
||||||
|
"o",
|
||||||
|
"a",
|
||||||
|
"vim",
|
||||||
|
],
|
||||||
|
"workspace.checkThirdParty": false
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
local path = vim.fn.stdpath("data") .. "/site/pack/deps/opt/dep"
|
local path = vim.fn.stdpath("data").."/site/pack/deps/opt/dep"
|
||||||
|
|
||||||
if vim.fn.empty(vim.fn.glob(path)) > 0 then
|
if vim.fn.empty(vim.fn.glob(path)) > 0 then
|
||||||
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep", path })
|
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep", path })
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.cmd("packadd dep")
|
vim.cmd("packadd dep")
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
-- helper functions that can come in handy ------------------------------------
|
|
||||||
local function run(cmd)
|
|
||||||
local x = io.popen(cmd)
|
|
||||||
if not x then return 1 end
|
|
||||||
local y = x:read("*a")
|
|
||||||
x:close()
|
|
||||||
return y
|
|
||||||
end
|
|
||||||
|
|
||||||
-- custom menu for simpler neovim managment -----------------------------------
|
|
||||||
local function genmenu()
|
|
||||||
local list = {}
|
|
||||||
local function add(name, plug)
|
|
||||||
if not plug then
|
|
||||||
table.insert(list, name)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if package.loaded[plug] then
|
|
||||||
table.insert(list, name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
add('edit config', nil)
|
|
||||||
add('update plugins', 'dep')
|
|
||||||
add('show keybinds', 'telescope')
|
|
||||||
add('change colorscheme', 'telescope')
|
|
||||||
add('new plugins', 'telescope')
|
|
||||||
|
|
||||||
return list
|
|
||||||
end
|
|
||||||
|
|
||||||
local function configmenu()
|
|
||||||
local list = genmenu()
|
|
||||||
vim.ui.select(list, { vpt = 'Config Menu' },
|
|
||||||
function(choice)
|
|
||||||
if choice == 'edit config' then
|
|
||||||
vim.cmd('e $XDG_CONFIG_HOME/nvim/init.lua')
|
|
||||||
end
|
|
||||||
if choice == 'update plugins' then
|
|
||||||
require('dep').sync()
|
|
||||||
if package.loaded['nvim-treesitter'] then
|
|
||||||
vim.cmd('TSUpdate')
|
|
||||||
end
|
|
||||||
if package.loaded['mason'] then
|
|
||||||
require('mason.api.command').MasonUpdate()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if choice == 'show keybinds' then
|
|
||||||
require('telescope.builtin').keymaps()
|
|
||||||
end
|
|
||||||
if choice == 'change colorscheme' then
|
|
||||||
vim.cmd("Colorscheme")
|
|
||||||
end
|
|
||||||
-- search though plugins (powered by nvim.sh)
|
|
||||||
if choice == 'new plugins' then
|
|
||||||
local result = run("curl -s https://nvim.sh/s")
|
|
||||||
local array = {}
|
|
||||||
for s in string.gmatch(result, "[^\r\n]+") do
|
|
||||||
table.insert(array, s)
|
|
||||||
end
|
|
||||||
local header = table.remove(array, 1)
|
|
||||||
vim.ui.select(array, { vpt = header }, function(choice)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>m', configmenu, {
|
|
||||||
desc = "Neovim config manager menu",
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_user_command("ConfigMenu", configmenu, {})
|
|
85
lua/conf/auto.lua
Normal file
85
lua/conf/auto.lua
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
local function auto(event, opts)
|
||||||
|
a.nvim_create_autocmd(event, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function augroup(name, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts['clear'] = true
|
||||||
|
a.nvim_create_augroup(name, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local winchange = augroup('winchange')
|
||||||
|
local bufcheck = augroup('bufcheck')
|
||||||
|
local toggles = augroup('toggles')
|
||||||
|
|
||||||
|
auto({ "FocusGained", "TermClose", "TermLeave" }, {
|
||||||
|
group = bufcheck,
|
||||||
|
desc = 'Update contents of file.',
|
||||||
|
command = "checktime",
|
||||||
|
})
|
||||||
|
|
||||||
|
auto("VimResized", {
|
||||||
|
group = winchange,
|
||||||
|
desc = 'Resize splits when window is resized.',
|
||||||
|
callback = function()
|
||||||
|
local current_tab = vim.fn.tabpagenr()
|
||||||
|
vim.cmd("tabdo wincmd =")
|
||||||
|
vim.cmd("tabnext " .. current_tab)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('TextYankPost', {
|
||||||
|
group = bufcheck,
|
||||||
|
pattern = '*',
|
||||||
|
desc = 'Highlight on yank.',
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank{ timeout = 250 }
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('BufRead', {
|
||||||
|
pattern = '*',
|
||||||
|
group = bufcheck,
|
||||||
|
desc = 'Return to the last place the buffer was closed in.',
|
||||||
|
callback = function() vim.cmd([[call setpos(".", getpos("'\""))]]) end
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('FileType', {
|
||||||
|
pattern = { 'gitcommit', 'markdown' },
|
||||||
|
desc = 'Spell checking and wrapping in commit buffers and markdown files.',
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.wrap = true
|
||||||
|
vim.opt_local.spell = true
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('BufWritePre', {
|
||||||
|
pattern = '*',
|
||||||
|
group = bufcheck,
|
||||||
|
desc = 'Basically mkdir -p.',
|
||||||
|
callback = function(ctx)
|
||||||
|
if ctx.match:match("^%w%w+://") then return end
|
||||||
|
local dir = vim.fn.fnamemodify(ctx.file, ':p:h')
|
||||||
|
vim.fn.mkdir(dir, 'p')
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('WinLeave', {
|
||||||
|
pattern = '!Alpha',
|
||||||
|
desc = 'Unset cursorline',
|
||||||
|
group = toggles,
|
||||||
|
callback = function() vim.opt.cursorline = false end
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('WinEnter', {
|
||||||
|
pattern = '!Alpha',
|
||||||
|
desc = 'Set cursorline',
|
||||||
|
group = toggles,
|
||||||
|
callback = function() vim.opt.cursorline = true end
|
||||||
|
})
|
||||||
|
|
||||||
|
auto('ColorScheme', {
|
||||||
|
desc = 'Update statusline on colorscheme change',
|
||||||
|
group = winchange,
|
||||||
|
callback = function() require('el').reset_windows() end
|
||||||
|
})
|
@ -1,3 +1,5 @@
|
|||||||
|
local conf = require('core.conf')
|
||||||
|
|
||||||
local function map(mode, bind, cmd, opts)
|
local function map(mode, bind, cmd, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts['noremap'] = true
|
opts['noremap'] = true
|
||||||
@ -52,6 +54,9 @@ map('n', '][', '<cmd>tabc<CR>')
|
|||||||
map('n', '[[', '<cmd>tabp<CR>')
|
map('n', '[[', '<cmd>tabp<CR>')
|
||||||
map('n', ']]', '<cmd>tabN<CR>')
|
map('n', ']]', '<cmd>tabN<CR>')
|
||||||
|
|
||||||
|
-- config binds ---------------------------------------------------------------
|
||||||
|
map('n', '<leader>m', conf.configmenu, { desc = 'Neovim config manager menu', })
|
||||||
|
|
||||||
-- plugin binds ---------------------------------------------------------------
|
-- plugin binds ---------------------------------------------------------------
|
||||||
|
|
||||||
-- pretty lsp view
|
-- pretty lsp view
|
||||||
@ -78,7 +83,7 @@ if pcall(require, "telescope") then
|
|||||||
{ desc = 'Find LSP Symbols.' })
|
{ desc = 'Find LSP Symbols.' })
|
||||||
-- search for keybinds
|
-- search for keybinds
|
||||||
map('n', '<leader>sk', telebuilt.keymaps,
|
map('n', '<leader>sk', telebuilt.keymaps,
|
||||||
{ desc = 'Find nvim Highlights.' })
|
{ desc = 'Find nvim Keymaps.' })
|
||||||
-- search for highlights
|
-- search for highlights
|
||||||
map('n', '<leader>sh', telebuilt.highlights,
|
map('n', '<leader>sh', telebuilt.highlights,
|
||||||
{ desc = 'Find nvim Highlights.' })
|
{ desc = 'Find nvim Highlights.' })
|
||||||
@ -89,7 +94,13 @@ if pcall(require, "telescope") then
|
|||||||
map('n', '<leader>sv', telebuilt.vim_options, { desc = 'Find vim options.' })
|
map('n', '<leader>sv', telebuilt.vim_options, { desc = 'Find vim options.' })
|
||||||
-- search for string in project
|
-- search for string in project
|
||||||
map('n', '<leader>sp', function()
|
map('n', '<leader>sp', function()
|
||||||
telebuilt.grep_string({ search = vim.fn.input('Find string in project > ')})
|
vim.ui.input({ prompt = 'Find string in project' }, function(input)
|
||||||
|
if not input or input == '' then
|
||||||
|
vim.notify('No query!', vim.log.levels.WARN, { title = misc.appid })
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
telebuilt.grep_string({ search = input })
|
||||||
|
end)
|
||||||
end, { desc = 'Find string in project.' })
|
end, { desc = 'Find string in project.' })
|
||||||
-- Code Actions (requires telescope)
|
-- Code Actions (requires telescope)
|
||||||
if pcall(require, "actions-preview") then
|
if pcall(require, "actions-preview") then
|
||||||
@ -141,17 +152,18 @@ end
|
|||||||
|
|
||||||
-- venn
|
-- venn
|
||||||
function _G.Toggle_venn()
|
function _G.Toggle_venn()
|
||||||
|
local mapb = vim.api.nvim_buf_set_keymap
|
||||||
local venn_enabled = vim.inspect(vim.b.venn_enabled)
|
local venn_enabled = vim.inspect(vim.b.venn_enabled)
|
||||||
if venn_enabled == "nil" then
|
if venn_enabled == "nil" then
|
||||||
vim.b.venn_enabled = true
|
vim.b.venn_enabled = true
|
||||||
vim.cmd([[setlocal ve=all]])
|
vim.cmd([[setlocal ve=all]])
|
||||||
-- draw a line on HJKL keystokes
|
-- draw a line on HJKL keystokes
|
||||||
vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
|
mapb(0, "n", "J", "<C-v>j:VBox<CR>", { noremap = true })
|
||||||
vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
|
mapb(0, "n", "K", "<C-v>k:VBox<CR>", { noremap = true })
|
||||||
vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
|
mapb(0, "n", "L", "<C-v>l:VBox<CR>", { noremap = true })
|
||||||
vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
|
mapb(0, "n", "H", "<C-v>h:VBox<CR>", { noremap = true })
|
||||||
-- draw a box by pressing "f" with visual selection
|
-- draw a box by pressing "f" with visual selection
|
||||||
vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
|
mapb(0, "v", "f", ":VBox<CR>", { noremap = true })
|
||||||
else
|
else
|
||||||
vim.cmd[[setlocal ve=]]
|
vim.cmd[[setlocal ve=]]
|
||||||
vim.cmd[[mapclear <buffer>]]
|
vim.cmd[[mapclear <buffer>]]
|
||||||
@ -159,4 +171,4 @@ function _G.Toggle_venn()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- toggle keymappings for venn using <leader>v
|
-- toggle keymappings for venn using <leader>v
|
||||||
vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
|
map('n', '<leader>v', ":lua Toggle_venn()<CR>")
|
4
lua/conf/init.lua
Normal file
4
lua/conf/init.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
misc.include('conf.plugins') -- load plugins first to allow colorscheme to be set in opts
|
||||||
|
misc.include('conf.opts')
|
||||||
|
misc.include('conf.binds')
|
||||||
|
misc.include('conf.auto')
|
@ -31,11 +31,11 @@ o.softtabstop = tabwidth
|
|||||||
|
|
||||||
-- colorscheme
|
-- colorscheme
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
vim.cmd('colorscheme mellow') -- mellow
|
misc.colorscheme('mellow')
|
||||||
vim.cmd('colorscheme mellow+') -- some changes
|
|
||||||
|
|
||||||
-- better editing -------------------------------------------------------------
|
-- better editing -------------------------------------------------------------
|
||||||
o.clipboard = 'unnamedplus' -- system clipboard
|
o.clipboard = 'unnamedplus' -- system clipboard
|
||||||
|
o.splitkeep = "screen" -- keep same text on screen when spliting
|
||||||
|
|
||||||
-- file saving ----------------------------------------------------------------
|
-- file saving ----------------------------------------------------------------
|
||||||
o.swapfile = false
|
o.swapfile = false
|
@ -1,15 +1,11 @@
|
|||||||
require 'dep' {
|
require('dep') {
|
||||||
sync = "always",
|
|
||||||
-- dep manages dep ----------------------------------------------------------
|
-- dep manages dep ----------------------------------------------------------
|
||||||
{ 'squibid/dep',
|
{ 'squibid/dep',
|
||||||
url = 'https://git.squi.bid/dep',
|
url = 'https://git.squi.bid/dep',
|
||||||
|
pin = true,
|
||||||
-- branch = 'dev'
|
-- branch = 'dev'
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'squibid/git-yodel',
|
|
||||||
url = 'https://git.squi.bid/git-yodel'
|
|
||||||
},
|
|
||||||
|
|
||||||
-- colorschemes -------------------------------------------------------------
|
-- colorschemes -------------------------------------------------------------
|
||||||
{ 'kvrohit/mellow.nvim',
|
{ 'kvrohit/mellow.nvim',
|
||||||
requires = 'nvim-treesitter/nvim-treesitter'
|
requires = 'nvim-treesitter/nvim-treesitter'
|
||||||
@ -20,19 +16,24 @@ require 'dep' {
|
|||||||
{ 'folke/which-key.nvim' }, -- key map help
|
{ 'folke/which-key.nvim' }, -- key map help
|
||||||
{ 'rcarriga/nvim-notify' }, -- notifications
|
{ 'rcarriga/nvim-notify' }, -- notifications
|
||||||
{ 'tjdevries/express_line.nvim', -- status bar
|
{ 'tjdevries/express_line.nvim', -- status bar
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = 'nvim-lua/plenary.nvim'
|
||||||
},
|
},
|
||||||
{ 'goolord/alpha-nvim' }, -- start page
|
{ 'goolord/alpha-nvim' }, -- start page
|
||||||
{ 'dinhhuy258/sfm.nvim', -- tree view
|
{ 'dinhhuy258/sfm.nvim', -- tree view
|
||||||
deps = 'dinhhuy258/sfm-git.nvim',
|
deps = 'dinhhuy258/sfm-git.nvim'
|
||||||
},
|
},
|
||||||
{ 'matbme/JABS.nvim' }, -- buffer switcher
|
{ 'matbme/JABS.nvim' }, -- buffer switcher
|
||||||
{ 'tomiis4/Hypersonic.nvim' }, -- regex helper/displayer
|
{ 'stevearc/dressing.nvim', -- nice ui selectors
|
||||||
|
requires = 'nvim-telescope/telescope.nvim'
|
||||||
|
},
|
||||||
|
{ 'lukas-reineke/headlines.nvim',
|
||||||
|
requires = 'nvim-neorg/neorg'
|
||||||
|
},
|
||||||
|
|
||||||
-- functional plugins -------------------------------------------------------
|
-- functional plugins -------------------------------------------------------
|
||||||
{ 'lewis6991/gitsigns.nvim' }, -- very helpful git things
|
{ 'lewis6991/gitsigns.nvim' }, -- very helpful git things
|
||||||
{ 'squibid/git-yodel', -- git cache diff preview when in commit buffer
|
{ 'squibid/git-yodel', -- git cache diff preview when in commit buffer
|
||||||
url = 'https://git.squi.bid/git-yodel'
|
url = 'https://git.squi.bid/git-yodel',
|
||||||
},
|
},
|
||||||
{ 'chentoast/marks.nvim' }, -- marks in gutter
|
{ 'chentoast/marks.nvim' }, -- marks in gutter
|
||||||
{ 'vidocqh/auto-indent.nvim' }, -- better tabbing into indents
|
{ 'vidocqh/auto-indent.nvim' }, -- better tabbing into indents
|
||||||
@ -65,23 +66,28 @@ require 'dep' {
|
|||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = 'nvim-lua/plenary.nvim',
|
||||||
deps = {
|
deps = {
|
||||||
'nvim-telescope/telescope-file-browser.nvim',
|
'nvim-telescope/telescope-file-browser.nvim',
|
||||||
'nvim-telescope/telescope-ui-select.nvim',
|
|
||||||
'nvim-telescope/telescope-symbols.nvim',
|
'nvim-telescope/telescope-symbols.nvim',
|
||||||
'axieax/urlview.nvim',
|
'axieax/urlview.nvim'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{ 'nvim-telescope/telescope-fzf-native.nvim',
|
||||||
|
config = function()
|
||||||
|
vim.cmd('make')
|
||||||
|
end,
|
||||||
|
requires = 'nvim-telescope/telescope.nvim'
|
||||||
|
},
|
||||||
|
|
||||||
-- treesitter + colorizing --------------------------------------------------
|
-- treesitter + colorizing --------------------------------------------------
|
||||||
{ 'nvim-treesitter/nvim-treesitter',
|
{ 'nvim-treesitter/nvim-treesitter',
|
||||||
deps = {
|
deps = {
|
||||||
'm-demare/hlargs.nvim',
|
'm-demare/hlargs.nvim',
|
||||||
'Wansmer/treesj',
|
'Wansmer/treesj',
|
||||||
'nvim-treesitter/nvim-treesitter-context',
|
'nvim-treesitter/nvim-treesitter-context'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ 'NvChad/nvim-colorizer.lua' },
|
{ 'NvChad/nvim-colorizer.lua' },
|
||||||
{ 'folke/todo-comments.nvim',
|
{ 'folke/todo-comments.nvim',
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = 'nvim-lua/plenary.nvim'
|
||||||
},
|
},
|
||||||
|
|
||||||
-- cmp ----------------------------------------------------------------------
|
-- cmp ----------------------------------------------------------------------
|
||||||
@ -91,23 +97,24 @@ require 'dep' {
|
|||||||
'hrsh7th/cmp-buffer', -- buffers
|
'hrsh7th/cmp-buffer', -- buffers
|
||||||
'FelipeLema/cmp-async-path', -- path
|
'FelipeLema/cmp-async-path', -- path
|
||||||
'hrsh7th/cmp-calc', -- calculator
|
'hrsh7th/cmp-calc', -- calculator
|
||||||
'saadparwaiz1/cmp_luasnip', -- snippets
|
|
||||||
'hrsh7th/cmp-nvim-lsp', -- lsp
|
'hrsh7th/cmp-nvim-lsp', -- lsp
|
||||||
'uga-rosa/cmp-dictionary', -- dictionary
|
'uga-rosa/cmp-dictionary', -- dictionary
|
||||||
'hrsh7th/cmp-nvim-lua', -- nvim lua api
|
'hrsh7th/cmp-nvim-lua', -- nvim lua api
|
||||||
|
{ 'doxnit/cmp-luasnip-choice', -- luasnip
|
||||||
|
requires = 'L3MON4D3/LuaSnip'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- snippets -----------------------------------------------------------------
|
-- snippets -----------------------------------------------------------------
|
||||||
{ 'L3MON4D3/LuaSnip',
|
{ 'L3MON4D3/LuaSnip',
|
||||||
deps = 'rafamadriz/friendly-snippets',
|
deps = 'rafamadriz/friendly-snippets'
|
||||||
},
|
},
|
||||||
{ 'doxnit/cmp-luasnip-choice' },
|
|
||||||
|
|
||||||
-- lsp ----------------------------------------------------------------------
|
-- lsp ----------------------------------------------------------------------
|
||||||
{ 'neovim/nvim-lspconfig' }, -- setup lsp
|
{ 'neovim/nvim-lspconfig' }, -- setup lsp
|
||||||
{ 'j-hui/fidget.nvim', -- shows lsp progress
|
{ 'j-hui/fidget.nvim', -- shows lsp progress
|
||||||
branch = 'legacy',
|
branch = 'legacy'
|
||||||
},
|
},
|
||||||
|
|
||||||
{ 'ray-x/lsp_signature.nvim' }, -- see information about the current function
|
{ 'ray-x/lsp_signature.nvim' }, -- see information about the current function
|
||||||
@ -121,14 +128,14 @@ require 'dep' {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{ 'whynothugo/lsp_lines.nvim',
|
{ 'whynothugo/lsp_lines.nvim',
|
||||||
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
|
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim'
|
||||||
},
|
},
|
||||||
|
|
||||||
-- mason --------------------------------------------------------------------
|
-- mason --------------------------------------------------------------------
|
||||||
{ 'williamboman/mason.nvim',
|
{ 'williamboman/mason.nvim',
|
||||||
deps = {
|
deps = {
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,30 +0,0 @@
|
|||||||
local function auto(event, opts)
|
|
||||||
a.nvim_create_autocmd(event, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
a.nvim_create_augroup('bufcheck', { clear = true })
|
|
||||||
|
|
||||||
auto('TextYankPost', { -- highlight yanks
|
|
||||||
group = 'bufcheck',
|
|
||||||
pattern = '*',
|
|
||||||
desc = 'Highlight on yank.',
|
|
||||||
callback = function()
|
|
||||||
vim.highlight.on_yank{ timeout = 250 }
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
auto('BufRead', { -- return to last place
|
|
||||||
pattern = '*',
|
|
||||||
command = [[call setpos(".", getpos("'\""))]],
|
|
||||||
desc = 'Return to the last place the buffer was closed in.',
|
|
||||||
})
|
|
||||||
|
|
||||||
auto('BufWritePre', { -- make dirs when they don't exist
|
|
||||||
pattern = '*',
|
|
||||||
group = vim.api.nvim_create_augroup('auto_create_dir', { clear = true }),
|
|
||||||
desc = 'Basically mkdir -p.',
|
|
||||||
callback = function(ctx)
|
|
||||||
local dir = vim.fn.fnamemodify(ctx.file, ':p:h')
|
|
||||||
vim.fn.mkdir(dir, 'p')
|
|
||||||
end
|
|
||||||
})
|
|
@ -1,8 +0,0 @@
|
|||||||
local function cmd(name, exec, opts)
|
|
||||||
opts = opts or {}
|
|
||||||
vim.api.nvim_create_user_command(name, exec, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
cmd('Colorscheme', function()
|
|
||||||
require('telescope.builtin').colorscheme()
|
|
||||||
end)
|
|
81
lua/core/conf.lua
Normal file
81
lua/core/conf.lua
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
local pickers = require("telescope.pickers")
|
||||||
|
local finders = require("telescope.finders")
|
||||||
|
local previewers = require("telescope.previewers")
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local function genmenu()
|
||||||
|
local list = {}
|
||||||
|
local function add(name, plug)
|
||||||
|
if not plug then
|
||||||
|
table.insert(list, name)
|
||||||
|
elseif package.loaded[plug] then
|
||||||
|
table.insert(list, name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
add('Edit Config', nil)
|
||||||
|
add('Update Plugins', 'dep')
|
||||||
|
add('Keybinds', 'telescope')
|
||||||
|
add('Colorscheme', 'telescope')
|
||||||
|
|
||||||
|
return list
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.configmenu()
|
||||||
|
pickers.new({
|
||||||
|
prompt_title = "Nvim Config Menu",
|
||||||
|
finder = finders.new_table { results = genmenu() },
|
||||||
|
sorter = conf.generic_sorter(),
|
||||||
|
previewer = previewers.new_buffer_previewer {
|
||||||
|
define_preview = function(self, entry)
|
||||||
|
local lines = {
|
||||||
|
'a'
|
||||||
|
}
|
||||||
|
if entry.value == "Edit Config" then
|
||||||
|
lines = misc.readf(os.getenv('XDG_CONFIG_HOME')..'/nvim/init.lua')
|
||||||
|
local ft = vim.filetype.match({
|
||||||
|
filename = os.getenv('XDG_CONFIG_HOME')..'/nvim/init.lua' })
|
||||||
|
require("telescope.previewers.utils").highlighter(self.state.bufnr, ft)
|
||||||
|
elseif entry.value == "Colorscheme" then
|
||||||
|
lines = vim.fn.getcompletion('', 'color')
|
||||||
|
for k, v in pairs(lines) do
|
||||||
|
if v.find(v, '.ext') then
|
||||||
|
table.remove(lines, k)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
attach_mappings = function(bufnr, map)
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
actions.close(bufnr)
|
||||||
|
local selection = action_state.get_selected_entry()
|
||||||
|
if selection[1] == 'Edit Config' then
|
||||||
|
vim.cmd('e $XDG_CONFIG_HOME/nvim/init.lua')
|
||||||
|
elseif selection[1] == 'Update Plugins' then
|
||||||
|
require('dep').sync()
|
||||||
|
if package.loaded['nvim-treesitter'] then
|
||||||
|
vim.cmd('TSUpdate')
|
||||||
|
end
|
||||||
|
if package.loaded['mason'] then
|
||||||
|
require('mason.api.command').MasonUpdate()
|
||||||
|
end
|
||||||
|
elseif selection[1] == 'Keybinds' then
|
||||||
|
require('telescope.builtin').keymaps()
|
||||||
|
elseif selection[1] == 'Colorscheme' then
|
||||||
|
require('core.theme').switcher()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
}):find()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
@ -1,5 +0,0 @@
|
|||||||
require('core.plugins') -- load plugins first to allow colorscheme to be set in opts
|
|
||||||
require('core.opts')
|
|
||||||
require('core.binds')
|
|
||||||
require('core.auto')
|
|
||||||
require('core.cmds')
|
|
30
lua/core/misc.lua
Normal file
30
lua/core/misc.lua
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.appid = "Nvim Config"
|
||||||
|
|
||||||
|
function M.colorscheme(name)
|
||||||
|
vim.cmd('colorscheme '..name)
|
||||||
|
for k, v in pairs(vim.fn.getcompletion('', 'color')) do
|
||||||
|
if v == name..'.ext' then
|
||||||
|
vim.cmd('colorscheme '..name..'.ext')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.include(fn)
|
||||||
|
if not pcall(require, fn) then
|
||||||
|
vim.notify('Could not find '..fn, vim.log.levels.WARN, { title = M.appid })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.readf(fn)
|
||||||
|
local f = io.open(fn, "r")
|
||||||
|
if not f then return nil end
|
||||||
|
local tab = {}
|
||||||
|
for l in f:lines() do
|
||||||
|
table.insert(tab, l)
|
||||||
|
end
|
||||||
|
return tab
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
76
lua/core/theme.lua
Normal file
76
lua/core/theme.lua
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
local pickers = require("telescope.pickers")
|
||||||
|
local finders = require("telescope.finders")
|
||||||
|
local previewers = require("telescope.previewers")
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
local action_set = require("telescope.actions.set")
|
||||||
|
local action_state = require("telescope.actions.state")
|
||||||
|
local misc = require('core.misc')
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.switcher()
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
|
||||||
|
-- show current buffer content in previewer
|
||||||
|
local colors = vim.fn.getcompletion('', 'color')
|
||||||
|
for k, v in pairs(colors) do
|
||||||
|
if v.find(v, '.ext') then
|
||||||
|
table.remove(colors, k)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- our picker function: colors
|
||||||
|
pickers.new({
|
||||||
|
prompt_title = "Set Nvim Colorscheme",
|
||||||
|
finder = finders.new_table { results = colors },
|
||||||
|
sorter = conf.generic_sorter(),
|
||||||
|
previewer = previewers.new_buffer_previewer {
|
||||||
|
define_preview = function(self, entry)
|
||||||
|
-- add content
|
||||||
|
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||||
|
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
|
||||||
|
|
||||||
|
-- add syntax highlighting in previewer
|
||||||
|
local ft = (vim.filetype.match { buf = bufnr } or "diff"):match "%w+"
|
||||||
|
require("telescope.previewers.utils").highlighter(self.state.bufnr, ft)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
attach_mappings = function(prompt_bufnr, map)
|
||||||
|
-- reload theme while typing
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_create_autocmd("TextChangedI", {
|
||||||
|
buffer = prompt_bufnr,
|
||||||
|
callback = function()
|
||||||
|
if action_state.get_selected_entry() then
|
||||||
|
misc.colorscheme(action_state.get_selected_entry()[1])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- reload theme on cycling
|
||||||
|
actions.move_selection_previous:replace(function()
|
||||||
|
action_set.shift_selection(prompt_bufnr, -1)
|
||||||
|
misc.colorscheme(action_state.get_selected_entry()[1])
|
||||||
|
end)
|
||||||
|
actions.move_selection_next:replace(function()
|
||||||
|
action_set.shift_selection(prompt_bufnr, 1)
|
||||||
|
misc.colorscheme(action_state.get_selected_entry()[1])
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- reload theme on selection
|
||||||
|
actions.select_default:replace(function()
|
||||||
|
if action_state.get_selected_entry() then
|
||||||
|
actions.close(prompt_bufnr)
|
||||||
|
misc.colorscheme(action_state.get_selected_entry()[1])
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
}):find()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
@ -54,4 +54,26 @@ ls.add_snippets('c', {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
s({
|
||||||
|
name = 'Variadic function parser',
|
||||||
|
trig = 'infinite vars',
|
||||||
|
dscr = 'Parse an infinite number of arguments passed to a function',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
t({
|
||||||
|
"/*",
|
||||||
|
" * NOTE: the function must have a int before the ... argument",
|
||||||
|
" * and you need to include <stdarg.h> for this to work",
|
||||||
|
" */",
|
||||||
|
"va_list ptr;",
|
||||||
|
"va_start(ptr, ", i(1, "n"),
|
||||||
|
");",
|
||||||
|
"for (int i = 0; i < ", ri(1),
|
||||||
|
"; i++) {",
|
||||||
|
i(2),
|
||||||
|
"}",
|
||||||
|
"va_end(ptr);",
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user