Updated and fixed neovim config

This commit is contained in:
_N0x 2022-06-09 16:25:51 +02:00
parent 9d1cc2fb39
commit cb351d4aac
16 changed files with 868 additions and 824 deletions

View File

@ -1,167 +1,167 @@
local status_ok, bufferline = pcall(require, "bufferline") local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then if not status_ok then
return return
end end
bufferline.setup { bufferline.setup {
options = { options = {
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string, numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions" right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
-- NOTE: this plugin is designed with this icon in mind, -- NOTE: this plugin is designed with this icon in mind,
-- and so changing this is NOT recommended, this is intended -- and so changing this is NOT recommended, this is intended
-- as an escape hatch for people who cannot bear it for whatever reason -- as an escape hatch for people who cannot bear it for whatever reason
indicator_icon = "", indicator_icon = "",
buffer_close_icon = "", buffer_close_icon = "",
-- buffer_close_icon = '', -- buffer_close_icon = '',
modified_icon = "", modified_icon = "",
close_icon = "", close_icon = "",
-- close_icon = '', -- close_icon = '',
left_trunc_marker = "", left_trunc_marker = "",
right_trunc_marker = "", right_trunc_marker = "",
--- name_formatter can be used to change the buffer's label in the bufferline. --- name_formatter can be used to change the buffer's label in the bufferline.
--- Please note some names can/will break the --- Please note some names can/will break the
--- bufferline so use this at your discretion knowing that it has --- bufferline so use this at your discretion knowing that it has
--- some limitations that will *NOT* be fixed. --- some limitations that will *NOT* be fixed.
-- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" -- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
-- -- remove extension from markdown files for example -- -- remove extension from markdown files for example
-- if buf.name:match('%.md') then -- if buf.name:match('%.md') then
-- return vim.fn.fnamemodify(buf.name, ':t:r') -- return vim.fn.fnamemodify(buf.name, ':t:r')
-- end -- end
-- end, -- end,
max_name_length = 30, max_name_length = 30,
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
tab_size = 21, tab_size = 21,
diagnostics = false, -- | "nvim_lsp" | "coc", diagnostics = false, -- | "nvim_lsp" | "coc",
diagnostics_update_in_insert = false, diagnostics_update_in_insert = false,
-- diagnostics_indicator = function(count, level, diagnostics_dict, context) -- diagnostics_indicator = function(count, level, diagnostics_dict, context)
-- return "("..count..")" -- return "("..count..")"
-- end, -- end,
-- NOTE: this will be called a lot so don't do any heavy processing here -- NOTE: this will be called a lot so don't do any heavy processing here
-- custom_filter = function(buf_number) -- custom_filter = function(buf_number)
-- -- filter out filetypes you don't want to see -- -- filter out filetypes you don't want to see
-- if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then -- if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
-- return true -- return true
-- end -- end
-- -- filter out by buffer name -- -- filter out by buffer name
-- if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then -- if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
-- return true -- return true
-- end -- end
-- -- filter out based on arbitrary rules -- -- filter out based on arbitrary rules
-- -- e.g. filter out vim wiki buffer from tabline in your work repo -- -- e.g. filter out vim wiki buffer from tabline in your work repo
-- if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then -- if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
-- return true -- return true
-- end -- end
-- end, -- end,
offsets = { { filetype = "NvimTree", text = "", padding = 1 } }, offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
show_buffer_icons = true, show_buffer_icons = true,
show_buffer_close_icons = true, show_buffer_close_icons = true,
show_close_icon = true, show_close_icon = true,
show_tab_indicators = true, show_tab_indicators = true,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
-- can also be a table containing 2 custom separators -- can also be a table containing 2 custom separators
-- [focused and unfocused]. eg: { '|', '|' } -- [focused and unfocused]. eg: { '|', '|' }
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' }, separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
enforce_regular_tabs = true, enforce_regular_tabs = true,
always_show_bufferline = true, always_show_bufferline = true,
-- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b) -- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b)
-- -- add custom logic -- -- add custom logic
-- return buffer_a.modified > buffer_b.modified -- return buffer_a.modified > buffer_b.modified
-- end -- end
},
highlights = {
fill = {
guifg = { attribute = "fg", highlight = "#ff0000" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
background = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
}, },
highlights = {
fill = {
guifg = { attribute = "fg", highlight = "#ff0000" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
background = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
-- buffer_selected = { -- buffer_selected = {
-- guifg = {attribute='fg',highlight='#ff0000'}, -- guifg = {attribute='fg',highlight='#ff0000'},
-- guibg = {attribute='bg',highlight='#0000ff'}, -- guibg = {attribute='bg',highlight='#0000ff'},
-- gui = 'none' -- gui = 'none'
-- }, -- },
buffer_visible = { buffer_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
close_button = { close_button = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
close_button_visible = { close_button_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
-- close_button_selected = { -- close_button_selected = {
-- guifg = {attribute='fg',highlight='TabLineSel'}, -- guifg = {attribute='fg',highlight='TabLineSel'},
-- guibg ={attribute='bg',highlight='TabLineSel'} -- guibg ={attribute='bg',highlight='TabLineSel'}
-- }, -- },
tab_selected = { tab_selected = {
guifg = { attribute = "fg", highlight = "Normal" }, guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" }, guibg = { attribute = "bg", highlight = "Normal" },
}, },
tab = { tab = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
tab_close = { tab_close = {
-- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
guifg = { attribute = "fg", highlight = "TabLineSel" }, guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "Normal" }, guibg = { attribute = "bg", highlight = "Normal" },
}, },
duplicate_selected = { duplicate_selected = {
guifg = { attribute = "fg", highlight = "TabLineSel" }, guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "TabLineSel" }, guibg = { attribute = "bg", highlight = "TabLineSel" },
gui = "italic", gui = "italic",
}, },
duplicate_visible = { duplicate_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic", gui = "italic",
}, },
duplicate = { duplicate = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic", gui = "italic",
}, },
modified = { modified = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
modified_selected = { modified_selected = {
guifg = { attribute = "fg", highlight = "Normal" }, guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" }, guibg = { attribute = "bg", highlight = "Normal" },
}, },
modified_visible = { modified_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
}, },
separator = { separator = {
guifg = { attribute = "bg", highlight = "TabLine" }, guifg = { attribute = "bg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, guibg = { attribute = "bg", highlight = "TabLine" },
},
separator_selected = {
guifg = { attribute = "bg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
-- separator_visible = {
-- guifg = {attribute='bg',highlight='TabLine'},
-- guibg = {attribute='bg',highlight='TabLine'}
-- },
indicator_selected = {
guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
guibg = { attribute = "bg", highlight = "Normal" },
},
}, },
separator_selected = {
guifg = { attribute = "bg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
-- separator_visible = {
-- guifg = {attribute='bg',highlight='TabLine'},
-- guibg = {attribute='bg',highlight='TabLine'}
-- },
indicator_selected = {
guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
guibg = { attribute = "bg", highlight = "Normal" },
},
},
} }

View File

@ -1,126 +1,126 @@
local cmp_status_ok, cmp = pcall(require, "cmp") local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then if not cmp_status_ok then
return return
end end
local snip_status_ok, luasnip = pcall(require, "luasnip") local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then if not snip_status_ok then
return return
end end
require("luasnip/loaders/from_vscode").lazy_load() require("luasnip/loaders/from_vscode").lazy_load()
local check_backspace = function() local check_backspace = function()
local col = vim.fn.col "." - 1 local col = vim.fn.col "." - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
end end
--   פּ ﯟ   some other good icons --   פּ ﯟ   some other good icons
local kind_icons = { local kind_icons = {
Text = "", Text = "",
Method = "m", Method = "m",
Function = "", Function = "",
Constructor = "", Constructor = "",
Field = "", Field = "",
Variable = "", Variable = "",
Class = "", Class = "",
Interface = "", Interface = "",
Module = "", Module = "",
Property = "", Property = "",
Unit = "", Unit = "",
Value = "", Value = "",
Enum = "", Enum = "",
Keyword = "", Keyword = "",
Snippet = "", Snippet = "",
Color = "", Color = "",
File = "", File = "",
Reference = "", Reference = "",
Folder = "", Folder = "",
EnumMember = "", EnumMember = "",
Constant = "", Constant = "",
Struct = "", Struct = "",
Event = "", Event = "",
Operator = "", Operator = "",
TypeParameter = "", TypeParameter = "",
} }
-- find more here: https://www.nerdfonts.com/cheat-sheet -- find more here: https://www.nerdfonts.com/cheat-sheet
cmp.setup { cmp.setup {
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users. luasnip.lsp_expand(args.body) -- For `luasnip` users.
end, end,
}, },
mapping = { mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(), ["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), ["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-Space>"] = 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-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping { ["<C-e>"] = cmp.mapping {
i = cmp.mapping.abort(), i = cmp.mapping.abort(),
c = cmp.mapping.close(), 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 = "[Snippet]",
buffer = "[Buffer]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
experimental = {
ghost_text = false,
native_menu = false,
}, },
-- 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 = "[Snippet]",
buffer = "[Buffer]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
experimental = {
ghost_text = false,
native_menu = false,
},
} }

View File

@ -1,48 +1,48 @@
local status_ok, gitsigns = pcall(require, "gitsigns") local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then if not status_ok then
return return
end end
gitsigns.setup { gitsigns.setup {
signs = { signs = {
add = {hl = 'GitSignsAdd' , text = '', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, add = { hl = 'GitSignsAdd', text = '', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, change = { hl = 'GitSignsChange', text = '', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
delete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, delete = { hl = 'GitSignsDelete', text = '', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, topdelete = { hl = 'GitSignsDelete', text = '', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
}, },
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl` numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = { watch_gitdir = {
interval = 1000, interval = 1000,
follow_files = true follow_files = true
}, },
attach_to_untracked = true, attach_to_untracked = true,
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame` current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = { current_line_blame_opts = {
virt_text = true, virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 1000, delay = 1000,
ignore_whitespace = false, ignore_whitespace = false,
}, },
current_line_blame_formatter_opts = { current_line_blame_formatter_opts = {
relative_time = false, relative_time = false,
}, },
sign_priority = 6, sign_priority = 6,
update_debounce = 100, update_debounce = 100,
status_formatter = nil, -- Use default status_formatter = nil, -- Use default
max_file_length = 40000, max_file_length = 40000,
preview_config = { preview_config = {
-- Options passed to nvim_open_win -- Options passed to nvim_open_win
border = 'single', border = 'single',
style = 'minimal', style = 'minimal',
relative = 'cursor', relative = 'cursor',
row = 0, row = 0,
col = 1 col = 1
}, },
yadm = { yadm = {
enable = false enable = false
}, },
} }

View File

@ -96,11 +96,10 @@ keymap("n", "<c-t>", "<cmd>Telescope live_grep<cr>", opts)
keymap("n", "<leader><leader>f", "<cmd>Format<cr>", opts) keymap("n", "<leader><leader>f", "<cmd>Format<cr>", opts)
-- close buffer -- -- close buffer --
keymap("n", "<leader>q", "<cmd>Bdelete! %d<cr>",opts) keymap("n", "<leader>q", "<cmd>Bdelete! %d<cr>", opts)
-- toggle whitespace -- -- toggle whitespace --
keymap("n", "<leader>w", "<cmd>set list!<cr>", opts) keymap("n", "<leader>w", "<cmd>set list!<cr>", opts)
-- toggle gitsign line blame -- -- toggle gitsign line blame --
keymap("n", "<leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr>", opts) keymap("n", "<leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr>", opts)

View File

@ -2,106 +2,99 @@ local M = {}
-- TODO: backfill this to template -- TODO: backfill this to template
M.setup = function() M.setup = function()
local signs = { local signs = {
{ name = "DiagnosticSignError", text = "" }, { name = "DiagnosticSignError", text = "" },
{ name = "DiagnosticSignWarn", text = "" }, { name = "DiagnosticSignWarn", text = "" },
{ name = "DiagnosticSignHint", text = "" }, { name = "DiagnosticSignHint", text = "" },
{ name = "DiagnosticSignInfo", text = "" }, { name = "DiagnosticSignInfo", text = "" },
} }
for _, sign in ipairs(signs) do for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
end end
local config = { local config = {
-- disable virtual text -- disable virtual text
virtual_text = false, virtual_text = false,
-- show signs -- show signs
signs = { signs = {
active = signs, active = signs,
}, },
update_in_insert = true, update_in_insert = true,
underline = true, underline = true,
severity_sort = true, severity_sort = true,
float = { float = {
focusable = false, focusable = false,
style = "minimal", style = "minimal",
border = "rounded", border = "rounded",
source = "always", source = "always",
header = "", header = "",
prefix = "", prefix = "",
}, },
} }
vim.diagnostic.config(config) vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded", border = "rounded",
}) })
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded", border = "rounded",
}) })
end end
local function lsp_highlight_document(client) local function lsp_highlight_document(client)
-- Set autocommands conditional on server_capabilities -- Set autocommands conditional on server_capabilities
if client.resolved_capabilities.document_highlight then local status_ok, illuminate = pcall(require, "illuminate")
vim.api.nvim_exec( if not status_ok then
[[ return
augroup lsp_document_highlight end
autocmd! * <buffer> illuminate.on_attach(client)
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]],
false
)
end
end end
local function lsp_keymaps(bufnr) local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
-- for german keyboard... -- for german keyboard...
vim.api.nvim_buf_set_keymap(bufnr, "n", "Üd", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "Üd", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap( vim.api.nvim_buf_set_keymap(
bufnr, bufnr,
"n", "n",
"gl", "gl",
'<cmd>lua vim.diagnostic.open_float()<CR>', '<cmd>lua vim.diagnostic.open_float()<CR>',
opts opts
) )
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
-- for german keyboard ... -- for german keyboard ...
vim.api.nvim_buf_set_keymap(bufnr, "n", "*d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "*d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
end end
M.on_attach = function(client, bufnr) M.on_attach = function(client, bufnr)
if client.name == "tsserver" then if client.name == "tsserver" then
client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_formatting = false
end end
lsp_keymaps(bufnr) lsp_keymaps(bufnr)
lsp_highlight_document(client) lsp_highlight_document(client)
end end
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not status_ok then if not status_ok then
return return
end end
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities) M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)

View File

@ -1,6 +1,6 @@
local status_ok, _ = pcall(require, "lspconfig") local status_ok, _ = pcall(require, "lspconfig")
if not status_ok then if not status_ok then
return return
end end
require("user.lsp.lsp-installer") require("user.lsp.lsp-installer")

View File

@ -1,28 +1,33 @@
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer") local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_ok then if not status_ok then
return return
end end
-- Register a handler that will be called for all installed servers. -- Register a handler that will be called for all installed servers.
-- Alternatively, you may also register handlers on specific server instances instead (see example below). -- Alternatively, you may also register handlers on specific server instances instead (see example below).
lsp_installer.on_server_ready(function(server) lsp_installer.on_server_ready(function(server)
local opts = { local opts = {
on_attach = require("user.lsp.handlers").on_attach, on_attach = require("user.lsp.handlers").on_attach,
capabilities = require("user.lsp.handlers").capabilities, capabilities = require("user.lsp.handlers").capabilities,
} }
if server.name == "jsonls" then if server.name == "jsonls" then
local jsonls_opts = require("user.lsp.settings.jsonls") local jsonls_opts = require("user.lsp.settings.jsonls")
opts = vim.tbl_deep_extend("force", jsonls_opts, opts) opts = vim.tbl_deep_extend("force", jsonls_opts, opts)
end end
if server.name == "sumneko_lua" then if server.name == "sumneko_lua" then
local sumneko_opts = require("user.lsp.settings.sumneko_lua") local sumneko_opts = require("user.lsp.settings.sumneko_lua")
opts = vim.tbl_deep_extend("force", sumneko_opts, opts) opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
end end
-- This setup() function is exactly the same as lspconfig's setup function. if server.name == "clangd" then
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md local clangd_opts = require("user.lsp.settings.clangd")
server:setup(opts) opts = vim.tbl_deep_extend("force", clangd_opts, opts)
end
-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end) end)

View File

@ -11,7 +11,10 @@ local diagnostics = null_ls.builtins.diagnostics
null_ls.setup { null_ls.setup {
debug = false, debug = false,
sources = { sources = {
formatting.clang_format, formatting.clang_format.with({
extra_filetypes = {"inl"},
extra_args = {"-style=file:~/.config/nvim/lua/user/lsp/settings/clang-format"},
}),
diagnostics.gccdiag, diagnostics.gccdiag,
}, },
} }

View File

@ -1,182 +1,182 @@
local schemas = { local schemas = {
{ {
description = "TypeScript compiler configuration file", description = "TypeScript compiler configuration file",
fileMatch = { fileMatch = {
"tsconfig.json", "tsconfig.json",
"tsconfig.*.json", "tsconfig.*.json",
},
url = "https://json.schemastore.org/tsconfig.json",
}, },
url = "https://json.schemastore.org/tsconfig.json", {
}, description = "Lerna config",
{ fileMatch = { "lerna.json" },
description = "Lerna config", url = "https://json.schemastore.org/lerna.json",
fileMatch = { "lerna.json" },
url = "https://json.schemastore.org/lerna.json",
},
{
description = "Babel configuration",
fileMatch = {
".babelrc.json",
".babelrc",
"babel.config.json",
}, },
url = "https://json.schemastore.org/babelrc.json", {
}, description = "Babel configuration",
{ fileMatch = {
description = "ESLint config", ".babelrc.json",
fileMatch = { ".babelrc",
".eslintrc.json", "babel.config.json",
".eslintrc", },
url = "https://json.schemastore.org/babelrc.json",
}, },
url = "https://json.schemastore.org/eslintrc.json", {
}, description = "ESLint config",
{ fileMatch = {
description = "Bucklescript config", ".eslintrc.json",
fileMatch = { "bsconfig.json" }, ".eslintrc",
url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json", },
}, url = "https://json.schemastore.org/eslintrc.json",
{
description = "Prettier config",
fileMatch = {
".prettierrc",
".prettierrc.json",
"prettier.config.json",
}, },
url = "https://json.schemastore.org/prettierrc", {
}, description = "Bucklescript config",
{ fileMatch = { "bsconfig.json" },
description = "Vercel Now config", url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
fileMatch = { "now.json" },
url = "https://json.schemastore.org/now",
},
{
description = "Stylelint config",
fileMatch = {
".stylelintrc",
".stylelintrc.json",
"stylelint.config.json",
}, },
url = "https://json.schemastore.org/stylelintrc", {
}, description = "Prettier config",
{ fileMatch = {
description = "A JSON schema for the ASP.NET LaunchSettings.json files", ".prettierrc",
fileMatch = { "launchsettings.json" }, ".prettierrc.json",
url = "https://json.schemastore.org/launchsettings.json", "prettier.config.json",
}, },
{ url = "https://json.schemastore.org/prettierrc",
description = "Schema for CMake Presets",
fileMatch = {
"CMakePresets.json",
"CMakeUserPresets.json",
}, },
url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", {
}, description = "Vercel Now config",
{ fileMatch = { "now.json" },
description = "Configuration file as an alternative for configuring your repository in the settings page.", url = "https://json.schemastore.org/now",
fileMatch = {
".codeclimate.json",
}, },
url = "https://json.schemastore.org/codeclimate.json", {
}, description = "Stylelint config",
{ fileMatch = {
description = "LLVM compilation database", ".stylelintrc",
fileMatch = { ".stylelintrc.json",
"compile_commands.json", "stylelint.config.json",
},
url = "https://json.schemastore.org/stylelintrc",
}, },
url = "https://json.schemastore.org/compile-commands.json", {
}, description = "A JSON schema for the ASP.NET LaunchSettings.json files",
{ fileMatch = { "launchsettings.json" },
description = "Config file for Command Task Runner", url = "https://json.schemastore.org/launchsettings.json",
fileMatch = {
"commands.json",
}, },
url = "https://json.schemastore.org/commands.json", {
}, description = "Schema for CMake Presets",
{ fileMatch = {
description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.", "CMakePresets.json",
fileMatch = { "CMakeUserPresets.json",
"*.cf.json", },
"cloudformation.json", url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
}, },
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json", {
}, description = "Configuration file as an alternative for configuring your repository in the settings page.",
{ fileMatch = {
description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.", ".codeclimate.json",
fileMatch = { },
"serverless.template", url = "https://json.schemastore.org/codeclimate.json",
"*.sam.json",
"sam.json",
}, },
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json", {
}, description = "LLVM compilation database",
{ fileMatch = {
description = "Json schema for properties json file for a GitHub Workflow template", "compile_commands.json",
fileMatch = { },
".github/workflow-templates/**.properties.json", url = "https://json.schemastore.org/compile-commands.json",
}, },
url = "https://json.schemastore.org/github-workflow-template-properties.json", {
}, description = "Config file for Command Task Runner",
{ fileMatch = {
description = "golangci-lint configuration file", "commands.json",
fileMatch = { },
".golangci.toml", url = "https://json.schemastore.org/commands.json",
".golangci.json",
}, },
url = "https://json.schemastore.org/golangci-lint.json", {
}, description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
{ fileMatch = {
description = "JSON schema for the JSON Feed format", "*.cf.json",
fileMatch = { "cloudformation.json",
"feed.json", },
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
}, },
url = "https://json.schemastore.org/feed.json", {
versions = { description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
["1"] = "https://json.schemastore.org/feed-1.json", fileMatch = {
["1.1"] = "https://json.schemastore.org/feed.json", "serverless.template",
"*.sam.json",
"sam.json",
},
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
}, },
}, {
{ description = "Json schema for properties json file for a GitHub Workflow template",
description = "Packer template JSON configuration", fileMatch = {
fileMatch = { ".github/workflow-templates/**.properties.json",
"packer.json", },
url = "https://json.schemastore.org/github-workflow-template-properties.json",
}, },
url = "https://json.schemastore.org/packer.json", {
}, description = "golangci-lint configuration file",
{ fileMatch = {
description = "NPM configuration file", ".golangci.toml",
fileMatch = { ".golangci.json",
"package.json", },
url = "https://json.schemastore.org/golangci-lint.json",
}, },
url = "https://json.schemastore.org/package.json", {
}, description = "JSON schema for the JSON Feed format",
{ fileMatch = {
description = "JSON schema for Visual Studio component configuration files", "feed.json",
fileMatch = { },
"*.vsconfig", url = "https://json.schemastore.org/feed.json",
versions = {
["1"] = "https://json.schemastore.org/feed-1.json",
["1.1"] = "https://json.schemastore.org/feed.json",
},
},
{
description = "Packer template JSON configuration",
fileMatch = {
"packer.json",
},
url = "https://json.schemastore.org/packer.json",
},
{
description = "NPM configuration file",
fileMatch = {
"package.json",
},
url = "https://json.schemastore.org/package.json",
},
{
description = "JSON schema for Visual Studio component configuration files",
fileMatch = {
"*.vsconfig",
},
url = "https://json.schemastore.org/vsconfig.json",
},
{
description = "Resume json",
fileMatch = { "resume.json" },
url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
}, },
url = "https://json.schemastore.org/vsconfig.json",
},
{
description = "Resume json",
fileMatch = { "resume.json" },
url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
},
} }
local opts = { local opts = {
settings = { settings = {
json = { json = {
schemas = schemas, schemas = schemas,
},
}, },
}, setup = {
setup = { commands = {
commands = { Format = {
Format = { function()
function() vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) end,
end, },
}, },
}, },
},
} }
return opts return opts

