From 6f6457b7397247a34e25d4d9bfca434d8306283e Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Mon, 22 Dec 2025 17:28:43 +0100 Subject: Backup: Alte Neovim-Konfiguration --- nvim_alt/autocmd.vim | 3 + nvim_alt/colorscheme.vim | 5 ++ nvim_alt/completion.lua | 21 ++++++ nvim_alt/ftplugin/c.vim | 9 +++ nvim_alt/ftplugin/html.vim | 15 ++++ nvim_alt/ftplugin/markdown.vim | 3 + nvim_alt/ftplugin/typescript.vim | 11 +++ nvim_alt/ftplugin/vim.vim | 6 ++ nvim_alt/init.vim | 8 ++ nvim_alt/keymaps.vim | 84 +++++++++++++++++++++ nvim_alt/lsp.lua | 60 +++++++++++++++ nvim_alt/plugins.vim | 153 +++++++++++++++++++++++++++++++++++++++ nvim_alt/settings.vim | 82 +++++++++++++++++++++ nvim_alt/statusline.vim | 36 +++++++++ 14 files changed, 496 insertions(+) create mode 100644 nvim_alt/autocmd.vim create mode 100644 nvim_alt/colorscheme.vim create mode 100644 nvim_alt/completion.lua create mode 100644 nvim_alt/ftplugin/c.vim create mode 100644 nvim_alt/ftplugin/html.vim create mode 100644 nvim_alt/ftplugin/markdown.vim create mode 100644 nvim_alt/ftplugin/typescript.vim create mode 100644 nvim_alt/ftplugin/vim.vim create mode 100644 nvim_alt/init.vim create mode 100644 nvim_alt/keymaps.vim create mode 100644 nvim_alt/lsp.lua create mode 100644 nvim_alt/plugins.vim create mode 100644 nvim_alt/settings.vim create mode 100644 nvim_alt/statusline.vim (limited to 'nvim_alt') diff --git a/nvim_alt/autocmd.vim b/nvim_alt/autocmd.vim new file mode 100644 index 0000000..fb718c8 --- /dev/null +++ b/nvim_alt/autocmd.vim @@ -0,0 +1,3 @@ +"autocmd FileType html,css EmmetInstall +"autocmd VimEnter * NERDTree | wincmd p +"autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif diff --git a/nvim_alt/colorscheme.vim b/nvim_alt/colorscheme.vim new file mode 100644 index 0000000..4484210 --- /dev/null +++ b/nvim_alt/colorscheme.vim @@ -0,0 +1,5 @@ +" Farbschema +set termguicolors +set background=dark +colorscheme codedark + diff --git a/nvim_alt/completion.lua b/nvim_alt/completion.lua new file mode 100644 index 0000000..747607e --- /dev/null +++ b/nvim_alt/completion.lua @@ -0,0 +1,21 @@ +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + -- if client and client:supports_method("textDocument/completion") then + -- vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) + -- end + + if client and not client:supports_method('textDocument/willSaveWaitUntil') and + client:supports_method('textDocument/formatting') then + vim.api.nvim_create_autocmd('BufWritePre', { + group = vim.api.nvim_create_augroup('my.lsp', { clear = false }), + buffer = ev.buf, + callback = function() + vim.lsp.buf.format({ bufnr = ev.buf, id = client.id, timeout_ms = 1000 }) + end, + }) + end + end, +}) + +vim.o.winborder = 'rounded' diff --git a/nvim_alt/ftplugin/c.vim b/nvim_alt/ftplugin/c.vim new file mode 100644 index 0000000..3fc55eb --- /dev/null +++ b/nvim_alt/ftplugin/c.vim @@ -0,0 +1,9 @@ +setlocal cinoptions=:0,p0,t0 +setlocal cinwords=if,else,while,do,for,switch,case +setlocal formatoptions=tcqr +setlocal cindent +setlocal indentexpr=nvim_treesitter#indent() + +setlocal foldenable +setlocal foldmethod=expr +setlocal foldexpr=nvim_treesitter#foldexpr() diff --git a/nvim_alt/ftplugin/html.vim b/nvim_alt/ftplugin/html.vim new file mode 100644 index 0000000..fe513b6 --- /dev/null +++ b/nvim_alt/ftplugin/html.vim @@ -0,0 +1,15 @@ +setlocal tabstop=2 +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal smarttab +setlocal expandtab +setlocal autoindent + +setlocal foldenable +setlocal foldmethod=expr +setlocal foldexpr=nvim_treesitter#foldexpr() + +let g:html_indent_script1='inc' +let g:html_indent_style1='inc' +let g:html_indent_autotags='html' +let g:html_indent_inctags='head,body' diff --git a/nvim_alt/ftplugin/markdown.vim b/nvim_alt/ftplugin/markdown.vim new file mode 100644 index 0000000..e5f14dc --- /dev/null +++ b/nvim_alt/ftplugin/markdown.vim @@ -0,0 +1,3 @@ +setlocal wrap +setlocal linebreak +setlocal spell diff --git a/nvim_alt/ftplugin/typescript.vim b/nvim_alt/ftplugin/typescript.vim new file mode 100644 index 0000000..5f56854 --- /dev/null +++ b/nvim_alt/ftplugin/typescript.vim @@ -0,0 +1,11 @@ +setlocal tabstop=2 +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal smarttab +setlocal expandtab +setlocal autoindent + +setlocal foldenable +setlocal foldmethod=expr +setlocal foldexpr=nvim_treesitter#foldexpr() + diff --git a/nvim_alt/ftplugin/vim.vim b/nvim_alt/ftplugin/vim.vim new file mode 100644 index 0000000..1054984 --- /dev/null +++ b/nvim_alt/ftplugin/vim.vim @@ -0,0 +1,6 @@ +setlocal tabstop=2 +setlocal softtabstop=2 +setlocal shiftwidth=2 +setlocal smarttab +setlocal expandtab +setlocal autoindent diff --git a/nvim_alt/init.vim b/nvim_alt/init.vim new file mode 100644 index 0000000..96ecac9 --- /dev/null +++ b/nvim_alt/init.vim @@ -0,0 +1,8 @@ +source $HOME/.config/nvim/settings.vim +source $HOME/.config/nvim/statusline.vim +source $HOME/.config/nvim/autocmd.vim +source $HOME/.config/nvim/keymaps.vim +source $HOME/.config/nvim/plugins.vim +source $HOME/.config/nvim/colorscheme.vim +source $HOME/.config/nvim/lsp.lua +source $HOME/.config/nvim/completion.lua diff --git a/nvim_alt/keymaps.vim b/nvim_alt/keymaps.vim new file mode 100644 index 0000000..f03f451 --- /dev/null +++ b/nvim_alt/keymaps.vim @@ -0,0 +1,84 @@ +let mapleader=',' + +" mit + durch die Tabs schalten +nnoremap :tabprevious +nnoremap :tabnext + +" besseres Verhalten von +map 1000 +map 1000 +imap 1000 +imap 1000 + +" Verschiebe Zeilen mit ALT+j oder ALT+k +nnoremap :m .+1== +nnoremap :m .-2== +inoremap :m .+1==gi +inoremap :m .-2==gi +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv + +" Absatzweises springen auf einer deutsche Tastatur +nnoremap ö } +nnoremap ä { +xnoremap ö } +xnoremap ä { +onoremap ö } +onoremap ä { + +" besseres Verhalten in umbrochenen Texten +map j gj +map k gk +"map $ g$ +"map 0 g0 + +" Funktionstasten +nnoremap :NvimTreeToggle +nnoremap :make + +" Telescope +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags + +" LSP Keybindings +lua << EOF +vim.keymap.set("i", "", function() vim.lsp.completion.get() end) + +-- map to when the popup menu is visible +vim.keymap.set("i", "", "pumvisible() ? '' : ''", { expr = true }) + +--[[ +vim.keymap.set('n', 'e', vim.diagnostic.open_float) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' + + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + end, +}) +]] +EOF diff --git a/nvim_alt/lsp.lua b/nvim_alt/lsp.lua new file mode 100644 index 0000000..fbb5066 --- /dev/null +++ b/nvim_alt/lsp.lua @@ -0,0 +1,60 @@ +vim.lsp.config.clangd = { + cmd = { '/usr/local/bin/clangd19', '--background-index', '--function-arg-placeholders' }, + root_markers = { 'compile_commands.json', 'compile_flags.txt' }, + filetypes = { 'c', 'cpp' }, +} + +vim.lsp.config.lua_ls = { + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + }, + telemetry = { + enable = false, + }, + }, + } +} + +local project_library_path = "/home/t/.local/lib/node_modules" +local ng_cmd = { "ngserver", "--stdio", "--tsProbeLocations", project_library_path, "--ngProbeLocations", + project_library_path } + +vim.lsp.config.angularls = { + cmd = ng_cmd, + on_new_config = function(new_config, new_root_dir) + new_config.cmd = ng_cmd + end, +} + +vim.lsp.config.markdown_oxide = { + on_attach = on_attach, + cmd = { + 'markdown-oxide' + } +} + +vim.lsp.enable({ + 'clangd', + 'lua_ls', + 'angularls', + 'cssls', + 'html', + 'ts_ls', + 'vimls', + 'jsonls', + 'gopls', + 'markdown_oxid' +}) + +vim.diagnostic.config({ + virtual_text = true, + -- virtual_lines = true +}) diff --git a/nvim_alt/plugins.vim b/nvim_alt/plugins.vim new file mode 100644 index 0000000..4277d35 --- /dev/null +++ b/nvim_alt/plugins.vim @@ -0,0 +1,153 @@ +" automatische Installation von vim-plug +let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +endif + +" vim-plug +call plug#begin() + Plug 'neovim/nvim-lspconfig' + + Plug 'nvim-tree/nvim-web-devicons' + Plug 'nvim-tree/nvim-tree.lua' + + Plug 'romainl/vim-cool' + + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-surround' + + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + + Plug 'windwp/nvim-autopairs' + Plug 'windwp/nvim-ts-autotag' + + Plug 'lewis6991/gitsigns.nvim' + + Plug 'RRethy/vim-illuminate' + + " Telescope + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' + + " Colorscheme + Plug 'tomasiser/vim-code-dark' +call plug#end() + +lua << EOF + +-- nvim-tree +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + adaptive_size = true, + }, + renderer = { + group_empty = true, + indent_markers = { + enable = true, + }, + }, + filters = { + dotfiles = true, + }, +}) + +-- require('nvim-treesitter.configs').setup { +-- ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "typescript", "python", "html", "go", "gomod", "gosum" }, +-- sync_install = false, +-- auto_install = false, +-- highlight = { +-- enable = true, +-- additional_vim_regex_highlighting = true, +-- }, +-- indent = { +-- enable = true, +-- } +-- } + +require'nvim-treesitter'.install { "c", "cpp", "lua", "vim", "vimdoc", "typescript", "python", "html", "go", "gomod", "gosum" } + +require('nvim-autopairs').setup() + +require('nvim-ts-autotag').setup() + +require('gitsigns').setup() + +require('illuminate').configure({ + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + -- delay: delay in milliseconds + delay = 50, + -- filetype_overrides: filetype specific overrides. + -- The keys are strings to represent the filetype while the values are tables that + -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist + filetype_overrides = {}, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + 'dirbuf', + 'dirvish', + 'fugitive', + }, + -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist + -- You must set filetypes_denylist = {} to override the defaults to allow filetypes_allowlist to take effect + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + -- See `:help mode()` for possible values + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist + -- See `:help mode()` for possible values + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + -- large_file_cutoff: number of lines at which to use large_file_config + -- The `under_cursor` option is disabled when this cutoff is hit + large_file_cutoff = nil, + -- large_file_config: config to use for large files (based on large_file_cutoff). + -- Supports the same keys passed to .configure + -- If nil, vim-illuminate will be disabled for large files. + large_file_overrides = nil, + -- min_count_to_highlight: minimum number of matches required to perform highlighting + min_count_to_highlight = 2, + -- should_enable: a callback that overrides all other settings to + -- enable/disable illumination. This will be called a lot so don't do + -- anything expensive in it. + should_enable = function(bufnr) return true end, + -- case_insensitive_regex: sets regex case sensitivity + case_insensitive_regex = false, +}) + +-- change the highlight style + +vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "MatchParen" }) +vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "MatchParen" }) +vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "MatchParen" }) + +--- auto update the highlight style on colorscheme change +vim.api.nvim_create_autocmd({ "ColorScheme" }, { + pattern = { "*" }, + callback = function(ev) + vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "MatchParen" }) + vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "MatchParen" }) + vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "MatchParen" }) + end +}) + +EOF + diff --git a/nvim_alt/settings.vim b/nvim_alt/settings.vim new file mode 100644 index 0000000..1586c23 --- /dev/null +++ b/nvim_alt/settings.vim @@ -0,0 +1,82 @@ +" Allgemeine Einstellungen +set number +set cursorline +set shortmess+=I +set nowrap +set nocompatible +set ruler +set wildmenu +set noshowcmd +set splitright +set splitbelow +set hidden +set signcolumn=yes + +" Rechtsschreibprüfung +set nospell +set spelllang=de,en + +" Optionen für ^n-Vervollständigung +set complete=.,w,b,u,t,i + +" bessere Suche +set hlsearch +set incsearch +set ignorecase +set smartcase + +" Sonderzeichen anzeigen +set list +set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+ +set matchpairs+=<:> + +" automatisches Einlesen geänderter Dateien +set autoread + +" Suche rekursiv +set path+=** + +" Tabs +set noexpandtab +set tabstop=4 +set shiftwidth=4 +set softtabstop=0 + +" Einrückungen +set smartindent +set autoindent +set cindent + +" Faltungen +set foldlevel=1000 +set foldcolumn=0 + +" Autovervollständigung +set completeopt=longest,menuone,noselect,popup + +" externe Programme +set makeprg=gmake +set autowrite + +" Guifont +set guifont=JetBrains\ Mono\ Semibold:h12 + +" provider +let g:python3_host_prog='/usr/local/bin/python' +let g:loaded_node_provider=0 +let g:loaded_ruby_provider=0 +let g:loaded_perl_provider=0 + +" Swap files und UnDo +set noswapfile +set undofile +set undolevels=10000 +set undoreload=10000 + +" Clipboard +set clipboard=unnamedplus + +" weitere Einstellungen +syntax enable +filetype plugin indent on + diff --git a/nvim_alt/statusline.vim b/nvim_alt/statusline.vim new file mode 100644 index 0000000..069e632 --- /dev/null +++ b/nvim_alt/statusline.vim @@ -0,0 +1,36 @@ +" Statusline +function! GitBranch() + return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") +endfunction + +function! StatuslineGit() + let l:branchname = GitBranch() + return strlen(l:branchname) > 0?' '.l:branchname.' ':'' +endfunction + +let g:currentmode={ + \ 'n' : 'n', + \ 'v' : 'v', + \ 'V' : 'vl', + \ '' : 'vb', + \ 'i' : 'i', + \ 'R' : 'r', + \ 'Rv' : 'rv', + \ 'c' : 'c', + \ 't' : 'f', + \} + +set laststatus=2 +set statusline= +set statusline+=%#PmenuSel# +set statusline+=%{StatuslineGit()} +set statusline+=%#Statusline# +set statusline+=\ %f +set statusline+=%m +set statusline+=%= +set statusline+=%#StatusLineNc# +set statusline+=\ %y +set statusline+=\ %{&fileencoding?&fileencoding:&encoding} +set statusline+=\ %p%% +set statusline+=\ %l:%c + -- cgit v1.3