Rewrote Neovim configuration to use Lazy

This commit is contained in:
pfm 2023-02-13 22:09:04 -06:00
parent b7c113644e
commit 244042ab31
15 changed files with 410 additions and 499 deletions

View file

@ -1,12 +1,28 @@
require('packer_init') -- Change leader to a comma, ensure this happens before packages are loaded.
vim.g.mapleader = ','
-- Disable netrw in favor of nvim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Configure basic Neovim settings.
require('general') require('general')
require('colorscheme')
-- Configure key mappings not defined for plugins.
require('keymap') require('keymap')
require('plugins/floaterm')
require('plugins/cmp') -- This loads (lazily) all plugins and configures things like plugin-specific
require('plugins/lsp') -- key mappings.
require('plugins/scala') require('plugin_management')
require('plugins/bufferline')
require('plugins/lualine') -- Initialize the color scheme, depends on plugins being available.
require('plugins/telescope') require('colorscheme')
-- Setup autocmd for metals - metals is a little weird and needs to load itself.
-- The plugin that's loaded just makes metals code available in the first place.
require('plugins/metals')
-- Setup treesitter, select the configs to load, etc.
require('plugins/treesitter') require('plugins/treesitter')
require('plugins/lualine')

View file

@ -0,0 +1,3 @@
{
"workspace.checkThirdParty": false
}

View file

@ -2,47 +2,5 @@
vim.opt.background = 'dark' vim.opt.background = 'dark'
--vim.opt.background = 'light' --vim.opt.background = 'light'
-- Settings for gruvbox-material
--
--vim.g.gruvbox_material_palette = 'mix'
vim.g.gruvbox_material_palette = 'material'
--vim.g.gruvbox_material_palette = 'original'
--
vim.g.gruvbox_material_background = 'hard'
--vim.g.gruvbox_material_background = 'medium'
--vim.g.gruvbox_material_background = 'soft'
--
vim.g.gruvbox_material_enable_bold = 1
-- Settings for material
vim.g.material_style = "palenight"
require('material').setup {
italics = {
comments = true, -- Enable italic comments
},
plugins = {
neogit = false,
sidebar_nvim = false,
lsp_saga = false,
nvim_dap = false,
nvim_navic = false,
hop = false,
}
}
-- Settings for nightfox
-- Available colorscheme values: nightfox, duskfox, nordfox, terafox
require('nightfox').setup({
options = {
styles = {
comments = "italic",
keywords = "bold",
}
}
})
-- Set the color scheme -- Set the color scheme
vim.cmd 'colorscheme gruvbox-material' vim.cmd 'colorscheme gruvbox-material'

View file

