1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-04-19 08:17:47 +02:00

nvim: imported nvim from master branch

This commit is contained in:
TiynGer 2023-08-08 00:17:46 +02:00
parent 879dfa8d5e
commit 07dfe4ec7d
23 changed files with 1308 additions and 162 deletions

87
.config/nvim/init.lua Normal file
View File

@ -0,0 +1,87 @@
vim.o.go = 'a'
vim.o.showmode = false
-- disable netrw
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- enable mouse for all modes
vim.o.mouse = 'a'
vim.o.clipboard = 'unnamedplus'
-- basic color settings
vim.o.background = 'dark'
-- setting Tab-length
vim.o.expandtab = true
vim.o.softtabstop = 4
vim.o.shiftwidth = 4
-- splits open at the bottom and right
vim.o.splitbelow = true
vim.o.splitright = true
-- disable case sensitive matching
vim.o.ignorecase = true
-- enable nocompatible mode
vim.o.nocompatible = true
-- enable syntax highlighting
vim.o.syntax = true
-- enable true colors
vim.o.termguicolors = true
-- set utf-8 encoding
vim.o.encoding = "utf-8"
-- show relative numbers on left side
vim.o.number = true
vim.o.relativenumber = true
-- speedup vim with long lines
vim.o.ttyfast = true
vim.o.lazyredraw = true
-- textEdit might fail without hidden
vim.o.hidden = true
-- disable backupfiles
vim.o.nobackup = true
vim.o.nowritebackup = true
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- always show the signcolumn
vim.o.signcolumn = "yes"
-- enable persistent undo
vim.o.undofile = true
vim.o.undodir = vim.env.XDG_CACHE_HOME .. "/vim/undo"
-- python programs to use
vim.g.python_host_prog = '/usr/bin/python2'
vim.g.python3_host_prog = '/usr/bin/python3'
-- display certain invisible chars
vim.opt.list = true
vim.opt.listchars:append "space:·"
vim.opt.listchars:append "eol:"
-- folding
vim.o.foldcolumn = '0'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- set filetypes correctly by extension
require('autocmd')
-- load plugins (autoload all files in plugin folder)
require('loadplugins')
-- load general mapped keys
require('keymap')

View File

@ -1,162 +0,0 @@
let mapleader = ","
" begin plugin section
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ~/.config/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
endif
call plug#begin('~/.config/nvim/plugged')
Plug 'qpkorr/vim-renamer'
Plug 'tomasiser/vim-code-dark'
call plug#end()
" end plugin section
set go=a
" enable mouse for all modes
set mouse=a
set clipboard+=unnamedplus
" enable command completion
set wildmode=longest,list,full
" setting Tab-length
set expandtab
set softtabstop=4
set shiftwidth=4
" splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" disable case sensitive matching
set ignorecase
" enable nocompatible mode
set nocompatible
" enable Plugins
filetype plugin on
" enable syntax highlighting
syntax on
" enable true colors
set termguicolors
" set utf-8 encoding
set encoding=utf-8
" show relative numbers on left side
set number relativenumber
" speedup vim with long lines
set ttyfast
set lazyredraw
" textEdit might fail without hidden
set hidden
" disable Backupfiles for Lsp
set nobackup
set nowritebackup
" dont pass messages to ins-completion-menu
set shortmess+=c
" always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
if has("patch-8.1.1564")
" Recently vim can merge signcolumn and number column into one
set signcolumn=number
else
set signcolumn=yes
endif
" enable persistent undo
if has('persistent_undo')
set undofile
set undodir="$XDG_CACHE_HOME/vim/undo"
endif
" unmap unwanted commands
nnoremap <F1> <NOP>
nnoremap <F2> <NOP>
nnoremap <F3> <NOP>
nnoremap <F4> <NOP>
nnoremap <F5> <NOP>
nnoremap <F8> <NOP>
nnoremap <F9> <NOP>
nnoremap <F10> <NOP>
nnoremap <F11> <NOP>
nnoremap <F12> <NOP>
inoremap <F1> <NOP>
inoremap <F2> <NOP>
inoremap <F3> <NOP>
inoremap <F4> <NOP>
inoremap <F5> <NOP>
inoremap <F6> <NOP>
inoremap <F7> <NOP>
inoremap <F8> <NOP>
inoremap <F9> <NOP>
inoremap <F10> <NOP>
inoremap <F11> <NOP>
inoremap <F12> <NOP>
" mapping Dictionaries
nnoremap <F6> :setlocal spell! spelllang=de_de<CR>
nnoremap <F7> :setlocal spell! spelllang=en_us<CR>
" compiler for languages
nnoremap <leader>c :w! \| !compiler <c-r>%<CR>
" open corresponding file (pdf/html/...)
nnoremap <leader>p :!opout <c-r>%<CR><CR>
" shortcut for split navigation
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" save file as sudo on files that require root permission
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
" alias for replacing
nnoremap <leader>ss :%s//gI<Left><Left><Left>
" delete trailing whitespaces on save
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
autocmd BufWritePre * :call TrimWhitespace()
" read files correctly
autocmd BufRead,BufNewFile *.tex set filetype=tex
autocmd BufRead,BufNewFile *.h set filetype=c
" formatting
autocmd FileType c setlocal formatprg=astyle\ --mode=c
autocmd FileType java setlocal formatprg=astyle\ --indent=spaces=2\ --style=google
autocmd FileType java setlocal shiftwidth=2 softtabstop=2
autocmd FileType markdown noremap <F8> :silent %!prettier --stdin-filepath % <CR>
autocmd FileType python setlocal formatprg=autopep8\ -
autocmd FileType tex,latex setlocal formatprg=latexindent\ -
autocmd FileType c,java,python,tex,latex noremap <F8> gggqG
" cleanup certain files after leaving the editor
autocmd VimLeave *.tex !texclear %
autocmd VimLeave *.c !cclear
" highlighting break line
autocmd BufEnter,FileType c set colorcolumn=80
autocmd BufEnter,FileType java set colorcolumn=100
autocmd BufEnter,FileType markdown set colorcolumn=80
" colorscheme
colorscheme codedark
highlight colorcolumn guibg=#772222

