Closed j2kun closed 2 years ago
My nvim init.vim
call plug#begin(stdpath('data') . '/plugged')
Plug 'SirVer/ultisnips'
Plug 'airblade/vim-gitgutter'
Plug 'airblade/vim-rooter'
Plug 'christoomey/vim-tmux-navigator'
Plug 'honza/vim-snippets'
Plug 'knubie/vim-kitty-navigator'
Plug 'lervag/vimtex'
" gs to start function arg swap mode
Plug 'machakann/vim-swap'
Plug 'mechatroner/rainbow_csv'
Plug 'neovim/nvim-lspconfig'
Plug 'overcache/NeoSolarized'
Plug 'preservim/nerdtree'
Plug 'simrat39/rust-tools.nvim'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-surround'
Plug 'wellle/targets.vim'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-session'
" autocompletion, with spearate plugins for each source
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'quangnguyen30192/cmp-nvim-ultisnips'
" Fuzzy finder
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
call plug#end()
" Completion menu options
set completeopt=noinsert,menu,menuone,noselect
lua << EOF
require('language_server')
EOF
" <leader> = ,
let mapleader=","
" faster esc
inoremap jk <ESC>
" Jump to config
nnoremap <leader>ve :vsp $MYVIMRC<CR>
nnoremap <leader>vs :source $MYVIMRC<CR>
" Tabs = 2 spaces
set tabstop=2 " number of visual spaces per TAB
set shiftwidth=2 " number of visual spaces per shift
set softtabstop=2 " number of spaces in tab when editing
set expandtab " tabs are spaces
""" Misc UI config
colorscheme NeoSolarized
set background=dark
set cursorline " highlight current line
set termguicolors " terminal colors
set nohlsearch " don't highlight searches after done
" use system clipboard
set clipboard=unnamed
""" Backup preferences
set backup
set backupdir=~/.cache/nvim/backup
set backupskip=~/.cache/*
set directory=~/.cache/nvim/swap
set writebackup
set undofile " Maintain undo history between sessions
set undodir=~/.cache/nvim/undo
""" Session management
let g:session_autosave = 'yes'
let g:session_autoload = 'yes'
let g:session_default_to_last = 'yes'
" Don't save hidden and unloaded buffers in sessions.
set sessionoptions-=buffers
""" Movement + selection config
" move vertically by visual line
nnoremap j gj
nnoremap k gk
" highlight last inserted text
nnoremap gV `[v`]
" align text in current paragraph
nnoremap <leader>gq vipgq
" Sort and dedupe current paragraph by line
nnoremap <leader>s vip:sort u<CR>
" recommended by vim-stay
set viewoptions=cursor,folds,slash,unix
" relative numbers for focus + normal mode, absolute for all others
set number relativenumber
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber
augroup END
" expand current path in command mode
cabbr %% <C-R>=expand('%:p:h')<CR>
""" Plugin settings
" Ensure latex uses ftplugin/tex.vim for all .tex files
let g:tex_flavor = 'latex'
" telescope/fuzzy finder
nnoremap <c-p> <cmd>Telescope find_files<cr>
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
nnoremap <leader>fr <cmd>Telescope registers<cr>
nnoremap <leader>fj <cmd>Telescope jump_list<cr>
nnoremap <leader>fo <cmd>Telescope oldfiles<cr>
nnoremap <leader>fd <cmd>Telescope lsp_diagnostics<cr>
" to explore picker options, list them all in the fuzzy finder window
nnoremap <leader>fl <cmd>Telescope builtin<cr>
nnoremap <leader>m <cmd>Telescope marks<cr>
" Gitgutter
nmap <Leader>ha <Plug>(GitGutterStageHunk)
nmap <Leader>hr <Plug>(GitGutterUndoHunk)
nmap <Leader>gb :Gbrowse<CR>
vmap <Leader>gb :Gbrowse<CR>
set signcolumn=number
highlight clear SignColumn
let g:gitgutter_realtime = 1
let g:gitgutter_max_signs = 1000
" ultisnips
let g:UltiSnipsExpandTrigger="<c-j>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', 'UltiSnips', '~/.vim/bundle/vim-snippets/UltiSnips']
" vim-rooter
" for files not in a project, chroot to the directory containing the file
let g:rooter_change_directory_for_non_project_files = 'current'
" NERDtree
nnoremap <leader>t :NERDTreeToggle %<CR>
nnoremap <C-t> :NERDTreeToggle %<CR>
" Highlight LSP matches for variable names
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
I've also noticed that the UltiSnips path let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', 'UltiSnips', '~/.vim/bundle/vim-snippets/UltiSnips']
is not valid on this new system, so I tried changing it to
let g:UltiSnipsSnippetDirectories = ['~/.vim/UltiSnips', stdpath('data') . '/plugged' . '/vim-snippets/UltiSnips']
But that doesn't seem to fix the problem.
This seems to be the same issue as seen in #67. I ran into the same issue today, and was able to fix it by adding
lua << EOF
local cmp_ultisnips = require('cmp_nvim_ultisnips')
cmp_ultisnips.setup{
filetype_source = "ultisnips_default"
}
EOF
I am not exactly sure what is causing this, but I tried to fix it in #69. Since I can't reproduce this on my side I'm not sure if this will solve your issue. Could you please check out that branch and see if it works for you? (Simply change the entry in your vim-plug config to Plug 'smjonas/cmp-nvim-ultisnips', { 'branch': 'fix_undefined' }
.)
@riddlew I think this is a different issue
I was getting the same error and changing my vim-plug configuration to Plug 'smjonas/cmp-nvim-ultisnips', { 'branch': 'fix_undefined' }
as @smjonas suggested fixed the issue.
I have a new install of nvim + all my plugins (from a previous working setup), and any time I type in insert mode I see the following error. Not sure how to further debug it. Any ideas?