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

@ -20,7 +20,7 @@ gitsigns.setup {
follow_files = 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 = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'

View File

@ -103,4 +103,3 @@ keymap("n", "<leader>w", "<cmd>set list!<cr>", opts)
-- toggle gitsign line blame --
keymap("n", "<leader>g", "<cmd>Gitsigns toggle_current_line_blame<cr>", opts)

View File

@ -46,18 +46,11 @@ end
local function lsp_highlight_document(client)
-- Set autocommands conditional on server_capabilities
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec(
[[
augroup lsp_document_highlight
autocmd! * <buffer>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]],
false
)
local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then
return
end
illuminate.on_attach(client)
end
local function lsp_keymaps(bufnr)

View File

@ -21,6 +21,11 @@ lsp_installer.on_server_ready(function(server)
opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
end
if server.name == "clangd" then
local clangd_opts = require("user.lsp.settings.clangd")
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)

View File

@ -11,7 +11,10 @@ local diagnostics = null_ls.builtins.diagnostics
null_ls.setup {
debug = false,
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,
},
}

View File

@ -1,6 +1,31 @@
-- following options are the default
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
vim.g.nvim_tree_icons = {
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not config_status_ok then
return
end
local tree_cb = nvim_tree_config.nvim_tree_callback
nvim_tree.setup {
renderer = {
icons = {
webdev_colors = true,
git_placement = "before",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
glyphs = {
default = "",
symlink = "",
git = {
@ -19,21 +44,15 @@ vim.g.nvim_tree_icons = {
empty_open = "",
symlink = "",
},
}
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not config_status_ok then
return
end
local tree_cb = nvim_tree_config.nvim_tree_callback
nvim_tree.setup {
},
},
highlight_git = true,
root_folder_modifier = ":t",
},
hijack_directories = {
enable = true,
auto_open = true,
},
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
@ -59,6 +78,14 @@ nvim_tree.setup {
update_cwd = true,
ignore_list = {},
},
system_open = {
cmd = nil,
args = {},
},
filters = {
dotfiles = false,
custom = {},
},
git = {
enable = true,
ignore = true,
@ -80,4 +107,17 @@ nvim_tree.setup {
number = false,
relativenumber = false,
},
trash = {
cmd = "trash",
require_confirm = true,
},
actions = {
open_file = {
resize_window = true,
quit_on_open = true,
window_picker = {
enable = false,
},
},
},
}

View File

@ -16,7 +16,7 @@ local options = {
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
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)
undofile = true, -- enable persistent undo
updatetime = 300, -- faster completion (4000ms default)
@ -34,6 +34,9 @@ local options = {
sidescrolloff = 8,
guifont = "monospace:h17", -- the font used in graphical neovim applications
list = true,
foldenable = false,
foldmethod = "indent",
}
vim.opt.shortmess:append "c"
@ -45,3 +48,4 @@ end
vim.cmd "set whichwrap+=<,>,[,],h,l"
vim.cmd [[set iskeyword+=-]]
vim.cmd "set listchars=space:·"
--vim.cmd "set term=screen-256color"

View File

@ -84,7 +84,7 @@ return packer.startup(function(use)
requires = {
'kyazdani42/nvim-web-devicons', -- optional, for file icon
},
config = function() require'nvim-tree'.setup {} end
--config = function() require'nvim-tree'.setup {} end
}
--