View File

@ -0,0 +1,117 @@
-- autocmd
-- read files correctly
vim.filetype.add({
extension = {
c = 'c',
h = 'c',
html = 'html',
java = 'java',
js = 'javascript',
lua = 'lua',
md = 'markdown',
nim = 'nim',
py = 'python',
tex = 'tex',
}
})
-- settings for filetype: c
vim.api.nvim_create_autocmd({ 'VimLeave' },
{
pattern = { 'c' },
command = '!cclear'
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'c' },
command = 'set colorcolumn=80'
})
-- settings for filetype: java
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'java' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'java' },
command = 'set colorcolumn=100'
})
-- settings for filetype: javascript
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'javascript' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
-- settings for filetype: lua
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'lua' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'lua' },
command = 'set colorcolumn=100'
})
-- settings for filetype: markdown
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'markdown' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'markdown' },
command = 'set colorcolumn=100'
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'markdown' },
command = 'set conceallevel=2'
})
-- settings for filetype: nim
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'nim' },
command = 'set colorcolumn=80'
})
-- settings for filetype: python
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'python' },
command = 'set colorcolumn=80'
})
-- settings for filetype: tex
vim.api.nvim_create_autocmd({ 'VimLeave' },
{
pattern = { 'tex' },
command = '!texclear %'
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'tex' },
command = 'set colorcolumn=80'
})

View File

