many changes

This commit is contained in:
James Dixon 2022-12-20 16:50:05 -05:00
parent eee6a71ac8
commit 6c6b4aadf8
5 changed files with 52 additions and 71 deletions

View File

@ -10,6 +10,8 @@ end
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
-- * nvim specific plugins * --
use { -- LSP Configuration & Plugins
'neovim/nvim-lspconfig',
requires = {
@ -18,21 +20,39 @@ require('packer').startup(function(use)
'j-hui/fidget.nvim',
},
}
use { -- Autocompletion
use { -- Autocompletion (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',
run = function()
pcall(require('nvim-treesitter.install').update { with_sync = true })
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
use 'tpope/vim-commentary'
use 'tpope/vim-surround'
use 'tpope/vim-unimpaired'
-- command mode keybinds
use 'tpope/vim-rsi'
use 'tpope/vim-eunuch'
@ -43,11 +63,11 @@ require('packer').startup(function(use)
use 'tpope/vim-rhubarb'
use 'airblade/vim-gitgutter'
-- fzf
use { 'junegunn/fzf', run = ":call fzf#install()" }
use { 'junegunn/fzf.vim' }
-- colorschemes
use 'nanotech/jellybeans.vim'
use({
'rose-pine/neovim',
as = 'rose-pine',
@ -56,42 +76,3 @@ require('packer').startup(function(use)
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')

View File

@ -1,7 +1,16 @@
require('plugin-config.nvim-treesitter')
-- lsp
require('plugin-config.lsp')
-- completion
require('plugin-config.cmp')
-- treesitter (syntax highlighting)
require('plugin-config.nvim-treesitter')
-- nvim-tree
require('plugin-config.nvim-tree')
-- plugin keybinds
require('plugin-config.keybinds.vim-fugitive')
require('plugin-config.keybinds.fzf')
require('plugin-config.keybinds.nvim-tree')

View File

@ -0,0 +1,2 @@
-- NvimTree
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<cr>')

View File

@ -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>q', vim.diagnostic.setloclist)
-- LSP settings.
-- This function gets run when an LSP connects to a particular buffer.
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)
if desc then
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>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('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>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('<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>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function()
@ -51,24 +40,21 @@ local on_attach = function(_, bufnr)
vim.lsp.buf.formatting()
end
end, { desc = 'Format current buffer with LSP' })
end
-- Setup mason so it can manage external tooling
-- mason - package manager for lsp servers
require('mason').setup()
-- 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
local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'gopls', 'bashls'}
require('mason-lspconfig').setup {
ensure_installed = servers,
}
-- nvim-cmp supports additional completion capabilities
-- nvim-cmp - extend capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- loop through servers, adding keymaps and capabilities
for _, lsp in ipairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
@ -76,11 +62,13 @@ for _, lsp in ipairs(servers) do
}
end
-- Turn on lsp status information
-- fidget - for lsp status above statusline
require('fidget').setup()
-- Example custom configuration for lua
--
-- lua lsp config
-- Make runtime files discoverable to the server
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')

View File

@ -0,0 +1 @@
require('nvim-tree').setup()