Compare commits

...
Sign in to create a new pull request.

24 commits

Author SHA1 Message Date
2b0a371526 Update cmp configuration 2022-10-28 11:22:19 +02:00
39ee27e694 Add autopairs plugins 2022-10-07 11:26:26 +02:00
3cbf71d7dc Remove trailing space 2022-10-07 11:16:38 +02:00
6b9f9ff964 Add options for pum 2022-08-07 01:06:39 +02:00
962e06b0d7 Add path source for completion 2022-08-07 01:04:37 +02:00
7fc6b33625 Rework completion window with icons 2022-08-07 00:55:09 +02:00
1bb7cba58f Remove border on diagnostic windows 2022-08-07 00:07:21 +02:00
6faace4a0c Change diagnostic window appareance 2022-08-06 02:08:40 +02:00
0556e2f742 Add mason-lspconfig plugin
start lsp server automatically
2022-08-05 23:41:14 +02:00
82d9f01eda Update theme 2022-08-05 23:15:17 +02:00
097cdea76a Migrate from lsp-installer to mason 2022-08-05 22:31:38 +02:00
2ad7915f35 Update lualine configuration 2022-05-20 00:26:03 +02:00
7af8115e00 Add nvim-lint options 2022-04-18 00:18:00 +02:00
16f1e00291 Add nvim-lint plugin 2022-04-18 00:04:01 +02:00
8c2ffc6202 Remove useless keybinding 2022-04-18 00:03:46 +02:00
aa0176f411 Add bootstrap for Paq
nvim --headless -u NONE -c 'lua require("bootstrap").bootstrap_paq()'

For install
2022-04-18 00:02:51 +02:00
dc5dfe9851 Remove autoload 2022-04-17 16:55:52 +02:00
50dc13ed64 Replace 'maintained' by 'all' 2022-04-17 16:48:49 +02:00
Yorick Barbanneau
6829f75639 Not gook big commit... 2022-04-15 16:32:43 +02:00
f1b7a59595 Reorder require() 2022-01-07 01:45:05 +01:00
a19375707d Add tree sitter plugin 2022-01-04 01:22:12 +01:00
0fcc53b2cf Put configuration elements in different files 2022-01-03 23:45:30 +01:00
d6a419cfdd Change package manager to paq 2022-01-03 23:09:46 +01:00
0d9cc47300 Update configuration to Lua 2022-01-03 01:55:06 +01:00
18 changed files with 361 additions and 2953 deletions

View file

@ -1,17 +1,24 @@
NeoVim Setup files NeoVim Setup files
=============== ===============
This is my NeoVim setup with Vim-Plug and plugins : This is mys neovim configuration with lua and paq plugins manager
* Base16 themes
* Syntastic plugin
* NerdTree plugin
* Vim-Airline
## Installation ## Installation
This Nvim installation need somes dependencies:
* gcc (Tree-Sitter)
* g++ (Tree-Sitter)
* clang (Tree-sitter)
For install plugins, you need to execute neovim with arguments like below
```
nvim --headless -u NONE -c 'lua require("plugins").bootstrap_paq()'
```
This repository is installable with [dotinstall][l_dotinstall] : This repository is installable with [dotinstall][l_dotinstall] :
``` ```
dotinstall https://git.epha.se/ephase/vim.git dotinstall https://git.epha.se/ephase/dotinstall.git
``` ```

File diff suppressed because it is too large Load diff

5
conf/nvim/init.lua Normal file
View file

@ -0,0 +1,5 @@
require("functions")
require("plugins")
require("settings")
require("plugins-options")
require("keybiding")

View file

