From 00aebc91d514c1a52b14cb54e9c1e549661a6303 Mon Sep 17 00:00:00 2001 From: Max Richter Date: Fri, 24 Sep 2021 12:47:15 +0200 Subject: [PATCH] feat: reload after plug install --- configs/init.lua | 13 ++++++++-- configs/lua/autocomplete.lua | 47 +++++++++++++++++------------------ configs/lua/autoformatter.lua | 1 + configs/lua/keymappings.lua | 2 +- configs/lua/lsp-utils.lua | 6 ++--- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/configs/init.lua b/configs/init.lua index b41bff9..4460509 100644 --- a/configs/init.lua +++ b/configs/init.lua @@ -59,6 +59,12 @@ if u.has_plugin("cmp") then o.expandtab = false -- Expand TABs to spaces cmd [[set mouse=a]] 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 o.syntax = "enable" @@ -72,6 +78,8 @@ if u.has_plugin("cmp") then g.nvim_tree_gitignore = 1 g.nvim_tree_auto_open = 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_special_files = {} g.nvim_tree_icons = { @@ -87,8 +95,8 @@ if u.has_plugin("cmp") then ignored = "◌" }, folder = { - arrow_open = "", - arrow_closed = "", + arrow_open = "", + arrow_closed = "", default = "", open = "", empty = "", @@ -204,4 +212,5 @@ if u.has_plugin("cmp") then require "autoformatter" else paq.install() + cmd [[source $MYVIMRC]] end diff --git a/configs/lua/autocomplete.lua b/configs/lua/autocomplete.lua index ed40b57..cc8f415 100644 --- a/configs/lua/autocomplete.lua +++ b/configs/lua/autocomplete.lua @@ -1,51 +1,50 @@ - -- luasnip setup -local luasnip = require 'luasnip' +local luasnip = require "luasnip" -local cmp = require 'cmp' +local cmp = require "cmp" cmp.setup { + completion = { + completeopt = "menu,menuone,noselect" + }, + preselect = "none", snippet = { expand = function(args) - require('luasnip').lsp_expand(args.body) - end, + require("luasnip").lsp_expand(args.body) + end }, mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.close(), + [""] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, - select = true, + select = true }, - [''] = function(fallback) + [""] = function(fallback) if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, true, true), 'n') + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") elseif luasnip.expand_or_jumpable() then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-expand-or-jump', true, true, true), '') + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") else fallback() end end, - [''] = function(fallback) + [""] = function(fallback) if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('', true, true, true), 'n') + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("", true, true, true), "n") elseif luasnip.jumpable(-1) then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes('luasnip-jump-prev', true, true, true), '') + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") else fallback() end - end, + end }, sources = { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - }, + {name = "nvim_lsp"}, + {name = "luasnip"} + } } -- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities) diff --git a/configs/lua/autoformatter.lua b/configs/lua/autoformatter.lua index 157b633..7802d30 100644 --- a/configs/lua/autoformatter.lua +++ b/configs/lua/autoformatter.lua @@ -3,6 +3,7 @@ local u = require "utils" -- Config Formatter u.create_augroup( { + --{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.svelte", "OrganizeImports"}, {"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.lua", "FormatWrite"} }, "FormatAutogroup" diff --git a/configs/lua/keymappings.lua b/configs/lua/keymappings.lua index 1f11d6a..01b892c 100644 --- a/configs/lua/keymappings.lua +++ b/configs/lua/keymappings.lua @@ -10,7 +10,7 @@ g.mapleader = " " map("n", "", ":Telescope find_files", options) map("n", "", ":Telescope grep_string", options) -map("n", "", ":Telescope live_grep", options) +map("n", "", ":Telescope live_grep", options) -- Navigate Buffers map("n", "", "h", options) map("n", "", "j", options) diff --git a/configs/lua/lsp-utils.lua b/configs/lua/lsp-utils.lua index c6d04f6..736bf7c 100644 --- a/configs/lua/lsp-utils.lua +++ b/configs/lua/lsp-utils.lua @@ -20,9 +20,9 @@ local function on_attach(client) buf_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) - buf_set_keymap("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) - buf_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) - buf_set_keymap("n", "", "lua vim.lsp.buf.code_action()", opts) + buf_set_keymap("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) + buf_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) + buf_set_keymap("n", "", "lua vim.lsp.buf.code_action()", opts) buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts)