aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksa Vuckovic <aleksa@vuckovic.cc>2023-02-25 01:49:02 +0100
committerAleksa Vuckovic <aleksa@vuckovic.cc>2023-02-25 01:49:02 +0100
commite37e216a65a8b0df58dce366f50a4d8b896cde0b (patch)
tree258e141859e8b88276fc3553d307cc41f69e6550
parent336b2de4b36ad9eafdef6c5e882bc08a66d7c959 (diff)
few small fixes
-rw-r--r--lua/user/bufferline.lua4
-rw-r--r--lua/user/cmp.lua7
-rw-r--r--lua/user/keymaps.lua2
-rw-r--r--lua/user/lsp/handlers.lua21
-rw-r--r--lua/user/options.lua2
5 files changed, 17 insertions, 19 deletions
diff --git a/lua/user/bufferline.lua b/lua/user/bufferline.lua
index fb7431b..f013e0e 100644
--- a/lua/user/bufferline.lua
+++ b/lua/user/bufferline.lua
@@ -7,8 +7,8 @@ end
bufferline.setup {
options = {
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
- close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
- right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
+ close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
+ right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
-- NOTE: this plugin is designed with this icon in mind,
diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua
index bb475a3..3d7569b 100644
--- a/lua/user/cmp.lua
+++ b/lua/user/cmp.lua
@@ -16,7 +16,6 @@ local check_backspace = function()
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
end
---   פּ ﯟ   some other good icons
local kind_icons = {
Text = "",
Method = "m",
@@ -51,13 +50,13 @@ cmp.setup {
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
+
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs( -1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
- ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-e>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
@@ -97,9 +96,7 @@ cmp.setup {
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
- -- Kind icons
- vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
- -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
+ vim_item.kind = kind_icons[vim_item.kind]
vim_item.menu = ({
nvim_lsp = "[LSP]",
luasnip = "[Snippet]",
diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua
index 17f015b..f3ac5e9 100644
--- a/lua/user/keymaps.lua
+++ b/lua/user/keymaps.lua
@@ -10,6 +10,8 @@ keymap("", "<Space>", "<Nop>", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
+keymap("n", "<leader>f", ":lua vim.lsp.buf.format()<CR>", opts)
+
-- Modes
-- normal_mode = "n",
-- insert_mode = "i",
diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua
index eabeae6..5c4bb88 100644
--- a/lua/user/lsp/handlers.lua
+++ b/lua/user/lsp/handlers.lua
@@ -1,5 +1,15 @@
local M = {}
+local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
+if not cmp_nvim_lsp_status then
+ print("lsp/handlers.lua: loading cmp_nvim_lsp failed")
+ return
+end
+
+M.capabilities = vim.lsp.protocol.make_client_capabilities()
+M.capabilities.textDocument.completion.completionItem.snippetSupport = true
+M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
+
M.setup = function()
local signs = {
{ name = "DiagnosticSignError", text = "" },
@@ -13,9 +23,7 @@ M.setup = function()
end
local config = {
- -- disable virtual text
virtual_text = true,
- -- show signs
signs = {
active = signs,
},
@@ -93,14 +101,5 @@ M.on_attach = function(client, bufnr)
lsp_highlight_document(client)
end
-local capabilities = vim.lsp.protocol.make_client_capabilities()
-
-local cmp_nvim_lsp_status, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
-if not cmp_nvim_lsp_status then
- print("lsp/handlers.lua: loading cmp_nvim_lsp failed")
- return
-end
-
-M.capabilities = cmp_nvim_lsp.default_capabilities(capabilities)
return M
diff --git a/lua/user/options.lua b/lua/user/options.lua
index 5a0433c..03b5c04 100644
--- a/lua/user/options.lua
+++ b/lua/user/options.lua
@@ -23,7 +23,7 @@ local options = {
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = false, -- convert tabs to spaces
shiftwidth = 8, -- the number of spaces inserted for each indentation
- tabstop = 8, -- insert 4 spaces for a tab
+ tabstop = 8, -- insert 8 spaces for a tab
preserveindent = true,
softtabstop = 0,
cursorline = true, -- highlight the current line