many changes
This commit is contained in:
parent
eee6a71ac8
commit
6c6b4aadf8
@ -10,6 +10,8 @@ end
|
|||||||
|
|
||||||
require('packer').startup(function(use)
|
require('packer').startup(function(use)
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
-- * nvim specific plugins * --
|
||||||
use { -- LSP Configuration & Plugins
|
use { -- LSP Configuration & Plugins
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
requires = {
|
requires = {
|
||||||
@ -18,21 +20,39 @@ require('packer').startup(function(use)
|
|||||||
'j-hui/fidget.nvim',
|
'j-hui/fidget.nvim',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
use { -- Autocompletion
|
|
||||||
|
use { -- Autocompletion (cmp)
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
requires = {
|
||||||
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'L3MON4D3/LuaSnip',
|
||||||
|
'saadparwaiz1/cmp_luasnip'
|
||||||
|
},
|
||||||
}
|
}
|
||||||
use { -- Highlight, edit, and navigate code
|
|
||||||
|
use { -- Highlighting/nav/editing (TreeSitter)
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
run = function()
|
run = function()
|
||||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use { -- File Explorer
|
||||||
|
'nvim-tree/nvim-tree.lua',
|
||||||
|
requires = {
|
||||||
|
'nvim-tree/nvim-web-devicons', -- optional, for file icons
|
||||||
|
},
|
||||||
|
tag = 'nightly'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- * vanilla vim plugins * --
|
||||||
|
|
||||||
-- normal mode keybinds
|
-- normal mode keybinds
|
||||||
use 'tpope/vim-commentary'
|
use 'tpope/vim-commentary'
|
||||||
use 'tpope/vim-surround'
|
use 'tpope/vim-surround'
|
||||||
use 'tpope/vim-unimpaired'
|
use 'tpope/vim-unimpaired'
|
||||||
|
|
||||||
-- command mode keybinds
|
-- command mode keybinds
|
||||||
use 'tpope/vim-rsi'
|
use 'tpope/vim-rsi'
|
||||||
use 'tpope/vim-eunuch'
|
use 'tpope/vim-eunuch'
|
||||||
@ -43,11 +63,11 @@ require('packer').startup(function(use)
|
|||||||
use 'tpope/vim-rhubarb'
|
use 'tpope/vim-rhubarb'
|
||||||
use 'airblade/vim-gitgutter'
|
use 'airblade/vim-gitgutter'
|
||||||
|
|
||||||
|
-- fzf
|
||||||
use { 'junegunn/fzf', run = ":call fzf#install()" }
|
use { 'junegunn/fzf', run = ":call fzf#install()" }
|
||||||
use { 'junegunn/fzf.vim' }
|
use { 'junegunn/fzf.vim' }
|
||||||
|
|
||||||
-- colorschemes
|
-- colorschemes
|
||||||
use 'nanotech/jellybeans.vim'
|
|
||||||
use({
|
use({
|
||||||
'rose-pine/neovim',
|
'rose-pine/neovim',
|
||||||
as = 'rose-pine',
|
as = 'rose-pine',
|
||||||
@ -56,42 +76,3 @@ require('packer').startup(function(use)
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- vim.cmd [[
|
|
||||||
-- let autoload_plug_path = stdpath('data') . '/site/autoload/plug.vim'
|
|
||||||
-- if !filereadable(autoload_plug_path)
|
|
||||||
-- silent execute '!curl -fLo ' . autoload_plug_path . ' --create-dirs
|
|
||||||
-- \ "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"'
|
|
||||||
-- autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
||||||
-- endif
|
|
||||||
-- unlet autoload_plug_path
|
|
||||||
-- ]]
|
|
||||||
-- local Plug = vim.fn['plug#']
|
|
||||||
-- vim.call('plug#begin', '~/.config/nvim/plugged')
|
|
||||||
-- -- plug
|
|
||||||
-- Plug 'junegunn/vim-plug'
|
|
||||||
|
|
||||||
-- -- normal mode keybinds
|
|
||||||
-- Plug 'tpope/vim-commentary'
|
|
||||||
-- Plug 'tpope/vim-surround'
|
|
||||||
-- Plug 'tpope/vim-unimpaired'
|
|
||||||
-- -- command mode keybinds
|
|
||||||
-- Plug 'tpope/vim-rsi'
|
|
||||||
-- Plug 'tpope/vim-eunuch'
|
|
||||||
-- Plug 'tpope/vim-repeat'
|
|
||||||
|
|
||||||
-- -- external tools
|
|
||||||
-- -- git
|
|
||||||
-- Plug 'tpope/vim-fugitive'
|
|
||||||
-- Plug 'tpope/vim-rhubarb'
|
|
||||||
-- Plug 'tpope/vim-dispatch'
|
|
||||||
-- Plug 'airblade/vim-gitgutter'
|
|
||||||
|
|
||||||
-- -- fzf
|
|
||||||
-- Plug 'junegunn/fzf'
|
|
||||||
-- Plug 'junegunn/fzf.vim'
|
|
||||||
|
|
||||||
-- -- colors
|
|
||||||
-- Plug 'flazz/vim-colorschemes'
|
|
||||||
-- vim.call('plug#end')
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
require('plugin-config.nvim-treesitter')
|
-- lsp
|
||||||
require('plugin-config.lsp')
|
require('plugin-config.lsp')
|
||||||
|
|
||||||
|
-- completion
|
||||||
require('plugin-config.cmp')
|
require('plugin-config.cmp')
|
||||||
|
|
||||||
|
-- treesitter (syntax highlighting)
|
||||||
|
require('plugin-config.nvim-treesitter')
|
||||||
|
|
||||||
|
-- nvim-tree
|
||||||
|
require('plugin-config.nvim-tree')
|
||||||
|
|
||||||
-- plugin keybinds
|
-- plugin keybinds
|
||||||
require('plugin-config.keybinds.vim-fugitive')
|
require('plugin-config.keybinds.vim-fugitive')
|
||||||
require('plugin-config.keybinds.fzf')
|
require('plugin-config.keybinds.fzf')
|
||||||
|
require('plugin-config.keybinds.nvim-tree')
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- NvimTree
|
||||||
|
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<cr>')
|
||||||
@ -4,15 +4,7 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
|||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
||||||
|
|
||||||
-- LSP settings.
|
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
|
||||||
local on_attach = function(_, bufnr)
|
local on_attach = function(_, bufnr)
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
|
||||||
-- many times.
|
|
||||||
--
|
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
|
||||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
||||||
local nmap = function(keys, func, desc)
|
local nmap = function(keys, func, desc)
|
||||||
if desc then
|
if desc then
|
||||||
desc = 'LSP: ' .. desc
|
desc = 'LSP: ' .. desc
|
||||||
@ -23,20 +15,17 @@ local on_attach = function(_, bufnr)
|
|||||||
|
|
||||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||||
|
|
||||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
|
||||||
-- nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
|
||||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
|
||||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||||
|
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||||
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||||
|
|
||||||
|
-- nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||||
-- nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
-- nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||||
-- nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
-- nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
|
||||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||||
nmap('<leader>wl', function()
|
nmap('<leader>wl', function()
|
||||||
@ -51,24 +40,21 @@ local on_attach = function(_, bufnr)
|
|||||||
vim.lsp.buf.formatting()
|
vim.lsp.buf.formatting()
|
||||||
end
|
end
|
||||||
end, { desc = 'Format current buffer with LSP' })
|
end, { desc = 'Format current buffer with LSP' })
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Setup mason so it can manage external tooling
|
-- mason - package manager for lsp servers
|
||||||
require('mason').setup()
|
require('mason').setup()
|
||||||
|
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls', 'bashls'}
|
||||||
-- Enable the following language servers
|
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed
|
|
||||||
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls' }
|
|
||||||
|
|
||||||
-- Ensure the servers above are installed
|
|
||||||
require('mason-lspconfig').setup {
|
require('mason-lspconfig').setup {
|
||||||
ensure_installed = servers,
|
ensure_installed = servers,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities
|
-- nvim-cmp - extend capabilities
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
|
|
||||||
|
-- loop through servers, adding keymaps and capabilities
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
require('lspconfig')[lsp].setup {
|
require('lspconfig')[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
@ -76,11 +62,13 @@ for _, lsp in ipairs(servers) do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Turn on lsp status information
|
-- fidget - for lsp status above statusline
|
||||||
require('fidget').setup()
|
require('fidget').setup()
|
||||||
|
|
||||||
-- Example custom configuration for lua
|
|
||||||
--
|
|
||||||
|
-- lua lsp config
|
||||||
|
|
||||||
-- Make runtime files discoverable to the server
|
-- Make runtime files discoverable to the server
|
||||||
local runtime_path = vim.split(package.path, ';')
|
local runtime_path = vim.split(package.path, ';')
|
||||||
table.insert(runtime_path, 'lua/?.lua')
|
table.insert(runtime_path, 'lua/?.lua')
|
||||||
|
|||||||
1
config/nvim/.config/nvim/lua/plugin-config/nvim-tree.lua
Normal file
1
config/nvim/.config/nvim/lua/plugin-config/nvim-tree.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
require('nvim-tree').setup()
|
||||||
Loading…
x
Reference in New Issue
Block a user