View File

@ -1,16 +1,16 @@
return { return {
settings = { settings = {
Lua = { Lua = {
diagnostics = { diagnostics = {
globals = { "vim" }, globals = { "vim" },
}, },
workspace = { workspace = {
library = { library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true, [vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true, [vim.fn.stdpath("config") .. "/lua"] = true,
}, },
}, },
}, },
}, },
} }

View File

@ -1,83 +1,123 @@
-- following options are the default -- following options are the default
-- each of these are documented in `:help nvim-tree.OPTION_NAME` -- each of these are documented in `:help nvim-tree.OPTION_NAME`
vim.g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "",
deleted = "",
untracked = "U",
ignored = "",
},
folder = {
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
},
}
local status_ok, nvim_tree = pcall(require, "nvim-tree") local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then if not status_ok then
return return
end end
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not config_status_ok then if not config_status_ok then
return return
end end
local tree_cb = nvim_tree_config.nvim_tree_callback local tree_cb = nvim_tree_config.nvim_tree_callback
nvim_tree.setup { nvim_tree.setup {
disable_netrw = true, renderer = {
hijack_netrw = true, icons = {
open_on_setup = false, webdev_colors = true,
ignore_ft_on_setup = { git_placement = "before",
"startify", padding = " ",
"dashboard", symlink_arrow = "",
"alpha", show = {
}, file = true,
open_on_tab = false, folder = true,
hijack_cursor = false, folder_arrow = true,
update_cwd = true, git = true,
diagnostics = { },
enable = true, glyphs = {
icons = { default = "",
hint = "", symlink = "",
info = "", git = {
warning = "", unstaged = "",
error = "", staged = "S",
unmerged = "",
renamed = "",
deleted = "",
untracked = "U",
ignored = "",
},
folder = {
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
},
},
},
highlight_git = true,
root_folder_modifier = ":t",
}, },
}, hijack_directories = {
update_focused_file = { enable = true,
enable = true, auto_open = true,
},
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {
"startify",
"dashboard",
"alpha",
},
open_on_tab = false,
hijack_cursor = false,
update_cwd = true, update_cwd = true,
ignore_list = {}, diagnostics = {
}, enable = true,
git = { icons = {
enable = true, hint = "",
ignore = true, info = "",
timeout = 500, warning = "",
}, error = "",
view = { },
width = 30, },
height = 30, update_focused_file = {
hide_root_folder = false, enable = true,
side = "left", update_cwd = true,
mappings = { ignore_list = {},
custom_only = false, },
list = { system_open = {
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, cmd = nil,
{ key = "h", cb = tree_cb "close_node" }, args = {},
{ key = "v", cb = tree_cb "vsplit" }, },
}, filters = {
dotfiles = false,
custom = {},
},
git = {
enable = true,
ignore = true,
timeout = 500,
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = "left",
mappings = {
custom_only = false,
list = {
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
{ key = "h", cb = tree_cb "close_node" },
{ key = "v", cb = tree_cb "vsplit" },
},
},
number = false,
relativenumber = false,
},
trash = {
cmd = "trash",
require_confirm = true,
},
actions = {
open_file = {
resize_window = true,
quit_on_open = true,
window_picker = {
enable = false,
},
},
}, },
number = false,
relativenumber = false,
},
} }