@ -9,11 +9,14 @@ opt.swapfile = false -- Don't use swapfile
opt.modelines = 0 -- Disable modelines opt.modelines = 0 -- Disable modelines
opt.encoding = 'utf-8' -- Set default encoding to UTF-8 opt.encoding = 'utf-8' -- Set default encoding to UTF-8
opt.termguicolors = true
-- Note that this setting is important for which-key. Also don't reduce it too -- Note that this setting is important for which-key. Also don't reduce it too
-- low, or the behavior will start getting wonky and always show which-key. -- low, or the behavior will start getting wonky and always show which-key.
opt.timeoutlen = 500 -- Time in ms to wait for a sequnece to complete opt.timeoutlen = 500 -- Time in ms to wait for a sequnece to complete
opt.shortmess:remove("F") opt.shortmess:remove("F")
vim.opt_global.shortmess:remove("F")
opt.shortmess:append("c") opt.shortmess:append("c")
opt.wildignore = { opt.wildignore = {

View file

@ -1,141 +1,49 @@
----------------------------------------------------------- --------------------------------------------------------------------------------
-- Define keymaps for Neovim and plugins. -- Define keymaps for Neovim
----------------------------------------------------------- --
-- Note that leader is defined in init.lua to ensure that all mappings are
-- correct in plugins.
--
-- Plugins define their own keymappings in plugin_management.lua
--------------------------------------------------------------------------------
local function map(mode, lhs, rhs, opts) local map = vim.keymap.set
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend('force', options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- Change leader to a comma
vim.g.mapleader = ','
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-----------------------------------------------------------
-- General
-----------------------------------------------------------
-- Clear search highlighting -- Clear search highlighting
map('n', '<leader>/', ':nohlsearch<CR>') map('n', '<leader>/', ':nohlsearch<CR>', { desc = 'Clear Search Highlight' })
-- Save current buffer -- Save current buffer
map('n', '<leader>s', ':up<CR>') map('n', '<leader>s', ':up<CR>', { desc = 'Save' })
-- Move to previous buffer -- Move to previous buffer
map('n', '<leader>bp', ':bp<CR>') map('n', '<leader>bp', ':bp<CR>', { desc = 'Prev Buffer' })
-- Move to next buffer -- Move to next buffer
map('n', '<leader>bn', ':bn<CR>') map('n', '<leader>bn', ':bn<CR>', { desc = 'Next Buffer' })
-- Delete current buffer -- Delete current buffer
map('n', '<leader>bd', ':bd<CR>') map('n', '<leader>bd', ':bd<CR>', { desc = 'Delete Buffer' })
-- Close the quickfix window -- Close the quickfix window
map('n', '<leader>cq', ':ccl<CR>') map('n', '<leader>cq', ':ccl<CR>', { desc = 'Close Quickfix' })
-- Create a vertical split -- Create a vertical split
map('n', '<leader>v', ':vsplit<CR>') map('n', '<leader>v', ':vsplit<CR>', { desc = 'Vertical Split' })
-- These appear broken with latest neovim, and nvim-cmp has --------------------------------------------------------------------------------
-- settings that work in any case. Keep as a reminder for a
-- few weeks just in case.
-- Use Tab to jump to the next option in a popup menu
--vim.keymap.set('i', '<Tab>', function()
-- return vim.fn.pumvisible() == 1 and '<C-N>' or '<Tab>'
--end, {expr = true})
-- Use Shift+Tab to jump to the previous option in a popup menu
--vim.keymap.set('i', '<S-Tab>', function()
-- return vim.fn.pumvisible() == 1 and '<C-P>' or '<Tab>'
--end, {expr = true})
-----------------------------------------------------------
-- Telescope
-----------------------------------------------------------
-- Use ';' to search active buffers
map('n', ';', '<cmd>Telescope buffers<CR>')
-- Use Ctrl+P to show a list of files
map('n', '<C-P>', '<cmd>Telescope find_files<CR>')
-- Live Grep
map('n', '<leader>fg', '<cmd>Telescope live_grep<CR>')
-- Metals commands
map('n', '<leader>fm', '<cmd>Telescope metals commands<CR>')
-- Search project TODOs in Telescope
map('n', '<leader>ft', '<cmd>TodoTelescope<CR>')
-----------------------------------------------------------
-- Trouble
-----------------------------------------------------------
-- Show/hide Trouble
map('n', '<leader>xx', '<cmd>TroubleToggle<CR>')
-- Show workspace diagnostics
map('n', '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<CR>')
-- Show document diagnostics
map('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<CR>')
-- Show quickfix
map('n', '<leader>xq', '<cmd>TroubleToggle quickfix<CR>')
-- Show local list
map('n', '<leader>xl', '<cmd>TroubleToggle loclist<CR>')
-- Show LSP references
map('n', '<leader>xr', '<cmd>TroubleToggle lsp_references<CR>')
-- Show project TODOs in Trouble
map('n', '<leader>xt', '<cmd>TodoTrouble<CR>')
-----------------------------------------------------------
-- Floaterm
-----------------------------------------------------------
-- Create a new floating terminal
vim.g.floaterm_keymap_new = '<leader>tc'
-- Move to the previous terminal
vim.g.floaterm_keymap_prev = '<leader>tp'
-- Move to the next terminal
vim.g.floaterm_keymap_next = '<leader>tn'
-- Toggle the visibility of the floating terminal
vim.g.floaterm_keymap_toggle = '<leader>tt'
-----------------------------------------------------------
-- nvim-tree
-----------------------------------------------------------
-- Toggle the file tree
map('n', '<C-A>tt', '<cmd>NvimTreeToggle<CR>')
-- Find the current buffer in the file tree
map('n', '<C-A>tf', '<cmd>NvimTreeFindFile<CR>')
-----------------------------------------------------------
-- LSP -- LSP
----------------------------------------------------------- --------------------------------------------------------------------------------
map('n', 'K', vim.lsp.buf.hover, { desc = 'Hover' })
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>') map('n', 'gi', vim.lsp.buf.implementation, { desc = 'Go To Implementation' })
map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>') map('n', 'gr', vim.lsp.buf.references, { desc = 'Go To References' })
map('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>') map('n', 'gds', vim.lsp.buf.document_symbol, { desc = 'Document Symbol' })
map('n', 'gds', '<cmd>lua vim.lsp.buf.document_symbol()<CR>') map('n', 'gws', vim.lsp.buf.workspace_symbol, { desc = 'Workspace Symbol' })
map('n', 'gws', '<cmd>lua vim.lsp.buf.workspace_symbol()<CR>') map('n', 'gd', vim.lsp.buf.definition, { desc = 'Go To Definition' })
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>') map('n', '<leader>cl', vim.lsp.codelens.run, { desc = 'Code Lens' })
map('n', '<leader>cl', '<cmd>lua vim.lsp.codelens.run()<CR>') map('n', '<leader>D', vim.lsp.buf.type_definition, { desc = 'Type Definition' })
map('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>') map('n', '<leader>rn', vim.lsp.buf.rename, { desc = 'Rename' })
map('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>') map('n', '<leader>ca', vim.lsp.buf.code_action, { desc = 'Code Action' })
map('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>') map('n', '[c', '<cmd>lua vim.diagnostic.goto_prev({ wrap = false })<CR>', { desc = 'prev diagnostic' })
map('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>') map('n', ']c', '<cmd>lua vim.diagnostic.goto_next({ wrap = false })<CR>', { desc = 'next diagnostic' })
map('n', '[c', '<cmd>lua vim.diagnostic.goto_prev { wrap = false }<CR>')
map('n', ']c', '<cmd>lua vim.diagnostic.goto_next { wrap = false }<CR>')

View file

@ -1,157 +0,0 @@
-- Automatically install packer
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
local _ = fn.system({
'git',
'clone',
'--depth',
'1',
'https://github.com/wbthomason/packer.nvim',
install_path
})
vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. vim.o.runtimepath
end
-- Use a protected call so we don't error out on first use
local status_ok, _ = pcall(require, 'packer')
if not status_ok then
return
end
return require('packer').startup(function(use)
-- Plugin/package manager.
use 'wbthomason/packer.nvim'
-- Required for a number of Lua plugins.
use 'nvim-lua/plenary.nvim'
-- Color schemes
use 'sainnhe/gruvbox-material'
use 'rebelot/kanagawa.nvim'
use 'marko-cerovac/material.nvim'
use { 'EdenEast/nightfox.nvim', run = ':NightfoxCompile' }
-- Telescope: fuzzy finder
use {
'nvim-telescope/telescope.nvim',
requires = {
{ 'nvim-lua/plenary.nvim' }
}
}
-- Native Telescope implementation based on FZF for performance.
use {
'nvim-telescope/telescope-fzf-native.nvim',
run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
}
-- A pretty list for showing diagnostics, references, telescope results,
-- quickfix and location lists to help you solve all the trouble your code
-- is causing.
use {
'folke/trouble.nvim',
requires = 'kyazdani42/nvim-web-devicons',
config = function()
require('trouble').setup()
end
}
-- Treesitter: Neovim bindings for the Tree-sitter parser generator tool and
-- incremental parsing library.
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
-- Neovim-native LSP Implementation
use 'neovim/nvim-lspconfig'
-- Snippet engine is REQUIRED for nvim-cmp.
use 'L3MON4D3/LuaSnip'
-- nvim-cmp - completion plugin, used for LSP and Metals
use {
'hrsh7th/nvim-cmp',
requires = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'hrsh7th/cmp-buffer',
'saadparwaiz1/cmp_luasnip'
--'PaterJason/cmp-conjure'
}
}
-- Metals, for Scala development.
use {
'scalameta/nvim-metals',
requires = { 'nvim-lua/plenary.nvim' },
--ft = { 'scala', 'sbt' } -- this is busted for some reason.
}
-- Lualine (configures the bottom bars)
use {
'nvim-lualine/lualine.nvim',
requires = 'kyazdani42/nvim-web-devicons'
}
-- bufferline - shows a bar at the top with open buffers
use {
'akinsho/bufferline.nvim',
requires = 'kyazdani42/nvim-web-devicons'
}
-- Floating terminal
use 'voldikss/vim-floaterm'
-- Show signs for Git
use {
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
end
}
-- Show unobtrusive indentation guides
use {
'lukas-reineke/indent-blankline.nvim',
config = function()
require('indent_blankline').setup()
end
}
-- nvim-tree for when I want to view files
use {
'kyazdani42/nvim-tree.lua',
requires = {
'kyazdani42/nvim-web-devicons'
},
tag = 'nightly',
config = function()
require('nvim-tree').setup()
end
}
-- Special highlighting and tracking for certain notable words
use {
'folke/todo-comments.nvim',
requires = 'nvim-lua/plenary.nvim',
config = function()
require('todo-comments').setup()
end
}
-- Racket support
use 'benknoble/vim-racket'
-- PlantUML syntax
use 'aklt/plantuml-syntax'
-- Terraform
use 'hashivim/vim-terraform'
-- i3 configuration syntax
use 'mboughaba/i3config.vim'
end)

View file

@ -0,0 +1,320 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
-- Color schemes. Lazy, only selected will be loaded.
{
'sainnhe/gruvbox-material',
config = function(_)
vim.g.gruvbox_material_palette = 'material'
vim.g.gruvbox_material_background = 'hard'
vim.g.gruvbox_material_enable_bold = 1
end
},
{
'rebelot/kanagawa.nvim',
lazy = true,
},
{
'marko-cerovac/material.nvim',
lazy = true,
opts = {
italics = {
comments = true, -- Enable italic comments
},
plugins = {
neogit = false,
sidebar_nvim = false,
lsp_saga = false,
nvim_dap = false,
nvim_navic = false,
hop = false,
}
}
},
{
'EdenEast/nightfox.nvim',
build = ':NightfoxCompile',
lazy = true,
opts = {
options = {
styles = {
comments = "italic",
keywords = "bold",
}
}
}
},
-- Common dependency for Lua plugins
'nvim-lua/plenary.nvim',
-- Common dependency for many plugins (visual)
'nvim-tree/nvim-web-devicons',
-- Fuzzy finder (files, buffers, live grep, etc.)
-- Includes a native build based on FZF for performance.
{
'nvim-telescope/telescope.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
keys = {
{ ';', '<cmd>Telescope buffers<CR>', desc = 'Find Buffer' },
{ '<C-P>', '<cmd>Telescope find_files<CR>', desc = 'Find File' },
{ '<leader>fg', '<cmd>Telescope live_grep<CR>', desc = 'Live Grep' },
{ '<leader>fm', '<cmd>Telescope metals commands<CR>', desc = 'Find Metals Command' },
{ '<leader>ft', '<cmd>TodoTelescope<CR>', desc = 'Find TODO' },
}
},
{
'nvim-telescope/telescope-fzf-native.nvim',
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
config = function(_)
require('telescope').load_extension('fzf')
end
},
-- A pretty list for showing diagnostics, references, telescope results,
-- quickfix and location lists to help you solve all the trouble your code
-- is causing.
{
'folke/trouble.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
keys = {
{ '<leader>xx', '<cmd>TroubleToggle<CR>', desc = 'Trouble' },
{ '<leader>xw', '<cmd>TroubleToggle workspace_diagnostics<CR>', desc = 'Workspace Diagnostics' },
{ '<leader>xd', '<cmd>TroubleToggle document_diagnostics<CR>', desc = 'Document Diagnostics' },
{ '<leader>xq', '<cmd>TroubleToggle quickfix<CR>', desc = 'Quickfix' },
{ '<leader>xl', '<cmd>TroubleToggle loclist<CR>', desc = 'Local List' },
{ '<leader>xr', '<cmd>TroubleToggle lsp_references<CR>', desc = 'LSP References' },
{ '<leader>xr', '<cmd>TodoTrouble<CR>', desc = 'Show TODOs' },
}
},
-- Treesitter: Neovim bindings for the Tree-sitter parser generator tool and
-- incremental parsing library.
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate'
},
-- Neovim-native LSP Implementation
{
'neovim/nvim-lspconfig',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
},
config = function(_)
local lsp = require('lspconfig')
-- Establish a set of capabilities so we can advertise nvim-cmp support.
local capabilities = vim.lsp.protocol.make_client_capabilities()
-- Add nvim-cmp support to the capabilities.
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- lua-language-server
lsp.lua_ls.setup {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most
-- likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique
-- identifier
telemetry = {
enable = false,
},
},
},
}
-- bash-language-server
lsp.bashls.setup{}
-- texlab = latex language server
lsp.texlab.setup{}
-- terraform-ls = terraform language server (Hashicorp stable)
lsp.terraformls.setup{}
-- tsserver = typescript language server, works for JS as well.
lsp.tsserver.setup{}
end
},
-- nvim-cmp - completion plugin, used for LSP and Metals
{
'hrsh7th/nvim-cmp',
dependencies = {
'L3MON4D3/LuaSnip',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-path',
'hrsh7th/cmp-buffer',
'saadparwaiz1/cmp_luasnip'
},
config = function(_)
local cmp = require('cmp')
cmp.setup{
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'buffer', option = { keyword_length = 5 }, },
},
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
},
}
end
},
-- Metals, for Scala development.
{
'scalameta/nvim-metals',
--event = 'FileType *.scala,*.sbt',
--lazy = true,
dependencies = { 'nvim-lua/plenary.nvim' }
},
-- Lualine (configures the bottom bars)
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
},
-- bufferline - shows a bar at the top with open buffers
{
'akinsho/bufferline.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
options = {
mode = 'buffers',
indicator = {
style = 'none'
},
diagnostics = 'nvim_lsp',
color_icons = true,
show_buffer_icons = true,
show_buffer_close_icons = false,
separator_style = 'slant',
always_show_bufferline = true,
hover = {
enabled = false
},
},
}
},
-- Floating terminal
{
'voldikss/vim-floaterm',
keys = {
{ '<leader>tc', '<cmd>FloatermNew<CR>', desc = 'New Floating Terminal' },
{ '<leader>tc', '<C-\\><C-n><cmd>FloatermNew<CR>', mode = 't', desc = 'New Floating Terminal' },
{ '<leader>tt', '<cmd>FloatermToggle<CR>', desc = 'Toggle Floating Terminal' },
{ '<leader>tt', '<C-\\><C-n><cmd>FloatermToggle<CR>', mode = 't', desc = 'Toggle Floating Terminal' },
{ '<leader>tp', '<cmd>FloatermPrev<CR>', desc = 'Previous Terminal' },
{ '<leader>tp', '<C-\\><C-n><cmd>FloatermPrev<CR>', mode = 't', desc = 'Previous Terminal' },
{ '<leader>tn', '<cmd>FloatermNext<CR>', desc = 'Next Terminal' },
{ '<leader>tn', '<C-\\><C-n><cmd>FloatermNext<CR>', mode = 't', desc = 'Next Terminal' },
},
config = function(_)
vim.g.floaterm_width = 0.8
vim.g.floaterm_height = 0.8
vim.g.floaterm_gitcommit = 'split'
end
},
-- Show signs for Git
{ 'lewis6991/gitsigns.nvim' },
-- Show unobtrusive indentation guides
{ 'lukas-reineke/indent-blankline.nvim', },
-- nvim-tree for when I want to view files
{
'nvim-tree/nvim-tree.lua',
dependencies = { 'nvim-tree/nvim-web-devicons' },
tag = 'nightly',
lazy = false,
keys = {
{ '<C-A>tt', '<cmd>NvimTreeToggle<CR>', desc = 'File Tree' },
{ '<C-A>tf', '<cmd>NvimTreeFindFile<CR>', desc = 'Tree Find File' },
},
config = function(_)
require('nvim-tree').setup()
end
},
-- Special highlighting and tracking for certain notable words
{
'folke/todo-comments.nvim',
dependencies = 'nvim-lua/plenary.nvim',
},
-- Racket support
{
'benknoble/vim-racket',
event = 'BufEnter *.rkt',
lazy = true,
},
-- PlantUML syntax
{
'aklt/plantuml-syntax',
event = 'BufEnter *.puml',
lazy = true,
},
-- Terraform
{
'hashivim/vim-terraform',
event = 'BufEnter *.tf',
lazy = true,
},
-- i3 configuration syntax
'mboughaba/i3config.vim',
})

