Rust tools
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
|
require( "roka.core.options" )
|
||||||
require( "roka.core.options")
|
require( "roka.core.keymaps" )
|
||||||
require( "roka.core.keymaps")
|
require( "roka.core.plugins" )
|
||||||
require( "roka.core.plugins")
|
|
||||||
|
|
||||||
require( "roka.plug.color" )
|
require( "roka.plug.color" )
|
||||||
|
require( "roka.plug.mason" )
|
||||||
|
require( "roka.plug.rust-tools" )
|
||||||
|
|||||||
+62
-16
@@ -62,6 +62,19 @@ return packer.startup(function(use)
|
|||||||
use "wbthomason/packer.nvim"
|
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"
|
use "lewis6991/impatient.nvim"
|
||||||
|
|
||||||
-- ----------------------------------------------------
|
-- ----------------------------------------------------
|
||||||
@@ -118,22 +131,22 @@ return packer.startup(function(use)
|
|||||||
-- --------------------------------------------------------------
|
-- --------------------------------------------------------------
|
||||||
-- autocompletion
|
-- autocompletion
|
||||||
-- --------------------------------------------------------------
|
-- --------------------------------------------------------------
|
||||||
use {
|
-- use {
|
||||||
"hrsh7th/nvim-cmp",
|
-- "hrsh7th/nvim-cmp",
|
||||||
|
--
|
||||||
requires = {
|
-- requires = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
-- "hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-nvim-lua",
|
-- "hrsh7th/cmp-nvim-lua",
|
||||||
"hrsh7th/cmp-buffer",
|
-- "hrsh7th/cmp-buffer",
|
||||||
"hrsh7th/cmp-path",
|
-- "hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-calc",
|
-- "hrsh7th/cmp-calc",
|
||||||
"saadparwaiz1/cmp_luasnip",
|
-- "saadparwaiz1/cmp_luasnip",
|
||||||
},
|
-- },
|
||||||
|
--
|
||||||
config = function()
|
-- config = function()
|
||||||
require( "roka.plug.nvim-cmp")
|
-- require( "roka.plug.nvim-cmp")
|
||||||
end
|
-- end
|
||||||
}
|
-- }
|
||||||
|
|
||||||
-- --------------------------------------------------------------
|
-- --------------------------------------------------------------
|
||||||
-- autocompletion/snippets
|
-- autocompletion/snippets
|
||||||
@@ -143,6 +156,39 @@ return packer.startup(function(use)
|
|||||||
"rafamadriz/friendly-snippets", -- Optional
|
"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.
|
-- Automatically set up your configuration after cloning packer.nvim.
|
||||||
-- Put this at the end after all plugins.
|
-- Put this at the end after all plugins.
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|
||||||
@@ -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", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||||
|
-- Code action groups
|
||||||
|
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user