Install efm lsp and use lua-format on all files
This commit is contained in:
@@ -2,24 +2,12 @@ require("nvim-tree").setup({
|
|||||||
open_on_setup = true,
|
open_on_setup = true,
|
||||||
hijack_cursor = true,
|
hijack_cursor = true,
|
||||||
update_cwd = true,
|
update_cwd = true,
|
||||||
update_focused_file = {
|
update_focused_file = { enable = true },
|
||||||
enable = true
|
view = { width = 30, side = "left", auto_resize = true },
|
||||||
},
|
filters = { custom = { ".git" } }
|
||||||
view = {
|
|
||||||
width = 30,
|
|
||||||
side = "left",
|
|
||||||
auto_resize = true
|
|
||||||
},
|
|
||||||
filters = {
|
|
||||||
custom = { ".git" }
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.g.nvim_tree_add_trailing = 1
|
vim.g.nvim_tree_add_trailing = 1
|
||||||
vim.g.nvim_tree_indent_markers = 1
|
vim.g.nvim_tree_indent_markers = 1
|
||||||
vim.g.nvim_tree_show_icons = {
|
|
||||||
git = 0,
|
vim.g.nvim_tree_show_icons = { git = 0, folders = 0, files = 0, folder_arrows = 0 }
|
||||||
folders = 0,
|
|
||||||
files = 0,
|
|
||||||
folder_arrows = 0
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ vim.api.nvim_exec([[
|
|||||||
]], false)
|
]], false)
|
||||||
|
|
||||||
-- Automatically formatting buffer on save
|
-- Automatically formatting buffer on save
|
||||||
vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()")
|
vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 100)")
|
||||||
|
|
||||||
vim.cmd('command! ToggleBackground lua require("utils").toggleBackground()')
|
vim.cmd('command! ToggleBackground lua require("utils").toggleBackground()')
|
||||||
|
|||||||
@@ -45,50 +45,64 @@ cmp.setup({
|
|||||||
['<C-k>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
['<C-k>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||||
['<TAB>'] = cmp.mapping.confirm({ behavior = cmp.SelectBehavior.Insert })
|
['<TAB>'] = cmp.mapping.confirm({ behavior = cmp.SelectBehavior.Insert })
|
||||||
},
|
},
|
||||||
sources = {
|
sources = { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "nvim_lua" }, { name = "path" }, { name = "buffer", keyword_length = 5 } },
|
||||||
{ name = "nvim_lsp" },
|
completion = { completeopt = "menu,menuone,noselect,noinsert" },
|
||||||
{ name = "luasnip" },
|
|
||||||
{ name = "nvim_lua" },
|
|
||||||
{ name = "path" },
|
|
||||||
{ name = "buffer", keyword_length = 5 }
|
|
||||||
},
|
|
||||||
completion = {
|
|
||||||
completeopt = "menu,menuone,noselect,noinsert"
|
|
||||||
},
|
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
|
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
|
||||||
vim_item.menu = ({
|
vim_item.menu = ({ buffer = "[Buffer]", nvim_lsp = "[LSP]", luasnip = "[Snippet]", nvim_lua = "[Lua]", path = "[File]" })[entry.source.name]
|
||||||
buffer = "[Buffer]",
|
|
||||||
nvim_lsp = "[LSP]",
|
|
||||||
luasnip = "[Snippet]",
|
|
||||||
nvim_lua = "[Lua]",
|
|
||||||
path = "[File]"
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
return vim_item
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
experimental = {
|
experimental = { ghost_text = true },
|
||||||
ghost_text = true
|
documentation = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } },
|
||||||
},
|
sorting = { comparators = cmp.config.compare.recently_used }
|
||||||
documentation = {
|
|
||||||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
|
||||||
},
|
|
||||||
sorting = {
|
|
||||||
comparators = cmp.config.compare.recently_used
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
lsp_installer.on_server_ready(function(server)
|
||||||
local opts = {
|
local opts = { capabilities = capabilities }
|
||||||
capabilities = capabilities
|
|
||||||
}
|
|
||||||
|
|
||||||
require("lsp_signature").setup({
|
if server.name == "sumneko_lua" then
|
||||||
bind = true,
|
opts = {
|
||||||
})
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = { version = "LuaJIT", path = vim.split(package.path, ";") },
|
||||||
|
diagnostics = { globals = { "vim" } },
|
||||||
|
workspace = {
|
||||||
|
library = {
|
||||||
|
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||||
|
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
|
||||||
|
[vim.fn.expand("$HOME/.local/share/nvim/site/pack/packer/start")] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
if server.name == "efm" then
|
||||||
|
opts = {
|
||||||
|
capabilities = capabilities,
|
||||||
|
init_options = { documentFormatting = true },
|
||||||
|
filetypes = { "lua" },
|
||||||
|
settings = {
|
||||||
|
rootMarkers = { ".git/" },
|
||||||
|
languages = {
|
||||||
|
lua = {
|
||||||
|
{
|
||||||
|
formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb --tab-width 2 --indent-width 2 --spaces-inside-table-braces",
|
||||||
|
formatStdin = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lsp_signature").setup({ bind = true })
|
||||||
|
|
||||||
server:setup(opts)
|
server:setup(opts)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ require("colorizer").setup()
|
|||||||
-- Git
|
-- Git
|
||||||
require("gitsigns").setup({
|
require("gitsigns").setup({
|
||||||
current_line_blame = true,
|
current_line_blame = true,
|
||||||
current_line_blame_opts = {
|
current_line_blame_opts = { virt_text = true, virt_text_pos = "eol", delay = 500 },
|
||||||
virt_text = true,
|
|
||||||
virt_text_pos = "eol",
|
|
||||||
delay = 500
|
|
||||||
},
|
|
||||||
keymaps = {
|
keymaps = {
|
||||||
noremap = true,
|
noremap = true,
|
||||||
["n <leader>gs"] = '<cmd>lua require("gitsigns").stage_hunk()<CR>',
|
["n <leader>gs"] = '<cmd>lua require("gitsigns").stage_hunk()<CR>',
|
||||||
@@ -24,9 +20,6 @@ require("gitsigns").setup({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
require("iswap").setup({
|
require("iswap").setup({ keys = "1234567890", autoswap = true })
|
||||||
keys = "1234567890",
|
|
||||||
autoswap = true
|
|
||||||
})
|
|
||||||
|
|
||||||
require("focus").setup()
|
require("focus").setup()
|
||||||
|
|||||||
@@ -10,12 +10,18 @@ return require("packer").startup(function(use)
|
|||||||
use({ "windwp/nvim-ts-autotag" })
|
use({ "windwp/nvim-ts-autotag" })
|
||||||
use({ "JoosepAlviste/nvim-ts-context-commentstring" })
|
use({ "JoosepAlviste/nvim-ts-context-commentstring" })
|
||||||
use({ "nvim-treesitter/playground" })
|
use({ "nvim-treesitter/playground" })
|
||||||
use({ "folke/twilight.nvim", config = function()
|
use({
|
||||||
require("twilight").setup({})
|
"folke/twilight.nvim",
|
||||||
end })
|
config = function()
|
||||||
use({ "folke/zen-mode.nvim", config = function()
|
require("twilight").setup({})
|
||||||
require("zen-mode").setup({})
|
end
|
||||||
end })
|
})
|
||||||
|
use({
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
config = function()
|
||||||
|
require("zen-mode").setup({})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- Make commenting code great
|
-- Make commenting code great
|
||||||
use({ "tpope/vim-commentary" })
|
use({ "tpope/vim-commentary" })
|
||||||
@@ -32,14 +38,12 @@ return require("packer").startup(function(use)
|
|||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer", "onsails/lspkind-nvim" })
|
use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer", "onsails/lspkind-nvim" })
|
||||||
use({ "hrsh7th/nvim-cmp", requires = {
|
use({
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/nvim-cmp",
|
||||||
"hrsh7th/cmp-buffer",
|
requires = {
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lua", "saadparwaiz1/cmp_luasnip"
|
||||||
"hrsh7th/cmp-cmdline",
|
}
|
||||||
"hrsh7th/cmp-nvim-lua",
|
})
|
||||||
"saadparwaiz1/cmp_luasnip"
|
|
||||||
}})
|
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
use({ "L3MON4D3/LuaSnip" })
|
use({ "L3MON4D3/LuaSnip" })
|
||||||
@@ -71,19 +75,16 @@ return require("packer").startup(function(use)
|
|||||||
-- Show indent lines
|
-- Show indent lines
|
||||||
use({
|
use({
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
config = function ()
|
config = function()
|
||||||
vim.cmd("let g:indent_blankline_filetype_exclude = ['help']")
|
vim.cmd("let g:indent_blankline_filetype_exclude = ['help']")
|
||||||
require("indent_blankline").setup({
|
require("indent_blankline").setup({ char = "|", buftype_exclude = { "terminal" } })
|
||||||
char = "|",
|
|
||||||
buftype_exclude = { "terminal" },
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Fast movement
|
-- Fast movement
|
||||||
use({
|
use({
|
||||||
"ggandor/lightspeed.nvim",
|
"ggandor/lightspeed.nvim",
|
||||||
config = function ()
|
config = function()
|
||||||
require("lightspeed").setup()
|
require("lightspeed").setup()
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ local ls = require("luasnip")
|
|||||||
ls.config.set_config({
|
ls.config.set_config({
|
||||||
history = true,
|
history = true,
|
||||||
-- Update more often, :h events for more info.
|
-- Update more often, :h events for more info.
|
||||||
updateevents = "TextChanged,TextChangedI",
|
updateevents = "TextChanged,TextChangedI"
|
||||||
})
|
})
|
||||||
|
|
||||||
require("luasnip/loaders/from_vscode").lazy_load()
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|||||||
@@ -1,6 +1,2 @@
|
|||||||
require("telescope").setup({
|
|
||||||
defaults = {
|
require("telescope").setup({ defaults = { sorting_strategy = "ascending", file_ignore_patterns = { ".git", "node_modules" } } })
|
||||||
sorting_strategy = "ascending",
|
|
||||||
file_ignore_patterns = { ".git", "node_modules" }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
highlight = {
|
highlight = { enable = true },
|
||||||
enable = true
|
rainbow = { enable = true, extended_mode = true, disable = { "html" } },
|
||||||
},
|
autotag = { enable = true },
|
||||||
rainbow = {
|
context_commentstring = { enable = true }
|
||||||
enable = true,
|
|
||||||
extended_mode = true,
|
|
||||||
disable = { "html" }
|
|
||||||
},
|
|
||||||
autotag = {
|
|
||||||
enable = true
|
|
||||||
},
|
|
||||||
context_commentstring = {
|
|
||||||
enable = true
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.toggleBackground = function ()
|
M.toggleBackground = function()
|
||||||
if vim.opt.background:get() == "dark" then
|
if vim.opt.background:get() == "dark" then
|
||||||
vim.opt.background = "light"
|
vim.opt.background = "light"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user