@ -0,0 +1,84 @@
-- keymap
-- set mapleader for hotkeys
vim.g.mapleader = ","
-- unmap unwanted commands
vim.api.nvim_set_keymap('n', '<F1>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F9>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F10>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F11>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F12>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F2>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F3>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F4>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F5>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F6>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F7>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F8>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F9>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F10>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F11>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F12>', '<NOP>', { noremap = true })
-- shortcut for split navigation
vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', { noremap = true })
-- mapping Dictionaries
vim.api.nvim_set_keymap('n', '<F6>', ':setlocal spell! spelllang=de_de<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F7>', ':setlocal spell! spelllang=en_us<CR>', { noremap = true })
-- compiler for languages
vim.api.nvim_set_keymap('n', '<leader>c', ':w! | !compiler <c-r>%<CR>', { noremap = true })
-- save file as sudo on files that require root permission
vim.api.nvim_set_keymap('c', 'w!!', '"silent! write !sudo tee % >/dev/null" <bar> edit!', { noremap = true })
-- alias for replacing
vim.api.nvim_set_keymap('n', '<leader>ss', ':%s//gI<Left><Left><Left>', { noremap = true })
-- irc compatibility for interactivity
vim.api.nvim_set_keymap('n', '<leader>is', ':.w >> in<cr>dd', { noremap = true })
-- open corresponding file (pdf/html/...,md)
vim.api.nvim_set_keymap('n', '<leader>p', ':!opout <c-r>%<CR><CR>', { noremap = true })
-- iamcco/markdown-preview.nvim
vim.api.nvim_create_autocmd('FileType', {
pattern = 'markdown',
callback = function()
vim.api.nvim_set_keymap('n', '<leader>p', ':MarkdownPreviewToggle<CR>', { noremap = true })
end,
})
-- SmiteshP/nvim-navbuddy
vim.api.nvim_set_keymap('n', '<F3>', ':Navbuddy<CR>', {})
-- nvim-tree/nvim-tree.lua
vim.api.nvim_set_keymap('n', '<F2>', ':NvimTreeToggle toggle<CR>', {})
-- tpope/vim-fugitive
vim.api.nvim_set_keymap('n', '<leader>ga', ':Git add %:p<CR><CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gd', ':Git diff<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gc', ':Git commit<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gh', ':diffget //3<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gr', ':Gread<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':diffget //2<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gs', ':G<CR>', { noremap = true })
-- hrsh7th/nvim-cmp
vim.api.nvim_set_keymap('n', 'gD', ':lua vim.lsp.buf.declaration()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gd', ':lua vim.lsp.buf.definition()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gy', ':lua vim.lsp.buf.type_definition()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gi', ':lua vim.lsp.buf.implementation()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F5>', ':lua vim.lsp.buf.rename()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F8>', ':lua vim.lsp.buf.format()<CR>', { noremap = true })
-- nvim-telescope/telescope.nvim
vim.api.nvim_set_keymap('n', '<F4>', ':Telescope find_files<CR>', { noremap = true })

View File

@ -0,0 +1,169 @@
-- loadplugins
-- bootstrap lazy
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)
return require("lazy").setup({
-- indicate git diff status of line
'lewis6991/gitsigns.nvim',
-- show indentation lines (in empty lines too)
'lukas-reineke/indent-blankline.nvim',
-- improved java syntax highlighting
{
'uiiaoo/java-syntax.vim',
ft = { 'java' },
},
-- custom statusline
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', }
},
-- show signature while typing
'ray-x/lsp_signature.nvim',
-- preview for markdown filetypes
{
"iamcco/markdown-preview.nvim",
ft = { 'markdown' },
build = "cd app && yarn install",
},
-- latex asynchronous pdf rendering
{
'donRaphaco/neotex',
ft = { 'tex' },
},
-- nim language support
{
'zah/nim.vim',
ft = { 'nim' },
},
-- automatic closing of brackets
'windwp/nvim-autopairs',
-- autocompletion and its sources
{
'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-buffer',
-- standalone cmp sources
'hrsh7th/cmp-path',
'lukas-reineke/cmp-under-comparator',
-- lsp cmp source
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
'onsails/lspkind-nvim',
-- luasnip cmp source
'l3mon4d3/luasnip',
'saadparwaiz1/cmp_luasnip',
-- lang server management
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'jose-elias-alvarez/null-ls.nvim',
'LostNeophyte/null-ls-embedded',
'jay-babu/mason-null-ls.nvim',
-- dependencies
'nvim-lua/plenary.nvim',
},
},
-- fix for cursorhold function
'antoinemadec/fixcursorhold.nvim',
-- showing color of hex values, etc
'norcalli/nvim-colorizer.lua',
-- show tags
{
"SmiteshP/nvim-navbuddy",
dependencies = {
"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
},
},
-- fileexplorer on the side
{
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
},
-- better language highlighting by improved parsing
'nvim-treesitter/nvim-treesitter',
-- automatically close html-tags
{
'windwp/nvim-ts-autotag',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
},
-- folding improvements
{
'kevinhwang91/nvim-ufo',
dependencies = { 'kevinhwang91/promise-async' },
},
-- colorful brackets
'luochen1990/rainbow',
-- fuzzy finder
{
'nvim-telescope/telescope.nvim',
version = '0.1.2',
dependencies = { 'nvim-lua/plenary.nvim' },
},
-- clean up white spaces and empty lines before writing
"mcauley-penney/tidy.nvim",
-- todo symbols and highlighting
{
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
},
-- git wrapper
'tpope/vim-fugitive',
-- golang language support
{
'fatih/vim-go',
ft = { 'go' },
},
-- markdown language support
{
'preservim/vim-markdown',
ft = { 'markdown' },
dependencies = { 'godlygeek/tabular' },
},
-- bulk renamer
'qpkorr/vim-renamer',
-- additional quote/parantheses funtions
'tpope/vim-surround',
-- colorscheme
'tiyn/vim-tccs',
})

