Updated and fixed neovim config
This commit is contained in:
parent
9d1cc2fb39
commit
cb351d4aac
@ -5,11 +5,11 @@ 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`
|
||||||
@ -20,7 +20,7 @@ gitsigns.setup {
|
|||||||
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'
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
@ -46,18 +46,11 @@ 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
|
|
||||||
autocmd! * <buffer>
|
|
||||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
|
||||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
|
||||||
augroup END
|
|
||||||
]],
|
|
||||||
false
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
illuminate.on_attach(client)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lsp_keymaps(bufnr)
|
local function lsp_keymaps(bufnr)
|
||||||
|
@ -21,6 +21,11 @@ lsp_installer.on_server_ready(function(server)
|
|||||||
opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
|
opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
|
||||||
end
|
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.
|
-- 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
|
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
server:setup(opts)
|
server:setup(opts)
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,31 @@
|
|||||||
-- 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 = {
|
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 = "",
|
default = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
git = {
|
git = {
|
||||||
@ -19,21 +44,15 @@ vim.g.nvim_tree_icons = {
|
|||||||
empty_open = "",
|
empty_open = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
},
|
||||||
local status_ok, nvim_tree = pcall(require, "nvim-tree")
|
highlight_git = true,
|
||||||
if not status_ok then
|
root_folder_modifier = ":t",
|
||||||
return
|
},
|
||||||
end
|
hijack_directories = {
|
||||||
|
enable = true,
|
||||||
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
|
auto_open = true,
|
||||||
if not config_status_ok then
|
},
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local tree_cb = nvim_tree_config.nvim_tree_callback
|
|
||||||
|
|
||||||
nvim_tree.setup {
|
|
||||||
disable_netrw = true,
|
disable_netrw = true,
|
||||||
hijack_netrw = true,
|
hijack_netrw = true,
|
||||||
open_on_setup = false,
|
open_on_setup = false,
|
||||||
@ -59,6 +78,14 @@ nvim_tree.setup {
|
|||||||
update_cwd = true,
|
update_cwd = true,
|
||||||
ignore_list = {},
|
ignore_list = {},
|
||||||
},
|
},
|
||||||
|
system_open = {
|
||||||
|
cmd = nil,
|
||||||
|
args = {},
|
||||||
|
},
|
||||||
|
filters = {
|
||||||
|
dotfiles = false,
|
||||||
|
custom = {},
|
||||||
|
},
|
||||||
git = {
|
git = {
|
||||||
enable = true,
|
enable = true,
|
||||||
ignore = true,
|
ignore = true,
|
||||||
@ -80,4 +107,17 @@ nvim_tree.setup {
|
|||||||
number = false,
|
number = false,
|
||||||
relativenumber = false,
|
relativenumber = false,
|
||||||
},
|
},
|
||||||
|
trash = {
|
||||||
|
cmd = "trash",
|
||||||
|
require_confirm = true,
|
||||||
|
},
|
||||||
|
actions = {
|
||||||
|
open_file = {
|
||||||
|
resize_window = true,
|
||||||
|
quit_on_open = true,
|
||||||
|
window_picker = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ local options = {
|
|||||||
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)
|
||||||
@ -34,6 +34,9 @@ local options = {
|
|||||||
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"
|
||||||
@ -45,3 +48,4 @@ 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"
|
||||||
|
@ -84,7 +84,7 @@ return packer.startup(function(use)
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
require('lualine').setup {
|
require('lualine').setup {
|
||||||
options = { theme = 'nord'}
|
options = { theme = 'nord' }
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ telescope.setup {
|
|||||||
media_files = {
|
media_files = {
|
||||||
-- filetypes whitelist
|
-- filetypes whitelist
|
||||||
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
|
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
|
||||||
filetypes = {"png", "webp", "jpg", "jpeg"},
|
filetypes = { "png", "webp", "jpg", "jpeg" },
|
||||||
find_cmd = "rg" -- find command (defaults to `fd`)
|
find_cmd = "rg" -- find command (defaults to `fd`)
|
||||||
}
|
}
|
||||||
-- Your extension configuration goes here:
|
-- Your extension configuration goes here:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
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 = {
|
||||||
|
Loading…
Reference in New Issue
Block a user