View file

@ -1,25 +0,0 @@
require('bufferline').setup {
options = {
mode = 'buffers',
indicator = {
style = 'none'
},
diagnostics = 'nvim_lsp',
-- offsets appear to be broken
--offsets = {
-- filetype = 'NvimTree',
-- text = 'File Explorer',
-- highlight = 'Directory',
-- text_align = 'center',
-- separator = true
--},
color_icons = true,
show_buffer_icons = true,
show_buffer_close_icons = false,
separator_style = 'slant',
always_show_bufferline = true,
hover = {
enabled = false
},
},
}

View file

@ -1,43 +0,0 @@
local cmp = require('cmp')
cmp.setup{
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },
{ name = 'buffer', option = { keyword_length = 5 }, },
},
mapping = {
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<C-Space>'] = cmp.mapping.complete(),
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
},
}
-- Setup conjure, only for supported files
--cmp.setup.filetype('racket', {
-- sources = {
-- { name = 'conjure' },
-- { name = 'luasnip' },
-- { name = 'path' },
-- { name = 'buffer', option = { keyword_length = 5 }, },
-- }
--})

View file

@ -1,3 +0,0 @@
vim.g.floaterm_width = 0.8
vim.g.floaterm_height = 0.8
vim.g.floaterm_gitcommit = 'split'