View File

@ -1,47 +1,51 @@
local options = { local options = {
backup = false, -- creates a backup file backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 2, -- more space in the neovim command line for displaying messages cmdheight = 2, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" }, -- mostly just for cmp completeopt = { "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file fileencoding = "utf-8", -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 2, -- always show tabs showtabline = 2, -- always show tabs
smartcase = true, -- smart case smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile swapfile = false, -- creates a swapfile
-- termguicolors = true, -- set term gui colors (most terminals support this) termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo undofile = true, -- enable persistent undo
updatetime = 300, -- faster completion (4000ms default) updatetime = 300, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces expandtab = true, -- convert tabs to spaces
shiftwidth = 4, -- the number of spaces inserted for each indentation shiftwidth = 4, -- the number of spaces inserted for each indentation
tabstop = 4, -- insert 2 spaces for a tab tabstop = 4, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line cursorline = true, -- highlight the current line
number = true, -- set numbered lines number = true, -- set numbered lines
relativenumber = false, -- set relative numbered lines relativenumber = false, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4} numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line wrap = false, -- display lines as one long line
scrolloff = 8, -- is one of my fav scrolloff = 8, -- is one of my fav
sidescrolloff = 8, sidescrolloff = 8,
guifont = "monospace:h17", -- the font used in graphical neovim applications guifont = "monospace:h17", -- the font used in graphical neovim applications
list = true, list = true,
foldenable = false,
foldmethod = "indent",
} }
vim.opt.shortmess:append "c" vim.opt.shortmess:append "c"
for k, v in pairs(options) do for k, v in pairs(options) do
vim.opt[k] = v vim.opt[k] = v
end end
vim.cmd "set whichwrap+=<,>,[,],h,l" vim.cmd "set whichwrap+=<,>,[,],h,l"
vim.cmd [[set iskeyword+=-]] vim.cmd [[set iskeyword+=-]]
vim.cmd "set listchars=space:·" vim.cmd "set listchars=space:·"
--vim.cmd "set term=screen-256color"