@ -1,149 +0,0 @@
set nocompatible
"Plug init
"
call plug#begin('~/.local/lib/nvim/plugged')
"vim airline and vim airline theme
Plug 'vim-airline/vim-airline'
"vim airline and vim airline theme
Plug 'vim-airline/vim-airline-themes'
if v:version >= 800
" Replace syntastic with ale (test)
Plug 'w0rp/ale'
endif
"Base16 theme
Plug 'chriskempson/base16-vim'
"NERDTree file manager
Plug 'scrooloose/nerdtree'
"Vim fugitive
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'sheerun/vim-polyglot'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
endif
Plug 'zchee/deoplete-jedi'
"Grammalecte
Plug 'dpelle/vim-Grammalecte', { 'on': 'GrammalecteCheck' }
call plug#end()
filetype plugin indent on
syntax enable
set title
set nu
set showmode
set noswapfile
set nofsync
set buftype=
set mouse=a
set encoding=utf8
set directory^=$HOME/.local/tmp/nvim
set backupdir^=$HOME/.local/tmp/nvim
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set showmatch
set colorcolumn=80
set clipboard+=unnamedplus "Use system clipboard
"Code Fold
"---------
set foldmethod=indent
"Load and save view atomatocally (save and restore fold)
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent! loadview
"Searching
"---------
set incsearch " Ignore case when searching
set ignorecase
set smartcase " When searching try to be smart about cases
set hlsearch " hightlight search terms
set gdefault " Search all occurrences by default
" NerdTree
" --------
" Close NERDTree if it is the last buffer open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" ALE (test)
" ----------
let g:ale_sign_column_always = 1
let g:ale_sign_error = '⚠'
let g:ale_sign_warning = '⚠'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
" Vim-airLine
" -----------
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ''
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_powerline_fonts = 1
let g:airline_skip_empty_sections = 1
"let g:airline#extensions#bufferline#enabled = 1
let g:airline#extensions#tabline#show_splits = 0
" Grammalecte
" -----------
let g:grammalecte_cli_py='/usr/bin/grammalecte-cli'
"set laststatus=2
set laststatus
" Deoplete
" --------
let g:deoplete#enable_at_startup = 1
" Deoplete tab order on popup to be down/up instead of up/down
inoremap <silent><expr><tab> pumvisible()? "\<c-n>" : "\<tab>"
inoremap <silent><expr><s-tab> pumvisible()? "\<c-p>" : "\<s-tab>"
" Color Scheme
" ------------
set termguicolors "24 bits color support
let base16colorspace=256
colorscheme base16-classic-dark
set background=dark
" Key biding
" ----------
map <silent> [C-left] :tabprevious<CR>
map <silent> [C-right] :tabnext<CR>
map <silent> <leader>/ :nohlsearch<CR>
map <silent> <F2> :NERDTreeToggle<CR>
" Move tabs with \[ and \]
map <Leader>] :tabnext<CR>
map <Leader>[ :tabprev<CR>
" show special character
set listchars=tab:→\ ,trail:␣,extends:…,eol:
nmap <leader>l :set list!<CR>
" Autotype
" --------
au BufRead,BufNewFile *.md setlocal textwidth=80
au BufRead,BufNewFile *.tex setlocal textwidth=80
autocmd BufNewFile,BufRead /tmp/neomutt* set tw=72 fo=awq comments+=nb:> noautoindent filetype=mail
" Enable enhanced command line completion.
set wildmenu
set wildmode=longest:full,list
" Ignore these filenames during enhanced command line completion.
set wildignore+=*.bak,*.class
set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
set wildignore+=*.jpg,*.bmp,*.gif,*.png " binary images
set wildignore+=*.luac " Lua byte code
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
set wildignore+=*.pyc " Python byte code
set wildignore+=*.spl " compiled spelling word lists
set wildignore+=*.sw? " Vim swap files

View file

@ -0,0 +1,28 @@
local PKGS = {
"savq/paq-nvim";
-- List your packages here!
}
local function clone_paq()
local path = vim.fn.stdpath('data') .. '/site/pack/paqs/start/paq-nvim'
if vim.fn.empty(vim.fn.glob(path)) > 0 then
vim.fn.system {
'git',
'clone',
'--depth=1',
'https://github.com/savq/paq-nvim.git',
path
}
end
end
local function bootstrap_paq()
clone_paq()
-- Load Paq
vim.cmd('packadd paq-nvim')
local paq = require('paq')
-- Exit nvim after installing plugins
vim.cmd('autocmd User PaqDoneInstall quit')
-- Read and install packages
paq(PKGS)
paq.install()
end
return { bootstrap_paq = bootstrap_paq }

View file

@ -0,0 +1,17 @@
function map(key)
-- get the extra options
local opts = {noremap = true}
for i, v in pairs(key) do
if type(i) == 'string' then opts[i] = v end
end
-- basic support for buffer-scoped keybindings
local buffer = opts.buffer
opts.buffer = nil
if buffer then
vim.api.nvim_buf_set_keymap(0, key[1], key[2], key[3], opts)
else
vim.api.nvim_set_keymap(key[1], key[2], key[3], opts)
end
end

View file

@ -0,0 +1,24 @@
-- " Key biding
-- " ----------
map {'n', '<leader>/', ':nohlsearch<CR>', noremap = false, silent = true}
map {'n', '<F2>', ':NERDTreeToggle<CR>', noremap = false, silent = true}
-- Move tabs with \[ and \]
map {'n', '<Leader>]', ':tabnext<CR>', noremap = false, silent = true}
map {'n', '<Leader>[', ':tabprev<CR>', noremap = false, silent = true}
map {'n', '<leader>l', ':set list!<CR>', silent = true}
-- Manage Tab
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
-- git sign
-- Actions
local opts = { noremap = true, silent = true}
--vim.api.nvim_set_keymap('n', '<leader>gp', require("gitsigns").preview_hunk, opts)
vim.api.nvim_set_keymap('n', '<leader>gn', [[<cmd>lua require('gitsigns').next_hunk()<CR>]], opts)
vim.api.nvim_set_keymap('n', '<leader>gN', [[<cmd>lua require('gitsigns').prev_hunk()<CR>]], opts)
vim.api.nvim_set_keymap('n', '<leader>gs', ':Gitsigns stage_hunk<CR>', opts)
vim.api.nvim_set_keymap('n', '<leader>gr', ':Gitsigns reset_hunk<CR>', opts)
vim.api.nvim_set_keymap('n', '<leader>gd', [[<cmd>lua require("gitsigns").diffthis('~')<CR>]], opts)

View file

@ -0,0 +1,15 @@
-- Global variables
vim.g['base16colorspace'] = 256
-- NerdTree
-- Close NERDTree if it is the last buffer open
vim.cmd('au bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif')
require('plugins.treesitter')
require('plugins.lsp')
require('plugins.cmp')
require('plugins.gitsigns')
require('plugins.lualine')
require('plugins.nvimlint')
require('plugins.mason')
require('plugins.autopairs')

36
conf/nvim/lua/plugins.lua Normal file
View file

@ -0,0 +1,36 @@
-- Plugins
require "paq" {
"savq/paq-nvim";
-- status bar
'nvim-lualine/lualine.nvim';
-- Base16 theme
'RRethy/nvim-base16';
-- NERDTree file manager
'scrooloose/nerdtree';
'lewis6991/gitsigns.nvim';
-- need to install g++ package on Debian
-- for tree sitter plugins
'nvim-treesitter/nvim-treesitter';
-- LSP installer
'neovim/nvim-lspconfig';
-- Mason is a GUI to install language servers and lspconfig is a bridge
-- between mason and nvim-lspconfig
'williamboman/mason.nvim';
'williamboman/mason-lspconfig.nvim';
-- autocompletion plugin
'hrsh7th/nvim-cmp';
'hrsh7th/cmp-nvim-lsp'; -- LSP source
'hrsh7th/cmp-path'; -- path source
-- vim lint when it is not possible withlsp
'mfussenegger/nvim-lint';
-- autopair
'windwp/nvim-autopairs';
}

View file

@ -0,0 +1 @@
local autopair = require("nvim-autopairs").setup {}

View file

@ -0,0 +1,71 @@
-- Add additional capabilities supported by nvim-cmp
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
}
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
['<S-Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
},
formatting = {
format = function(_, vim_item)
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
return vim_item
end,
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'path' },
},
}

