this is my new neovim config after transitioning from ~/.vim

master
Daniel Knüttel 2021-02-25 20:14:33 +01:00
commit 73cd0edd82
5 changed files with 3117 additions and 0 deletions

View File

@ -0,0 +1,68 @@
snippet main
int
main(int argc, char ** argv)
{
$0
return 0;
}
endsnippet
snippet GPL
#
# Copyright(c) $1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$2
endsnippet
snippet AGPL
#
# Copyright(c) $1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$2
endsnippet
snippet LGPL
#
# Copyright(c) $1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$2
endsnippet

View File

@ -0,0 +1,78 @@
snippet main "Create the typical __main__ part"
if __name__ == "__main__":
$0
endsnippet
snippet cls "Create a class skeleton"
class $0(object):
def __init__(self):
pass
endsnippet
snippet pltimp
import matplotlib.pyplot as plt
endsnippet
snippet shebang
#!/usr/bin/env python3
endsnippet
snippet GPL
#
# Copyright(c) $1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$2
endsnippet
snippet AGPL
#
# Copyright(c) $1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$2
endsnippet
snippet LGPL
#
# Copyright(c) $1
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
$2
endsnippet

2797
autoload/plug.vim 100644

File diff suppressed because it is too large Load Diff

171
init.vim 100644
View File

@ -0,0 +1,171 @@
"===============================================================================
"====================== NVIM Main Configuration File ===========================
"===============================================================================
"============================== General Setup ==================================
"===============================================================================
" This section contains seme stuff I just want in general.
inoremap jk <Esc>
" Automatic expansion of comments.
set formatoptions=rqn1
" Disable mouse.
set mouse=""
" Plain old cursor in every mode.
set guicursor=
" Don't use arrow keys unless in command mode.
inoremap <Up> <Nop>
inoremap <Down> <Nop>
inoremap <Left> <Nop>
inoremap <Right> <Nop>
nnoremap <Up> <Nop>
nnoremap <Down> <Nop>
nnoremap <Left> <Nop>
nnoremap <Right> <Nop>
vnoremap <Up> <Nop>
vnoremap <Down> <Nop>
vnoremap <Left> <Nop>
vnoremap <Right> <Nop>
tnoremap <Up> <Nop> tnoremap <Down> <Nop>
tnoremap <Left> <Nop>
tnoremap <Right> <Nop>
" Getting out of the terminal insert mode is extremely awkward.
" This mapping solves that.
tnoremap <Esc><Esc> <C-\><C-n>
" Use UTF-8, because we don't live in 1783 anymore.
set encoding=UTF-8
" Why would everything remain highlighted all the time?
set nohlsearch
" Relative numbers are great.
set number relativenumber
"====================== Code Style Related Settings ============================
"===============================================================================
" This is basically Python's recommendation.
set tabstop=4
set softtabstop=0
set shiftwidth=4
set expandtab
"===================== Filetype And Related Settings ===========================
"===============================================================================
" This section contains stuff that is related to file types.
filetype plugin on
set modeline
set modelines=10
"_______________________________________________________________________________
"========================= Installing all Plugins ==============================
"===============================================================================
" For reasons this has to been done in a single step.
call plug#begin('~/.vim/plugged')
" This is for the LSP stuff.
Plug 'neovim/nvim-lspconfig'
Plug 'anott03/nvim-lspinstall'
Plug 'nvim-lua/completion-nvim'
" Inserting unicode characters.
Plug 'chrisbra/unicode.vim'
" Color schemes.
Plug 'tomasr/molokai'
Plug 'bluz71/vim-moonfly-colors'
" This is for snippets.
Plug 'SirVer/ultisnips'
call plug#end()
"===================== Language Server Configuration ===========================
"===============================================================================
" This section sets up the language server for the languages I use.
" Run this to install pyls if you haven't yet.
"LspInstall pyls
"LspInstall bashls
" Install ccls from snap or flatpack.
lua << EOF
local nvim_lsp = require('lspconfig')
-- This basically enables autocompletion
local on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
require'completion'.on_attach()
end
-- Enable the language servers.
nvim_lsp.ccls.setup{on_attach=on_attach}
nvim_lsp.vimls.setup{on_attach=on_attach}
nvim_lsp.pyls.setup{on_attach=on_attach}
nvim_lsp.bashls.setup{on_attach=on_attach}
nvim_lsp.yamlls.setup{on_attach=on_attach}
EOF
" Highlight the problems in the code.
highlight LspDiagnosticsDefaultError guifg=BrightRed
highlight LspDiagnosticsDefaultWarning guifg=BrightYellow
" This allows to jump to the definition, and
" show some documentation respectively.
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
nnoremap <silent> gh <cmd>lua vim.lsp.buf.hover()<CR>
" This part sets up lsp diagnostics.
lua << EOF
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
-- This sets the spacing and the prefix, obviously.
virtual_text = {
spacing = 4
, prefix = '🔙'
}
})
EOF
"========================= Settings For Autocompletion =========================
"===============================================================================
" This prevents vim from inserting random function heads,
" and also gives some documentation preview.
set completeopt=menuone,noinsert,noselect
" This prevents the auto-completion from
" inserting the full method signature.
let g:completion_enable_auto_signature = 0
let g:completion_enable_snippet = 'UltiSnips'
"========================== A Nice Color Scheme ================================
"===============================================================================
"set background=dark
"let g:airline_theme='one'
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
set termguicolors
colorscheme molokai
"=================== Settings Related to Highlighting ==========================
"===============================================================================
let g:vimsyn_embed= 'l'

3
init.vim.old 100644
View File

@ -0,0 +1,3 @@
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc