nvim-config

Log | Files | Refs | Submodules | README

commit 839125cd97f9d5e240cf81299688361df780b13a
parent 00768c9126fc8027a8558c914e005854f16ea785
Author: Thomas Vigouroux <tomvig38@gmail.com>
Date:   Thu,  5 Aug 2021 08:31:35 +0200

Update

Diffstat:
M.gitignore | 1+
Mafter/compiler/latexmk.vim | 2+-
Mafter/ftplugin/c.vim | 9+++------
Aafter/ftplugin/ledger.vim | 3+++
Mafter/ftplugin/lua.vim | 3++-
Mafter/ftplugin/mail.vim | 6+++++-
Mafter/plugin/config/completion.vim | 3++-
Mafter/plugin/config/nvim-lsp.vim | 5++---
Mafter/plugin/mappings.vim | 10+++++-----
Mafter/queries/c/highlights.scm | 1+
Ainit.lua | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ainit.old.vim | 74++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dinit.vim | 75---------------------------------------------------------------------------
Alua/completree-config.lua | 16++++++++++++++++
Mlua/lsp_config.lua | 1+
Mlua/mappings.lua | 30++++++++++++------------------
Mlua/plugins.lua | 13++++---------
Mlua/tele_config.lua | 3---
Aqueries/c/highlights.scm | 2++
19 files changed, 210 insertions(+), 123 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,3 +1,4 @@ spell plugin/packer_compiled.vim parser/ +plugin/packer_compiled.lua diff --git a/after/compiler/latexmk.vim b/after/compiler/latexmk.vim @@ -4,7 +4,7 @@ if exists("current_compiler") endif let current_compiler = "latexmk" -CompilerSet makeprg=latexmk\ -pdf\ -shell-escape\ -pvc\ %:t:r +CompilerSet makeprg=latexmk\ -pdf\ -shell-escape\ %:t:r CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m, \%E!\ %m, \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#, diff --git a/after/ftplugin/c.vim b/after/ftplugin/c.vim @@ -1,4 +1,4 @@ -" Last Change: 2020 Nov 23 +" Last Change: 2021 Aug 03 setlocal expandtab setlocal textwidth=80 " Nvim uses this @@ -6,11 +6,8 @@ setlocal tabstop=2 setlocal foldmethod=expr setlocal foldexpr=nvim_treesitter#foldexpr() setlocal foldlevel=0 - -augroup CPerso - autocmd! - autocmd BufWrite *.c,*.h call GenerateTagsAsync('.') -augroup END +setlocal omnifunc=v:lua.vim.lsp.omnifunc +setlocal comments^=:/// if !empty(findfile('.clang-format', ';')) setlocal formatprg=clang-format\ -style=file diff --git a/after/ftplugin/ledger.vim b/after/ftplugin/ledger.vim @@ -0,0 +1,3 @@ +" Last Change: 2021 May 16 + +iabbrev <expr> cdate strftime("%Y-%m-%d") diff --git a/after/ftplugin/lua.vim b/after/ftplugin/lua.vim @@ -1,8 +1,9 @@ -" Last Change: 2020 Sep 22 +" Last Change: 2021 Jul 29 setlocal foldmethod=expr setlocal foldexpr=nvim_treesitter#foldexpr() setlocal tabstop=2 setlocal shiftwidth=2 setlocal softtabstop=2 +setlocal omnifunc=v:lua.vim.lsp.omnifunc setlocal makeprg=TEST_FILE=%:p\ make\ test diff --git a/after/ftplugin/mail.vim b/after/ftplugin/mail.vim @@ -1,3 +1,7 @@ -" Last Change: 2020 mai 11 +" Last Change: 2021 May 15 setlocal textwidth=0 setlocal spell +setlocal linebreak +setlocal breakindent +setlocal wrap +setlocal showbreak=++ diff --git a/after/plugin/config/completion.vim b/after/plugin/config/completion.vim @@ -1,4 +1,4 @@ -" Last Change: 2021 Apr 14 +" Last Change: 2021 May 19 if !exists('g:loaded_completion') finish @@ -29,6 +29,7 @@ let g:completion_chain_complete_list = { \ { 'mode' : 'tags' }, \ ], \'groff' : [], + \'ledger' : [ {"complete_items" : ["ts"]} ], \'mail' : [], \'vimwiki' : [], \'markdown': [ diff --git a/after/plugin/config/nvim-lsp.vim b/after/plugin/config/nvim-lsp.vim @@ -1,4 +1,4 @@ -" Last Change: 2021 Apr 20 +" Last Change: 2021 Aug 04 " Utility to store lsp/completion config lua require'lsp_config' @@ -11,5 +11,4 @@ nnoremap <silent> gr <cmd>lua vim.lsp.buf.rename()<CR> nnoremap <silent> gR <cmd>lua vim.lsp.buf.references()<CR> nnoremap <silent> <Leader>= <cmd>lua vim.lsp.buf.formatting_sync()<CR> -" autocmd CursorHold,CursorHoldI * lua vim.lsp.util.show_line_diagnostics() -" autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync() +autocmd CursorHold,CursorHoldI *.rs lua vim.lsp.diagnostic.show_line_diagnostics{focusable=false} diff --git a/after/plugin/mappings.vim b/after/plugin/mappings.vim @@ -1,4 +1,4 @@ -" Last Change: 2021 May 01 +" Last Change: 2021 Aug 02 vnoremap <silent> < <gv vnoremap <silent> > >gv @@ -8,10 +8,10 @@ nnoremap <silent> yQ :cclose<CR> inoremap <expr><CR> pumvisible() ? "\<C-y>" : "\<CR>" imap <expr><TAB> v:lua.tab_complete() -smap <expr><TAB> v:lua.tab_complete() - -imap <expr><S-TAB> v:lua.s_tab_complete() -smap <expr><S-TAB> v:lua.s_tab_complete() +snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr> +" +"imap <expr><S-TAB> v:lua.s_tab_complete() +"smap <expr><S-TAB> v:lua.s_tab_complete() nnoremap <expr>K v:lua.K_help_hover() diff --git a/after/queries/c/highlights.scm b/after/queries/c/highlights.scm @@ -1,2 +1,3 @@ ; ((identifier) @parameter ; (#is? @parameter parameter)) +; "goto" @Conceal diff --git a/init.lua b/init.lua @@ -0,0 +1,76 @@ +local M = {} + +vim.g.python_host_prog = "/bin/python" + +if jit.os == "Linux" then + vim.g.python3_host_prog = "/bin/python3" +elseif jit.os == "Darwin" then + vim.g.python3_host_prog = "/usr/bin/python3" +end + +local o = vim.opt + +o.number = true +o.relativenumber = true +o.showmode = false +o.hidden = true +o.cursorline = true +o.termguicolors = true +o.splitright = true +o.lazyredraw = true +o.foldenable = false +o.spelllang = { "en", "fr" } +o.spellfile = vim.fn.stdpath("config") .. "/spell/correct.UTF-8.add" +o.textwidth = 100 +o.colorcolumn = "+0" +o.signcolumn = "yes:2" +o.scrolloff = 5 +o.winblend = 10 +o.updatetime = 500 +o.wrap = false +o.cursorline = false +o.mouse = "n" +o.previewheight = 10 +o.title = true + +-- Completion and ui +o.inccommand = "nosplit" +o.completeopt = { "preview", "menuone", "noinsert" } +o.list = true +o.listchars = { + tab = "|-", + trail = "•", + nbsp = "!", + conceal = ":", + precedes = "<", + extends = ">" +} +o.tags = ".tags;/" +o.undofile = true +o.grepprg = "rg --vimgrep" + +-- Conceal +o.conceallevel = 1 +o.concealcursor = "niv" + +-- Tabs +o.tabstop = 2 +o.shiftwidth = 2 +o.softtabstop = 2 +o.expandtab = true + +o.shortmess:append "c" +o.sessionoptions:remove "buffers" + +vim.g.mapleader = " " +vim.g.maplocalleader = "&" + +vim.api.nvim_command [[language time POSIX]] + +-- Now load plugins and such +vim.api.nvim_command"packadd packer.nvim" +require "plugins" -- Load all plugins +require "colorizer".setup() +require "mappings" + +return M diff --git a/init.old.vim b/init.old.vim @@ -0,0 +1,74 @@ +" Last Change: 2021 Jul 18 + +let OS=substitute(system('uname -s'),"\n","","") +if (OS == "Darwin") + let g:python_host_prog='/bin/python' + let g:python3_host_prog = '/usr/bin/python3' +elseif ( OS == 'Linux' ) + let g:python_host_prog='/bin/python' + let g:python3_host_prog = '/bin/python3' +endif + +" I always need it +packadd termdebug +lua require"plugins" + +" Options {{{ + +set number relativenumber " nombre hybrides (relatifs + absolu) +set noshowmode " Don't echo -- NORMAL -- ect... +set hidden " la masse de buffers, sauvés, pas sauvés belek a :qa +set cursorline " Jolies couleurs pour le nombre absolu +set termguicolors " Des jolies couleurs +set splitright " Faire les splits à droite +set lazyredraw " Performances ?? +set nofoldenable " "Si tu fold, c'est que c'est pas assez refactor" -- Léo Paquet, 2019 +set spelllang=en,fr +set spellfile=~/.config/nvim/spell/correct.UTF-8.add +set textwidth=100 +set colorcolumn=+0 +set signcolumn=yes:2 " Pour eviter que ça clignotte à gauche +set scrolloff=5 +set winblend=10 " Des fenetres flottantes transparentes, tro stylé +set updatetime=500 +set nowrap +set nocursorline +set mouse=n +set previewheight=10 +set title + +set inccommand=nosplit " preview des recherches © Ensimag bb +set completeopt=preview,menuone,noinsert " j'ai pas encore tout compris +set list listchars=tab:\|-,trail:•,nbsp:!,conceal::,precedes:<,extends:> " Afficher les caractères moches +set tags=.tags;/ " Chercher les tags dans les dossiers superieurs +set undofile " Undo persistants +set grepprg=rg\ --vimgrep " plus vite que grep +set shortmess+=c + +set sessionoptions-=buffers + +" For conceal markers. +set conceallevel=1 concealcursor=niv + +" netrw +let g:netrw_liststyle = 3 +let g:netrw_list_hide = netrw_gitignore#Hide() . ',\(^\|\s\s\)\zs\.\S\+' + +" tabs +set tabstop=2 +set shiftwidth=2 +set softtabstop=2 +set expandtab + +" Leader +let mapleader = "\<Space>" +let maplocalleader = "&" + +" }}} + +au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false, higroup="Visual"} + +lua require'colorizer'.setup() +lua require'mappings' + +language time POSIX diff --git a/init.vim b/init.vim @@ -1,75 +0,0 @@ -" Last Change: 2021 May 01 - -let OS=substitute(system('uname -s'),"\n","","") -if (OS == "Darwin") - let g:python_host_prog='/bin/python' - let g:python3_host_prog = '/usr/bin/python3' -elseif ( OS == 'Linux' ) - let g:python_host_prog='/bin/python' - let g:python3_host_prog = '/bin/python3' -endif - -" I always need it -packadd termdebug -packadd packer.nvim -lua require"plugins" - -" Options {{{ - -set number relativenumber " nombre hybrides (relatifs + absolu) -set noshowmode " Don't echo -- NORMAL -- ect... -set hidden " la masse de buffers, sauvés, pas sauvés belek a :qa -set cursorline " Jolies couleurs pour le nombre absolu -set termguicolors " Des jolies couleurs -set splitright " Faire les splits à droite -set lazyredraw " Performances ?? -set nofoldenable " "Si tu fold, c'est que c'est pas assez refactor" -- Léo Paquet, 2019 -set spelllang=en,fr -set spellfile=~/.config/nvim/spell/correct.UTF-8.add -set textwidth=100 -set colorcolumn=+0 -set signcolumn=yes:2 " Pour eviter que ça clignotte à gauche -set scrolloff=5 -set winblend=10 " Des fenetres flottantes transparentes, tro stylé -set updatetime=500 -set nowrap -set nocursorline -set mouse=n -set previewheight=10 -set title - -set inccommand=nosplit " preview des recherches © Ensimag bb -set completeopt=preview,menuone,noinsert " j'ai pas encore tout compris -set list listchars=tab:\|-,trail:•,nbsp:!,conceal::,precedes:<,extends:> " Afficher les caractères moches -set tags=.tags;/ " Chercher les tags dans les dossiers superieurs -set undofile " Undo persistants -set grepprg=rg\ --vimgrep " plus vite que grep -set shortmess+=c - -set sessionoptions-=buffers - -" For conceal markers. -set conceallevel=1 concealcursor=niv - -" netrw -let g:netrw_liststyle = 3 -let g:netrw_list_hide = netrw_gitignore#Hide() . ',\(^\|\s\s\)\zs\.\S\+' - -" tabs -set tabstop=2 -set shiftwidth=2 -set softtabstop=2 -set expandtab - -" Leader -let mapleader = "\<Space>" -let maplocalleader = "&" - -" }}} - -au TextYankPost * silent! lua vim.highlight.on_yank {on_visual=false, higroup="Visual"} - -lua require'colorizer'.setup() -lua require'mappings' - -language time POSIX diff --git a/lua/completree-config.lua b/lua/completree-config.lua @@ -0,0 +1,16 @@ +local comp = require"completree" +local s = require"completree.sources" + +local lsp_completion = { + default = s.lsp, + string = s.ins_completion "C-F", + comment = s.dummy +} + +comp.setup { + default = s.ins_completion "C-N", + vim = s.ins_completion "C-V", + c = lsp_completion, + lua = lsp_completion, + rust = lsp_completion +} diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua @@ -18,6 +18,7 @@ nvim_lsp.als.setup{ capabilities = capabilities } nvim_lsp.rust_analyzer.setup{ capabilities = capabilities } nvim_lsp.ghcide.setup{ capabilities = capabilities } nvim_lsp.tsserver.setup{ capabilities = capabilities } +nvim_lsp.pylsp.setup { capabilities = capabilities } local sumneko_root_path = vim.fn.expand('$HOME')..'/src/lua-language-server' local sumneko_binary = sumneko_root_path.."/bin/Linux/lua-language-server" diff --git a/lua/mappings.lua b/lua/mappings.lua @@ -1,28 +1,22 @@ -- Completion and so on +require"completree-config" +local luasnip = require'luasnip' local rt = function(codes) - return vim.api.nvim_replace_termcodes(codes, true, true, true) + return vim.api.nvim_replace_termcodes(codes, true, true, true) end local call = vim.api.nvim_call_function function tab_complete() - if vim.fn.pumvisible() == 1 then - return rt('<C-N>') - elseif call('vsnip#available', {1}) == 1 then - return rt('<Plug>(vsnip-expand-or-jump)') - else - return rt('<Tab>') - end -end - -function s_tab_complete() - if vim.fn.pumvisible() == 1 then - return rt('<C-P>') - elseif call('vsnip#jumpable', {-1}) == 1 then - return rt('<Plug>(vsnip-jump-prev)') - else - return rt('<S-Tab>') - end + if vim.fn.pumvisible() == 1 then + return rt '<C-N>' + elseif vim.api.nvim_get_current_line():match("^%s+$") then + return rt '<Tab>' + elseif luasnip.jumpable(1) then + return rt '<Plug>luasnip-jump-next' + else + return rt '<Plug>(completree-complete)' + end end -- Help diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -51,18 +51,10 @@ return require"packer".startup(function(use) use 'tpope/vim-surround' -- LSP related - use { - 'nvim-lua/completion-nvim', - requires = { - 'hrsh7th/vim-vsnip', - 'hrsh7th/vim-vsnip-integ', - 'neovim/nvim-lspconfig' - } - } + use 'neovim/nvim-lspconfig' -- Treesitter related localuse 'nvim-treesitter/nvim-treesitter' - use 'nvim-treesitter/completion-treesitter' use 'nvim-treesitter/nvim-tree-docs' use 'nvim-treesitter/playground' @@ -85,7 +77,10 @@ return require"packer".startup(function(use) localuse 'vigoux/architext.nvim' localuse 'vigoux/mem.nvim' localuse 'vigoux/scope-tree' + localuse 'vigoux/completree' + use 'L3MON4D3/LuaSnip' use 'norcalli/nvim-colorizer.lua' + use 'bfredl/luarefvim' -- lua docs from nvim -- One true colorscheme localuse 'vigoux/oak' -- Not sure it is that binary diff --git a/lua/tele_config.lua b/lua/tele_config.lua @@ -34,10 +34,7 @@ local previewers = require'telescope.previewers' tele.setup { defaults = { - winblend = 10, - results_height = 20, sorting_strategy = 'ascending', - preview_cutoff = 0, generic_sorter = sorters.get_fzy_sorter, file_sorter = sorters.get_fzy_sorter, layout_strategy = 'center', diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm @@ -0,0 +1,2 @@ +(preproc_if condition: (_) @_const (_) @comment + (#eq? @_const "0"))