feat: reload after plug install

This commit is contained in:
max_richter 2021-09-24 12:47:15 +02:00
parent f8b31c0333
commit 00aebc91d5
5 changed files with 39 additions and 30 deletions

View File

@ -59,6 +59,12 @@ if u.has_plugin("cmp") then
o.expandtab = false -- Expand TABs to spaces o.expandtab = false -- Expand TABs to spaces
cmd [[set mouse=a]] cmd [[set mouse=a]]
cmd [[set undofile]] cmd [[set undofile]]
cmd [[set fcs=eob:\ ]]
cmd [[set noshowmode]] --to get rid of thing like --INSERT--
cmd [[set noshowcmd]] --to get rid of display of last command
cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar
cmd [[set noruler]]
-- Apply Theme -- Apply Theme
o.syntax = "enable" o.syntax = "enable"
@ -72,6 +78,8 @@ if u.has_plugin("cmp") then
g.nvim_tree_gitignore = 1 g.nvim_tree_gitignore = 1
g.nvim_tree_auto_open = 1 g.nvim_tree_auto_open = 1
g.nvim_tree_group_empty = 1 g.nvim_tree_group_empty = 1
g.nvim_tree_hide_root_folder = 1
g.nvim_tree_root_folder_modifier = ":~:."
g.nvim_tree_lsp_diagnostics = 1 g.nvim_tree_lsp_diagnostics = 1
g.nvim_tree_special_files = {} g.nvim_tree_special_files = {}
g.nvim_tree_icons = { g.nvim_tree_icons = {
@ -87,8 +95,8 @@ if u.has_plugin("cmp") then
ignored = "" ignored = ""
}, },
folder = { folder = {
arrow_open = "", arrow_open = "",
arrow_closed = "", arrow_closed = "",
default = "", default = "",
open = "", open = "",
empty = "", empty = "",
@ -204,4 +212,5 @@ if u.has_plugin("cmp") then
require "autoformatter" require "autoformatter"
else else
paq.install() paq.install()
cmd [[source $MYVIMRC]]
end end

View File

@ -1,51 +1,50 @@
-- luasnip setup -- luasnip setup
local luasnip = require 'luasnip' local luasnip = require "luasnip"
local cmp = require 'cmp' local cmp = require "cmp"
cmp.setup { cmp.setup {
completion = {
completeopt = "menu,menuone,noselect"
},
preselect = "none",
snippet = { snippet = {
expand = function(args) expand = function(args)
require('luasnip').lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end
}, },
mapping = { mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(), ["<C-Space>"] = cmp.mapping.complete(),
['<C-n>'] = cmp.mapping.select_next_item(), ["<C-e>"] = cmp.mapping.close(),
['<C-d>'] = cmp.mapping.scroll_docs(-4), ["<CR>"] = cmp.mapping.confirm {
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true
}, },
['<Tab>'] = function(fallback) ["<Tab>"] = function(fallback)
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), 'n') vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-n>", true, true, true), "n")
elseif luasnip.expand_or_jumpable() then elseif luasnip.expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-expand-or-jump', true, true, true), '') vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else else
fallback() fallback()
end end
end, end,
['<S-Tab>'] = function(fallback) ["<S-Tab>"] = function(fallback)
if vim.fn.pumvisible() == 1 then if vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<C-p>', true, true, true), 'n') vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<C-p>", true, true, true), "n")
elseif luasnip.jumpable(-1) then elseif luasnip.jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes('<Plug>luasnip-jump-prev', true, true, true), '') vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else else
fallback() fallback()
end end
end, end
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, {name = "nvim_lsp"},
{ name = 'luasnip' }, {name = "luasnip"}
}, }
} }
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. -- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)

View File

@ -3,6 +3,7 @@ local u = require "utils"
-- Config Formatter -- Config Formatter
u.create_augroup( u.create_augroup(
{ {
--{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.svelte", "OrganizeImports"},
{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.lua", "FormatWrite"} {"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.lua", "FormatWrite"}
}, },
"FormatAutogroup" "FormatAutogroup"

View File

@ -10,7 +10,7 @@ g.mapleader = " "
map("n", "<C-p>", ":Telescope find_files<CR>", options) map("n", "<C-p>", ":Telescope find_files<CR>", options)
map("n", "<C-f>", ":Telescope grep_string<CR>", options) map("n", "<C-f>", ":Telescope grep_string<CR>", options)
map("n", "<Leader><C-f>", ":Telescope live_grep<CR>", options) map("n", "<C-S-f>", ":Telescope live_grep<CR>", options)
-- Navigate Buffers -- Navigate Buffers
map("n", "<C-h>", "<C-w>h", options) map("n", "<C-h>", "<C-w>h", options)
map("n", "<C-j>", "<C-w>j", options) map("n", "<C-j>", "<C-w>j", options)

View File

@ -20,9 +20,9 @@ local function on_attach(client)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts) buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts) buf_set_keymap("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) buf_set_keymap("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "<space><C-f>", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) buf_set_keymap("n", "<Leader><C-f>", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts) buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts) buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)