浏览代码

more neovim config updates + including lua config for treesitter

Noah Vogt 3 年之前
父节点
当前提交
5a2e15de80

+ 7 - 0
dot-config/nvim/general/auto.vim

@@ -80,3 +80,10 @@ augroup EmmetEnabler
   autocmd!
   autocmd FileType html,css EmmetInstall
 augroup END
+
+" colored nerdfont icons on fern + startify buffers
+augroup my-glyph-palette
+  autocmd! *
+  autocmd FileType fern call glyph_palette#apply()
+  autocmd FileType startify call glyph_palette#apply()
+augroup END

+ 8 - 1
dot-config/nvim/general/basic.vim

@@ -2,11 +2,12 @@ set nocompatible
 
 " set vim paths
 set undodir="~/.cache/vim/undo"
-set viminfo="~/.cache/vim/viminfo"
 set runtimepath+="~/.config/vim"
 
 " make :find recursive
 set path+=**
+set wildignore+=*/node_modules/*
+set wildignore+=*/__pycache__/*
 
 " display all files for tab completion
 set wildmenu
@@ -64,3 +65,9 @@ syntax enable
 
 " always show tabs
 "set showtabline=2
+
+" don't redraw while executing macros (good performance config)
+set lazyredraw
+
+" ignore case when searching
+set ignorecase

+ 2 - 0
dot-config/nvim/init.vim

@@ -11,6 +11,8 @@ source $XDG_CONFIG_HOME/nvim/plug-conf/emmet.vim
 source $XDG_CONFIG_HOME/nvim/plug-conf/ctrlp.vim
 source $XDG_CONFIG_HOME/nvim/plug-conf/sneak.vim
 source $XDG_CONFIG_HOME/nvim/plug-conf/airline.vim
+source $XDG_CONFIG_HOME/nvim/plug-conf/startify.vim
+lua require('treesitter')
 " get theme
 source $XDG_CONFIG_HOME/nvim/theme/theme.vim
 " get keybinds

+ 64 - 0
dot-config/nvim/lua/treesitter.lua

@@ -0,0 +1,64 @@
+require'nvim-treesitter.configs'.setup {
+    ensure_installed = {
+        "c",
+        "lua",
+        "java",
+        "python",
+        "bash",
+        "html",
+        "css",
+        "javascript",
+        "bibtex",
+        "cmake",
+        "cpp",
+        "latex",
+        "perl",
+        "regex",
+        "toml",
+        "yaml"
+    },
+
+  -- Install parsers synchronously (only applied to `ensure_installed`)
+  sync_install = false,
+
+  highlight = {
+    enable = true,
+
+    disable = {"rust"},
+
+    -- 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.
+    additional_vim_regex_highlighting = false,
+    },
+
+    refactor = {
+        highlight_definitions = {
+            enable = true,
+            -- Set to false if you have an `updatetime` of ~100.
+            clear_on_cursor_move = false,
+        },
+
+        highlight_current_scope = { 
+            -- very annonying per default, maybe has its use when its unclear
+            enable = false
+        },
+
+        smart_rename = {
+            enable = true,
+            keymaps = {
+                smart_rename = "grr",
+            },
+        },
+
+        navigation = {
+            enable = true,
+            keymaps = {
+                goto_definition = "gnd",
+                list_definitions = "gnD",
+                list_definitions_toc = "gO",
+                goto_next_usage = "<A-n>",
+                goto_previous_usage = "<A-p>",
+            },
+        },
+    },
+}

+ 35 - 0
dot-config/nvim/plug-conf/startify.vim

@@ -0,0 +1,35 @@
+" set custom welcome message header
+let g:startify_custom_header = [
+        \ '_   ___     ___            ',
+        \ '| \ | \ \   / (_)_ __ ___  ',
+        \ '|  \| |\ \ / /| | |_ ` _ \ ',
+        \ '| |\  | \ V / | | | | | | |',
+        \ '|_| \_|  \_/  |_|_| |_| |_|',
+        \]
+
+" auto restart session
+" NOTE: If this option is enabled and you start Vim in a directory that contains a
+" Session.vim, that session will be loaded automatically. Otherwise it will be
+" shown as the top entry in the Startify buffer.
+let g:startify_session_autoload = 1
+
+" let startify take care of buffers
+let g:startify_session_delete_buffers = 1
+
+" similar to vim-rooter
+let g:startify_change_to_vcs_root = 1
+
+" use unicode
+let g:startify_fortune_use_unicode = 1
+
+" auto update sessions
+let g:startify_session_persistence = 1
+
+" get rid of empy buffer and quit
+let g:startify_enable_special = 0
+
+let g:startify_lists = [
+          \ { 'type': 'files',     'header': ['   Files']            },
+          \ { 'type': 'dir',       'header': ['   Current Directory '. getcwd()] },
+          \ { 'type': 'sessions',  'header': ['   Sessions']       },
+          \ ]

+ 19 - 5
dot-config/nvim/vim-plug/plugins.vim

@@ -7,8 +7,8 @@
 call plug#begin('~/.cache/vim/plugged')
 
 " colorshemes
-"Plug 'morhetz/gruvbox'
-"Plug 'itchyny/landscape.vim'
+Plug 'morhetz/gruvbox'
+Plug 'itchyny/landscape.vim'
 Plug 'joshdick/onedark.vim'
 
 " better syntax support
@@ -19,11 +19,12 @@ Plug 'ctrlpvim/ctrlp.vim'
 
 " faster nerdtree
 Plug 'lambdalisue/fern.vim'
-" with git status integration
+" w/ git status integration
 Plug 'lambdalisue/fern-git-status.vim'
-" with nerdfont icons
+" w/ colored nerdfont icons
 Plug 'lambdalisue/nerdfont.vim'
 Plug 'lambdalisue/fern-renderer-nerdfont.vim'
+Plug 'lambdalisue/glyph-palette.vim'
 " and a floating, scrollable preview window
 Plug 'yuki-yano/fern-preview.vim'
 
@@ -48,7 +49,7 @@ Plug 'neoclide/coc.nvim', {'branch': 'release'}
 Plug 'romainl/vim-cool'
 
 " graphical debugger
-"Plug 'puremourning/vimspector'
+Plug 'puremourning/vimspector'
 
 " use when there are too many parentheses
 "Plug 'kien/rainbow_parentheses.vim'
@@ -68,4 +69,17 @@ Plug 'mattn/emmet-vim'
 " fast search 'n' jump
 Plug 'justinmk/vim-sneak'
 
+" fancy start screen
+Plug 'mhinz/vim-startify'
+" w/ nerdfont icons
+Plug 'csch0/vim-startify-renderer-nerdfont'
+
+" easily change surrounding elements
+Plug 'tpope/vim-surround'
+
+" use treesitter inside nvim
+Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
+" w/ refactoring capabilites
+Plug 'nvim-treesitter/nvim-treesitter-refactor'
+
 call plug#end()