Compare commits

..

No commits in common. "9e5306707872672787ed653469a7792dd16f3c6d" and "be5c0939a5f08fa361cb01fddb140a74b8da4243" have entirely different histories.

6 changed files with 0 additions and 286 deletions

View file

@ -1,2 +0,0 @@
plugin/
!after/plugin/

View file

@ -1,89 +0,0 @@
-- Custom LSP configuration
-- This cannot be done in the config function from Packer
-- because it somehow does not work well with make_client_capabilities()
require("mason-lspconfig").setup({
ensure_installed = { "rust_analyzer" }
})
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
local cmp = require 'cmp'
cmp.setup({
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
},
})
-- Rewrite LSP capabilities (to enable completion)
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
end
require('lspconfig')['rust_analyzer'].setup({
on_attach = on_attach,
settings = {
['rust_analyzer'] = {
cargo = {
autoreload = true,
buildScripts = { enable = true },
},
procMacro = {
enable = true,
},
},
},
capabilities = capabilities,
})
-- TODO: Set this to OFF when neovim supports it (0.8 release probably)
-- rust_analyzer spits out spurious errors with build.rs outputs
-- likely due to a race condition between the VFS initialization and the diagnostics
vim.lsp.set_log_level("error")

View file

@ -1,8 +0,0 @@
" Mouse
set mouse=a
" Set Editor Font
GuiFont! FiraCode Nerd Font Mono:h10.5:l
" Ligature
GuiRenderLigatures 1

View file

@ -1,57 +0,0 @@
" Packer plugins
lua require('plugins')
" Gruvbox Theme (colorscheme applied from plugins.lua)
if has('termguicolors')
set termguicolors
endif
" For dark version.
set background=dark
" We need to apply this here too to make sure the startup components work
colorscheme gruvbox
" Miscellaneous boilerplate
set nocompatible " Disable vi compatibility
set ignorecase
set cc=128 " 128 characters
set noswapfile
set backupdir=~/.cache/nvim
set cursorline " Highlight current line
set mouse=a " Mouse
set nofixendofline
set clipboard+=unnamedplus " System clipboard
" Default indentation
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
" Syntax highlighting
set syntax=on
let g:special_filetype_pattern = 'neo-tree\|toggleterm\|minimap'
" Show line numbers on non-toolbar buffers
fun! ShowNumberIfNecessary()
if &ft =~ g:special_filetype_pattern
return
endif
setlocal nu
endfun
autocmd BufEnter * call ShowNumberIfNecessary()
" Terminal remapping
lua << EOF
function _G.set_terminal_keymaps()
local opts = {buffer = 0}
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
end
EOF
autocmd TermOpen term://* lua set_terminal_keymaps()

View file

@ -1,128 +0,0 @@
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- LSP stuff
use {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
}
-- Gruvbox theme
use {
"ellisonleao/gruvbox.nvim",
config = function()
require("gruvbox").setup({
bold = false,
italic = true,
strikethrough = true,
overrides = {
Directory = { link = "GruvboxFg2" },
},
})
vim.cmd("colorscheme gruvbox")
end,
}
-- A way saner buffer closing implementation
use "ojroques/nvim-bufdel"
-- Indentation guide
use "lukas-reineke/indent-blankline.nvim"
-- Indentation autodetection
use {
"nmac427/guess-indent.nvim",
config = function()
require("guess-indent").setup()
end
}
-- Scrollbar
use {
"petertriho/nvim-scrollbar",
config = function()
require("scrollbar").setup()
end,
}
-- Directory tree
use {
"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
requires = {
"nvim-lua/plenary.nvim",
"kyazdani42/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
config = function()
require("neo-tree").setup({
window = {
position = "left",
width = 36,
},
})
require("neo-tree.sources.manager").show("filesystem")
end,
}
-- Tabs
use {
"akinsho/bufferline.nvim", tag = "v2.*", requires = "kyazdani42/nvim-web-devicons",
config = function() require("bufferline").setup({
options = {
close_command = "BufDel %d",
right_mouse_command = "BufDel %d",
offsets = {
{
filetype = "neo-tree",
text = "Files",
highlight = "Directory",
text_align = "left",
}
},
separator_style = "slant",
}
}) end,
}
-- Status line
use {
"nvim-lualine/lualine.nvim", requires = { 'kyazdani42/nvim-web-devicons', opt = true },
config = function() require("lualine").setup({
options = {
theme = "gruvbox",
disabled_filetypes = {
statusline = { "neo-tree" },
},
},
}) end,
}
-- Terminal
use {
"akinsho/toggleterm.nvim", tag = "v2.*",
config = function() require("toggleterm").setup({
open_mapping = [[<c-\>]],
persist_size = false,
shade_terminals = false,
hide_numbers = false,
winbar = {
enabled = false,
},
on_open = function()
-- Toggle the neo-tree file view such that it is
-- always full height; This is a dirty workaround
local manager = require('neo-tree.sources.manager')
if manager.close('filesystem') then
manager.show('filesystem')
end
end,
}) end,
}
end)

View file

@ -6,5 +6,3 @@ set shiftwidth=4 softtabstop=4 expandtab
" In these files, use 2 spaces " In these files, use 2 spaces
autocmd FileType sh setlocal shiftwidth=2 softtabstop=2 autocmd FileType sh setlocal shiftwidth=2 softtabstop=2
set nofixeol