diff --git a/init.lua b/init.lua index 2aa02e96..b9a27321 100644 --- a/init.lua +++ b/init.lua @@ -1,11 +1,14 @@ -- Lua quick doc reference https://learnxinyminutes.com/docs/lua/ -require "core.settings" +-- Sets as the key +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' -- Bootsrap plugin manager require "core.bootstrap-plugin-manager" require "core.plugins" +require "core.settings" require "core.keymaps" require "core.setup" diff --git a/lua/core/keymaps/async/language-servers.lua b/lua/core/keymaps/async/language-servers.lua index 134b3de6..476be3ae 100644 --- a/lua/core/keymaps/async/language-servers.lua +++ b/lua/core/keymaps/async/language-servers.lua @@ -26,13 +26,16 @@ return function(buffer) print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, '[W]orkspace [L]ist Folders') - -- nvim-ufo mappings - nmap("zR", require("ufo").openAllFolds, "Open All Folds") - nmap("zM", require("ufo").closeAllFolds, "Close All Folds") - nmap("zj", function() + local function peekAtFold() local winid = require("ufo").peekFoldedLinesUnderCursor() + if not winid then vim.lsp.buf.hover() end - end, "Peek At Current Fold") + end + + -- nvim-ufo mappings + nmap("zR", require("ufo").openAllFolds, "Open All Folds") + nmap("zM", require("ufo").closeAllFolds, "Close All Folds") + nmap("zj", peekAtFold, "Peek At Current Fold") end diff --git a/lua/core/plugins/file-search.lua b/lua/core/plugins/file-search.lua new file mode 100644 index 00000000..039829be --- /dev/null +++ b/lua/core/plugins/file-search.lua @@ -0,0 +1,19 @@ +return { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + }, +} diff --git a/lua/core/plugins/init.lua b/lua/core/plugins/init.lua index 3310ae7c..1a42cbb2 100644 --- a/lua/core/plugins/init.lua +++ b/lua/core/plugins/init.lua @@ -103,20 +103,7 @@ local plugins = { }, -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, - - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, + require 'core.plugins.file-search', { -- Highlight, edit, and navigate code @@ -137,7 +124,6 @@ local plugins = { require 'core.plugins.todo-comments', - -- require 'core.plugins.neo-tree', require 'core.plugins.project-tree', require 'core.plugins.nvim-ufo', diff --git a/lua/core/settings/init.lua b/lua/core/settings/init.lua index 6a62126c..a6efed22 100644 --- a/lua/core/settings/init.lua +++ b/lua/core/settings/init.lua @@ -1,9 +1,5 @@ -- [[ Setting options ]] --- Sets as the key -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - -- As in nvim-tree docs -- disable netrw at the very start of your init.lua @@ -40,6 +36,9 @@ vim.o.smartcase = true -- Keep signcolumn on by default vim.wo.signcolumn = 'yes' +-- Save undo history +vim.o.undofile = true + -- Decrease update time vim.o.updatetime = 250 vim.o.timeout = true diff --git a/lua/core/setup/language-servers.lua b/lua/core/setup/language-servers.lua index 7a82b67a..0aa3538d 100644 --- a/lua/core/setup/language-servers.lua +++ b/lua/core/setup/language-servers.lua @@ -67,11 +67,6 @@ end require('lspconfig').tsserver.setup { on_attach = tsserver_on_attach, capabilities = capabilities, - init_options = { - preferences = { - disableSuggestions = true - } - }, commands = { OrganizeImports = { organize_imports,