From 5ec73d44d6eddb9491311f633f4be6ef609768b6 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Fri, 20 Jan 2023 00:42:58 +0100 Subject: qol improvements --- .gitmodules | 6 ++++++ after/ftplugin/javascript.vim | 2 +- init.lua | 38 +++++++++++++++++++++++++++++++++++++- pack/all/start/fzf.vim | 1 + pack/all/start/vim-recently-used | 2 +- pack/nvim/start/nvim-treesitter | 1 + plugin/max-fix-colorschemes.vim | 30 ++++++++++++++++++------------ utils/bashrc | 16 ++++++++++++++++ vimrc-common | 19 ++++++++++++------- 9 files changed, 93 insertions(+), 22 deletions(-) create mode 160000 pack/all/start/fzf.vim create mode 160000 pack/nvim/start/nvim-treesitter diff --git a/.gitmodules b/.gitmodules index d09951e..986283d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -55,3 +55,9 @@ [submodule "pack/all/start/vim-editorconfig"] path = pack/all/start/vim-editorconfig url = https://github.com/cxw42/editorconfig-vim +[submodule "pack/nvim/start/nvim-treesitter"] + path = pack/nvim/start/nvim-treesitter + url = https://github.com/nvim-treesitter/nvim-treesitter +[submodule "pack/all/start/fzf.vim"] + path = pack/all/start/fzf.vim + url = https://github.com/junegunn/fzf.vim diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim index d4c9199..ce0e6f2 100644 --- a/after/ftplugin/javascript.vim +++ b/after/ftplugin/javascript.vim @@ -1 +1 @@ -set number +" set number diff --git a/init.lua b/init.lua index 9cc1598..d58bbba 100644 --- a/init.lua +++ b/init.lua @@ -3,6 +3,12 @@ vim.cmd('source ~/.vim/vimrc') vim.o.termguicolors = true vim.o.exrc = true +vim.o.shadafile = (os.getenv("XDG_CACHE_HOME") or + os.getenv("HOME") .. "/.cache" + ) .. "/vim.shada" + +-- vimscript: get(environ(), "XDG_CACHE_HOME", "~/.cache")."/vim.shada" + require'man' require'colorizer'.setup() @@ -175,4 +181,34 @@ sources = cmp.config.sources({ -- require'lspconfig'.html.setup{capabilities = capabilities} -- -- require'lspconfig'.jsonls.setup{capabilities = capabilities} --- +-- + + +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" + ensure_installed = { "c", "bash", "javascript" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (for "all") + ignore_install = { "javascript" }, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + -- `false` will disable the whole extension + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} diff --git a/pack/all/start/fzf.vim b/pack/all/start/fzf.vim new file mode 160000 index 0000000..0f03107 --- /dev/null +++ b/pack/all/start/fzf.vim @@ -0,0 +1 @@ +Subproject commit 0f03107bc94b31a9c7adcee6da8e5de7492e4b0b diff --git a/pack/all/start/vim-recently-used b/pack/all/start/vim-recently-used index b0762c9..7845fa4 160000 --- a/pack/all/start/vim-recently-used +++ b/pack/all/start/vim-recently-used @@ -1 +1 @@ -Subproject commit b0762c939a9c1cd1e8e8d88d3491c28d556e993e +Subproject commit 7845fa4e392e8808693096329bf3638e3231186f diff --git a/pack/nvim/start/nvim-treesitter b/pack/nvim/start/nvim-treesitter new file mode 160000 index 0000000..68e8181 --- /dev/null +++ b/pack/nvim/start/nvim-treesitter @@ -0,0 +1 @@ +Subproject commit 68e8181dbcf29330716d380e5669f2cd838eadb5 diff --git a/plugin/max-fix-colorschemes.vim b/plugin/max-fix-colorschemes.vim index 0a5e401..9f55fdf 100644 --- a/plugin/max-fix-colorschemes.vim +++ b/plugin/max-fix-colorschemes.vim @@ -15,18 +15,24 @@ function! ExtendColorTheme() highlight! PmenuThumb cterm=inverse highlight! MoreMsg cterm=inverse - highlight! link qfSeparator Normal | " reserve one space - highlight! link qfLineNr Normal | " informational line numbers should look different - highlight! link SpecialKey NonText | " makes tab stop (see listchars) less disturbing - highlight! link WildMenu Search - highlight! link Convention Error - highlight! link PmenuSbar Pmenu - highlight! link VertSplit LineNr - highlight! link SignColumn LineNr - highlight! link ALEErrorSign LineNr - highlight! link FoldColumn VertSplit - " highlight! link Folded LineNr - highlight! link EndOfBuffer NonText + highlight! link qfSeparator Normal | " reserve one space + highlight! link qfLineNr Normal | " informational line numbers should look different + highlight! link SpecialKey NonText | " makes tab stop (see listchars) less disturbing + highlight! link WildMenu Search + highlight! link Convention Error + highlight! link PmenuSbar Pmenu + highlight! link VertSplit LineNr + highlight! link SignColumn LineNr + highlight! link ALEErrorSign LineNr + highlight! link FoldColumn VertSplit + highlight! link Folded LineNr + highlight! link EndOfBuffer NonText + highlight! link DiagnosticHint Debug + highlight! link DiagnosticInfo Debug + highlight! link DiagnosticError Error + highlight! link DiagnosticWarn Debug + + hi Comment gui=italic hi Keyword gui=bold diff --git a/utils/bashrc b/utils/bashrc index 24c51a0..f0ee98b 100644 --- a/utils/bashrc +++ b/utils/bashrc @@ -28,3 +28,19 @@ git config --global --replace-all core.pager 'vim -c":set noswapfile filetype=gi # export PAGER="tee /tmp/output.txt /dev/stdout | /bin/vim -" # --remote-expr ":%!col -b" -c":set buftype=nowrite filetype=man readonly" -'A + +function vim() { + SERVER=$(ls -tr "$XDG_RUNTIME_DIR"/nvim.* | tail -n1) + if [ $# -gt 0 ] && [ -n "$SERVER" ]; then + for i in "$@"; do + NEXT=$(realpath "$i") + nvim --server "$SERVER" --remote-silent "$NEXT" + done + else + nvim $@ + fi + +} + + + diff --git a/vimrc-common b/vimrc-common index 03daedd..f650dad 100644 --- a/vimrc-common +++ b/vimrc-common @@ -16,7 +16,7 @@ set noexrc | " exrc was nice, but has too many se set modeline | " set variables specific to a file, like indentation by adding a comment (TODO: should probably be replaced by editorconfig) set ts=4 sts=4 sw=4 expandtab textwidth=0 | " better done with a modeline or local exrc set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against -set number norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis +set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis set ignorecase smartcase | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower) set hlsearch incsearch | " highlight pattern while entering it (performance wise this isn't that good) " set cindent cinoptions+=(0 | " indent at parentheses @@ -105,7 +105,7 @@ end " SETTINGS: " ====================================================================================================================== set breakindent | " Every wrapped line will continue visually indented -" set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) +set clipboard=unnamedplus | " makes copy and paste work (autoselectplus might work as well) set concealcursor=nc | " limits the display of concealed text to normal and command mode set conceallevel=2 | " replace escaped chars by their UTF-8 representation (useful for LaTeX) set confirm | " asks 'do you want to save?' @@ -124,11 +124,16 @@ if has('nvim') " Neovim? endif if exists("g:neovide") - set guifont=monospace:h11:b - let g:neovide_cursor_animation_length=0.03 - let g:neovide_cursor_trail_size=0.8 - let g:neovide_scroll_animation_length = 0.05 - let g:neovide_transparency = 0.9 + set guifont=monospace:h11:b + let g:neovide_cursor_animation_length=0 + let g:neovide_scroll_animation_length = 0.5 + let g:neovide_cursor_trail_size=0.8 + let g:neovide_cursor_vfx_mode = "" + let g:neovide_transparency = 0.9 + let g:neovide_floating_blur_amount_x = 4.0 + let g:neovide_floating_blur_amount_y = 4.0 + let g:neovide_background_color = '#383a62' + let g:neovide_scale_factor = 1.0 endif set pumheight=8 | " Determines the maximum number of items to show in the pop-up menu for -- cgit v1.2.3