diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 3da150b..8eb6e5a 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -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('colorscheme') + +-- Configure key mappings not defined for plugins. require('keymap') -require('plugins/floaterm') -require('plugins/cmp') -require('plugins/lsp') -require('plugins/scala') -require('plugins/bufferline') -require('plugins/lualine') -require('plugins/telescope') + +-- This loads (lazily) all plugins and configures things like plugin-specific +-- key mappings. +require('plugin_management') + +-- Initialize the color scheme, depends on plugins being available. +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/lualine') diff --git a/.config/nvim/lua/.luarc.json b/.config/nvim/lua/.luarc.json new file mode 100644 index 0000000..23b9ee2 --- /dev/null +++ b/.config/nvim/lua/.luarc.json @@ -0,0 +1,3 @@ +{ + "workspace.checkThirdParty": false +} \ No newline at end of file diff --git a/.config/nvim/lua/colorscheme.lua b/.config/nvim/lua/colorscheme.lua index 9f1e37e..b7195e6 100644 --- a/.config/nvim/lua/colorscheme.lua +++ b/.config/nvim/lua/colorscheme.lua @@ -2,47 +2,5 @@ vim.opt.background = 'dark' --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 vim.cmd 'colorscheme gruvbox-material' diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua index b72fcb3..8174740 100644 --- a/.config/nvim/lua/general.lua +++ b/.config/nvim/lua/general.lua @@ -9,11 +9,14 @@ opt.swapfile = false -- Don't use swapfile opt.modelines = 0 -- Disable modelines 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 -- 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.shortmess:remove("F") +vim.opt_global.shortmess:remove("F") opt.shortmess:append("c") opt.wildignore = { diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index 9953cb0..d023248 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -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 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 +local map = vim.keymap.set --- Change leader to a comma -vim.g.mapleader = ',' vim.g.maplocalleader = ' ' ------------------------------------------------------------ --- General ------------------------------------------------------------ - -- Clear search highlighting -map('n', '/', ':nohlsearch') +map('n', '/', ':nohlsearch', { desc = 'Clear Search Highlight' }) -- Save current buffer -map('n', 's', ':up') +map('n', 's', ':up', { desc = 'Save' }) -- Move to previous buffer -map('n', 'bp', ':bp') +map('n', 'bp', ':bp', { desc = 'Prev Buffer' }) -- Move to next buffer -map('n', 'bn', ':bn') +map('n', 'bn', ':bn', { desc = 'Next Buffer' }) -- Delete current buffer -map('n', 'bd', ':bd') +map('n', 'bd', ':bd', { desc = 'Delete Buffer' }) -- Close the quickfix window -map('n', 'cq', ':ccl') +map('n', 'cq', ':ccl', { desc = 'Close Quickfix' }) -- Create a vertical split -map('n', 'v', ':vsplit') +map('n', 'v', ':vsplit', { 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', '', function() --- return vim.fn.pumvisible() == 1 and '' or '' ---end, {expr = true}) - --- Use Shift+Tab to jump to the previous option in a popup menu ---vim.keymap.set('i', '', function() --- return vim.fn.pumvisible() == 1 and '' or '' ---end, {expr = true}) - ------------------------------------------------------------ --- Telescope ------------------------------------------------------------ - --- Use ';' to search active buffers -map('n', ';', 'Telescope buffers') - --- Use Ctrl+P to show a list of files -map('n', '', 'Telescope find_files') - --- Live Grep -map('n', 'fg', 'Telescope live_grep') - --- Metals commands -map('n', 'fm', 'Telescope metals commands') - --- Search project TODOs in Telescope -map('n', 'ft', 'TodoTelescope') - ------------------------------------------------------------ --- Trouble ------------------------------------------------------------ - --- Show/hide Trouble -map('n', 'xx', 'TroubleToggle') - --- Show workspace diagnostics -map('n', 'xw', 'TroubleToggle workspace_diagnostics') - --- Show document diagnostics -map('n', 'xd', 'TroubleToggle document_diagnostics') - --- Show quickfix -map('n', 'xq', 'TroubleToggle quickfix') - --- Show local list -map('n', 'xl', 'TroubleToggle loclist') - --- Show LSP references -map('n', 'xr', 'TroubleToggle lsp_references') - --- Show project TODOs in Trouble -map('n', 'xt', 'TodoTrouble') - ------------------------------------------------------------ --- Floaterm ------------------------------------------------------------ - --- Create a new floating terminal -vim.g.floaterm_keymap_new = 'tc' - --- Move to the previous terminal -vim.g.floaterm_keymap_prev = 'tp' - --- Move to the next terminal -vim.g.floaterm_keymap_next = 'tn' - --- Toggle the visibility of the floating terminal -vim.g.floaterm_keymap_toggle = 'tt' - ------------------------------------------------------------ --- nvim-tree ------------------------------------------------------------ - --- Toggle the file tree -map('n', 'tt', 'NvimTreeToggle') - --- Find the current buffer in the file tree -map('n', 'tf', 'NvimTreeFindFile') - ------------------------------------------------------------ +-------------------------------------------------------------------------------- -- LSP ------------------------------------------------------------ - -map('n', 'K', 'lua vim.lsp.buf.hover()') -map('n', 'gi', 'lua vim.lsp.buf.implementation()') -map('n', 'gr', 'lua vim.lsp.buf.references()') -map('n', 'gds', 'lua vim.lsp.buf.document_symbol()') -map('n', 'gws', 'lua vim.lsp.buf.workspace_symbol()') -map('n', 'gd', 'lua vim.lsp.buf.definition()') -map('n', 'cl', 'lua vim.lsp.codelens.run()') -map('n', 'D', 'lua vim.lsp.buf.type_definition()') -map('n', 'rn', 'lua vim.lsp.buf.rename()') -map('n', 'ca', 'lua vim.lsp.buf.code_action()') -map('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()') -map('n', '[c', 'lua vim.diagnostic.goto_prev { wrap = false }') -map('n', ']c', 'lua vim.diagnostic.goto_next { wrap = false }') +-------------------------------------------------------------------------------- +map('n', 'K', vim.lsp.buf.hover, { desc = 'Hover' }) +map('n', 'gi', vim.lsp.buf.implementation, { desc = 'Go To Implementation' }) +map('n', 'gr', vim.lsp.buf.references, { desc = 'Go To References' }) +map('n', 'gds', vim.lsp.buf.document_symbol, { desc = 'Document Symbol' }) +map('n', 'gws', vim.lsp.buf.workspace_symbol, { desc = 'Workspace Symbol' }) +map('n', 'gd', vim.lsp.buf.definition, { desc = 'Go To Definition' }) +map('n', 'cl', vim.lsp.codelens.run, { desc = 'Code Lens' }) +map('n', 'D', vim.lsp.buf.type_definition, { desc = 'Type Definition' }) +map('n', 'rn', vim.lsp.buf.rename, { desc = 'Rename' }) +map('n', 'ca', vim.lsp.buf.code_action, { desc = 'Code Action' }) +map('n', '[c', 'lua vim.diagnostic.goto_prev({ wrap = false })', { desc = 'prev diagnostic' }) +map('n', ']c', 'lua vim.diagnostic.goto_next({ wrap = false })', { desc = 'next diagnostic' }) diff --git a/.config/nvim/lua/packer_init.lua b/.config/nvim/lua/packer_init.lua deleted file mode 100644 index 5a46efe..0000000 --- a/.config/nvim/lua/packer_init.lua +++ /dev/null @@ -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) diff --git a/.config/nvim/lua/plugin_management.lua b/.config/nvim/lua/plugin_management.lua new file mode 100644 index 0000000..d631c28 --- /dev/null +++ b/.config/nvim/lua/plugin_management.lua @@ -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 = { + { ';', 'Telescope buffers', desc = 'Find Buffer' }, + { '', 'Telescope find_files', desc = 'Find File' }, + { 'fg', 'Telescope live_grep', desc = 'Live Grep' }, + { 'fm', 'Telescope metals commands', desc = 'Find Metals Command' }, + { 'ft', 'TodoTelescope', 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 = { + { 'xx', 'TroubleToggle', desc = 'Trouble' }, + { 'xw', 'TroubleToggle workspace_diagnostics', desc = 'Workspace Diagnostics' }, + { 'xd', 'TroubleToggle document_diagnostics', desc = 'Document Diagnostics' }, + { 'xq', 'TroubleToggle quickfix', desc = 'Quickfix' }, + { 'xl', 'TroubleToggle loclist', desc = 'Local List' }, + { 'xr', 'TroubleToggle lsp_references', desc = 'LSP References' }, + { 'xr', 'TodoTrouble', 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 = { + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.complete(), + [''] = function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, + [''] = 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 = { + { 'tc', 'FloatermNew', desc = 'New Floating Terminal' }, + { 'tc', 'FloatermNew', mode = 't', desc = 'New Floating Terminal' }, + { 'tt', 'FloatermToggle', desc = 'Toggle Floating Terminal' }, + { 'tt', 'FloatermToggle', mode = 't', desc = 'Toggle Floating Terminal' }, + { 'tp', 'FloatermPrev', desc = 'Previous Terminal' }, + { 'tp', 'FloatermPrev', mode = 't', desc = 'Previous Terminal' }, + { 'tn', 'FloatermNext', desc = 'Next Terminal' }, + { 'tn', 'FloatermNext', 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 = { + { 'tt', 'NvimTreeToggle', desc = 'File Tree' }, + { 'tf', 'NvimTreeFindFile', 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', +}) diff --git a/.config/nvim/lua/plugins/bufferline.lua b/.config/nvim/lua/plugins/bufferline.lua deleted file mode 100644 index 3aa02a3..0000000 --- a/.config/nvim/lua/plugins/bufferline.lua +++ /dev/null @@ -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 - }, - }, -} diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua deleted file mode 100644 index 36f4fef..0000000 --- a/.config/nvim/lua/plugins/cmp.lua +++ /dev/null @@ -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 = { - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.complete(), - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - [''] = 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 }, }, --- } ---}) diff --git a/.config/nvim/lua/plugins/floaterm.lua b/.config/nvim/lua/plugins/floaterm.lua deleted file mode 100644 index ee4583e..0000000 --- a/.config/nvim/lua/plugins/floaterm.lua +++ /dev/null @@ -1,3 +0,0 @@ -vim.g.floaterm_width = 0.8 -vim.g.floaterm_height = 0.8 -vim.g.floaterm_gitcommit = 'split' diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua deleted file mode 100644 index 37459f6..0000000 --- a/.config/nvim/lua/plugins/lsp.lua +++ /dev/null @@ -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{} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index 2f81dba..c93a5ac 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -6,10 +6,10 @@ require('lualine').setup { options = { theme = 'gruvbox-material' }, - sections = { - lualine_c = { - 'filename', - metals_status_for_lualine - } + sections = { + lualine_c = { + 'filename', + metals_status_for_lualine + } } } diff --git a/.config/nvim/lua/plugins/scala.lua b/.config/nvim/lua/plugins/metals.lua similarity index 82% rename from .config/nvim/lua/plugins/scala.lua rename to .config/nvim/lua/plugins/metals.lua index 8b3727f..8957f43 100644 --- a/.config/nvim/lua/plugins/scala.lua +++ b/.config/nvim/lua/plugins/metals.lua @@ -4,9 +4,7 @@ -- Autocmd that will actually be in charging of starting the whole thing local nvim_metals_group = vim.api.nvim_create_augroup( 'nvim-metals', - { - clear = true - } + { clear = true } ) vim.api.nvim_create_autocmd('FileType', { @@ -14,9 +12,6 @@ vim.api.nvim_create_autocmd('FileType', { callback = function() local metals_config = require('metals').bare_config() - -- Capabilities for completion. - local capabilities = require('cmp_nvim_lsp').default_capabilities() - metals_config.settings = { showImplicitArguments = true, showInferredType = true, @@ -28,7 +23,7 @@ vim.api.nvim_create_autocmd('FileType', { -- status bar somehow." 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) end, group = nvim_metals_group, diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua deleted file mode 100644 index 8d47b2f..0000000 --- a/.config/nvim/lua/plugins/telescope.lua +++ /dev/null @@ -1,4 +0,0 @@ -require('telescope').setup() - --- This is required to use FZF with Telescope. -require('telescope').load_extension('fzf') diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 30ec3ce..f262bb3 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,28 +1,28 @@ require'nvim-treesitter.configs'.setup { - -- One of "all", "maintained", or a list of languages - ensure_installed = { - "c", "zig", "bash", "scala", "yaml", "css", "javascript", - "latex", "clojure", "lua", "cpp", "hcl", "json" - }, + -- One of "all", "maintained", or a list of languages + ensure_installed = { + "c", "zig", "bash", "scala", "yaml", "css", "javascript", + "latex", "clojure", "lua", "cpp", "hcl", "json" + }, - -- Install languages synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install languages synchronously (only applied to `ensure_installed`) + sync_install = false, - -- List of parsers to ignore installing - ignore_install = { }, + -- List of parsers to ignore installing + ignore_install = { }, - highlight = { - enable = true, - disable = {}, - -- 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 - -- 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 - -- of languages - additional_vim_regex_highlighting = false, - }, + highlight = { + enable = true, + disable = {}, + -- 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 + -- 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 + -- of languages + additional_vim_regex_highlighting = false, + }, - indent = { - enable = true - } + indent = { + enable = true + } }