679 lines
22 KiB
Lua
679 lines
22 KiB
Lua
-- local bufnr = vim.api.nvim_get_current_buf()
|
||
-- 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 = function() require("bufferline").setup{} end
|
||
} -- Top line
|
||
use { 'nvim-lualine/lualine.nvim', requires = {'kyazdani42/nvim-web-devicons', opt = true}, } -- Bottom line
|
||
use { 'folke/todo-comments.nvim', }
|
||
use { 'folke/noice.nvim',
|
||
requires = {
|
||
'MunifTanjim/nui.nvim',
|
||
-- 'rcarriga/nvim-notify' -- laisser fidget s'en occuper
|
||
}
|
||
} -- 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' -- maintient les entêtes des fonctions pour avoir le contexte d'où on se trouve
|
||
|
||
-- LSP
|
||
use {'neovim/nvim-lspconfig'}
|
||
-- use {'williamboman/mason.nvim', tag = "stable" }
|
||
use {'williamboman/mason.nvim'}
|
||
use {'williamboman/mason-lspconfig.nvim'}
|
||
use {'j-hui/fidget.nvim',
|
||
tag = "v1.4.*",
|
||
config = function() require('fidget').setup() end
|
||
} -- 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', 'nvim-neotest/nvim-nio', 'theHamsta/nvim-dap-virtual-text'},-- Debug Adapter Protocol
|
||
}
|
||
}
|
||
-- use 'puremourning/vimspector'
|
||
|
||
-- Search and move
|
||
use 'justinmk/vim-sneak'
|
||
use {'ThePrimeagen/harpoon',
|
||
config = function() require("harpoon").setup({}) end
|
||
}
|
||
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
|
||
|
||
use "S1M0N38/love2d.nvim"
|
||
-- Database
|
||
-- use {'tpope/vim-dadbod',
|
||
-- requires = {
|
||
-- 'kristijanhusak/vim-dadbod-ui',
|
||
-- 'kristijanhusak/vim-dadbod-completion'
|
||
-- }
|
||
-- }
|
||
|
||
-- development
|
||
use {"mrcjkb/rustaceanvim", tag = "4.*" }
|
||
-- use "lvimuser/lsp-inlayhints.nvim" -- will be added in version 10 of neovim
|
||
use {'folke/neodev.nvim', -- Additional lua configuration, makes nvim stuff amazing
|
||
config = function() require('neodev').setup() end
|
||
}
|
||
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 = function() require("which-key").setup {} end
|
||
}
|
||
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.relativenumber = true -- show relative numbers in gutter
|
||
vim.opt.number = true -- affiche le numéro absolu de la ligne active lorsque que relativenumber est activé
|
||
|
||
vim.opt.tabstop = 2 -- spaces per tab
|
||
vim.opt.shiftwidth = 2 -- spaces per tab
|
||
vim.opt.expandtab = true -- always use spaces instead of tabs
|
||
vim.opt.smartindent = true
|
||
|
||
vim.opt.ignorecase = true -- Ignore la casse lors d'une recherche
|
||
vim.opt.smartcase = true -- Sauf si une recherche contient une majuscule
|
||
vim.opt.hlsearch = true -- surlignage de toutes les occurrences de la recherche en cours
|
||
|
||
vim.opt.cursorline = true
|
||
|
||
vim.opt.termguicolors = true -- Truecolor
|
||
vim.opt.signcolumn = "yes"
|
||
|
||
vim.opt.backspace = "indent,eol,start" -- on autorise l'utilisation de retour quand on indente, à la fin de ligne ou au début
|
||
|
||
vim.opt.clipboard = "unnamedplus" -- Put those yanks in my os clipboards
|
||
|
||
vim.opt.swapfile = false -- don't create swap files
|
||
|
||
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.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.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.list = false
|
||
vim.opt.listchars = {
|
||
tab='▷⋯',
|
||
eol='↲',
|
||
nbsp='␣',
|
||
space='•',
|
||
trail='•',
|
||
extends='»',
|
||
precedes='«'
|
||
}
|
||
vim.opt.modelines = 5 -- scan this many lines looking for modeline
|
||
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.shiftround = true -- Round indent to multiple of 'shiftwidth' for > and < commands
|
||
-- 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.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.g.catppuccin_flavour = "mocha" -- latte, frappe, macchiato, mocha
|
||
vim.cmd[[colorscheme catppuccin]]
|
||
|
||
vim.g.loaded_perl_provider = 0
|
||
vim.g.loaded_ruby_provider = 0
|
||
vim.lsp.inlay_hint.enable(true)
|
||
|
||
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
|
||
local map = vim.keymap.set
|
||
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/
|
||
map('n', '<leader>ra', "<cmd>lua vim.cmd.RustLsp('codeAction')<CR>",{ silent = true})
|
||
map('n', 'XX', ':w<CR>', {noremap = true})
|
||
map('i', 'XX', '<ESC>:w<CR>', {noremap = true})
|
||
-- }}}
|
||
-- Lsp {{{
|
||
|
||
require('mason').setup() -- https://github.com/williamboman/mason.nvim
|
||
-- https://github.com/williamboman/mason-lspconfig.nvim
|
||
require('mason-lspconfig').setup({
|
||
ensure_installed = {
|
||
'html',
|
||
'cssls',
|
||
'lua_ls',
|
||
'marksman',
|
||
'sqlls',
|
||
'jinja_lsp'
|
||
},
|
||
-- 'rust_analyzer',
|
||
-- non compatible avec rustaceanvim : https://github.com/mrcjkb/rustaceanvim/blob/master/doc/mason.txt
|
||
})
|
||
|
||
require('lspconfig').marksman.setup({})
|
||
require('lspconfig').html.setup({
|
||
filetypes = { "html", "htmldjango" }
|
||
})
|
||
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'},
|
||
},
|
||
workspace = {
|
||
library = {
|
||
"${3rd}/love2d/library",
|
||
},
|
||
},
|
||
},
|
||
},
|
||
})
|
||
local cmp = require('cmp')
|
||
-- require('lsp-zero').cmp_action()
|
||
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
||
local luasnip = require("luasnip")
|
||
|
||
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({
|
||
-- https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings#luasnip
|
||
['<Tab>'] = cmp.mapping(function(fallback)
|
||
if cmp.visible() then
|
||
cmp.select_next_item()
|
||
elseif luasnip.locally_jumpable(1) then
|
||
luasnip.jump(1)
|
||
else
|
||
fallback()
|
||
end
|
||
end, { "i", "s" }),
|
||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||
if cmp.visible() then
|
||
cmp.select_prev_item()
|
||
elseif luasnip.locally_jumpable(-1) then
|
||
luasnip.jump(-1)
|
||
else
|
||
fallback()
|
||
end
|
||
end, { "i", "s" }),
|
||
['<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 snippet = luasnip.snippet
|
||
local text = luasnip.text_node
|
||
local insert = luasnip.insert_node
|
||
local func = luasnip.function_node
|
||
|
||
require'luasnip'.filetype_extend("htmldjango", {"html"})
|
||
luasnip.setup({})
|
||
|
||
-- Functions {{{
|
||
local date = function() return {os.date('%Y-%m-%d')} end
|
||
local filename = function() return debug.getinfo(1, 'S').source end
|
||
-- }}}
|
||
-- Zola {{{
|
||
luasnip.add_snippets("sh", {
|
||
snippet("header",
|
||
text({
|
||
"#!/usr/bin/env sh",
|
||
"",
|
||
"#set -x",
|
||
"# exit on error",
|
||
"set -e",
|
||
"# no undefined variables",
|
||
"set -u"
|
||
})
|
||
),
|
||
})
|
||
luasnip.add_snippets("html", {
|
||
snippet("header",
|
||
text({
|
||
"<!doctype html>",
|
||
"<html lang='fr'>",
|
||
" <head>",
|
||
" <meta charset='utf-8'>",
|
||
" <title>Title</title>",
|
||
" <link rel='stylesheet' href='style.css'>",
|
||
" </head>",
|
||
" <body>",
|
||
"",
|
||
" <script src='myScript.js'></script>",
|
||
" </body>",
|
||
"</html>"
|
||
})
|
||
),
|
||
})
|
||
luasnip.add_snippets("css", {
|
||
snippet("header",
|
||
text({
|
||
"# Reset (Source: https://css-tricks.com/notes-on-josh-comeaus-custom-css-reset/)",
|
||
"* {",
|
||
" margin: 0;",
|
||
" padding: 0;",
|
||
"}",
|
||
"html, body {",
|
||
" height: 100%;",
|
||
"}",
|
||
"img, picture, video, canvas, svg {",
|
||
" display: block;",
|
||
" max-width: 100%;",
|
||
"}",
|
||
"p, h1, h2, h3, h4, h5, h6 {",
|
||
" overflow-wrap: break-word;",
|
||
"}"
|
||
})
|
||
),
|
||
snippet("debug",
|
||
text({
|
||
" Debug",
|
||
"* {",
|
||
" background: #000 !important;",
|
||
" color: #0f0 !important;",
|
||
" outline: solid #f00 1px !important;",
|
||
"}"
|
||
})
|
||
),
|
||
})
|
||
luasnip.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",
|
||
}),
|
||
}),
|
||
})
|
||
-- }}}
|
||
-- }}}
|
||
|
||
|
||
|
||
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.filetype.add({
|
||
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
||
})
|
||
|
||
require'colorizer'.setup()
|
||
require("nvim-autopairs").setup {} -- ne semble pas pouvoir être intégré dans le use
|
||
|
||
local dap, dapui = require("dap"), require("dapui")
|
||
dapui.setup()
|
||
require("nvim-dap-virtual-text").setup()
|
||
|
||
dap.adapters.rustlldb = {
|
||
type = "executable",
|
||
-- command = "/usr/bin/lldb-vscode", -- adjust as needed
|
||
command = vim.fn.expand('~').."/.cargo/bin/rust-lldb", -- adjust as needed
|
||
name = "rustlldb",
|
||
}
|
||
|
||
dap.listeners.before.attach.dapui_config = function()
|
||
dapui.open()
|
||
vim.opt.mouse = 'n'
|
||
end
|
||
dap.listeners.before.launch.dapui_config = function()
|
||
dapui.open()
|
||
vim.opt.mouse = 'n'
|
||
end
|
||
dap.listeners.before.event_terminated.dapui_config = function()
|
||
dapui.close()
|
||
vim.opt.mouse = ''
|
||
end
|
||
dap.listeners.before.event_exited.dapui_config = function()
|
||
dapui.close()
|
||
vim.opt.mouse = ''
|
||
end
|
||
|
||
vim.keymap.set('n', '<F5>', require 'dap'.continue)
|
||
vim.keymap.set('n', '<F6>', require 'dap'.step_over)
|
||
vim.keymap.set('n', '<F7>', require 'dap'.step_into)
|
||
vim.keymap.set('n', '<F8>', require 'dap'.step_out)
|
||
vim.keymap.set('n', '<leader>b', require 'dap'.toggle_breakpoint)
|
||
vim.keymap.set('n', '<leader>e', require 'dapui'.eval)
|
||
|
||
vim.fn.sign_define('DapBreakpoint',{ text ='🟥', texthl ='', linehl ='', numhl =''})
|
||
vim.fn.sign_define('DapStopped',{ text ='▶️', texthl ='', linehl ='', numhl =''})
|
||
|
||
require('todo-comments').setup()
|
||
require('love2d').setup()
|