Better rust LSP, slimmer configs, catpuccin
This commit is contained in:
@@ -30,7 +30,6 @@ O.termguicolors=true
|
||||
--}
|
||||
O.clipboard='unnamedplus'
|
||||
|
||||
V.cmd("colorscheme lunaperche")
|
||||
|
||||
--------------------------
|
||||
---- Config Section -----
|
||||
@@ -80,32 +79,24 @@ local packer = require('packer')
|
||||
packer.startup({function(u)
|
||||
u 'wbthomason/packer.nvim'
|
||||
|
||||
-- Colorscheme
|
||||
u {
|
||||
'catppuccin/nvim', as = 'catppuccin'
|
||||
}
|
||||
|
||||
-- LSP + Autocomplete
|
||||
u 'neovim/nvim-lspconfig'
|
||||
u 'williamboman/mason.nvim'
|
||||
u 'williamboman/mason-lspconfig.nvim'
|
||||
u 'neovim/nvim-lspconfig'
|
||||
u 'hrsh7th/nvim-cmp'
|
||||
u 'hrsh7th/cmp-nvim-lsp'
|
||||
u 'hrsh7th/cmp-buffer'
|
||||
u 'hrsh7th/cmp-path'
|
||||
u 'L3MON4D3/LuaSnip'
|
||||
u 'Sirver/ultisnips'
|
||||
u 'simrat39/rust-tools.nvim'
|
||||
u 'honza/vim-snippets'
|
||||
u {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v2.x'
|
||||
}
|
||||
|
||||
-- Debugging
|
||||
u 'puremourning/vimspector'
|
||||
|
||||
-- Markdown
|
||||
u 'godlygeek/tabular'
|
||||
u 'elzr/vim-json'
|
||||
u 'preservim/vim-markdown'
|
||||
u 'vim-pandoc/vim-pandoc-syntax'
|
||||
u 'itchyny/calendar.vim'
|
||||
u 'junegunn/goyo.vim'
|
||||
u 'junegunn/limelight.vim'
|
||||
|
||||
@@ -162,22 +153,44 @@ config = {
|
||||
--- 5 --- Plugins conf----
|
||||
--------------------------
|
||||
|
||||
local telescope = require('telescope')
|
||||
telescope.setup();
|
||||
V.cmd("colorscheme catppuccin")
|
||||
V.cmd("let g:lightline = {'colorscheme': 'catppuccin'}")
|
||||
|
||||
local lsp = require('lsp-zero').preset({})
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
lsp.default_keymaps({buffer = bufnr})
|
||||
end)
|
||||
require('telescope').setup()
|
||||
|
||||
lsp.ensure_installed({
|
||||
'tsserver',
|
||||
'eslint',
|
||||
'rust_analyzer',
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup()
|
||||
require("lspconfig").rust_analyzer.setup {}
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>ff', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
lsp.setup();
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.setup {
|
||||
mapping = {
|
||||
@@ -299,7 +312,6 @@ keymap("x", "tt", ":ToggleTerm<cr>", opts)
|
||||
keymap('n', '<leader>tf', ':TableFormat<cr>', opts)
|
||||
keymap('n', '<leader>tc', ':Toc<cr>', opts)
|
||||
keymap('n', '<leader>di', ":pu='{'..strftime('%c')..'}'<cr>", opts)
|
||||
keymap('n', '<leader>cs', ":Calendar -view=year -height=12 -split=vertical -position=topright<cr>", opts)
|
||||
keymap('n', '<leader>o', 'o<esc>i', opts)
|
||||
keymap('n', '<leader>fy', ':let @+=@%<cr>', opts)
|
||||
keymap('n', 'gn', 'yi[:e <C-r>*<cr>', opts)
|
||||
|
||||
Reference in New Issue
Block a user