Change syntax conviention fisrt part
This commit is contained in:
parent
daa989d24a
commit
433fcafca9
9 changed files with 109 additions and 108 deletions
|
|
@ -1,17 +1,17 @@
|
|||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
|
@ -23,10 +23,10 @@ vim.g.maplocalleader = "\\"
|
|||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = false },
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = false },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
All plugins what looks like a pure library (as a plenary.nvim) should be use in "depenedencies" filed and with "lazy = true".
|
||||
Main theme should be load during startup (lazy = false) and high priority.
|
||||
Main theme should be load during startup (lazy = false) and high priority.
|
||||
If plugin required a "require("nvim-treesitter.configs").setup(opts)" we can use "main = 'nvim-treesitter.configs'" intead
|
||||
will use it implicity in "config" and "opts" blocks.
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
return {
|
||||
'stevearc/aerial.nvim',
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
"stevearc/aerial.nvim",
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
return {
|
||||
{
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
end,
|
||||
opts = { style = 'dark' }
|
||||
},
|
||||
} -- Main theme should be load during startup.
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
end,
|
||||
opts = { style = "dark" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
return { 'ej-shafran/compile-mode.nvim',
|
||||
version = '^5.13.0',
|
||||
return {
|
||||
"ej-shafran/compile-mode.nvim",
|
||||
version = "^5.13.0",
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim', lazy = true,
|
||||
'm00qek/baleia.nvim'
|
||||
"nvim-lua/plenary.nvim", lazy = true,
|
||||
"m00qek/baleia.nvim"
|
||||
},
|
||||
config = function()
|
||||
---@type CompileModeOpts
|
||||
vim.g.compile_mode = {
|
||||
default_command = 'cmake --build build',
|
||||
default_command = "cmake --build build",
|
||||
input_word_completion = true,
|
||||
baleia_setup = true,
|
||||
bang_expansion = true,
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'petertriho/cmp-git',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'hrsh7th/vim-vsnip',
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
"neovim/nvim-lspconfig",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"petertriho/cmp-git",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require'cmp'
|
||||
local cmp = require"cmp"
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require("snippy").expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
},
|
||||
|
|
@ -28,56 +28,56 @@ return {
|
|||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" }, -- For vsnip users.
|
||||
-- { name = "luasnip" }, -- For luasnip users.
|
||||
-- { name = "ultisnips" }, -- For ultisnips users.
|
||||
-- { name = "snippy" }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
})
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype('gitcommit', {
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'git' },
|
||||
{ name = "git" },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = "buffer" },
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.filetype('cmake', {
|
||||
cmp.setup.filetype("cmake", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmake', "CMakeLists.txt" },
|
||||
{ name = "cmake", "CMakeLists.txt" },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
{ name = "buffer" },
|
||||
})
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won"t work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
{ name = "buffer" }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
-- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
{ name = "path" }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
{ name = "cmdline" }
|
||||
})
|
||||
})
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
-- Setup language servers
|
||||
-- Server-specific settings. See `:help lspconfig-all`
|
||||
vim.lsp.config('*', {
|
||||
vim.lsp.config("*", {
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
semanticTokens = {
|
||||
|
|
@ -11,47 +11,47 @@ return {
|
|||
}
|
||||
}
|
||||
},
|
||||
root_markers = { '.git' },
|
||||
root_markers = { ".git" },
|
||||
})
|
||||
vim.lsp.config('clangd', {
|
||||
cmd = { 'clangd', '--background-index', '--clang-tidy', '--log=verbose', '--header-insertion=never' },
|
||||
filetypes = { 'c', 'cpp' }
|
||||
vim.lsp.config("clangd", {
|
||||
cmd = { "clangd", "--background-index", "--clang-tidy", "--log=verbose", "--header-insertion=never" },
|
||||
filetypes = { "c", "cpp" }
|
||||
})
|
||||
|
||||
vim.lsp.enable('clangd')
|
||||
vim.lsp.enable("clangd")
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<space>f", function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
main = 'nvim-treesitter.configs',
|
||||
main = "nvim-treesitter.configs",
|
||||
opts = {
|
||||
ensure_installed = { 'c', 'cpp', 'lua' },
|
||||
ensure_installed = { "c", "cpp", "lua" },
|
||||
highlight = { enable = true, }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
return { 'tpope/vim-commentary' }
|
||||
return { "tpope/vim-commentary" }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue