First commit
This commit is contained in:
commit
326643dbcf
553
init.lua
Normal file
553
init.lua
Normal file
@ -0,0 +1,553 @@
|
|||||||
|
-- Packer {{{
|
||||||
|
-- Install packer
|
||||||
|
local ensure_packer = function()
|
||||||
|
local fn = vim.fn
|
||||||
|
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local packer_bootstrap = ensure_packer()
|
||||||
|
|
||||||
|
require('packer').startup(function(use)
|
||||||
|
-- Packer can manage itself
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
-- UI
|
||||||
|
use { "catppuccin/nvim", as = "catppuccin" } -- Theme
|
||||||
|
use { 'akinsho/bufferline.nvim',
|
||||||
|
requires = 'kyazdani42/nvim-web-devicons',
|
||||||
|
config = require("bufferline").setup({})
|
||||||
|
} -- Top line
|
||||||
|
use { 'nvim-lualine/lualine.nvim', requires = {'kyazdani42/nvim-web-devicons', opt = true}, } -- Bottom line
|
||||||
|
use { 'folke/noice.nvim',
|
||||||
|
requires = {
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
|
'rcarriga/nvim-notify'
|
||||||
|
}
|
||||||
|
} -- replaces the UI for messages, cmdline and the popupmenu.
|
||||||
|
use 'yggdroot/indentline' -- Display vertical lines at each indentation
|
||||||
|
-- use 'junegunn/goyo.vim' -- Distraction-free writing in Vim
|
||||||
|
-- use 'xiyaowong/nvim-transparent'
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate', }
|
||||||
|
use 'nvim-treesitter/nvim-treesitter-refactor' -- refactoring / renaming
|
||||||
|
use 'romgrk/nvim-treesitter-context'
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
use {'neovim/nvim-lspconfig'}
|
||||||
|
use {'williamboman/mason.nvim',
|
||||||
|
config = require('mason').setup({}) -- https://github.com/williamboman/mason.nvim
|
||||||
|
}
|
||||||
|
use {'williamboman/mason-lspconfig.nvim'}
|
||||||
|
use {'j-hui/fidget.nvim',
|
||||||
|
tag = 'legacy',
|
||||||
|
config = require('fidget').setup()
|
||||||
|
} -- Visualisation du status du LSP
|
||||||
|
use 'onsails/lspkind.nvim' -- This tiny plugin adds vscode-like pictograms to neovim built-in lsp
|
||||||
|
|
||||||
|
-- Autocompletion
|
||||||
|
use {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
requires = {
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
'hrsh7th/cmp-nvim-lua',
|
||||||
|
'hrsh7th/cmp-path',
|
||||||
|
'hrsh7th/cmp-cmdline',
|
||||||
|
'saadparwaiz1/cmp_luasnip'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Snippets
|
||||||
|
use {"L3MON4D3/LuaSnip", tag = "v2.*", run = "make install_jsregexp"}
|
||||||
|
use "rafamadriz/friendly-snippets"
|
||||||
|
|
||||||
|
-- Debugger
|
||||||
|
-- use {
|
||||||
|
-- 'rcarriga/nvim-dap-ui',-- Debug Adapter UI
|
||||||
|
-- requires = {
|
||||||
|
-- {'mfussenegger/nvim-dap'},-- Debug Adapter Protocol
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
-- use 'puremourning/vimspector'
|
||||||
|
|
||||||
|
-- Search and move
|
||||||
|
use 'justinmk/vim-sneak'
|
||||||
|
use {'ThePrimeagen/harpoon',
|
||||||
|
config = require("harpoon").setup({})
|
||||||
|
}
|
||||||
|
use { 'nvim-telescope/telescope.nvim',
|
||||||
|
requires = {
|
||||||
|
{'nvim-lua/plenary.nvim'},-- LUA framework
|
||||||
|
{'nvim-treesitter/nvim-treesitter'},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
use 'romainl/vim-cool' -- Toggle search highlighting
|
||||||
|
|
||||||
|
-- Highlight
|
||||||
|
use 'cespare/vim-toml'
|
||||||
|
use 'mboughaba/i3config.vim' -- i3config highlight
|
||||||
|
use 'f3fora/cmp-spell' -- add spell support into cmp
|
||||||
|
-- use 'pearofducks/ansible-vim' -- Ansible highlight
|
||||||
|
|
||||||
|
-- Database
|
||||||
|
-- use {'tpope/vim-dadbod',
|
||||||
|
-- requires = {
|
||||||
|
-- 'kristijanhusak/vim-dadbod-ui',
|
||||||
|
-- 'kristijanhusak/vim-dadbod-completion'
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- development
|
||||||
|
use {
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
requires = {
|
||||||
|
{'nvim-lua/plenary.nvim'}, -- LUA framework
|
||||||
|
{'mfussenegger/nvim-dap'},-- Debug Adapter Protocol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
use {'folke/neodev.nvim', -- Additional lua configuration, makes nvim stuff amazing
|
||||||
|
config = require('neodev').setup()
|
||||||
|
}
|
||||||
|
use { "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons", } -- A pretty list for showing diagnostics, references, telescope results, quickfix and location lists to help you solve all the trouble your code is causing.
|
||||||
|
|
||||||
|
-- confort
|
||||||
|
use 'farmergreg/vim-lastplace' -- plugin that intelligently reopens files at your last edit position.
|
||||||
|
use { 'folke/which-key.nvim',
|
||||||
|
config = require("which-key").setup {}
|
||||||
|
}
|
||||||
|
use 'tpope/vim-commentary'
|
||||||
|
use 'junegunn/vim-easy-align'
|
||||||
|
use 'tpope/vim-surround'
|
||||||
|
use { "windwp/nvim-autopairs", }
|
||||||
|
|
||||||
|
-- Others
|
||||||
|
use { 'norcalli/nvim-colorizer.lua' } -- Fast color highlighter
|
||||||
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
|
-- Put this at the end after all plugins
|
||||||
|
if packer_bootstrap then
|
||||||
|
require('packer').sync()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- -- Automatically source and re-compile packer whenever you save this init.lua
|
||||||
|
-- local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
|
||||||
|
-- vim.api.nvim_create_autocmd('BufWritePost', {
|
||||||
|
-- command = 'source <afile> | silent! LspStop | silent! LspStart | PackerCompile',
|
||||||
|
-- group = packer_group,
|
||||||
|
-- pattern = vim.fn.expand '$MYVIMRC',
|
||||||
|
-- })
|
||||||
|
|
||||||
|
-- }}}
|
||||||
|
-- local execute = vim.api.nvim_command
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- Opt {{{
|
||||||
|
vim.opt.belloff = 'all' -- never ring the bell for any reason
|
||||||
|
vim.opt.completeopt = 'menuone' -- show menu even if there is only one candidate (for nvim-compe)
|
||||||
|
vim.opt.completeopt = vim.opt.completeopt + 'noselect' -- don't automatically select canditate (for nvim-compe)
|
||||||
|
vim.opt.expandtab = true -- always use spaces instead of tabs
|
||||||
|
vim.opt.foldenable = true -- enable folding, za for toggling
|
||||||
|
vim.opt.foldmethod = "marker" -- choose marker method other : manual indent expr syntax diff marker
|
||||||
|
vim.opt.foldlevel = 99
|
||||||
|
vim.opt.inccommand = 'split' -- live preview of :s results
|
||||||
|
vim.opt.listchars = {
|
||||||
|
tab='▷⋯',
|
||||||
|
eol='↲',
|
||||||
|
nbsp='␣',
|
||||||
|
space='•',
|
||||||
|
trail='•',
|
||||||
|
extends='»',
|
||||||
|
precedes='«'
|
||||||
|
}
|
||||||
|
vim.opt.modelines = 5 -- scan this many lines looking for modeline
|
||||||
|
vim.opt.relativenumber = true -- show relative numbers in gutter
|
||||||
|
vim.opt.scrolloff = 999 -- Make sure that cursor is always vertically centered on j/k moves
|
||||||
|
vim.opt.shada = "'20,<1000,s100,:0,/20,%,n~/.cache/shada"
|
||||||
|
-- ' - Specify the maximum number of marked files remembered. It also saves the jump list and the change list we saw in a previous article.
|
||||||
|
-- < - Specify the maximum of lines saved for each register. All the lines are saved if this is not included. If you don’t want to save your registers, use the value <0.
|
||||||
|
-- / and : - Number of search patterns and entries from the command-line history saved. The option history is used if it’s not specified.
|
||||||
|
-- % - Save and restore the buffer list. You can specify the maximum number of buffer stored with a number.
|
||||||
|
-- s - Specify the maximum size of an item’s content in KiB (kilobyte).
|
||||||
|
-- For the viminfo file, it only applies to register.
|
||||||
|
-- For the shada file, it applies to all items except for the buffer list and header.
|
||||||
|
vim.opt.shiftwidth = 2 -- spaces per tab
|
||||||
|
vim.opt.shiftround = true -- Round indent to multiple of 'shiftwidth' for > and < commands
|
||||||
|
vim.opt.smartindent = true -- don't create swap files
|
||||||
|
vim.opt.swapfile = false -- don't create swap files
|
||||||
|
vim.opt.tabstop = 2 -- spaces per tab
|
||||||
|
vim.opt.undodir = vim.fn.expand('~').."/.cache/nvim/undodir/" -- keep undo files out of the way
|
||||||
|
vim.opt.undofile = true -- actually use undo files
|
||||||
|
-- vim.opt.updatetime = 350 -- Reduce time for highlighting other references
|
||||||
|
vim.opt.redrawtime = 10000 -- Allow more time for loading syntax on large files
|
||||||
|
vim.opt.clipboard = "unnamedplus" -- Put those yanks in my os clipboards
|
||||||
|
vim.opt.ignorecase = true -- Ignore la casse lors d'une recherche
|
||||||
|
vim.opt.smartcase = true -- Sauf si une recherche contient une majuscule
|
||||||
|
vim.opt.hidden = true -- Changing buffer without saving
|
||||||
|
|
||||||
|
-- Obligatoire pour cmp-spell
|
||||||
|
vim.opt.spell = true -- à ne pas activer de base pour éviter les parasites avec les fichiers de code
|
||||||
|
vim.opt.spelllang = { 'fr', 'en_us' }
|
||||||
|
vim.opt.spellsuggest = { 'best',9 }
|
||||||
|
|
||||||
|
vim.opt.mouse = ''
|
||||||
|
vim.g.CoolTotalMatches = 1 -- vim-cool : Show numbers of matches
|
||||||
|
-- vim.opt.shortmess+=c
|
||||||
|
-- }}}
|
||||||
|
-- Scheme + UI + Highlight {{{
|
||||||
|
vim.opt.termguicolors = true -- Truecolor
|
||||||
|
vim.g.catppuccin_flavour = "mocha" -- latte, frappe, macchiato, mocha
|
||||||
|
vim.cmd[[colorscheme catppuccin]]
|
||||||
|
|
||||||
|
require("lualine").setup({
|
||||||
|
|
||||||
|
options = {
|
||||||
|
theme = 'catppuccin'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vim.cmd(([[
|
||||||
|
au BufRead,BufNewFile *.playbook set filetype=yaml.ansible
|
||||||
|
]]))
|
||||||
|
--- }}}
|
||||||
|
-- General keybinds {{{
|
||||||
|
local map = vim.api.nvim_set_keymap
|
||||||
|
map('n', '<leader>,', '<Esc>A,<Esc>', {noremap = true}) -- Easy insertion of a trailing ; or , from insert mode
|
||||||
|
map('n', '<leader>;', '<Esc>A;<Esc>', {noremap = true}) -- Easy insertion of a trailing ; or , from insert mode
|
||||||
|
map('n', '<leader>w', ':w!<cr>', {noremap = true})
|
||||||
|
map('i', 'mw', '<Esc>`^:w<cr>', {noremap = true})
|
||||||
|
-- map('i', 'mwq', '<Esc>:wq!<cr>', {noremap = true})
|
||||||
|
map('i', 'kj', '<Esc>`^', {noremap = true})
|
||||||
|
map('n', 'Q', '<Nope>', {noremap = true})
|
||||||
|
|
||||||
|
map('v', '<leader>p', ':"_dP<CR>', {noremap = true})
|
||||||
|
|
||||||
|
local opts = { noremap=true, silent=true }
|
||||||
|
map('n', '<C-j>', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||||
|
map('n', 'R', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
|
|
||||||
|
map('n', '<leader>db', ':DB mysql://root:ntz-mdb2uch2nvc7DVW@web2.enim.univ-lorraine.fr/concours', {noremap = true})
|
||||||
|
map('n', '<leader>y', '"+y', {noremap = true})
|
||||||
|
map('n', '<leader>pwd', ':lua vim.fn.setreg("+",vim.fn.system("pwd"):gsub("$","").."/"..vim.fn.getreg("%"))<CR>', {noremap = true})
|
||||||
|
|
||||||
|
map('n', ']<space>', "mao<esc>`a", {noremap = true}) -- ma: set cursor mark, `a jump to position (line and column)
|
||||||
|
map('n', '[<space>', "maO<esc>`a", {noremap = true})
|
||||||
|
map('n', '<C-U>', '<C-U>zz', {noremap = true})
|
||||||
|
map('n', '<C-D>', '<C-D>zz', {noremap = true})
|
||||||
|
-- map('n', 'n', 'nzzzc', {noremap = true})
|
||||||
|
-- map('n', 'N', 'Nzzzc', {noremap = true})
|
||||||
|
-- }}}
|
||||||
|
-- Plugin keybind {{{
|
||||||
|
map('n', 'ga', '<Plug>(EasyAlign)', {noremap = true}) -- Easy insertion of a trailing ; or , from insert mode
|
||||||
|
map('i', '<c-l>', "<cmd>lua require'luasnip'.jump(1)<cr>", {noremap = true})
|
||||||
|
map('i', '<c-h>', "<cmd>lua require'luasnip'.jump(-1)<cr>", {noremap = true})
|
||||||
|
map('n', '<leader>hm', ':lua require("harpoon.ui").toggle_quick_menu()<CR>', {noremap = true})
|
||||||
|
map('n', '<leader>ha', ':lua require("harpoon.mark").add_file()<CR>', {noremap = true})
|
||||||
|
map('n', '<tab>', ':lua require("harpoon.ui").nav_next()<CR>', {noremap = true})
|
||||||
|
map('i', '<C-space>', 'copilot#Accept("<CR>")', {noremap = true, silent = true, expr = true})
|
||||||
|
-- vim.g.copilot_no_tab_map = true
|
||||||
|
-- vim.g.copilot_assume_mapped = true -- https://www.reddit.com/r/neovim/comments/sk70rk/using_github_copilot_in_neovim_tab_map_has_been/
|
||||||
|
-- }}}
|
||||||
|
-- Lsp {{{
|
||||||
|
|
||||||
|
-- https://github.com/williamboman/mason-lspconfig.nvim
|
||||||
|
require('mason-lspconfig').setup({
|
||||||
|
ensure_installed = {
|
||||||
|
'html',
|
||||||
|
'cssls',
|
||||||
|
'rust_analyzer',
|
||||||
|
'lua_ls',
|
||||||
|
'marksman',
|
||||||
|
'sqlls'
|
||||||
|
},
|
||||||
|
-- handlers = {
|
||||||
|
-- lsp.default_setup,
|
||||||
|
-- },
|
||||||
|
})
|
||||||
|
|
||||||
|
require('lspconfig').marksman.setup({})
|
||||||
|
require('lspconfig').lua_ls.setup({
|
||||||
|
settings = {
|
||||||
|
-- for suppressing warning: undefined global `vim`?
|
||||||
|
Lua = {
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = {'vim'},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
local cmp = require('cmp')
|
||||||
|
-- require('lsp-zero').cmp_action()
|
||||||
|
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'marksman' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
{ name = 'path' }
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-k>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||||
|
['<C-j>'] = cmp.mapping.select_next_item(cmp_select),
|
||||||
|
['<C-n>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.close(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- `/` cmdline setup.
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{
|
||||||
|
name = 'cmdline',
|
||||||
|
option = {
|
||||||
|
ignore_cmds = { 'Man', '!' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- lsp.setup()
|
||||||
|
-- }}}
|
||||||
|
--
|
||||||
|
vim.cmd(([[
|
||||||
|
let g:sneak#s_next = 1
|
||||||
|
]]))
|
||||||
|
|
||||||
|
-- Telescope {{{
|
||||||
|
-- https://github.com/nvim-telescope/telescope.nvim
|
||||||
|
map('n', '<C-P>', '<cmd>Telescope find_files<cr>', {noremap = true}) -- Telescope
|
||||||
|
map('n', '<C-k>', '<cmd>Telescope buffers<cr>', {noremap = true}) -- Telescope
|
||||||
|
map('n', '<C-g>', '<cmd>Telescope live_grep<cr>', {noremap = true}) -- Telescope
|
||||||
|
-- }}}
|
||||||
|
require'nvim-treesitter.configs'.setup {
|
||||||
|
ensure_installed = { "html", "bash", "dockerfile", "rust" , "css" , "markdown", "markdown_inline", "sql", "hyprlang", "nix", "vimdoc", "lua", "regex"},
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = { "markdown" },
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
autotag = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
refactor = {
|
||||||
|
smart_rename = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
smart_rename = "grr",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require("trouble").setup({
|
||||||
|
auto_open = true, -- automatically open the list when you have diagnostics
|
||||||
|
auto_close = true, -- automatically close the list when you have no diagnostics
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Source : https://alpha2phi.medium.com/neovim-for-beginners-fuzzy-file-search-part-2-2aab95fe8cfe
|
||||||
|
-- Custom actions
|
||||||
|
local transform_mod = require("telescope.actions.mt").transform_mod
|
||||||
|
local nvb_actions = transform_mod {
|
||||||
|
file_path = function(prompt_bufnr)
|
||||||
|
-- Get selected entry and the file full path
|
||||||
|
local content = require("telescope.actions.state").get_selected_entry()
|
||||||
|
-- local full_path = content.cwd .. require("plenary.path").path.sep .. content.value
|
||||||
|
local relative_path = "." .. require("plenary.path").path.sep .. content.value
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
-- local x = vim.api.nvim_win_get_cursor(vim.api.nvim_get_current_win())[1] - 1
|
||||||
|
-- local y = vim.api.nvim_win_get_cursor(vim.api.nvim_get_current_win())[2]
|
||||||
|
local x,y = table.unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
vim.api.nvim_buf_set_text(0,x-1,y,x-1,y, {"[](" .. relative_path .. ")"})
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Close the popup
|
||||||
|
require("telescope.actions").close(prompt_bufnr)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
require('telescope').setup{
|
||||||
|
defaults = {
|
||||||
|
-- https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/mappings.lua
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-j>"] = require('telescope.actions').move_selection_next,
|
||||||
|
["<C-k>"] = require('telescope.actions').move_selection_previous,
|
||||||
|
["<Esc>"] = require('telescope.actions').close,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
find_files = {
|
||||||
|
-- theme = "ivy",
|
||||||
|
-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
|
||||||
|
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||||
|
mappings = {
|
||||||
|
n = {
|
||||||
|
["y"] = nvb_actions.file_path,
|
||||||
|
},
|
||||||
|
i = {
|
||||||
|
["<C-y>"] = nvb_actions.file_path,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
require('telescope').load_extension("noice")
|
||||||
|
-- Luasnip {{{
|
||||||
|
-- load friendly snippet
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
local ls = require("luasnip")
|
||||||
|
local snippet = ls.snippet
|
||||||
|
local text = ls.text_node
|
||||||
|
local insert = ls.insert_node
|
||||||
|
local func = ls.function_node
|
||||||
|
|
||||||
|
ls.setup({})
|
||||||
|
|
||||||
|
-- Functions {{{
|
||||||
|
local date = function() return {os.date('%Y-%m-%d')} end
|
||||||
|
local filename = function() return debug.getinfo(1, 'S').source end
|
||||||
|
-- }}}
|
||||||
|
-- Zola {{{
|
||||||
|
ls.add_snippets("markdown", {
|
||||||
|
snippet("zh", {
|
||||||
|
text("+++"),
|
||||||
|
text("title = \""), func (filename, {}), text("\""),
|
||||||
|
text("slug = \""), func (filename, {}), text("\""),
|
||||||
|
text("date = "), func(date, {}),
|
||||||
|
text("updated = "), func(date, {}),
|
||||||
|
text("[taxonomies]"),
|
||||||
|
text("tags = []"),
|
||||||
|
text("+++")
|
||||||
|
}),
|
||||||
|
snippet("zi", {
|
||||||
|
text("{{ image_fit(path=\"@/images/"),
|
||||||
|
insert(1,"image_filename"),
|
||||||
|
text("\") }}")
|
||||||
|
}),
|
||||||
|
snippet("z2i", {
|
||||||
|
text("{{ image_fit(path1=\"@/images/"),
|
||||||
|
insert(1,"image_filename"),
|
||||||
|
text("\", path2=\"@/images/"),
|
||||||
|
insert(2,"image_filename"),
|
||||||
|
text("\") }}"),
|
||||||
|
}),
|
||||||
|
snippet("zyt", {
|
||||||
|
text("{{ yt(id=\""),
|
||||||
|
insert(1,"youtube_filename"),
|
||||||
|
text("\") }}")
|
||||||
|
}),
|
||||||
|
snippet("histoire", {
|
||||||
|
text( {
|
||||||
|
"## Focalisation",
|
||||||
|
"- 1ère personne/3ème personne",
|
||||||
|
"- externe/interne/omniscient",
|
||||||
|
"## Narrateur",
|
||||||
|
"- objectif/subjectif",
|
||||||
|
"- relate honnêtement/partis pris dissimulé",
|
||||||
|
"## Quelle temporalité",
|
||||||
|
"- aujourd'hui/historique/futuriste",
|
||||||
|
"- ailleurs/voyage temporel/fragmentaire",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
snippet("character", {
|
||||||
|
text( {
|
||||||
|
"- 3 traits psy : ",
|
||||||
|
"- 3 traits physiques : ",
|
||||||
|
"- 1 ou 2 motivation : ",
|
||||||
|
"- habilité spéciale",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
|
||||||
|
local rt = require("rust-tools")
|
||||||
|
rt.setup({
|
||||||
|
server = {
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
-- Hover actions
|
||||||
|
vim.keymap.set("n", "<Leader>rh", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||||
|
-- Code action groups
|
||||||
|
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("noice").setup({
|
||||||
|
lsp = {
|
||||||
|
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||||
|
override = {
|
||||||
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
|
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- you can enable a preset for easier configuration
|
||||||
|
presets = {
|
||||||
|
bottom_search = false, -- use a classic bottom cmdline for search
|
||||||
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
|
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.autoread = true
|
||||||
|
vim.g.indentLine_conceallevel = 0 -- pose trop de problème avec le markdown et le json
|
||||||
|
-- vim.keymap.set("n", "<Leader>rb", ':call vimspector#ToggleBreakpoint()<cr>', { buffer = bufnr })
|
||||||
|
-- vim.keymap.set("n", "<Leader>rl", ':call vimspector#Launch()<cr>', { buffer = bufnr })
|
||||||
|
-- vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
-- pattern = { "sql", "mysql", "plsql" },
|
||||||
|
-- callback = function()
|
||||||
|
-- cmp.setup.buffer({
|
||||||
|
-- sources = {
|
||||||
|
-- { name = "vim-dadbod-completion" },
|
||||||
|
-- { name = "buffer" },
|
||||||
|
-- { name = "luasnip" },
|
||||||
|
-- },
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
-- group = autocomplete_group,
|
||||||
|
-- })
|
||||||
|
|
||||||
|
vim.filetype.add({
|
||||||
|
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
||||||
|
})
|
||||||
|
|
||||||
|
require'colorizer'.setup()
|
||||||
|
require("nvim-autopairs").setup {} -- ne semble pas pouvoir être intégré dans le use
|
||||||
|
|
Reference in New Issue
Block a user