View File

@ -3,16 +3,16 @@ local fn = vim.fn
-- Automatically install packer -- Automatically install packer
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system { PACKER_BOOTSTRAP = fn.system {
"git", "git",
"clone", "clone",
"--depth", "--depth",
"1", "1",
"https://github.com/wbthomason/packer.nvim", "https://github.com/wbthomason/packer.nvim",
install_path, install_path,
} }
print "Installing packer close and reopen Neovim..." print "Installing packer close and reopen Neovim..."
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
end end
-- Autocommand that reloads neovim whenever you save the plugins.lua file -- Autocommand that reloads neovim whenever you save the plugins.lua file
@ -26,80 +26,80 @@ vim.cmd [[
-- Use a protected call so we don't error out on first use -- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer") local status_ok, packer = pcall(require, "packer")
if not status_ok then if not status_ok then
return return
end end
-- Have packer use a popup window -- Have packer use a popup window
packer.init { packer.init {
display = { display = {
open_fn = function() open_fn = function()
return require("packer.util").float { border = "rounded" } return require("packer.util").float { border = "rounded" }
end, end,
}, },
} }
-- Install your plugins here -- Install your plugins here
return packer.startup(function(use) return packer.startup(function(use)
-- My plugins here -- My plugins here
use "wbthomason/packer.nvim" -- Have packer manage itself use "wbthomason/packer.nvim" -- Have packer manage itself
use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim
use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins
-- Colorschemes -- Colorschemes
use "shaunsingh/nord.nvim" use "shaunsingh/nord.nvim"
-- cmp plugins -- cmp plugins
use "hrsh7th/nvim-cmp" -- The completion plugin use "hrsh7th/nvim-cmp" -- The completion plugin
use "hrsh7th/cmp-buffer" -- buffer completions use "hrsh7th/cmp-buffer" -- buffer completions
use "hrsh7th/cmp-path" -- path completions use "hrsh7th/cmp-path" -- path completions
use "hrsh7th/cmp-cmdline" -- cmdline completions use "hrsh7th/cmp-cmdline" -- cmdline completions
use "saadparwaiz1/cmp_luasnip" -- snippet completions use "saadparwaiz1/cmp_luasnip" -- snippet completions
use "hrsh7th/cmp-nvim-lsp" use "hrsh7th/cmp-nvim-lsp"
-- snippets -- snippets
use "L3MON4D3/LuaSnip" --snippet engine use "L3MON4D3/LuaSnip" --snippet engine
use "rafamadriz/friendly-snippets" -- a bunch of snippets to use use "rafamadriz/friendly-snippets" -- a bunch of snippets to use
-- LSP -- LSP
use "neovim/nvim-lspconfig" -- enable LSP use "neovim/nvim-lspconfig" -- enable LSP
use "williamboman/nvim-lsp-installer" -- simple to use language server installer use "williamboman/nvim-lsp-installer" -- simple to use language server installer
-- Telescope -- Telescope
use "nvim-telescope/telescope.nvim" use "nvim-telescope/telescope.nvim"
use 'nvim-telescope/telescope-media-files.nvim' use 'nvim-telescope/telescope-media-files.nvim'
-- Treesitter -- Treesitter
use { use {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
run = ":TSUpdate", run = ":TSUpdate",
} }
use { use {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true } requires = { 'kyazdani42/nvim-web-devicons', opt = true }
} }
-- nvim-tree -- nvim-tree
use { use {
'kyazdani42/nvim-tree.lua', 'kyazdani42/nvim-tree.lua',
requires = { requires = {
'kyazdani42/nvim-web-devicons', -- optional, for file icon 'kyazdani42/nvim-web-devicons', -- optional, for file icon
}, },
config = function() require'nvim-tree'.setup {} end --config = function() require'nvim-tree'.setup {} end
} }
-- --
use { use {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
} }
-- Bufferline -- Bufferline
use "akinsho/bufferline.nvim" use "akinsho/bufferline.nvim"
use "moll/vim-bbye" use "moll/vim-bbye"
-- Automatically set up your configuration after cloning packer.nvim -- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins -- Put this at the end after all plugins
if PACKER_BOOTSTRAP then if PACKER_BOOTSTRAP then
require("packer").sync() require("packer").sync()
end end
end) end)

View File

@ -1,3 +1,3 @@
require('lualine').setup { require('lualine').setup {
options = { theme = 'nord'} options = { theme = 'nord' }
} }

View File

@ -1,6 +1,6 @@
local status_ok, telescope = pcall(require, "telescope") local status_ok, telescope = pcall(require, "telescope")
if not status_ok then if not status_ok then
return return
end end
telescope.load_extension('media_files') telescope.load_extension('media_files')
@ -8,97 +8,97 @@ telescope.load_extension('media_files')
local actions = require "telescope.actions" local actions = require "telescope.actions"
telescope.setup { telescope.setup {
defaults = { defaults = {
prompt_prefix = "", prompt_prefix = "",
selection_caret = "", selection_caret = "",
path_display = { "smart" }, path_display = { "smart" },
mappings = { mappings = {
i = { i = {
["<C-n>"] = actions.cycle_history_next, ["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev, ["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next, ["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous, ["<C-k>"] = actions.move_selection_previous,
["<C-c>"] = actions.close, ["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next, ["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous, ["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default, ["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal, ["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical, ["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab, ["<C-t>"] = actions.select_tab,
["<C-u>"] = actions.preview_scrolling_up, ["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down, ["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up, ["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down, ["<PageDown>"] = actions.results_scrolling_down,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse, ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better, ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist, ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag, ["<C-l>"] = actions.complete_tag,
["<C-_>"] = actions.which_key, -- keys from pressing <C-/> ["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
}, },
n = { n = {
["<esc>"] = actions.close, ["<esc>"] = actions.close,
["<CR>"] = actions.select_default, ["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal, ["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical, ["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab, ["<C-t>"] = actions.select_tab,
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse, ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better, ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist, ["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next, ["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous, ["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top, ["H"] = actions.move_to_top,
["M"] = actions.move_to_middle, ["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom, ["L"] = actions.move_to_bottom,
["<Down>"] = actions.move_selection_next, ["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous, ["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top, ["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom, ["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up, ["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down, ["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up, ["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down, ["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key, ["?"] = actions.which_key,
}, },
},
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
media_files = {
-- filetypes whitelist
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg" -- find command (defaults to `fd`)
}
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
}, },
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
media_files = {
-- filetypes whitelist
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = {"png", "webp", "jpg", "jpeg"},
find_cmd = "rg" -- find command (defaults to `fd`)
}
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
},
} }

View File

@ -1,13 +1,13 @@
local configs = require("nvim-treesitter.configs") local configs = require("nvim-treesitter.configs")
configs.setup { configs.setup {
ensure_installed = {"c", "cpp"}, ensure_installed = { "c", "cpp" },
sync_install = false, sync_install = false,
ignore_install = { "" }, -- List of parsers to ignore installing ignore_install = { "" }, -- List of parsers to ignore installing
highlight = { highlight = {
enable = true, -- false will disable the whole extension enable = true, -- false will disable the whole extension
disable = { "" }, -- list of language that will be disabled disable = { "" }, -- list of language that will be disabled
additional_vim_regex_highlighting = true, additional_vim_regex_highlighting = true,
}, },
indent = { enable = true }, indent = { enable = true },
} }