View file

@ -1,60 +0,0 @@
local lsp = require('lspconfig')
-- Use an on_attach function to configure after LSP attaches to buffer
local on_attach = function(_, bufnr)
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
end
-- Establish a set of capabilities so we can advertise nvim-cmp support.
local capabilities = vim.lsp.protocol.make_client_capabilities()
-- Add nvim-cmp support to the capabilities.
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- zls = zig language server
lsp.zls.setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150
},
capabilities = capabilities
}
-- lua-language-server
lsp.sumneko_lua.setup {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most
-- likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique
-- identifier
telemetry = {
enable = false,
},
},
},
}
-- bash-language-server
lsp.bashls.setup{}
-- texlab = latex language server
lsp.texlab.setup{}
-- terraform-ls = terraform language server (Hashicorp stable)
lsp.terraformls.setup{}
-- tsserver = typescript language server, works for JS as well.
lsp.tsserver.setup{}

View file

@ -6,10 +6,10 @@ require('lualine').setup {
options = { options = {
theme = 'gruvbox-material' theme = 'gruvbox-material'
}, },
sections = { sections = {
lualine_c = { lualine_c = {
'filename', 'filename',
metals_status_for_lualine metals_status_for_lualine
} }
} }
} }

View file

@ -4,9 +4,7 @@
-- Autocmd that will actually be in charging of starting the whole thing -- Autocmd that will actually be in charging of starting the whole thing
local nvim_metals_group = vim.api.nvim_create_augroup( local nvim_metals_group = vim.api.nvim_create_augroup(
'nvim-metals', 'nvim-metals',
{ { clear = true }
clear = true
}
) )
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
@ -14,9 +12,6 @@ vim.api.nvim_create_autocmd('FileType', {
callback = function() callback = function()
local metals_config = require('metals').bare_config() local metals_config = require('metals').bare_config()
-- Capabilities for completion.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
metals_config.settings = { metals_config.settings = {
showImplicitArguments = true, showImplicitArguments = true,
showInferredType = true, showInferredType = true,
@ -28,7 +23,7 @@ vim.api.nvim_create_autocmd('FileType', {
-- status bar somehow." -- status bar somehow."
metals_config.init_options.statusBarProvider = 'on' metals_config.init_options.statusBarProvider = 'on'
metals_config.capabilities = capabilities metals_config.capabilities = require('cmp_nvim_lsp').default_capabilities()
require('metals').initialize_or_attach(metals_config) require('metals').initialize_or_attach(metals_config)
end, end,
group = nvim_metals_group, group = nvim_metals_group,

View file

@ -1,4 +0,0 @@
require('telescope').setup()
-- This is required to use FZF with Telescope.
require('telescope').load_extension('fzf')

View file

@ -1,28 +1,28 @@
require'nvim-treesitter.configs'.setup { require'nvim-treesitter.configs'.setup {
-- One of "all", "maintained", or a list of languages -- One of "all", "maintained", or a list of languages
ensure_installed = { ensure_installed = {
"c", "zig", "bash", "scala", "yaml", "css", "javascript", "c", "zig", "bash", "scala", "yaml", "css", "javascript",
"latex", "clojure", "lua", "cpp", "hcl", "json" "latex", "clojure", "lua", "cpp", "hcl", "json"
}, },
-- Install languages synchronously (only applied to `ensure_installed`) -- Install languages synchronously (only applied to `ensure_installed`)
sync_install = false, sync_install = false,
-- List of parsers to ignore installing -- List of parsers to ignore installing
ignore_install = { }, ignore_install = { },
highlight = { highlight = {
enable = true, enable = true,
disable = {}, disable = {},
-- Setting this to true will run `:h syntax` and tree-sitter at the same -- Setting this to true will run `:h syntax` and tree-sitter at the same
-- time. Set this to `true` if you depend on 'syntax' being enabled (like -- time. Set this to `true` if you depend on 'syntax' being enabled (like
-- for indentation). Using this option may slow down your editor, and you -- for indentation). Using this option may slow down your editor, and you
-- may see some duplicate highlights. Instead of true it can also be a list -- may see some duplicate highlights. Instead of true it can also be a list
-- of languages -- of languages
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
indent = { indent = {
enable = true enable = true
} }
} }