nvim config autoformat
This commit is contained in:
+46
-77
@@ -169,8 +169,7 @@ local install_path = vim.fn.stdpath("data") ..
|
||||
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
vim.fn.system({
|
||||
"git", "clone", "https://github.com/wbthomason/packer.nvim",
|
||||
install_path
|
||||
"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path
|
||||
})
|
||||
vim.api.nvim_command "packadd packer.nvim"
|
||||
end
|
||||
@@ -247,10 +246,7 @@ require("packer").startup {
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
requires = {"kyazdani42/nvim-web-devicons"},
|
||||
config = function()
|
||||
require("nvim-tree").setup {
|
||||
disable_netrw = false,
|
||||
auto_close = true
|
||||
}
|
||||
require("nvim-tree").setup {disable_netrw = false, auto_close = true}
|
||||
local map = vim.api.nvim_set_keymap
|
||||
map("n", "<C-p>", ":NvimTreeToggle<cr>", {noremap = true})
|
||||
end
|
||||
@@ -271,10 +267,7 @@ require("packer").startup {
|
||||
use {"NLKNguyen/papercolor-theme"}
|
||||
use {"drewtempelmeyer/palenight.vim"}
|
||||
use {"altercation/vim-colors-solarized"}
|
||||
use {
|
||||
"rakr/vim-one",
|
||||
config = function() vim.g.one_allow_italics = 1 end
|
||||
}
|
||||
use {"rakr/vim-one", config = function() vim.g.one_allow_italics = 1 end}
|
||||
|
||||
use {
|
||||
"ayu-theme/ayu-vim",
|
||||
@@ -314,8 +307,7 @@ require("packer").startup {
|
||||
use {
|
||||
"danilamihailov/beacon.nvim",
|
||||
setup = function()
|
||||
vim.api.nvim_exec([[highlight Beacon guibg=white ctermbg=15]],
|
||||
false)
|
||||
vim.api.nvim_exec([[highlight Beacon guibg=white ctermbg=15]], false)
|
||||
end,
|
||||
config = function()
|
||||
vim.g.beacon_size = 40
|
||||
@@ -410,9 +402,7 @@ require("packer").startup {
|
||||
"akinsho/nvim-bufferline.lua",
|
||||
requires = {"kyazdani42/nvim-web-devicons"},
|
||||
config = function()
|
||||
require("bufferline").setup {
|
||||
options = {diagnostics = "nvim_lsp"}
|
||||
}
|
||||
require("bufferline").setup {options = {diagnostics = "nvim_lsp"}}
|
||||
local map = vim.api.nvim_set_keymap
|
||||
map("n", "<M-J>", ":BufferLineCyclePrev<cr>",
|
||||
{noremap = true, silent = true})
|
||||
@@ -431,10 +421,9 @@ require("packer").startup {
|
||||
require("FTerm").setup {}
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local opts = {noremap = true, silent = true}
|
||||
map("n", "<F2>", [[<cmd>lua require("FTerm").toggle()<cr>]],
|
||||
map("n", "<F2>", [[<cmd>lua require("FTerm").toggle()<cr>]], opts)
|
||||
map("t", "<F2>", [[<C-\><C-n><cmd>lua require("FTerm").toggle()<cr>]],
|
||||
opts)
|
||||
map("t", "<F2>",
|
||||
[[<C-\><C-n><cmd>lua require("FTerm").toggle()<cr>]], opts)
|
||||
end
|
||||
}
|
||||
|
||||
@@ -445,9 +434,7 @@ require("packer").startup {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
ensure_installed = "all"
|
||||
}
|
||||
require("nvim-treesitter.configs").setup {ensure_installed = "all"}
|
||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
end
|
||||
}
|
||||
@@ -471,14 +458,12 @@ require("packer").startup {
|
||||
map("n", "<M-b>", "<cmd>Telescope buffers<cr>", opts)
|
||||
map("n", "<M-y>", "<cmd>Telescope filetypes<cr>", opts)
|
||||
map("n", "<F3>", "<cmd>Telescope colorscheme<cr>", opts)
|
||||
map("n", "<leader>la", "<cmd>Telescope lsp_code_actions<cr>",
|
||||
map("n", "<leader>la", "<cmd>Telescope lsp_code_actions<cr>", opts)
|
||||
map("v", "<leader>la", "<cmd>Telescope lsp_range_code_actions<cr>", opts)
|
||||
map("n", "<leader>ld", "<cmd>Telescope lsp_document_diagnostics<cr>",
|
||||
opts)
|
||||
map("n", "<leader>lD", "<cmd>Telescope lsp_workspace_diagnostics<cr>",
|
||||
opts)
|
||||
map("v", "<leader>la",
|
||||
"<cmd>Telescope lsp_range_code_actions<cr>", opts)
|
||||
map("n", "<leader>ld",
|
||||
"<cmd>Telescope lsp_document_diagnostics<cr>", opts)
|
||||
map("n", "<leader>lD",
|
||||
"<cmd>Telescope lsp_workspace_diagnostics<cr>", opts)
|
||||
map("n", "<F12>", "<cmd>Telescope<cr>", opts)
|
||||
require("telescope").setup {
|
||||
defaults = {
|
||||
@@ -489,8 +474,7 @@ require("packer").startup {
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-b>"] = actions.preview_scrolling_up,
|
||||
["<C-f>"] = actions.preview_scrolling_down,
|
||||
["<cr>"] = actions.select_default +
|
||||
actions.center,
|
||||
["<cr>"] = actions.select_default + actions.center,
|
||||
["<C-s>"] = actions.select_horizontal,
|
||||
["<C-v>"] = actions.select_vertical,
|
||||
["<C-t>"] = actions.select_tab,
|
||||
@@ -498,8 +482,7 @@ require("packer").startup {
|
||||
actions.move_selection_worse,
|
||||
["<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,
|
||||
["<C-l>"] = actions.complete_tag
|
||||
@@ -516,27 +499,25 @@ require("packer").startup {
|
||||
"romgrk/nvim-treesitter-context",
|
||||
requires = {"nvim-treesitter/nvim-treesitter"},
|
||||
config = function()
|
||||
require("treesitter-context").setup{
|
||||
require("treesitter-context").setup {
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
throttle = true, -- Throttles plugin updates (may improve performance)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
patterns = {
|
||||
default = {
|
||||
"class",
|
||||
"function",
|
||||
"method",
|
||||
"class", "function", "method"
|
||||
-- 'for', -- These won't appear in the context
|
||||
-- 'while',
|
||||
-- 'if',
|
||||
-- 'switch',
|
||||
-- 'case',
|
||||
},
|
||||
}
|
||||
-- Example for a specific filetype.
|
||||
-- If a pattern is missing, *open a PR* so everyone can benefit.
|
||||
-- rust = {
|
||||
-- 'impl_item',
|
||||
-- },
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
@@ -563,7 +544,8 @@ require("packer").startup {
|
||||
}),
|
||||
['<TAB>'] = cmp.mapping({
|
||||
c = function(fallback)
|
||||
if #cmp.core:get_sources() > 0 and not cmp.get_config().experimental.native_menu then
|
||||
if #cmp.core:get_sources() > 0 and
|
||||
not cmp.get_config().experimental.native_menu then
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
@@ -572,11 +554,12 @@ require("packer").startup {
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
end
|
||||
}),
|
||||
['<S-TAB>'] = cmp.mapping({
|
||||
c = function(fallback)
|
||||
if #cmp.core:get_sources() > 0 and not cmp.get_config().experimental.native_menu then
|
||||
if #cmp.core:get_sources() > 0 and
|
||||
not cmp.get_config().experimental.native_menu then
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
@@ -585,15 +568,13 @@ require("packer").startup {
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
}),
|
||||
end
|
||||
})
|
||||
},
|
||||
sources = {
|
||||
{name = "nvim_lsp"},
|
||||
{name = "buffer"},
|
||||
{name = "path"},
|
||||
{name = "nvim_lua"},
|
||||
},
|
||||
{name = "nvim_lsp"}, {name = "buffer"}, {name = "path"},
|
||||
{name = "nvim_lua"}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
@@ -695,8 +676,7 @@ require("packer").startup {
|
||||
bmap(bufnr, "n", "<leader>wa",
|
||||
"<cmd>lua vim.lsp.buf.add_workspace_folder()<cr>", opts)
|
||||
bmap(bufnr, "n", "<leader>wr",
|
||||
"<cmd>lua vim.lsp.buf.remove_workspace_folder()<cr>",
|
||||
opts)
|
||||
"<cmd>lua vim.lsp.buf.remove_workspace_folder()<cr>", opts)
|
||||
bmap(bufnr, "n", "<leader>wl",
|
||||
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<cr>",
|
||||
opts)
|
||||
@@ -714,26 +694,22 @@ require("packer").startup {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_prev({severity_limit='Warning', popup_opts={show_header=false}})<cr>",
|
||||
opts)
|
||||
-- popups
|
||||
bmap(bufnr, "n", "<M-x>",
|
||||
"<cmd>lua vim.lsp.buf.signature_help()<cr>", opts)
|
||||
bmap(bufnr, "i", "<M-x>",
|
||||
"<cmd>lua vim.lsp.buf.signature_help()<cr>", opts)
|
||||
bmap(bufnr, "n", "<M-x>", "<cmd>lua vim.lsp.buf.signature_help()<cr>",
|
||||
opts)
|
||||
bmap(bufnr, "i", "<M-x>", "<cmd>lua vim.lsp.buf.signature_help()<cr>",
|
||||
opts)
|
||||
-- other
|
||||
if client.resolved_capabilities.goto_definition then
|
||||
bmap(bufnr, "n", "gd",
|
||||
":lua vim.lsp.buf.definition()<cr>", opts)
|
||||
bmap(bufnr, "n", "gd", ":lua vim.lsp.buf.definition()<cr>", opts)
|
||||
end
|
||||
if client.resolved_capabilities.find_references then
|
||||
bmap(bufnr, "n", "gr",
|
||||
"<cmd>lua vim.lsp.buf.references()<cr>", opts)
|
||||
bmap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<cr>", opts)
|
||||
end
|
||||
if client.resolved_capabilities.hover then
|
||||
bmap(bufnr, "n", "K",
|
||||
"<cmd>lua vim.lsp.buf.hover()<cr>", opts)
|
||||
bmap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", opts)
|
||||
end
|
||||
if client.resolved_capabilities.rename then
|
||||
bmap(bufnr, "n", "<M-r>",
|
||||
"<cmd>lua vim.lsp.buf.rename()<cr>", opts)
|
||||
bmap(bufnr, "n", "<M-r>", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
|
||||
end
|
||||
if client.resolved_capabilities.document_formatting or
|
||||
client.resolved_capabilities.document_range_formatting then
|
||||
@@ -758,17 +734,13 @@ require("packer").startup {
|
||||
settings = {
|
||||
yaml = {
|
||||
customTags = {
|
||||
"!ChildAccessor mapping",
|
||||
"!ChildContainer mapping",
|
||||
"!ChildAccessor mapping", "!ChildContainer mapping",
|
||||
"!ConstantAccessor mapping", "!Dtype scalar",
|
||||
"!ConstantTensorAccessor mapping",
|
||||
"!DtypeTensor scalar", "!ImportClass scalar",
|
||||
"!ReferenceContainer mapping",
|
||||
"!ReferenceLink mapping",
|
||||
"!SeriesTensor mapping",
|
||||
"!SeriesTensorAccessor mapping",
|
||||
"!UDFtensorfactory scalar", "!UDFnu scalar",
|
||||
"!UDFvalidator scalar", "!Unit scalar",
|
||||
"!ConstantTensorAccessor mapping", "!DtypeTensor scalar",
|
||||
"!ImportClass scalar", "!ReferenceContainer mapping",
|
||||
"!ReferenceLink mapping", "!SeriesTensor mapping",
|
||||
"!SeriesTensorAccessor mapping", "!UDFtensorfactory scalar",
|
||||
"!UDFnu scalar", "!UDFvalidator scalar", "!Unit scalar",
|
||||
"!UserClass mapping", "!UserInstance mapping",
|
||||
"!getattr mapping"
|
||||
}
|
||||
@@ -783,7 +755,7 @@ require("packer").startup {
|
||||
diagnosticMode = "workspace",
|
||||
logLevel = "Warning",
|
||||
typeCheckingMode = "basic",
|
||||
autoImportCompletions = false,
|
||||
autoImportCompletions = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -791,9 +763,7 @@ require("packer").startup {
|
||||
nvim_lsp.efm.setup {
|
||||
on_attach = on_attach,
|
||||
init_options = {documentFormatting = true},
|
||||
filetypes = {
|
||||
"python", "markdown", "yaml", "lua", "javascript"
|
||||
},
|
||||
filetypes = {"python", "markdown", "yaml", "lua", "javascript"},
|
||||
root_dir = vim.loop.cwd,
|
||||
settings = {
|
||||
rootMarkers = {".git/"},
|
||||
@@ -828,7 +798,6 @@ require("packer").startup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user