View file

@ -0,0 +1,3 @@
require('gitsigns').setup {
keymaps = {}, -- NO default keybindings
}

View file

@ -0,0 +1 @@
local lspconfig = require('lspconfig')

View file

@ -0,0 +1,29 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'base16',
component_separators = { left = '|', right = '|'},
section_separators = { left = '', right = ''},
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = true,
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
extensions = {}
}

View file

@ -0,0 +1,13 @@
local mason = require("mason").setup()
local mason_lspconfig = require("mason-lspconfig").setup()
require("mason-lspconfig").setup_handlers({
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function (server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {}
end,
-- Next, you can provide targeted overrides for specific servers.
--
})

View file

@ -0,0 +1,6 @@
require('lint').linters_by_ft = {
bash = {'shellcheck'},
sh = {'shellcheck'}
}
vim.cmd('au BufWritePost <buffer> lua require("lint").try_lint()')

View file

@ -0,0 +1,12 @@
-- Tree sitter
local ts = require 'nvim-treesitter.configs'
ts.setup {
ensure_installed = 'all',
sync_install = false,
ignore_install = { 'erlang' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
}
}

View file

@ -0,0 +1,86 @@
-- General Option
vim.opt.autoindent = true
vim.opt.background = 'dark'
vim.opt.backupdir = os.getenv("HOME") .. '/.local/tmp/nvim'
vim.opt.clipboard = 'unnamedplus' --Use system clipboard
vim.opt.colorcolumn = '80'
vim.opt.directory = os.getenv("HOME") .. '/.local/tmp/nvim'
vim.opt.expandtab = true
vim.opt.foldmethod = 'syntax'
vim.opt.gdefault = true -- search: all occurrences by default
vim.opt.hlsearch = true -- search: hightlight terms
vim.opt.ignorecase = true
vim.opt.incsearch = true
vim.opt.laststatus = 1
-- show special character
vim.opt.listchars = {tab = '', trail = '', eol = '', extends = '' }
vim.opt.number = true
vim.opt.shiftwidth = 4
vim.opt.showmatch = true
vim.opt.smartcase = true -- search: try :to be smart about cases
vim.opt.smartindent = true
vim.opt.tabstop = 4
vim.opt.termguicolors = true -- 24 bits color support
vim.opt.wildmenu = true -- activate enhanced user menu
vim.opt.wildmode = 'lastused:full,list' -- enhance menu
vim.opt.pumheight = 10
vim.opt.pumwidth = 50
vim.opt.pumblend = 10
-- Options than need vim.cmd
vim.cmd('syntax on')
vim.cmd('colorscheme base16-default-dark')
-- -- Code Fold
-- "Load and save view atomatocally (save and restore fold)
vim.cmd('au BufWinLeave *.* mkview')
vim.cmd('au BufWinEnter *.* silent! loadview')
-- Diagnostic settings
--
-- diagnostic windows must be float
vim.diagnostic.config {
virtual_text = false,
signs = true,
underline = true,
}
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- You will likely want to reduce updatetime which affects CursorHold
-- note: this setting is global and should be set only once
vim.o.updatetime = 250
vim.cmd [[autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {scope='cursor', header = "", prefix = "", focus=false})]]
-- Autotype
vim.cmd('au BufRead,BufNewFile *.md setlocal textwidth=80')
vim.cmd('au BufRead,BufNewFile *.tex setlocal textwidth=80')
vim.cmd('au BufNewFile,BufRead /tmp/neomutt* set tw=72 fo=awq comments+=nb:> noautoindent filetype=mail')
-- Ignore these filenames during enhanced command line completion.
vim.opt.wildignore = {
'*.bak',
'*.class',
'*.aux',
'*.out',
'*.toc',
'*.jpg',
'*.bmp',
'*.gif',
'*.png',
'*.luac',
'*.o',
'*.obj',
'*.exe',
'*.dll',
'*.manifest',
'*.pyc',
'*.spl',
'*.sw?'
}