diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index 18f3d90..667f69c 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -117,6 +117,7 @@ cmp.setup({ { name = "luasnip" }, { name = "buffer" }, { name = "path" }, + { name = "nvim_lsp_signature_help" }, }, confirm_opts = { behavior = cmp.ConfirmBehavior.Replace, diff --git a/lua/user/indentline.lua b/lua/user/indentline.lua index dc53b6a..cd93975 100644 --- a/lua/user/indentline.lua +++ b/lua/user/indentline.lua @@ -1,19 +1,19 @@ -local enabled = false +local enabled = true local status_ok, indent_blankline = pcall(require, "indent_blankline") if (not enabled) or (not status_ok) then return end ---indent_blankline.setup { --- char = "▏", --- show_trailing_blankline_indent = false, --- show_first_indent_level = true, --- use_treesitter = true, --- show_current_context = true, --- buftype_exclude = { "terminal", "nofile" }, --- filetype_exclude = { --- "help", --- "packer", --- "NvimTree", --- }, ---} +indent_blankline.setup { + char = "▏", + show_trailing_blankline_indent = false, + show_first_indent_level = true, + use_treesitter = true, + show_current_context = true, + buftype_exclude = { "terminal", "nofile" }, + filetype_exclude = { + "help", + "packer", + "NvimTree", + }, +} diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b2bdef8..08afc9a 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -31,8 +31,8 @@ keymap("n", "", ":vertical resize +2", opts) -- Navigate buffers keymap("n", "", ":BufferLineCycleNext", opts) keymap("n", "", ":BufferLineCyclePrev", opts) -keymap("n", "", "", opts) -keymap("n", "", "", opts) +keymap("n", "H", "", opts) +keymap("n", "L", "", opts) keymap("n", "", ":BufferLineMoveNext", opts) keymap("n", "", ":BufferLineMovePrev", opts) for _, mode in ipairs({"n", "i", "v"}) do @@ -78,9 +78,38 @@ keymap("n", "ff", ":Telescope git_files", opts) keymap("n", "ft", ":Telescope live_grep", opts) keymap("n", "fp", ":Telescope projects", opts) keymap("n", "fb", ":Telescope buffers", opts) -keymap("n", "fs", ":Telescope grep_string", opts) +-- keymap("n", "fs", ":Telescope grep_string", opts) keymap("n", "fr", ":Telescope oldfiles", opts) +function vim.getVisualSelection() + vim.cmd('noau normal! "vy"') + local text = vim.fn.getreg('v') + vim.fn.setreg('v', {}) + + text = string.gsub(text, "\n", "") + if #text > 0 then + return text + else + return '' + end +end + + + +-- keymap('n', 'fs', ':Telescope current_buffer_fuzzy_find', opts) +-- keymap('v', 'fs', function() +-- local tb = require('telescope.builtin') +-- local text = vim.getVisualSelection() +-- tb.current_buffer_fuzzy_find({ default_text = text }) +-- end, opts) + +keymap('n', 'fs', ':Telescope grep_string', opts) +keymap('v', 'fs', function() + local tb = require('telescope.builtin') + local text = vim.getVisualSelection() + tb.live_grep({ default_text = text }) +end, opts) + -- Git --keymap("n", "gg", "lua _LAZYGIT_TOGGLE()", opts) @@ -129,12 +158,6 @@ keymap("i", "", "", opts) keymap("n", "j", "gj") keymap("n", "k", "gk") --- use Alt + ijkl to move in insert mode -keymap("i", "", "", opts) -keymap("i", "", "", opts) -keymap("i", "", "gj", opts) -keymap("i", "", "gk", opts) - local function clean_screen() vim.o.number = not vim.o.number; --if not vim.diagnostic.get_next() then return end diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index df4bcdf..e63511e 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -5,9 +5,10 @@ if not status_cmp_ok then return end -M.capabilities = vim.lsp.protocol.make_client_capabilities() +-- M.capabilities = vim.lsp.protocol.make_client_capabilities() +M.capabilities = cmp_nvim_lsp.default_capabilities() M.capabilities.textDocument.completion.completionItem.snippetSupport = true -M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities) +-- M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities) M.setup = function() local signs = { diff --git a/lua/user/lsp/mason.lua b/lua/user/lsp/mason.lua index 5a0b37d..1c86b6b 100644 --- a/lua/user/lsp/mason.lua +++ b/lua/user/lsp/mason.lua @@ -10,7 +10,8 @@ local servers = { "rust_analyzer", "gopls", "clangd", - "taplo" + "taplo", + "phpactor", } local settings = { diff --git a/lua/user/lsp/settings/yamlls.lua b/lua/user/lsp/settings/yamlls.lua new file mode 100644 index 0000000..2f186af --- /dev/null +++ b/lua/user/lsp/settings/yamlls.lua @@ -0,0 +1,7 @@ +return { + settings = { + yaml = { + keyOrdering = false + }, + }, +} diff --git a/lua/user/lsp/signature.lua b/lua/user/lsp/signature.lua new file mode 100644 index 0000000..b59798f --- /dev/null +++ b/lua/user/lsp/signature.lua @@ -0,0 +1,11 @@ +local ok, lsp_signature = pcall(require, "lsp_signature") +if not ok then + return +end + +lsp_signature.setup({ + bind = true, + handler_opts = { + border = "rounded", + }, +}) diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index ffad3c4..ebd0561 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -57,7 +57,7 @@ return packer.startup(function(use) use({ "akinsho/toggleterm.nvim", commit = "2a787c426ef00cb3488c11b14f5dcf892bbd0bda" }) use({ "ahmedkhalf/project.nvim", commit = "628de7e433dd503e782831fe150bb750e56e55d6" }) use({ "lewis6991/impatient.nvim", commit = "b842e16ecc1a700f62adb9802f8355b99b52a5a6" }) - --use { "lukas-reineke/indent-blankline.nvim", commit = "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" } + use { "lukas-reineke/indent-blankline.nvim", commit = "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" } use({ "goolord/alpha-nvim", commit = "0bb6fc0646bcd1cdb4639737a1cee8d6e08bcc31" }) -- Colorschemes @@ -70,7 +70,8 @@ return packer.startup(function(use) use({ "hrsh7th/cmp-buffer", commit = "3022dbc9166796b644a841a02de8dd1cc1d311fa" }) -- buffer completions use({ "hrsh7th/cmp-path", commit = "447c87cdd6e6d6a1d2488b1d43108bfa217f56e1" }) -- path completions use({ "saadparwaiz1/cmp_luasnip", commit = "a9de941bcbda508d0a45d28ae366bb3f08db2e36" }) -- snippet completions - use({ "hrsh7th/cmp-nvim-lsp", commit = "affe808a5c56b71630f17aa7c38e15c59fd648a8" }) + use({ "hrsh7th/cmp-nvim-lsp" }) + use({ "hrsh7th/cmp-nvim-lsp-signature-help" }) use({ "hrsh7th/cmp-nvim-lua", commit = "d276254e7198ab7d00f117e88e223b4bd8c02d21" }) -- snippets @@ -121,6 +122,9 @@ return packer.startup(function(use) use({ "mbbill/undotree" }) use({ "folke/trouble.nvim" }) + use({ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }) + -- use({ "ray-x/lsp_signature.nvim" }) + use({ "ray-x/lsp_signature.nvim" }) -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua index 33f8102..ff24d4f 100644 --- a/lua/user/telescope.lua +++ b/lua/user/telescope.lua @@ -21,5 +21,17 @@ telescope.setup { [""] = actions.move_selection_previous, }, }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } }, } + +telescope.load_extension('fzf') +