View File

@ -0,0 +1,3 @@
-- tiyn/vim-tccs
vim.cmd('colorscheme tccs')
vim.api.nvim_set_hl(0, 'colorcolumn', { bg = '#772222' })

View File

@ -0,0 +1,2 @@
-- lewis6991/gitsigns.nvim
require('gitsigns').setup()

View File

@ -0,0 +1,6 @@
-- lukas-reineke/indent-blankline.nvim
require("indent_blankline").setup {
show_current_context = true,
show_current_context_start = true,
}

View File

@ -0,0 +1,47 @@
-- nvim-lualine/lualine.nvim
require('lualine').setup {
options = {
icons_enabled = true,
symbols = {
error = '',
warn = '',
hint = '',
info = '',
},
theme = 'tccs',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View File

@ -0,0 +1,2 @@
-- donRaphaco/neotex
vim.g.neotex_enabled = 2

View File

@ -0,0 +1 @@
require("nvim-autopairs").setup {}

View File

@ -0,0 +1,205 @@
-- hrsh7th/nvim-cmp
local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_snipmate").lazy_load()
cmp.setup {
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require "cmp-under-comparator".under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'buffer' },
{ name = 'luasnip' },
},
formatting = {
format = require("lspkind").cmp_format({
mode = "symbol_text",
preset = "codicons",
maxwidth = 50,
menu = {
nvim_lsp = "[LSP]",
path = "[PATH]",
buffer = "[BUF]",
luasnip = "[SNIP]",
},
symbol_map = {
Text = "",
Method = "",
Function = "φ",
Constructor = "",
Field = "",
Variable = "β",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "π",
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
},
}),
},
}
-- jose-elias-alvarez/null-ls.nvim
local null_ls = require("null-ls")
null_ls.setup({
sources = {
require("null-ls-embedded").nls_source.with({
filetypes = { "markdown" },
}),
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.mdformat,
},
})
-- williamboman/mason.nvim
require("mason").setup()
-- williamboman/mason-lspconfig.nvim
require("mason-lspconfig").setup({
automatic_setup = true,
ensure_installed = { "pyright", "bashls", "texlab", "nimls", "marksman", "jdtls", "lua_ls" }
})
-- jay-babu/mason-null-ls.nvim
require("mason-null-ls").setup({
automatic_installation = true,
ensure_installed = {}
})
-- ray-x/lsp_signature.nvim
require "lsp_signature".setup({
bind = true,
handler_opts = {
border = "none"
},
hint_prefix = "",
hint_scheme = "DiagnosticSignHint",
})
-- smiteshp/nvim-navbuddy
local navbuddy = require("nvim-navbuddy")
-- hrsh7th/cmp-nvim-lsp
local cmp_nvim_lsp = require("cmp_nvim_lsp")
-- neovim/nvim-lspconfig
local nvim_lsp = require('lspconfig')
local servers = { "pyright", "bashls", "texlab", "nimls", "marksman" }
local attach_func = function(client, bufnr)
navbuddy.attach(client, bufnr)
end
local capabilities = cmp_nvim_lsp.default_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = attach_func,
capabilities = capabilities,
flags = {
debounce_text_changes = 150
}
}
end
require 'lspconfig'.jdtls.setup {
on_attach = attach_func,
capabilities = capabilities,
flags = {
debounce_text_changes = 150
},
cmd = { 'jdtls' }
}
require 'lspconfig'.lua_ls.setup {
on_attach = attach_func,
capabilities = capabilities,
settings = {
Lua = {
runtime = { version = 'LuaJIT' },
diagnostics = { globals = { 'vim' } },
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
telemetry = { enable = false },
},
},
}
require('ufo').setup()
vim.fn.sign_define(
"DiagnosticSignError",
{ texthl = "DiagnosticSignError", text = "", numhl = "DiagnosticSignError" }
)
vim.fn.sign_define(
"DiagnosticSignWarn",
{ texthl = "DiagnosticSignWarn", text = "", numhl = "DiagnosticSignWarn" }
)
vim.fn.sign_define(
"DiagnosticSignInfo",
{ texthl = "DiagnosticSignInfo", text = "", numhl = "DiagnosticSignInfo" }
)
vim.fn.sign_define(
"DiagnosticSignHint",
{ texthl = "DiagnosticSignHint", text = "", numhl = "DiagnosticSignHint" }
)

