fix config not working in other dirs. whoops
This commit is contained in:
122
lua/core/overrides/cmp.lua
Normal file
122
lua/core/overrides/cmp.lua
Normal file
@ -0,0 +1,122 @@
|
||||
local has_words_before = function()
|
||||
unpack = unpack or table.unpack
|
||||
local line, col = unpack(a.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and a.nvim_buf_get_lines(0, line - 1, line, true)
|
||||
[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup {
|
||||
completion = { autocomplete = false, },
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp', keyword_length = 3 },
|
||||
{ name = 'luasnip', keyword_length = 3 },
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer', keyword_length = 3, max_item_count = 7 },
|
||||
{ name = 'calc' },
|
||||
}),
|
||||
window = {
|
||||
completion = {
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||
col_offset = -3,
|
||||
side_padding = 0,
|
||||
}
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
local kind_icons = {
|
||||
Text = 'Tx',
|
||||
Snippet = '<>',
|
||||
Method = ' ',
|
||||
Function = '{}',
|
||||
Constructor = ' ',
|
||||
Field = '""',
|
||||
Variable = 'x=',
|
||||
Class = '~{',
|
||||
Interface = '.h',
|
||||
Module = ' ',
|
||||
Property = '@p',
|
||||
Unit = ' ',
|
||||
Value = ' ',
|
||||
Enum = 'E#',
|
||||
Keyword = '$1',
|
||||
Color = ' ',
|
||||
File = ' ',
|
||||
Reference = ' ',
|
||||
Folder = ' ',
|
||||
EnumMember = ' ',
|
||||
Constant = ' ',
|
||||
Struct = ' ',
|
||||
Event = ' ',
|
||||
Operator = ' ',
|
||||
TypeParameter = ' ',
|
||||
}
|
||||
local menu_items = {
|
||||
buffer = "buffer",
|
||||
nvim_lsp = "LSP",
|
||||
luasnip = "luasnip",
|
||||
nvim_lua = "lua",
|
||||
calc = "calc",
|
||||
}
|
||||
|
||||
vim_item.kind = string.format(' %s ', kind_icons[vim_item.kind])
|
||||
vim_item.menu = string.format(' (%s)', menu_items[entry.source.name])
|
||||
|
||||
return vim_item
|
||||
end
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<ESC>'] = cmp.mapping.close(),
|
||||
}),
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
require "cmp-under-comparator".under,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
enabled = function()
|
||||
local context = require 'cmp.config.context'
|
||||
if a.nvim_get_mode().mode == 'c' then
|
||||
return true
|
||||
else
|
||||
return not context.in_treesitter_capture("comment")
|
||||
and not context.in_syntax_group("Comment")
|
||||
end
|
||||
end
|
||||
}
|
3
lua/core/overrides/cmpluasnipchoice.lua
Normal file
3
lua/core/overrides/cmpluasnipchoice.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('cmp_luasnip_choice').setup {
|
||||
auto_open = true,
|
||||
}
|
16
lua/core/overrides/codewindow.lua
Normal file
16
lua/core/overrides/codewindow.lua
Normal file
@ -0,0 +1,16 @@
|
||||
local codewindow = require('codewindow')
|
||||
codewindow.setup({
|
||||
show_cursor = false,
|
||||
minimap_width = 15,
|
||||
window_border = 'single',
|
||||
exclude_filetypes = {
|
||||
"netrw",
|
||||
"help",
|
||||
"term",
|
||||
"gitcommit",
|
||||
"packer",
|
||||
"vim",
|
||||
"Trouble",
|
||||
},
|
||||
})
|
||||
codewindow.apply_default_keybinds()
|
8
lua/core/overrides/colorizer.lua
Normal file
8
lua/core/overrides/colorizer.lua
Normal file
@ -0,0 +1,8 @@
|
||||
require('colorizer').setup {
|
||||
filetypes = { '*' },
|
||||
user_default_options = {
|
||||
names = false,
|
||||
RRGGBBAA = true,
|
||||
AARRGGBB = true,
|
||||
},
|
||||
}
|
22
lua/core/overrides/indentblankline.lua
Normal file
22
lua/core/overrides/indentblankline.lua
Normal file
@ -0,0 +1,22 @@
|
||||
if copts.tablines == 'colored' then
|
||||
require("indent_blankline").setup {
|
||||
space_char_blankline = ' ',
|
||||
char_highlight_list = {
|
||||
'IndentBlanklineIndent1',
|
||||
'IndentBlanklineIndent2',
|
||||
'IndentBlanklineIndent3',
|
||||
'IndentBlanklineIndent4',
|
||||
'IndentBlanklineIndent5',
|
||||
'IndentBlanklineIndent6',
|
||||
},
|
||||
}
|
||||
elseif copts.tablines == 'wrap' then
|
||||
o.list = true
|
||||
require('indent_blankline').setup {
|
||||
space_char_blankline = ' ',
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
else
|
||||
g.indent_blankline_char = ' '
|
||||
end
|
17
lua/core/overrides/init.lua
Normal file
17
lua/core/overrides/init.lua
Normal file
@ -0,0 +1,17 @@
|
||||
require('core.overrides.indentblankline')
|
||||
require('core.overrides.lualine')
|
||||
require('core.overrides.telescope')
|
||||
require('core.overrides.codewindow')
|
||||
require('core.overrides.modicator')
|
||||
require('core.overrides.neorg')
|
||||
require('core.overrides.whichkey')
|
||||
require('core.overrides.neoclip')
|
||||
require('core.overrides.smartsplits')
|
||||
require('core.overrides.treesitter')
|
||||
require('core.overrides.treesittercontext')
|
||||
require('core.overrides.colorizer')
|
||||
require('core.overrides.trouble')
|
||||
require('core.overrides.lspzero')
|
||||
require('core.overrides.cmp')
|
||||
require('core.overrides.lspkind')
|
||||
require('core.overrides.cmpluasnipchoice')
|
1
lua/core/overrides/lspkind.lua
Normal file
1
lua/core/overrides/lspkind.lua
Normal file
@ -0,0 +1 @@
|
||||
require('lspkind').init()
|
17
lua/core/overrides/lspzero.lua
Normal file
17
lua/core/overrides/lspzero.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local lsp = require('lsp-zero')
|
||||
lsp.set_preferences {
|
||||
suggest_lsp_servers = true,
|
||||
setup_servers_on_start = true,
|
||||
set_lsp_keymaps = true,
|
||||
configure_diagnostics = true,
|
||||
cmp_capabilities = true,
|
||||
manage_nvim_cmp = false,
|
||||
call_servers = 'local',
|
||||
sign_icons = {
|
||||
error = 'x',
|
||||
warn = '!',
|
||||
hint = '?',
|
||||
info = 'i'
|
||||
}
|
||||
}
|
||||
lsp.setup()
|
119
lua/core/overrides/lualine.lua
Normal file
119
lua/core/overrides/lualine.lua
Normal file
@ -0,0 +1,119 @@
|
||||
local custom = require'lualine.themes.auto'
|
||||
|
||||
custom.normal = {
|
||||
a = { fg = colors.black, bg = colors.blue, gui = 'bold' },
|
||||
b = { fg = colors.black, bg = colors.blue, gui = 'bold' },
|
||||
c = { fg = colors.white, bg = colors.grey },
|
||||
x = {},
|
||||
y = { fg = colors.blue, bg = colors.black2 },
|
||||
z = { fg = colors.black2, bg = colors.blue, gui = 'bold' },
|
||||
}
|
||||
custom.insert = {
|
||||
a = { fg = colors.black, bg = colors.green, gui = 'bold' },
|
||||
b = { fg = colors.black, bg = colors.green, gui = 'bold' },
|
||||
c = { fg = colors.white, bg = colors.grey },
|
||||
x = {},
|
||||
y = { fg = colors.green, bg = colors.black2 },
|
||||
z = { fg = colors.black2, bg = colors.green, gui = 'bold' },
|
||||
}
|
||||
custom.replace = {
|
||||
a = { fg = colors.black, bg = colors.orange, gui = 'bold' },
|
||||
b = { fg = colors.black, bg = colors.orange, gui = 'bold' },
|
||||
c = { fg = colors.white, bg = colors.grey },
|
||||
x = {},
|
||||
y = { fg = colors.orange, bg = colors.black2 },
|
||||
z = { fg = colors.black2, bg = colors.orange, gui = 'bold' },
|
||||
}
|
||||
custom.visual = {
|
||||
a = { fg = colors.black, bg = colors.purple, gui = 'bold' },
|
||||
b = { fg = colors.black, bg = colors.purple, gui = 'bold' },
|
||||
c = { fg = colors.white, bg = colors.grey },
|
||||
x = {},
|
||||
y = { fg = colors.purple, bg = colors.black2 },
|
||||
z = { fg = colors.black2, bg = colors.purple, gui = 'bold' },
|
||||
}
|
||||
custom.command = {
|
||||
a = { fg = colors.black, bg = colors.red, gui = 'bold' },
|
||||
b = { fg = colors.black, bg = colors.red, gui = 'bold' },
|
||||
c = { fg = colors.white, bg = colors.grey },
|
||||
x = {},
|
||||
y = { fg = colors.red, bg = colors.black2 },
|
||||
z = { fg = colors.black2, bg = colors.red, gui = 'bold' },
|
||||
}
|
||||
custom.terminal = {
|
||||
a = { fg = colors.black, bg = colors.yellow, gui = 'bold' },
|
||||
b = { fg = colors.black, bg = colors.yellow, gui = 'bold' },
|
||||
c = { fg = colors.white, bg = colors.grey },
|
||||
x = {},
|
||||
y = { fg = colors.yellow, bg = colors.black2 },
|
||||
z = { fg = colors.black2, bg = colors.yellow, gui = 'bold' },
|
||||
}
|
||||
custom.inactive = {
|
||||
a = { bg = colors.grey },
|
||||
b = { bg = colors.grey },
|
||||
c = { bg = colors.grey },
|
||||
x = { bg = colors.grey },
|
||||
y = { bg = colors.grey },
|
||||
z = { bg = colors.grey },
|
||||
}
|
||||
|
||||
local function diff_source()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
theme = custom,
|
||||
always_divide_middle = false,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 100,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {
|
||||
{ 'filetype',
|
||||
color = { fg = colors.white, bg = colors.grey },
|
||||
},
|
||||
{ 'filename',
|
||||
filestatus = true,
|
||||
path = 1,
|
||||
|
||||
symbols = {
|
||||
modified = '[+]',
|
||||
readonly = '[=]',
|
||||
unnamed = 'No Name',
|
||||
newfile = '[New]',
|
||||
}
|
||||
}
|
||||
},
|
||||
lualine_c = { { 'diff', source = diff_source } },
|
||||
lualine_x = {
|
||||
{ 'fileformat',
|
||||
color = { gui = 'bold' }
|
||||
}
|
||||
},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {
|
||||
{ 'location',
|
||||
padding = 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_x = {'location'},
|
||||
},
|
||||
}
|
15
lua/core/overrides/modicator.lua
Normal file
15
lua/core/overrides/modicator.lua
Normal file
@ -0,0 +1,15 @@
|
||||
require('modicator').setup {
|
||||
show_warnings = true,
|
||||
highlights = {
|
||||
modes = {
|
||||
['i'] = colors.green,
|
||||
['v'] = colors.purple,
|
||||
['V'] = colors.purple,
|
||||
['<EFBFBD>'] = colors.purple,
|
||||
['s'] = colors.yellow,
|
||||
['S'] = colors.yellow,
|
||||
['R'] = colors.orange,
|
||||
['c'] = colors.red,
|
||||
}
|
||||
}
|
||||
}
|
9
lua/core/overrides/neoclip.lua
Normal file
9
lua/core/overrides/neoclip.lua
Normal file
@ -0,0 +1,9 @@
|
||||
require('neoclip').setup {
|
||||
keys = {
|
||||
telescope = {
|
||||
i = {
|
||||
paste_behind = ' '
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
17
lua/core/overrides/neorg.lua
Normal file
17
lua/core/overrides/neorg.lua
Normal file
@ -0,0 +1,17 @@
|
||||
require('neorg').setup {
|
||||
load = {
|
||||
['core.defaults'] = {},
|
||||
['core.norg.concealer'] = {
|
||||
config = {
|
||||
dim_code_blocks = {
|
||||
width = 'content',
|
||||
padding = { right = 2, },
|
||||
},
|
||||
folds = false,
|
||||
}
|
||||
},
|
||||
['core.norg.completion'] = {
|
||||
config = { engine = 'nvim-cmp', }
|
||||
},
|
||||
}
|
||||
}
|
7
lua/core/overrides/smartsplits.lua
Normal file
7
lua/core/overrides/smartsplits.lua
Normal file
@ -0,0 +1,7 @@
|
||||
require('smart-splits').setup {
|
||||
resize_mode = {
|
||||
hooks = {
|
||||
on_leave = require('bufresize').register
|
||||
},
|
||||
},
|
||||
}
|
33
lua/core/overrides/telescope.lua
Normal file
33
lua/core/overrides/telescope.lua
Normal file
@ -0,0 +1,33 @@
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
|
||||
telescope.load_extension('undo')
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
borderchars = { " ", " ", " ", " ", " ", " ", " ", " " },
|
||||
sorting_strategy = 'ascending',
|
||||
layout_config = {
|
||||
height = 0.9,
|
||||
prompt_position = 'top',
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-h>'] = 'which_key',
|
||||
['<C-j>'] = actions.move_selection_next,
|
||||
['<C-k>'] = actions.move_selection_previous,
|
||||
['<C-l>'] = actions.select_default,
|
||||
['<C-u>'] = actions.preview_scrolling_up,
|
||||
['<C-d>'] = actions.preview_scrolling_down,
|
||||
},
|
||||
n = {
|
||||
["gg"] = actions.move_to_top,
|
||||
["G"] = actions.move_to_bottom,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
a.nvim_create_autocmd('User', {
|
||||
pattern = 'TelescopePreviewerLoaded',
|
||||
command = 'setlocal number',
|
||||
})
|
14
lua/core/overrides/treesitter.lua
Normal file
14
lua/core/overrides/treesitter.lua
Normal file
@ -0,0 +1,14 @@
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { 'help',
|
||||
'c',
|
||||
'lua',
|
||||
'norg',
|
||||
'bash',
|
||||
'html',
|
||||
'make',
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
9
lua/core/overrides/treesittercontext.lua
Normal file
9
lua/core/overrides/treesittercontext.lua
Normal file
@ -0,0 +1,9 @@
|
||||
require('treesitter-context').setup {
|
||||
enable = true,
|
||||
max_lines = 1,
|
||||
patterns = {
|
||||
default = {
|
||||
'function',
|
||||
},
|
||||
},
|
||||
}
|
11
lua/core/overrides/trouble.lua
Normal file
11
lua/core/overrides/trouble.lua
Normal file
@ -0,0 +1,11 @@
|
||||
require("trouble").setup {
|
||||
icons = false,
|
||||
fold_open = "v",
|
||||
fold_closed = ">",
|
||||
signs = {
|
||||
error = "[x]",
|
||||
warning = "[!]",
|
||||
hint = "[?]",
|
||||
information = "[i]"
|
||||
},
|
||||
}
|
8
lua/core/overrides/whichkey.lua
Normal file
8
lua/core/overrides/whichkey.lua
Normal file
@ -0,0 +1,8 @@
|
||||
require("which-key").setup {
|
||||
icons = {
|
||||
breadcrumb = '>>',
|
||||
separator = '->',
|
||||
},
|
||||
window = { winblend = 3, },
|
||||
layout = { align = 'center', },
|
||||
}
|
Reference in New Issue
Block a user