diff --git a/init.lua b/init.lua index ce2b511..b6ce6eb 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,8 @@ +require( "roka.core.options" ) +require( "roka.core.keymaps" ) +require( "roka.core.plugins" ) -require( "roka.core.options") -require( "roka.core.keymaps") -require( "roka.core.plugins") - -require( "roka.plug.color" ) \ No newline at end of file +require( "roka.plug.color" ) +require( "roka.plug.mason" ) +require( "roka.plug.rust-tools" ) diff --git a/lua/roka/core/plugins.lua b/lua/roka/core/plugins.lua index ea2ca31..a94cd1c 100644 --- a/lua/roka/core/plugins.lua +++ b/lua/roka/core/plugins.lua @@ -62,6 +62,19 @@ return packer.startup(function(use) use "wbthomason/packer.nvim" + -- ---------------------------------------------------- + -- plugin to install and manage LSP servers + -- ---------------------------------------------------- + use "williamboman/mason.nvim" + use "williamboman/mason-lspconfig.nvim" + + -- ---------------------------------------------------- + -- attaching neovim to rust-analyzer + -- ---------------------------------------------------- + use "neovim/nvim-lspconfig" + use "simrat39/rust-tools.nvim" + + use "lewis6991/impatient.nvim" -- ---------------------------------------------------- @@ -104,7 +117,7 @@ return packer.startup(function(use) end } - -- ---------------------------------------------------- + -- ---------------------------------------------------- -- nvim-tree -- ---------------------------------------------------- use { @@ -115,25 +128,25 @@ return packer.startup(function(use) end } - -- -------------------------------------------------------------- + -- -------------------------------------------------------------- -- autocompletion -- -------------------------------------------------------------- - use { - "hrsh7th/nvim-cmp", - - requires = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-calc", - "saadparwaiz1/cmp_luasnip", - }, - - config = function() - require( "roka.plug.nvim-cmp") - end - } +-- use { +-- "hrsh7th/nvim-cmp", +-- +-- requires = { +-- "hrsh7th/cmp-nvim-lsp", +-- "hrsh7th/cmp-nvim-lua", +-- "hrsh7th/cmp-buffer", +-- "hrsh7th/cmp-path", +-- "hrsh7th/cmp-calc", +-- "saadparwaiz1/cmp_luasnip", +-- }, +-- +-- config = function() +-- require( "roka.plug.nvim-cmp") +-- end +-- } -- -------------------------------------------------------------- -- autocompletion/snippets @@ -143,6 +156,39 @@ return packer.startup(function(use) "rafamadriz/friendly-snippets", -- Optional } + -- -------------------------------------------------------------- + -- treesitter + -- -------------------------------------------------------------- + use { + "nvim-treesitter/nvim-treesitter", + run = function() + local ts_update = require('nvim-treesitter.install').update({ with_sync = true}) + ts_update() + end, + + build = ":TSUpdate", + + config = function() + require'nvim-treesitter.configs'.setup { + ensure_installed = {"c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "rust"}, + auto_install = false, + highlight = { + enable = true, + disable= function( lang, buf) + local max_filesize = 100 * 1024 + local ok, stats = pcall( vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + + if ok and stats and stats.size > max_filesize then + return true + end + end, + + additional_vim_regex_highlighting = false, + }, + } + end, + } + -- ------------------------------------------------------------------- -- Automatically set up your configuration after cloning packer.nvim. -- Put this at the end after all plugins. diff --git a/lua/roka/plug/mason.lua b/lua/roka/plug/mason.lua new file mode 100644 index 0000000..e8066b9 --- /dev/null +++ b/lua/roka/plug/mason.lua @@ -0,0 +1,17 @@ +local status, mason= pcall(require, "mason") +if not status then + return +end + +mason.setup({ + ui = { + icons = { + package_installed = "", + package_pending = "", + package_uninstalled = "", + }, + }, +}) + +require("mason-lspconfig").setup() + diff --git a/lua/roka/plug/rust-tools.lua b/lua/roka/plug/rust-tools.lua new file mode 100644 index 0000000..dc4554e --- /dev/null +++ b/lua/roka/plug/rust-tools.lua @@ -0,0 +1,15 @@ +local status, rt = pcall(require, "rust-tools") +if not status then + return +end + +rt.setup({ + server = { + on_attach = function(_, bufnr) + -- Hover actions + vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) + -- Code action groups + vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) + end, + }, +})