summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--coc-settings.json15
-rw-r--r--init.vim0
-rwxr-xr-xpack/ache/start/installPlugin.sh117
-rwxr-xr-xplugin/backup.vim16
-rwxr-xr-xplugin/editzone.vim8
-rwxr-xr-xplugin/encoding.vim18
-rw-r--r--plugin/init.lua315
-rwxr-xr-xplugin/misc-bindings.vim4
-rw-r--r--plugin/neo.lua183
-rw-r--r--plugin/neo.vim11
-rwxr-xr-xplugin/perso.vim273
-rwxr-xr-xplugin/syntax.vim7
13 files changed, 736 insertions, 234 deletions
diff --git a/.gitignore b/.gitignore
index 5c6d8b5..d46abe0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-.color
+.gitignore
+pack/ache/*
diff --git a/coc-settings.json b/coc-settings.json
index 7bba792..f719251 100644
--- a/coc-settings.json
+++ b/coc-settings.json
@@ -1,10 +1,23 @@
{
+ "diagnostic.displayByAle": true,
"languageserver": {
+ "ocaml-lsp": {
+ "command": "opam",
+ "args": ["exec", "--", "ocamllsp"],
+ "filetypes": ["ocaml", "reason"]
+ },
"go": {
"command": "gopls",
"rootPatterns": ["go.mod"],
"trace.server": "verbose",
"filetypes": ["go"]
}
- }
+ },
+ "ocaml-lsp": {
+ "command": "opam",
+ "args": ["config", "exec", "--", "ocamllsp"],
+ "filetypes": ["ocaml", "reason"]
+ },
+ "rust-analyzer.server.path": "/usr/bin/rust-analyzer",
+ "svelte.enable-ts-plugin": false
}
diff --git a/init.vim b/init.vim
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/init.vim
diff --git a/pack/ache/start/installPlugin.sh b/pack/ache/start/installPlugin.sh
deleted file mode 100755
index 56b0391..0000000
--- a/pack/ache/start/installPlugin.sh
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/bin/bash
-
-# jellybeans.vim/,
-# A good color scheme
-git clone "https://github.com/nanotech/jellybeans.vim"
-
-# badwolf
-# The default color scheme
-git clone "https://github.com/sjl/badwolf"
-
-# vim-eighties
-#
-# A lot of color schemes
-git clone "https://github.com/lithammer/vim-eighties"
-
-
-# tabular/,
-#
-# Seriously, I can't use that
-git clone "https://github.com/godlygeek/tabular"
-
-# python-mode
-#
-git clone "https://github.com/python-mode/python-mode"
-
-# Deoplete // Completion for Language
-git clone "https://github.com/Shougo/deoplete.nvim"
-
-# Neosnippet, completion for snippets
-git clone "https://github.com/Shougo/neosnippet.vim"
-git clone "https://github.com/Shougo/neosnippet-snippets"
-
-
-# Vim node ? Usefull to navigate between node package
-# Through require and import
-# TODO: How to do that again ?!
-git clone "https://github.com/moll/vim-node"
-
-# Vim Java script
-git clone "https://github.com/pangloss/vim-javascript"
-
- # Syntax checker
-git clone "https://github.com/vim-syntastic/syntastic"
-
- # Colorizer
-git clone "https://github.com/lilydjwg/colorizer"
-
-# Lightspeed
-#
-# Use 's' and 'S' to jump anywhere @ lightspeed ⚡
-git clone "https://github.com/ggandor/lightspeed.nvim"
-
-
-# coc.nvim
-#
-# A very good code integrator for Vim
-git clone --branch release "https://github.com/neoclide/coc.nvim.git" --depth=1
-
-# ale
-#
-# Check for error and format. 👍
-git clone "https://github.com/dense-analysis/ale.git"
-
-# Hexmod
-#
-# `vim -b` and `:Hexmod` will use xxd to print a file in hexadecimal
-git clone "https://github.com/fidian/hexmode.git"
-
-
-# vim-svelte
-#
-# Colorise one file CSS, JS and HTML
-git clone "https://github.com/evanleck/vim-svelte"
-
-
-# vim-surround/
-#
-# Quick change a delimiter from inside using `cs"'`
-git clone "https://github.com/tpope/vim-surround"
-
-
-# vim-javascript/
-#
-# Here the ony benfice is indentation
-git clone "https://github.com/pangloss/vim-javascript"
-
-# vim-commentary/
-#
-# Quick comment using `gc` and `gcc`
-git clone "https://github.com/tpope/vim-commentary"
-
-
-# tagalon
-#
-# When you rename an HTML tag, it will rename the corresponding end/opening tag.
-git clone "https://github.com/AndrewRadev/tagalong.vim"
-
-# vim-closetag
-#
-# Automatically lose HTML tag
-git clone "https://github.com/alvan/vim-closetag"
-
-
-
-# vim-css3-syntax/
-git clone "https://github.com/hail2u/vim-css3-syntax"
-
-# vim-Grammalecte/
-git clone "https://github.com/dpelle/vim-Grammalecte"
-
-# Much simpler Rainbow Parenthses
-git clone "https://github.com/junegunn/rainbow_parentheses.vim"
-
-# Active it
-echo ":RainbowParentheses" >> ./rainbow_parentheses.vim/plugin/rainbow_parentheses.vim
-
-
diff --git a/plugin/backup.vim b/plugin/backup.vim
index dfcf6a7..cc3661c 100755
--- a/plugin/backup.vim
+++ b/plugin/backup.vim
@@ -1,15 +1,13 @@
" backup.vim
" Backup related parameters
-
+"
set backup
set backupdir=~/.vimtmp/backup
set directory=~/.vimtmp/temp
+"
+"silent !mkdir -p ~/.vimtmp/backup
+"silent !mkdir -p ~/.vimtmp/temp
-silent !mkdir -p ~/.vimtmp/backup
-silent !mkdir -p ~/.vimtmp/temp
-
-if version >= 703
- set undofile
- set undodir=~/.vimtmp/undo
- silent !mkdir -p ~/.vimtmp/undo
-endif
+set undofile
+set undodir=~/.vimtmp/undo
+"silent !mkdir -p ~/.vimtmp/undo
diff --git a/plugin/editzone.vim b/plugin/editzone.vim
index c07a208..5bddf07 100755
--- a/plugin/editzone.vim
+++ b/plugin/editzone.vim
@@ -2,7 +2,13 @@
" Parameters related to the edition zone
" Display relative line numbers and absolute line number for the current line
-set number relativenumber
+set number
+
+augroup numbertoggle
+ autocmd!
+ autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
+ autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
+augroup END
" In insert mode, display absolute line numbers
au InsertEnter * :set number norelativenumber
diff --git a/plugin/encoding.vim b/plugin/encoding.vim
index af52f02..52c4a2e 100755
--- a/plugin/encoding.vim
+++ b/plugin/encoding.vim
@@ -2,12 +2,12 @@
" Sets Vim and files encoding.
" Get the encoding from the environment
-set encoding=utf-8
-
-" Transliterate files in UTF-8
-set fileencoding=utf-8
-
-set encoding=utf-8
-set termencoding=utf-8
-
-set ffs=unix,dos,mac
+"set encoding=utf-8
+"
+"" Transliterate files in UTF-8
+"set fileencoding=utf-8
+"
+"set encoding=utf-8
+"set termencoding=utf-8
+"
+"set ffs=unix,dos,mac
diff --git a/plugin/init.lua b/plugin/init.lua
new file mode 100644
index 0000000..9d7e2b0
--- /dev/null
+++ b/plugin/init.lua
@@ -0,0 +1,315 @@
+--[[
+ This is the first neovim configuration file.
+
+ It in fact load lazy vim first.
+--]]
+
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+
+if not vim.loop.fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git",
+ "--branch=stable", -- latest stable release
+ lazypath,
+ })
+end
+vim.opt.rtp:prepend(lazypath)
+
+
+require("lazy").setup({
+ "https://github.com/vim-airline/vim-airline",
+ "https://github.com/ggandor/leap.nvim",
+ "https://github.com/junegunn/fzf",
+ "https://github.com/junegunn/fzf.vim",
+ "https://github.com/dpelle/vim-Grammalecte",
+ "https://github.com/dense-analysis/ale.git",
+ "https://github.com/nvim-treesitter/nvim-treesitter", -- Syntax LSP
+ "https://github.com/neoclide/coc.nvim.git",
+ "https://github.com/kyazdani42/nvim-tree.lua", -- File explorer
+ "https://github.com/fidian/hexmode.git",
+ "https://github.com/tpope/vim-surround",
+ "https://github.com/godlygeek/tabular",
+ "https://github.com/AndrewRadev/tagalong.vim",
+ "https://github.com/MunifTanjim/nui.nvim",
+ "https://github.com/jparise/vim-graphql",
+ "https://github.com/rust-lang/rust.vim",
+ "https://github.com/hail2u/vim-css3-syntax",
+ "https://github.com/tmhedberg/SimpylFold",
+ "https://github.com/pangloss/vim-javascript",
+ "https://github.com/khaveesh/vim-fish-syntax",
+ "https://github.com/moll/vim-node",
+ "https://github.com/evanleck/vim-svelte",
+ "https://github.com/ray-x/go.nvim",
+ "https://github.com/kyazdani42/nvim-tree.lua",
+ "https://github.com/junegunn/rainbow_parentheses.vim",
+ "https://github.com/nanotech/jellybeans.vim",
+ "https://github.com/honza/vim-snippets",
+ "https://gitlab.com/HiPhish/rainbow-delimiters.nvim",
+ "https://github.com/ray-x/starry.nvim",
+ "https://github.com/nvim-tree/nvim-web-devicons",
+ "https://github.com/nvim-lua/plenary.nvim",
+ "https://github.com/andymass/vim-matchup",
+ "KostkaBrukowa/definition-or-references.nvim",
+ "ray-x/go.nvim",
+ "FabijanZulj/blame.nvim",
+ {
+ "tversteeg/registers.nvim",
+ cmd = "Registers",
+ config = true,
+ keys = {
+ { "\"", mode = { "n", "v" } },
+ { "<C-R>", mode = "i" }
+ },
+ name = "registers",
+ },
+ dependencies = { -- optional packages
+ "ray-x/guihua.lua",
+ "neovim/nvim-lspconfig",
+ "nvim-treesitter/nvim-treesitter",
+ },
+ config = function()
+ require("go").setup()
+ end,
+ event = {"CmdlineEnter"},
+ ft = {"go", 'gomod'},
+ build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
+})
+
+
+require('leap').set_default_keymaps()
+
+-- Nvim-tree keymap function
+local function my_on_attach(bufnr)
+ local api = require('nvim-tree.api')
+
+ local function opts(desc)
+ return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
+ end
+
+ api.config.mappings.default_on_attach(bufnr)
+
+ vim.keymap.set('n', 'A', api.tree.expand_all, opts('Expand All'))
+ vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
+ vim.keymap.set('n', 'P', function()
+ local node = api.tree.get_node_under_cursor()
+ print(node.absolute_path)
+ end, opts('Print Node Path'))
+
+ vim.keymap.set('n', 'Z', api.node.run.system, opts('Run System'))
+
+ vim.keymap.set('n', 'u', api.tree.change_root_to_parent, opts('Up'))
+end
+
+
+-- disable netrw at the very start of your init.lua (strongly advised)
+vim.g.loaded = 1
+vim.g.loaded_netrwPlugin = 1
+
+
+-- Setup with some options
+require("nvim-tree").setup({
+ sort_by = "case_sensitive",
+ on_attach = my_on_attach,
+ view = {
+ adaptive_size = true,
+ },
+ renderer = {
+ group_empty = true,
+ },
+ filters = {
+ dotfiles = true,
+ },
+ tab = {
+ sync = {
+ open = true,
+ close = true,
+ ignore = {}
+ }
+ },
+ update_focused_file = {
+ enable = true,
+ update_cwd = true,
+ },
+})
+
+vim.g.nvim_tree_respect_buf_cwd = 1
+
+vim.g.tabby_node_binary = '/usr/bin/node'
+
+--[[
+require('go').setup({
+ disable_defaults = false, -- true|false when true set false to all boolean settings and replace all table
+ -- settings with {}
+ go='go', -- go command, can be go[default] or go1.18beta1
+ goimport='gofumpt', -- goimport command, can be gopls[default] or either goimport or golines if need to split long lines
+ fillstruct = 'fillstruct', -- default, can also use fillstruct
+ gofmt = 'gofumpt', --gofmt cmd,
+ max_line_len = 128, -- max line length in golines format, Target maximum line length for golines
+ tag_transform = false, -- can be transform option("snakecase", "camelcase", etc) check gomodifytags for details and more options
+ tag_options = 'json=omitempty', -- sets options sent to gomodifytags, i.e., json=omitempty
+ gotests_template = "", -- sets gotests -template parameter (check gotests for details)
+ gotests_template_dir = "", -- sets gotests -template_dir parameter (check gotests for details)
+ comment_placeholder = '' , -- comment_placeholder your cool placeholder e.g. 󰟓    
+ icons = {breakpoint = '🧘', currentpos = '🏃'}, -- setup to `false` to disable icons setup
+ verbose = false, -- output loginf in messages
+ lsp_cfg = false, -- true: use non-default gopls setup specified in go/lsp.lua
+ -- false: do nothing
+ -- if lsp_cfg is a table, merge table with with non-default gopls setup in go/lsp.lua, e.g.
+ -- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}
+ lsp_gofumpt = true, -- true: set default gofmt in gopls format to gofumpt
+ lsp_on_attach = nil, -- nil: use on_attach function defined in go/lsp.lua,
+ -- when lsp_cfg is true
+ -- if lsp_on_attach is a function: use this function as on_attach function for gopls
+ lsp_keymaps = true, -- set to false to disable gopls/lsp keymap
+ lsp_codelens = true, -- set to false to disable codelens, true by default, you can use a function
+ -- function(bufnr)
+ -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {noremap=true, silent=true})
+ -- end
+ -- to setup a table of codelens
+ diagnostic = { -- set diagnostic to false to disable vim.diagnostic setup
+ hdlr = false, -- hook lsp diag handler and send diag to quickfix
+ underline = true,
+ -- virtual text setup
+ virtual_text = { spacing = 0, prefix = '■' },
+ signs = true,
+ update_in_insert = false,
+ },
+ lsp_document_formatting = false,
+ -- set to true: use gopls to format
+ -- false if you want to use other formatter tool(e.g. efm, nulls)
+ lsp_inlay_hints = {
+ enable = true,
+ -- hint style, set to 'eol' for end-of-line hints, 'inlay' for inline hints
+ -- inlay only avalible for 0.10.x
+ style = 'inlay',
+ -- Note: following setup only works for style = 'eol', you do not need to set it for 'inlay'
+ -- Only show inlay hints for the current line
+ only_current_line = false,
+ -- Event which triggers a refersh of the inlay hints.
+ -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
+ -- not that this may cause higher CPU usage.
+ -- This option is only respected when only_current_line and
+ -- autoSetHints both are true.
+ only_current_line_autocmd = "CursorHold",
+ -- whether to show variable name before type hints with the inlay hints or not
+ -- default: false
+ show_variable_name = true,
+ -- prefix for parameter hints
+ parameter_hints_prefix = "󰊕 ",
+ show_parameter_hints = true,
+ -- prefix for all the other hints (type, chaining)
+ other_hints_prefix = "=> ",
+ -- whether to align to the lenght of the longest line in the file
+ max_len_align = false,
+ -- padding from the left if max_len_align is true
+ max_len_align_padding = 1,
+ -- whether to align to the extreme right or not
+ right_align = false,
+ -- padding from the right if right_align is true
+ right_align_padding = 6,
+ -- The color of the hints
+ highlight = "Comment",
+ },
+ gopls_cmd = "gofumpt", -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" }
+ gopls_remote_auto = true, -- add -remote=auto to gopls
+ gocoverage_sign = "█",
+ sign_priority = 5, -- change to a higher number to override other signs
+ dap_debug = true, -- set to false to disable dap
+ dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua
+ -- false: do not use keymap in go/dap.lua. you must define your own.
+ -- Windows: Use Visual Studio keymap
+ dap_debug_gui = {}, -- bool|table put your dap-ui setup here set to false to disable
+ dap_debug_vt = { enabled_commands = true, all_frames = true }, -- bool|table put your dap-virtual-text setup here set to false to disable
+
+ dap_port = 38697, -- can be set to a number, if set to -1 go.nvim will pick up a random port
+ dap_timeout = 15, -- see dap option initialize_timeout_sec = 15,
+ dap_retries = 20, -- see dap option max_retries
+ build_tags = "tag1,tag2", -- set default build tags
+ textobjects = true, -- enable default text jobects through treesittter-text-objects
+ test_runner = 'go', -- one of {`go`, `richgo`, `dlv`, `ginkgo`, `gotestsum`}
+ verbose_tests = true, -- set to add verbose flag to tests deprecated, see '-v' option
+ run_in_floaterm = false, -- set to true to run in a float window. :GoTermClose closes the floatterm
+ -- float term recommend if you use richgo/ginkgo with terminal color
+
+ floaterm = { -- position
+ posititon = 'auto', -- one of {`top`, `bottom`, `left`, `right`, `center`, `auto`}
+ width = 0.45, -- width of float window if not auto
+ height = 0.98, -- height of float window if not auto
+ title_colors = 'nord', -- default to nord, one of {'nord', 'tokyo', 'dracula', 'rainbow', 'solarized ', 'monokai'}
+ -- can also set to a list of colors to define colors to choose from
+ -- e.g {'#D8DEE9', '#5E81AC', '#88C0D0', '#EBCB8B', '#A3BE8C', '#B48EAD'}
+ },
+ trouble = false, -- true: use trouble to open quickfix
+ test_efm = false, -- errorfomat for quickfix, default mix mode, set to true will be efm only
+ luasnip = false, -- enable included luasnip snippets. you can also disable while add lua/snips folder to luasnip load
+ -- Do not enable this if you already added the path, that will duplicate the entries
+ on_jobstart = function(cmd) _=cmd end, -- callback for stdout
+ on_stdout = function(err, data) _, _ = err, data end, -- callback when job started
+ on_stderr = function(err, data) _, _ = err, data end, -- callback for stderr
+ on_exit = function(code, signal, output) _, _, _ = code, signal, output end, -- callback for jobexit, output : string
+ iferr_vertical_shift = 4 -- defines where the cursor will end up vertically from the begining of if err statement
+})
+
+local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
+vim.api.nvim_create_autocmd("BufWritePre", {
+ pattern = "*.go",
+ callback = function()
+ require('go.format')
+ end,
+ group = format_sync_grp,
+})
+
+--]]
+
+-- Init starry colorsheme
+local config = {
+ border = false, -- Split window borders
+ italics = {
+ comments = false, -- Italic comments
+ strings = false, -- Italic strings
+ keywords = false, -- Italic keywords
+ functions = false, -- Italic functions
+ variables = false -- Italic variables
+ },
+
+ contrast = { -- Select which windows get the contrast background
+ enable = true, -- Enable contrast
+ terminal = true, -- Darker terminal
+ filetypes = {}, -- Which filetypes get darker? e.g. *.vim, *.cpp, etc.
+ },
+
+ text_contrast = {
+ lighter = false, -- Higher contrast text for lighter style
+ darker = false -- Higher contrast text for darker style
+ },
+
+ disable = {
+ background = false, -- true: transparent background
+ term_colors = false, -- Disable setting the terminal colors
+ eob_lines = false -- Make end-of-buffer lines invisible
+ },
+
+ style = {
+ name = 'moonlight', -- Theme style name (moonlight, earliestsummer, etc.)
+ -- " other themes: dracula, oceanic, dracula_blood, 'deep ocean', darker, palenight, monokai, mariana, emerald, middlenight_blue
+ disable = {}, -- a list of styles to disable, e.g. {'bold', 'underline'}
+ fix = true,
+ darker_contrast = false, -- More contrast for darker style
+ daylight_swith = false, -- Enable day and night style switching
+ deep_black = false, -- Enable a deeper black background
+ },
+
+ custom_colors = {
+ variable = '#f797d7',
+ },
+ custom_highlights = {
+ LineNr = { fg = '#777777' },
+ Idnetifier = { fg = '#ff4797' },
+ }
+}
+require('starry').setup(config)
+require('starry.functions').change_style("dracula")
+
diff --git a/plugin/misc-bindings.vim b/plugin/misc-bindings.vim
index 596962d..a95160a 100755
--- a/plugin/misc-bindings.vim
+++ b/plugin/misc-bindings.vim
@@ -28,7 +28,7 @@ nnoremap <Space>w :w<Return>
" save and quit
nnoremap <Space><Backspace> :x<Return>
-nnoremap <Space>! :tab sball<Return>
+nnoremap <Space><leader> :tab sball<Return>
-nnoremap <F5> :make<Return>
+nnoremap <leader><F5> :make<Return>
diff --git a/plugin/neo.lua b/plugin/neo.lua
new file mode 100644
index 0000000..1dad513
--- /dev/null
+++ b/plugin/neo.lua
@@ -0,0 +1,183 @@
+-- Some servers have issues with backup files, see #649.
+vim.opt.backup = false
+vim.opt.writebackup = false
+
+-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
+-- delays and poor user experience.
+vim.opt.updatetime = 300
+
+-- Always show the signcolumn, otherwise it would shift the text each time
+-- diagnostics appear/become resolved.
+vim.opt.signcolumn = "yes"
+
+local keyset = vim.keymap.set
+-- Auto complete
+function _G.check_back_space()
+ local col = vim.fn.col('.') - 1
+ return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
+end
+
+-- Use tab for trigger completion with characters ahead and navigate.
+-- NOTE: There's always complete item selected by default, you may want to enable
+-- no select by `"suggest.noselect": true` in your configuration file.
+-- NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
+-- other plugin before putting this into your config.
+local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
+keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
+keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
+
+-- Make <CR> to accept selected completion item or notify coc.nvim to format
+-- <C-g>u breaks current undo, please make your own choice.
+keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
+
+-- Use <c-j> to trigger snippets
+keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
+-- Use <c-space> to trigger completion.
+keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
+
+-- Use `[g` and `]g` to navigate diagnostics
+-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
+keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
+keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
+
+-- GoTo code navigation.
+keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
+keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
+keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
+keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
+
+
+-- Use K to show documentation in preview window.
+function _G.show_docs()
+ local cw = vim.fn.expand('<cword>')
+ if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
+ vim.api.nvim_command('h ' .. cw)
+ elseif vim.api.nvim_eval('coc#rpc#ready()') then
+ vim.fn.CocActionAsync('doHover')
+ else
+ vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
+ end
+end
+keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
+
+
+-- Highlight the symbol and its references when holding the cursor.
+vim.api.nvim_create_augroup("CocGroup", {})
+vim.api.nvim_create_autocmd("CursorHold", {
+ group = "CocGroup",
+ command = "silent call CocActionAsync('highlight')",
+ desc = "Highlight symbol under cursor on CursorHold"
+})
+
+
+-- Symbol renaming.
+keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
+
+
+-- Formatting selected code.
+keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
+keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
+
+
+-- Setup formatexpr specified filetype(s).
+vim.api.nvim_create_autocmd("FileType", {
+ group = "CocGroup",
+ pattern = "typescript,json",
+ command = "setl formatexpr=CocAction('formatSelected')",
+ desc = "Setup formatexpr specified filetype(s)."
+})
+
+-- Update signature help on jump placeholder.
+vim.api.nvim_create_autocmd("User", {
+ group = "CocGroup",
+ pattern = "CocJumpPlaceholder",
+ command = "call CocActionAsync('showSignatureHelp')",
+ desc = "Update signature help on jump placeholder"
+})
+
+
+-- Applying codeAction to the selected region.
+-- Example: `<leader>aap` for current paragraph
+local opts = {silent = true, nowait = true}
+keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
+keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
+
+-- Remap keys for applying codeAction to the current buffer.
+keyset("n", "<leader>ac", "<Plug>(coc-codeaction)", opts)
+
+
+-- Apply AutoFix to problem on the current line.
+keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)
+
+
+-- Run the Code Lens action on the current line.
+keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)
+
+
+-- Map function and class text objects
+-- NOTE: Requires 'textDocument.documentSymbol' support from the language server.
+keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
+keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
+keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
+keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
+keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
+keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
+keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
+keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
+
+
+-- Remap <C-f> and <C-b> for scroll float windows/popups.
+---@diagnostic disable-next-line: redefined-local
+local opts = {silent = true, nowait = true, expr = true}
+keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
+keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
+keyset("i", "<C-f>",
+ 'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
+keyset("i", "<C-b>",
+ 'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
+keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
+keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
+
+
+-- Use CTRL-S for selections ranges.
+-- Requires 'textDocument/selectionRange' support of language server.
+keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
+keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
+
+
+-- Add `:Format` command to format current buffer.
+vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
+
+-- " Add `:Fold` command to fold current buffer.
+vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
+
+-- Add `:OR` command for organize imports of the current buffer.
+vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
+
+-- Add (Neo)Vim's native statusline support.
+-- NOTE: Please see `:h coc-status` for integrations with external plugins that
+-- provide custom statusline: lightline.vim, vim-airline.
+-- vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
+
+-- Mappings for CoCList
+-- code actions and coc stuff
+---@diagnostic disable-next-line: redefined-local
+local opts = {silent = true, nowait = true}
+-- Show all diagnostics.
+keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
+-- Manage extensions.
+keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
+-- Show commands.
+keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
+-- Find symbol of current document.
+keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
+-- Search workspace symbols.
+keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
+-- Do default action for next item.
+keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
+-- Do default action for previous item.
+keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
+-- Resume latest coc list.
+keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)
+
+require("registers").setup({})
diff --git a/plugin/neo.vim b/plugin/neo.vim
index f1ef113..9114563 100644
--- a/plugin/neo.vim
+++ b/plugin/neo.vim
@@ -5,3 +5,14 @@ set concealcursor-=n
:tnoremap <C-b> <C-\>
:tnoremap <Esc> <C-\><C-n>
+
+
+" coc.nvim
+
+" Confirme the completion
+inoremap <expr> <cr> coc#pum#visible() ? coc#pum#confirm() : "\<CR>"
+inoremap <silent><expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
+
+" Use tab to navigate completion
+inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
+inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"
diff --git a/plugin/perso.vim b/plugin/perso.vim
index 1981757..75ab213 100755
--- a/plugin/perso.vim
+++ b/plugin/perso.vim
@@ -1,97 +1,98 @@
-set showcmd
+" Define the leader key, which is used to create a lot of shortcurts
+let mapleader = "!" " map leader to bang
-set backspace=indent,eol,start
+" I think it's the little help in the right bottom line
+" It shows the current state of the command like "3y" for "3yy"
+set showcmd
" Why the hell does Vim add \n add the end of a file ?
set nofixendofline
-
-set clipboard=unnamedplus
+" Show progress of the file (percentage and nunber of line)
set ruler
-set t_Co=256
-"map <leader>j <C-W>j
-"map <leader>k <C-W>k
-"map <leader>h <C-W>h
-"map <leader>l <C-W>l
-inoremap <C-N> <C-P>
-inoremap <C-P> <C-N>
+" Turns on file detection, plugin and indentation
+filetype plugin indent on
-let mapleader = "!" " map leader to bang
+" Used to move tabs
+nmap <C-S-PageUp> :tabmove -1<cr>
+nmap <C-S-PageDown> :tabmove +1<cr>
-nnoremap <leader>f :call FoldColumnToggle()<cr>
-function! FoldColumnToggle()
+" Function to quickly change color scheme
+nnoremap <leader>c :call ChangeColor()<cr>
+let g:colors_name = 'badwolf'
+function! ChangeColor()
try
- if g:colors_name ==? "pink"
+ if g:colors_name ==? "moonlight"
colo badwolf
- hi CursorLine term=bold cterm=bold ctermbg=black
- hi CursorColumn ctermbg=54
+ "hi CursorLine term=bold cterm=bold ctermbg=black
+ "hi CursorColumn ctermbg=54
+ "hi CursorLine term=bold cterm=bold ctermbg=black
+ "hi CursorColumn ctermbg=54
elseif g:colors_name ==? "badwolf"
colo jellybeans
+ elseif g:colors_name ==? "jellybeans"
+ colo moonlight
else
- colo pink
+ colo moonlight
hi CursorLine term=bold cterm=bold ctermbg=white
hi CursorColumn ctermbg=Yellow
endif
catch /^Vim:E121/
- colo pink
+ colo moonlight
hi CursorLine term=bold cterm=bold ctermbg=white
hi CursorColumn ctermbg=Yellow
endtry
endfunction
-filetype plugin indent on
-
" Color :
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=darkred guibg=darkred
-colo badwolf
-hi CursorLine term=bold cterm=bold ctermbg=black
-hi CursorColumn ctermbg=54
+" Hexokinase
+" A plugin to color the colorname in the source code by the actual color it's for.
+let g:Hexokinase_highlighters = ['background', 'virtual']
+set termguicolors " To activate maximum of colors ? Don't know
+
+" Show a line horizontal line on the cursor
set cursorline
+" Put a colored column on the 120th characers
+set colorcolumn=120
+set cursorcolumn
+" Activate highlight search.
+set hls
+set incsearch " Don't remenber
+
+" Set the color of trailing white space in red ! ⛔
match ExtraWhitespace /\s\+$/
+
" Completion related options
" wildcard char = <TAB>
set wildmenu
set wildmode=list:longest:full
-nnoremap <silent><A-o> :set paste<CR>m`o<Esc>``:set nopaste<CR>
-nnoremap <silent><A-O> :set paste<CR>m`O<Esc>``:set nopaste<CR>
-
+" Emacs style go to Origin/End in insert mode
inoremap <c-e> <Esc>A
inoremap <c-a> <Esc>0i
-"Perso C définition"
-inoremap prt printf
-inoremap swf printf
-inoremap #in< #include <><left>
-inoremap #in" #include ""<left>
-inoremap #def #define
-inoremap #un #undef
-inoremap #ifn #ifndef
-inoremap #ifd #ifdef
-inoremap #std #include <stdlib.h>
-inoremap #io #include <stdio.h>
-
-inoremap #main int main(void) {<CR>}<Esc><Up>A
-inoremap ##main int main(int argc, char* argv[]) {<CR>}<Esc><Up>A
-
-" Personal shortcurts
-
+" Set usefull shortcurts for command
ca tn tabnew
ca tc tabc
+" Grammatical verification
map <F5> :setlocal spell! spelllang=fr<CR>
map <F6> :setlocal spell! spelllang=en_us<CR>
+
+" Quick past the date
inoremap <F7> <C-r>=strftime('%F')<CR>
inoremap <F8> <C-r>=strftime('%c')<CR>
" Personal compil shortcurts
+" I'm not sure there are very used
noremap <Space><F9> :make<CR>:cw<CR><CR>:!./a.out<CR>
map <F9> :make<CR>:cw<CR><CR>
noremap <silent> [q :copen<CR>
@@ -101,37 +102,37 @@ noremap <silent> ]Q :clast<CR>
noremap <silent> [[ :cprev<CR>
noremap <silent> ]] :cnext<CR>
-
-
-
-"Allow vim clipboad <-> host clipboard to share data
+" Allow vim clipboad <-> host clipboard to share data
+" Very much used.
set clipboard=unnamedplus
" Quick Comment :
-autocmd FileType c,cpp,java,go,scala,js let b:comment_leader = '//'
-autocmd FileType sh,ruby,python let b:comment_leader = '#'
-autocmd FileType conf,fstab let b:comment_leader = '#'
-autocmd FileType tex let b:comment_leader = '%'
-autocmd FileType mail let b:comment_leader = '>'
-autocmd FileType vim let b:comment_leader = '"'
-autocmd FileType haskell let b:comment_leader = '--'
-
-autocmd FileType c,cpp,java,go,scala set foldmethod=syntax
-
+autocmd FileType c,cpp,java,go,scala,js let b:comment_leader = '//'
+autocmd FileType sh,ruby,python let b:comment_leader = '#'
+autocmd FileType conf,fstab let b:comment_leader = '#'
+autocmd FileType tex let b:comment_leader = '%'
+autocmd FileType mail let b:comment_leader = '>'
+autocmd FileType vim let b:comment_leader = '"'
+autocmd FileType haskell let b:comment_leader = '--'
+
+noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
+noremap <silent> <c-c><c-c> :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
+noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+noremap <silent> <c-c><c-x> :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
-noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
-noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+" Fold method based on syntax. For Python, there is a plugin for that.
+autocmd FileType c,cpp,java,go,scala,js,rust set foldmethod=syntax
-noremap <silent> <c-c><c-c> :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
-noremap <silent> <c-c>c :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
+" Completion baed on language ? I don't know.
+set omnifunc=syntaxcomplete#Complete
+" Change directory
nnoremap cd :cd %:p:h<CR>
+" Type "//" to disable highlight search.
nnoremap <silent> // :nohls<CR>
-
-
" Compil option
autocmd Filetype c call SetCCompiler()
function SetCCompiler()
@@ -148,25 +149,9 @@ function SetPythonCompiler()
endif
endfunction
-
-
-
noremap <silent> zv :!markdown % \| w3m -I utf-8 -T text/html
-
-
-
-
-set colorcolumn=80
-set cursorcolumn
-set hls
-set incsearch
-
-let $VIMHOME=expand('<sfile>:p:h:h')
-au BufNewFile *.c 0r $VIMHOME/template/skel.c
-
-
" let g:deoplete#enable_at_startup = 1
" imap <C-k> <Plug>(neosnippet_expand_or_jump)
" smap <C-k> <Plug>(neosnippet_expand_or_jump)
@@ -191,39 +176,143 @@ au BufNewFile *.c 0r $VIMHOME/template/skel.c
" For conceal markers.
+" Conceal is an option to hide irrelevant characters.
+" Maybe disabled
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
-
+" C-L to actually toggle conceal feature.
map <C-l> :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=2"<CR>
" Start interactive EasyAlign in visual mode (e.g. vipga)
-xmap ga <Plug>(EasyAlign)
+xmap <leader>ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
-nmap ga <Plug>(EasyAlign)
+nmap <leader>ga <Plug>(EasyAlign)
-noremap <silent> =g :GrammalecteCheck<CR>
-noremap <silent> =G :GrammalecteClear<CR>
-let b:ale_linters = { 'javascript': ['eslint', 'xo', 'jscs', 'jshint', 'standard'], 'typescript': ['eslint', 'tsserver', 'deno'] }
+" Configure linter
+let b:ale_linters = { 'javascript': ['eslint', 'xo', 'jscs', 'jshint', 'standard'], 'typescript': ['eslint', 'tsserver', 'deno'], 'python': ['ruff']}
+" LSP is used by nvim
let g:ale_disable_lsp = 1
-" Ale message config :
-let g:ale_echo_msg_error_str = 'E'
-let g:ale_echo_msg_warning_str = 'W'
+
+" ale message config :
+let g:ale_echo_msg_error_str = '⛔'
+let g:ale_echo_msg_warning_str = '⚠️'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
-" Ale only on save
+" Ale only on save, otherwise, it's called too much and have to many false potitive
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
+" nvim.tree.lua
+map <C-C>x :NvimTreeToggle<CR>
+map <C-C>c :NvimTreeFindFile<CR>
+
+
+" let g:vimspector_enable_mappings = 'HUMAN'
+" nmap <leader>dd :call vimspector#Launch()<CR>
+" nmap <leader>dx :VimspectorReset<CR>
+" nmap <leader>dr :VimspectorReset<CR>
+" nmap <leader>de :VimspectorEval
+" nmap <leader>dw :VimspectorWatch
+" nmap <leader>do :VimspectorShowOutputlet g:vimspector_install_gadgets = [ 'debugpy', 'delve', 'CodeLLDB' ]
+" nmap <Leader>dt :call vimspector#ToggleBreakpoint()<CR>
+" nmap <Leader>dT :call vimspector#ClearBreakpoints()<CR>
+"
+" nmap <Leader>dp :call vimspector#Pause()<CR>
+" nmap <Leader>ds :call vimspector#Stop()<CR>
+" nmap <Leader>dac :call vimspector#Continue()<CR>
+" nmap <Leader>dar :call vimspector#Restart()<CR>
+" nmap <Leader>dag :call vimspector#GoToCurrentLine()<CR>
+" nmap <Leader>dao :call vimspector#StepOver()<CR>
+" nmap <Leader>da> :call vimspector#StepInto()<CR>
+" nmap <Leader>da< :call vimspector#StepOut()<CR>
+" nmap <Leader>dap :call vimspector#UpFrame()<CR>
+" nmap <Leader>dan :call vimspector#DownFrame()<CR>
+
+
+let g:python3_host_prog = '/usr/bin/python3'
+
autocmd BufNewFile,BufRead /tmp/mesms_* set noautoindent filetype=mail wm=0 tw=78 nonumber digraph nolist nopaste
+" To disable ALE
map <Esc>at :ALEToggle<CR>
-
-set omnifunc=syntaxcomplete#Complete
+" To move between ALE message (usually errors)
+map <leader>> :ALENext<CR>
+map <leader>< :ALEPrevious<CR>
au BufReadPost,BufNewFile *.tmpl,*.tpm,*.svelte set filetype=html
+command! -bang -nargs=* Rg
+ \ call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1,
+ \ fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}), <bang>0)
+
+" Congure Grammalecte
+let g:grammalecte_cli_py='/usr/bin/grammalecte-cli'
+function! GrammalecteToggle()
+ try
+ if exists("g:grammalecte_state") && g:grammalecte_state ==? "on"
+ GrammalecteClear
+ let g:grammalecte_state = "off"
+ else
+ let g:grammalecte_state = "on"
+ GrammalecteCheck
+ endif
+ endtry
+endfunction
+
+
+" Congure CopIlot
+function! CopilotToggle()
+ try
+ if exists("g:copilot_enabled_toggle") && g:copilot_enabled_toggle ==? "on"
+ Copilot disable
+ let g:copilot_enabled_toggle = "off"
+ else
+ if exists("g:copilot_enabled_toggle")
+ Copilot enable
+ else
+ :packadd copilot.vim
+ endif
+ let g:copilot_enabled_toggle = "on"
+ endif
+ endtry
+endfunction
+
+
+" Congure Tabby
+function! TabbyToggle()
+ try
+ if exists("g:tabby_enabled_toggle") && g:tabby_enabled_toggle ==? "on"
+ let g:tabby_enabled_toggle = v:false
+ let g:tabby_trigger_mode = 'manual'
+ else
+ if !exists("g:tabby_enabled_toggle")
+ :packadd vim-tabby
+ endif
+ let g:tabby_trigger_mode = 'auto'
+ endif
+ endtry
+endfunction
+let g:tabby_trigger_mode = 'manual'
+
+" Configure git blame
+nnoremap <leader>b :ToggleBlame virtual<cr>
+
+" External program call
+nnoremap <leader>x :call TabbyToggle()<cr>
+nnoremap <leader><m-x> :call CopilotToggle()<cr>
+nnoremap <leader><F5> :call GrammalecteToggle()<cr>
+noremap <silent> =g :GrammalecteCheck<CR>
+noremap <silent> =G :GrammalecteClear<CR>
+
+" Call ripgrep
+" To find the current word in the working directory
+nnoremap <silent> <Leader>rg :Rg <C-R><C-W><CR>
+" To find a file in the current working directory
+nnoremap <silent> <Leader>/ :Files<CR>
+
+
diff --git a/plugin/syntax.vim b/plugin/syntax.vim
index fb26cb9..e9a6d7e 100755
--- a/plugin/syntax.vim
+++ b/plugin/syntax.vim
@@ -1,5 +1,5 @@
" syntax.vim
-
+" Enable syntaxic coloration (should be enabled by default anyway)
syntax enable
" Python specific options
@@ -8,7 +8,10 @@ let python_highlight_all = 1
" syntastic
let g:syntastic_cpp_compiler_options = "-std=cpp11"
-let javaScript_fold=1
+" let javaScript_fold=1
let xml_fold=1
let sh_fold=1
+" Limit the lenght of syntax coloration on a line.
+" Great performance improvement
+set synmaxcol=500