diff --git a/.gitignore b/.gitignore index 8cb205e..c362a62 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ plugin +.DS_Store diff --git a/README.md b/README.md index c570813..7a24cfb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Neovim Config -## Requirements: +## Requirements * Git * [ripgrep](https://github.com/BurntSushi/ripgrep) * [fd](https://github.com/sharkdp/fd) diff --git a/lua/core/init.lua b/lua/core/init.lua index dc30d24..2e27c67 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -21,3 +21,6 @@ opt.expandtab = true opt.smartindent = true opt.shiftwidth = 4 opt.tabstop = 4 + +-- Neovide GUI +require("core.neovide") diff --git a/lua/core/neovide.lua b/lua/core/neovide.lua new file mode 100644 index 0000000..0e8c73e --- /dev/null +++ b/lua/core/neovide.lua @@ -0,0 +1,16 @@ +local g = vim.g +local keymap = vim.keymap + +g.neovide_scale_factor = 1.0 + +local change_scale_factor = function(delta) + g.neovide_scale_factor = g.neovide_scale_factor * delta +end + +keymap.set("n", "", function() + change_scale_factor(1.25) +end) + +keymap.set("n", "", function() + change_scale_factor(1/1.25) +end) diff --git a/lua/plugins/config/cmp.lua b/lua/plugins/config/cmp.lua index 0baef0b..d8dac32 100644 --- a/lua/plugins/config/cmp.lua +++ b/lua/plugins/config/cmp.lua @@ -18,7 +18,7 @@ cmp.setup { }), sources = cmp.config.sources({ - { name = "nvim_lsp" }, + { name = "nvim-lsp" }, { name = "luasnip" } }, { { name = "buffer" } diff --git a/lua/plugins/config/illuminate.lua b/lua/plugins/config/illuminate.lua new file mode 100644 index 0000000..d379a83 --- /dev/null +++ b/lua/plugins/config/illuminate.lua @@ -0,0 +1,3 @@ +require("illuminate").configure { + +} diff --git a/lua/plugins/config/mason.lua b/lua/plugins/config/mason.lua new file mode 100644 index 0000000..235b9a6 --- /dev/null +++ b/lua/plugins/config/mason.lua @@ -0,0 +1,10 @@ +local mason = require("mason-lspconfig") +local lsp = require("lspconfig") + +mason.setup{} + +mason.setup_handlers { + function (server_name) + lsp[server_name].setup{} + end +} diff --git a/lua/plugins/config/toggleterm.lua b/lua/plugins/config/toggleterm.lua index 79e4393..9d5cb77 100644 --- a/lua/plugins/config/toggleterm.lua +++ b/lua/plugins/config/toggleterm.lua @@ -1,5 +1,13 @@ require("toggleterm").setup { - open_mapping = [[]], + size = function(term) + if term.direction == "horizontal" then + return 25 + elseif term.direction == "vertical" then + return vim.o.columns * 0.4 + end + end, + + open_mapping = [[]], direction = "float", float_opts = { border = "curved" diff --git a/lua/plugins/config/whichkey.lua b/lua/plugins/config/whichkey.lua index 0e6025a..9de3c90 100644 --- a/lua/plugins/config/whichkey.lua +++ b/lua/plugins/config/whichkey.lua @@ -13,6 +13,7 @@ wk.register({ name = "Find", f = { "Telescope fd", "find file" }, w = { "Telescope live_grep", "live grep" }, + s = { "Telescope spell_suggest", "spell suggest" }, b = { "Telescope buffers", "all buffers" }, t = { "TodoTelescope", "todos" }, ["."] = { "Telescope keymaps", "keymaps" } @@ -20,15 +21,18 @@ wk.register({ l = { name = "LSP", - r = { "lua vim.lsp.buf.rename()", "rename" }, + r = { "lua require('cosmic-ui').rename()", "rename" }, d = { "Telescope diagnostics", "diagnostics" }, f = { "lua vim.lsp.buf.format { async = true }", "format" }, - a = { "lua vim.lsp.buf.code_action()", "code action" } + a = { "CodeActionMenu", "code action" } }, b = { name = "Buffer", - p = { "BufferPick", "pick buffer" } + p = { "BufferPick", "pick buffer" }, + q = { "BufferMovePrevious", "move buffer left" }, + w = { "BufferMoveNext", "move buffer right" }, + x = { "BufferCloseAllButCurrent", "close all but current" } }, g = { @@ -42,7 +46,13 @@ wk.register({ x = { "BufferClose", "close buffer" }, r = { "NvimTreeRefresh", "refresh tree" }, c = { "Telescope colorscheme", "colorscheme" }, - s = { "SymbolsOutline", "symbols outline" } + s = { "SymbolsOutline", "symbols outline" }, + h = { "noh", "no highlight" }, + + t = { + name = "Terminal", + t = { "ToggleTerm direction=horizontal", "open terminal" } + } }, t = { @@ -61,9 +71,12 @@ wk.register({ [""] = { "lua vim.lsp.buf.signature_help()", "signature help" }, -- Nvim Tree - [""] = { "NvimTreeToggle", "toggle nvimtree" }, + [""] = { "NvimTreeToggle .", "toggle nvimtree" }, -- Switching Buffers [""] = { "BufferNext", "next buffer" }, - [""] = { "BufferPrevious", "previous buffer" } + [""] = { "BufferPrevious", "previous buffer" }, + + -- Find in file + [""] = { "Telescope current_buffer_fuzzy_find", "find in file" } }) diff --git a/lua/plugins/setup.lua b/lua/plugins/setup.lua index 101d1a6..cf666e2 100644 --- a/lua/plugins/setup.lua +++ b/lua/plugins/setup.lua @@ -82,4 +82,161 @@ return packer.startup(function(use) require("plugins.config.blankline") end } + + use { + "numToStr/Comment.nvim", + config = function() + require("Comment").setup() + end + } + + use { + "akinsho/toggleterm.nvim", + tag = "*", + config = function() + require("plugins.config.toggleterm") + end + } + + use { + "goolord/alpha-nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("alpha").setup(require("alpha.themes.dashboard").config) + end + } + + -- Teleport + + use { + "nvim-telescope/telescope-fzf-native.nvim", + run = "make" + } + + use { + "nvim-telescope/telescope.nvim", + tag = "0.1.1", + requires = "nvim-lua/plenary.nvim", + config = function() + require("plugins.config.telescope") + end + } + + -- LSP + use { + "williamboman/mason.nvim", + requires = "neovim/nvim-lspconfig", + config = function() + require("mason").setup() + end + } + + use { + "williamboman/mason-lspconfig.nvim", + requires = { + "neovim/nvim-lspconfig", + "williamboman/mason.nvim" + }, + config = function() + require("plugins.config.mason") + end + } + + use { + "hrsh7th/nvim-cmp", + requires = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip" + }, + config = function() + require("plugins.config.cmp") + end + } + + use { + "rafamadriz/friendly-snippets", + requires = "L3MON4D3/LuaSnip" + } + + use { + "ray-x/lsp_signature.nvim", + after = "nvim-lspconfig", + config = function() + require("lsp_signature").setup() + end + } + + use { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup() + end + } + + use { + "folke/trouble.nvim", + requires = "kyazdani42/nvim-web-devicons", + config = function() + require("trouble").setup() + end + } + + use { + "folke/todo-comments.nvim", + requires = "nvim-lua/plenary.nvim", + config = function() + require("todo-comments").setup() + end + } + + use { + "simrat39/symbols-outline.nvim", + config = function() + require("symbols-outline").setup() + end + } + + use { + "folke/which-key.nvim", + config = function() + require("plugins.config.whichkey") + end + } + + use { + "RRethy/vim-illuminate", + requires = "neovim/nvim-lspconfig" + } + + use { + "weilbith/nvim-code-action-menu", + requires = "neovim/nvim-lspconfig", + cmd = "CodeActionMenu" + } + + use { + "ellisonleao/glow.nvim", + config = function() + require("glow").setup() + end + } + + use { + "CosmicNvim/cosmic-ui", + requires = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim" + }, + config = function() + require("cosmic-ui").setup() + end + } + + if packer_bootstrap then + require("packer").sync() + end end)