View File

@ -0,0 +1,5 @@
-- norcalli/nvim-colorizer.lua
require 'colorizer'.setup {
'*',
'!markdown',
}

View File

@ -0,0 +1,14 @@
-- nvim-tree/nvim-tree.lua
require("nvim-tree").setup({
sort_by = "case_sensitive",
view = {
width = 30,
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
})

View File

@ -0,0 +1,19 @@
-- nvim-treesitter/nvim-treesitter
local ts_config = require "nvim-treesitter.configs"
ts_config.setup {
ensure_installed = {
"bash",
"c",
"cpp",
"css",
"html",
"java",
"markdown",
"latex",
"python",
},
autotag = { enable = true },
}

View File

@ -0,0 +1,2 @@
-- luochen1990/rainbow
vim.g.rainbow_active = 1

View File

@ -0,0 +1,17 @@
require("telescope").setup {
extensions = {
file_browser = {
theme = "ivy",
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = true,
mappings = {
["i"] = {
-- your custom insert mode mappings
},
["n"] = {
-- your custom normal mode mappings
},
},
},
},
}

View File

@ -0,0 +1,5 @@
-- mcauley-penney/tidy.nvim
require("tidy").setup({
filetype_exclude = {},
})

View File

@ -0,0 +1,62 @@
-- folke/todo-comments.nvim
require 'todo-comments'.setup {
signs = true, -- show icons in the signs column
sign_priority = 8, -- sign priority
-- keywords recognized as todo comments
keywords = {
ERRO = { icon = "", color = "error" },
WARN = { icon = "", color = "warning" },
HACK = { icon = "", color = "warning" },
HINT = { icon = "", color = "hint" },
TODO = { icon = "", color = "hint" },
INFO = { icon = "", color = "info", alt = { "NOTE" } },
PERF = { icon = "", color = "perfect" },
TEST = { icon = "", color = "test" },
},
gui_style = {
fg = "NONE", -- The gui style to use for the fg highlight group.
bg = "BOLD", -- The gui style to use for the bg highlight group.
},
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
-- highlighting of the line containing the todo comment
-- * before: highlights before the keyword (typically comment characters)
-- * keyword: highlights of the keyword
-- * after: highlights after the keyword (todo text)
highlight = {
multiline = true, -- enable multine todo comments
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
before = "", -- "fg" or "bg" or empty
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
after = "fg", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 400, -- ignore lines longer than this
exclude = {}, -- list of file types to exclude highlighting
},
-- list of named colors where we try to extract the guifg from the
-- list of highlight groups or use the hex color if hl not found as a fallback
colors = {
error = { "DiagnosticSignError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticSignWarn", "WarningMsg", "#FBBF24" },
hint = { "DiagnosticSignHint", "#10B981" },
info = { "DiagnosticSignInfo", "#999999" },
perfect = { "Special", "#FF00FF" },
test = { "Identifier", "#00dddd" }
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
-- regex that will be used to match keywords.
-- don't replace the (KEYWORDS) placeholder
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
},
}

View File

@ -0,0 +1,2 @@
-- fatih/vim-go
vim.g.go_def_mapping_enabled = 0

View File

@ -0,0 +1,3 @@
-- preservim/vim-markdown
vim.g.vim_markdown_folding_style_pythonic = 1
vim.g.vim_markdown_folding_disabled = 1

View File

@ -0,0 +1,199 @@
# shbang 3
snippet #!
#!/usr/bin/env python3
# shbang 2
snippet #!2
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# shbang 3
snippet #!3
#!/usr/bin/env python3
# import
snippet imp
import ${0:module}
# from ... import
snippet from
from ${1:package} import ${0:module}
# while
snippet wh
while ${1:condition}:
${0:${VISUAL}}
# do ... while
snippet dowh
while True:
${1}
if ${0:condition}:
break
# with
snippet with
with ${1:expr} as ${2:var}:
${0:${VISUAL}}
# async with
snippet awith
async with ${1:expr} as ${2:var}:
${0:${VISUAL}}
# class
snippet cla
class ${1:class_name}:
"""${0:description}"""
# class with init
snippet clai
class ${1:class_name}:
"""${2:description}"""
def __init__(self, ${3:args}):
${0}
# function with docstring
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${0}
# function
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${0}
# async function with docstring
snippet adef
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${0}
# async function
snippet adeff
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${0}
# init function
snippet defi
def __init__(self, ${1:args}):
${0}
# if
snippet if
if ${1:condition}:
${0:${VISUAL}}
# else
snippet el
else:
${0:${VISUAL}}
# else if
snippet ei
elif ${1:condition}:
${0:${VISUAL}}
# for
snippet for
for ${1:item} in ${2:items}:
${0}
# return
snippet ret
return ${0}
# self reference
snippet .
self.
# self attribute
snippet sa self.attribute = attribute
self.${1:attribute} = $1
# try ... except
snippet try Try/Except
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${0:raise $3}
# try ... except ... else
snippet trye Try/Except/Else
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
else:
${0}
# try ... except ... finally
snippet tryf Try/Except/Finally
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
finally:
${0}
# try ... except ... else ... finally
snippet tryef Try/Except/Else/Finally
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
else:
${5}
finally:
${0}
# if name is main
snippet ifmain
if __name__ == '__main__':
${0:main()}
# docstring
snippet "
"""${0:doc}
"""
# test function
snippet test
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
${0}
# list comprehension
snippet lcp list comprehension
[${1} for ${2} in ${3:${VISUAL}}]${0}
# dict comprehension
snippet dcp dict comprehension
{${1}: ${2} for ${3} in ${4:${VISUAL}}}${0}
# set comprehension
snippet scp set comprehension
{${1} for ${2} in ${3:${VISUAL}}}${0}
# print
snippet pr
print($0)
# print string
snippet prs
print("$0")
# fprint string
snippet prf
print(f"$0")
# print to file
snippet fpr
print($0, file=${1:sys.stderr})
# print string to file
snippet fprs
print("$0", file=${1:sys.stderr})
# fprint string to file
snippet fprf
print(f"$0", file=${1:sys.stderr})

View File

@ -0,0 +1,257 @@
# documentclass without options
snippet dcl \documentclass{}
\\documentclass{${1:class}} ${0}
# documentclass with options
snippet dclo \documentclass[]{}
\\documentclass[${1:options}]{${2:class}} ${0}
# newcommand
snippet nc \newcommand
\\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}
# usepackage
snippet up \usepackage
\\usepackage[${1:options}]{${2:package}} ${0}
# \begin{}...\end{}
snippet begin \begin{} ... \end{} block
\\begin{${1:env}}
${0:${VISUAL}}
\\end{$1}
# maketitle
snippet mkt maketitle
\\maketitle
# tabular
snippet tab tabular (or arbitrary) environment
\\begin{${1:tabular}}{${2:c}}
${0:${VISUAL}}
\\end{$1}
snippet center center environment
\\begin{center}
${0:${VISUAL}}
\\end{center}
# align(ed)
snippet ali align(ed) environment
\\begin{align${1:ed}}
\\label{eq:${2}}
${0:${VISUAL}}
\\end{align$1}
# equation
snippet eq equation environment
\\begin{equation}
${0:${VISUAL}}
\\end{equation}
# equation
snippet eql Labeled equation environment
\\begin{equation}
\\label{eq:${2}}
${0:${VISUAL}}
\\end{equation}
# equation
snippet eq* unnumbered equation environment
\\begin{equation*}
${0:${VISUAL}}
\\end{equation*}
# label
snippet lab \label
\\label{${1:eq:}${2:fig:}${3:tab:}${0}}
# enumerate
snippet enum enumerate environment
\\begin{enumerate}
\\item ${0}
\\end{enumerate}
# itemize
snippet item itemize environment
\\begin{itemize}
\\item ${0}
\\end{itemize}
# item
snippet it \item
\\item ${1:${VISUAL}}
# endless new item
snippet ]i \item (recursive)
\\item ${1}
${0:]i}
# matrix
snippet mat smart matrix environment
\\begin{${1:p/b/v/V/B/small}matrix}
${0:${VISUAL}}
\\end{$1matrix}
# chapter
snippet cha \chapter
\\chapter{${1:chapter name}}%
\\label{cha:${2:$1}}
${0}
# section
snippet sec \section
\\section{${1:section name}}%
\\label{sec:${2:$1}}
${0}
# section without number
snippet sec* \section*
\\section*{${1:section name}}%
\\label{sec:${2:$1}}
${0}
# sub section
snippet sub \subsection
\\subsection{${1:subsection name}}%
\\label{sub:${2:$1}}
${0}
# sub section without number
snippet sub* \subsection*
\\subsection*{${1:subsection name}}%
\\label{sub:${2:$1}}
${0}
# sub sub section
snippet ssub \subsubsection
\\subsubsection{${1:subsubsection name}}%
\\label{ssub:${2:$1}}
${0}
# sub sub section without number
snippet ssub* \subsubsection*
\\subsubsection*{${1:subsubsection name}}%
\\label{ssub:${2:$1}}
${0}
# paragraph
snippet par \paragraph
\\paragraph{${1:paragraph name}}%
\\label{par:${2:$1}}
${0}
# sub paragraph
snippet subp \subparagraph
\\subparagraph{${1:subparagraph name}}%
\\label{subp:${2:$1}}
${0}
# text italic
snippet ita italic text
\\textit{${1:${VISUAL:text}}}${0}
# text bold
snippet bf bold face text
\\textbf{${1:${VISUAL:text}}}${0}
# text underline
snippet under underline text
\\underline{${1:${VISUAL:text}}}${0}
# text overline
snippet over overline text
\\overline{${1:${VISUAL:text}}}${0}
# text emphasize
snippet emp emphasize text
\\emph{${1:${VISUAL:text}}}${0}
# text small caps
snippet sc small caps text
\\textsc{${1:${VISUAL:text}}}${0}
# text sans serife
snippet sf sans serife text
\\textsf{${1:${VISUAL:text}}}${0}
# text roman
snippet rm roman font text
\\textrm{${1:${VISUAL:text}}}${0}
# text typewriter
snippet tt typewriter (monospace) text
\\texttt{${1:${VISUAL:text}}}${0}
# text subscripted
snippet tsub subscripted text
\\textsubscript{${1:${VISUAL:text}}}${0}
# text superscripted
snippet tsup superscripted text
\\textsuperscript{${1:${VISUAL:text}}}${0}
# footnote
snippet ft \footnote
\\footnote{${1:${VISUAL:text}}}${0}
# figure includegraphics
snippet fig figure environment (includegraphics)
\\begin{figure}[htpb]
\\begin{center}
\\includegraphics[scale=${1}]{Figures/${2}}
\\end{center}
\\caption{${3}}
\\label{fig:${4}}
\\end{figure}
${0}
# figure tikz
snippet tikz figure environment (tikzpicture)
\\begin{figure}[htpb]
\\begin{center}
\\begin{tikzpicture}[scale=${1:1}, transform shape]
${2}
\\end{tikzpicture}
\\end{center}
\\caption{${3}}%
\\label{fig:${4}}
\\end{figure}
${0}
# math fraction
snippet frac \frac{}{}
\\frac{${1:num}}{${2:denom}} ${0}
# math sum
snippet sum \sum^{}_{}
\\sum^{${1:n}}_{${2:i=1}} ${0}
# math limes
snippet lim \lim_{}
\\lim_{${1:n \\to \\infty}} ${0}
# code listing
snippet lst
\\begin{listing}[language=${1:language}]
${0:${VISUAL}}
\\end{listing}
# code listing inline
snippet lsi
\\lstinline|${1}| ${0}
# hyperlink url
snippet url
\\url{${1}} ${0}
# hyperlink href
snippet href
\\href{${1}}{${2}} ${0}
# right arrow
snippet ra rightarrow
\\rightarrow {$0}
# long right arrow
snippet lra longrightarrow
\\longrightarrow {$0}