Compare commits

...

33 commits

Author SHA1 Message Date
9e53067078 neovin: Remove minimap and use a simplistic scrollbar
...with LSP integration, of course
2022-08-13 21:59:10 -04:00
93936d00ae neovim: Add auto-indentation plugin 2022-08-12 11:00:34 -04:00
c268319adb neovim: Add indentation guide 2022-08-08 22:39:27 -04:00
cf88166128 neovim: Use system clipboard 2022-08-08 22:35:50 -04:00
a898b5e555 neovim: Reduce LSP log level 2022-08-08 22:20:23 -04:00
031b4ab737 neovim: Move lsp initialization to after/plugin 2022-08-08 21:51:05 -04:00
da298002ff neovim: Reject focus in Minimap 2022-08-08 20:53:10 -04:00
51ac294e33 neovim: Colorize git diff 2022-08-08 19:16:07 -04:00
d94b3b6aec neovim: Configure Minimap
The Minimap plugin has to be activated on window resize, otherwise
neovim-qt will cause issues during its initial resizing
2022-08-08 18:42:56 -04:00
a662702be3 neovim: Remove focus remaps
These can be done by prefixing with Ctrl+W
2022-08-08 17:22:59 -04:00
3758670e5b neovim: Start Neotree in the config function
...so that our config is actually applied when we start
2022-08-08 15:25:03 -04:00
ebb90199fc neovim: Fix neo-tree window width config 2022-08-08 15:19:57 -04:00
9f75d943b3 neovim: Re-toggle the neo-tree sidebar when terminal is open 2022-08-08 15:18:04 -04:00
34d4f6f109 neovim: Stop it from "fixing" end of line 2022-08-08 09:48:32 -04:00
ad5f634ba5 neovim: Increase line length to 128 2022-08-08 09:47:40 -04:00
ca122389bd neovim: Remove line spacing
This breaks powerline fonts
2022-08-08 09:46:53 -04:00
bf4ca036ac neovim: Configure LSP for Rust 2022-08-07 22:59:34 -04:00
b128903bfb neovim: Tweak gruvbox theme 2022-08-07 20:41:07 -04:00
82abed7e25 neovim: Switch to the regular gruvbox theme 2022-08-07 20:28:01 -04:00
c2b952b9ce neovim: Use hard contrast for gruvbox 2022-08-07 20:16:54 -04:00
3f710f51de neovim: Configure status line 2022-08-07 20:05:42 -04:00
c7630d48f8 neovim: Use a sane bufdel impl 2022-08-07 18:06:45 -04:00
0b3168295c neovim: Fix neo-tree width 2022-08-07 17:51:55 -04:00
ebcba42537 neovim: Add focus moving bindings for term and normal 2022-08-07 17:49:06 -04:00
cefce76d7a neovim: Add toggleterm 2022-08-07 17:39:06 -04:00
4388ee491d neovim: Increase default line space 2022-08-07 14:11:36 -04:00
28d1ed543a neovim: only set line number for actual file buffers 2022-08-07 14:08:01 -04:00
ce8405840f neovim: use font height 10.5 2022-08-07 13:57:05 -04:00
4a48c7c83e ginit: use light Fira Code font 2022-08-07 13:56:30 -04:00
6d817ca1bf Use bufferline for the tabline instead of tabby 2022-08-07 13:51:01 -04:00
dd24be7b17 neovim: Add tabline 2022-08-07 13:22:25 -04:00
e3d10fa2b4 Initial NeoVim config 2022-08-07 13:06:49 -04:00
e91b841e90 vimrc: add nofixeol 2022-08-07 13:06:33 -04:00
6 changed files with 286 additions and 0 deletions

2
nvim/.config/nvim/.gitignore vendored Normal file
View file

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

View file

@ -0,0 +1,89 @@
-- 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

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

View file

@ -0,0 +1,57 @@
" 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

@ -0,0 +1,128 @@
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,3 +6,5 @@ set shiftwidth=4 softtabstop=4 expandtab
" In these files, use 2 spaces
autocmd FileType sh setlocal shiftwidth=2 softtabstop=2
set nofixeol