Add support for more formatter's, stylua config.

This commit is contained in:
CronyAkatsuki 2023-12-24 19:46:29 +01:00
parent 24f7bb50b6
commit ccc9ffa2db
19 changed files with 472 additions and 420 deletions

View file

@ -1,29 +1,29 @@
require('crony.set')
require('crony.map')
require('crony.lazy')
require("crony.set")
require("crony.map")
require("crony.lazy")
local autocmd = vim.api.nvim_create_autocmd
local function augroup(name)
return vim.api.nvim_create_augroup("crony_" .. name, { clear = true })
return vim.api.nvim_create_augroup("crony_" .. name, { clear = true })
end
-- [[ Highlight on yank ]]
autocmd("TextYankPost", {
group = augroup("highlight_yank"),
callback = function()
vim.highlight.on_yank()
end,
group = augroup("highlight_yank"),
callback = function()
vim.highlight.on_yank()
end,
})
-- [[ Auto create parent directory if it doesn't exist ]]
autocmd({ "BufWritePre" }, {
group = augroup("auto_create_dir"),
callback = function(event)
if event.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
group = augroup("auto_create_dir"),
callback = function(event)
if event.match:match("^%w%w+://") then
return
end
local file = vim.loop.fs_realpath(event.match) or event.match
vim.fn.mkdir(vim.fn.fnamemodify(file, ":p:h"), "p")
end,
})

View file

@ -1,166 +1,168 @@
-- bootstraping
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,
})
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)
-- plugins installation and configuration
require('lazy').setup({
-- Git plugins
'tpope/vim-fugitive',
require("lazy").setup({
-- Git plugins
"tpope/vim-fugitive",
{
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
dependencies = {
-- LSP Support
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{
"VonHeikemen/lsp-zero.nvim",
branch = "v3.x",
dependencies = {
-- LSP Support
{ "neovim/nvim-lspconfig" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- Autocompletion
{ 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-path' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-nvim-lua' },
-- Autocompletion
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
-- Snippets
{ 'L3MON4D3/LuaSnip' },
{ 'rafamadriz/friendly-snippets' },
-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
-- Nice lsp info
{ 'j-hui/fidget.nvim', opts = {} },
-- Nice lsp info
{ "j-hui/fidget.nvim", opts = {} },
-- Additional neovim docs
'folke/neodev.nvim',
opts = {},
}
},
-- Additional neovim docs
"folke/neodev.nvim",
opts = {},
},
},
-- Emacs which key but in a much nicer form
{ 'folke/which-key.nvim', opts = {}, event = "VeryLazy" },
-- Emacs which key but in a much nicer form
{ "folke/which-key.nvim", opts = {}, event = "VeryLazy" },
{
-- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
},
{
-- Adds git related signs to the gutter, as well as utilities for managing changes
"lewis6991/gitsigns.nvim",
},
{
-- Catppuccin, the best pastell color scheme
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
},
{
-- Catppuccin, the best pastell color scheme
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
},
{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'catppuccin',
component_separators = '|',
section_separators = '',
},
},
},
{
-- Set lualine as statusline
"nvim-lualine/lualine.nvim",
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = "catppuccin",
component_separators = "|",
section_separators = "",
},
},
},
{
-- show indent line
'lukas-reineke/indent-blankline.nvim',
},
{
-- show indent line
"lukas-reineke/indent-blankline.nvim",
},
-- highlight indentscope
"echasnovski/mini.indentscope",
-- highlight indentscope
"echasnovski/mini.indentscope",
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {}, event = "VeryLazy" },
-- "gc" to comment visual regions/lines
{ "numToStr/Comment.nvim", opts = {}, event = "VeryLazy" },
-- Fuzzy Finder (files, lsp, etc)
{
'nvim-telescope/telescope.nvim',
lazy = true,
dependencies = {
'nvim-lua/plenary.nvim',
},
},
-- Fuzzy Finder (files, lsp, etc)
{
"nvim-telescope/telescope.nvim",
lazy = true,
dependencies = {
"nvim-lua/plenary.nvim",
},
},
{
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
},
{
-- Highlight, edit, and navigate code
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
{
-- netrw on crack
'stevearc/oil.nvim',
opts = {
},
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons", lazy = true },
},
{
-- netrw on crack
"stevearc/oil.nvim",
opts = {},
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons", lazy = true },
},
{
-- harpoon your way around code
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
requires = { "nvim-lua/plenary.nvim", lazy = true }
}
},
{
-- harpoon your way around code
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
requires = { "nvim-lua/plenary.nvim", lazy = true },
},
},
"NvChad/nvim-colorizer.lua",
"NvChad/nvim-colorizer.lua",
{
"stevearc/dressing.nvim",
event = "VeryLazy",
opts = {
input = { default_prompt = "" },
select = { backend = { "telescope", "builtin" } },
},
},
{
"stevearc/dressing.nvim",
event = "VeryLazy",
opts = {
input = { default_prompt = "" },
select = { backend = { "telescope", "builtin" } },
},
},
-- nice tmux integration
'christoomey/vim-tmux-navigator',
-- nice tmux integration
"christoomey/vim-tmux-navigator",
-- smart autopairs
'windwp/nvim-autopairs',
-- smart autopairs
"windwp/nvim-autopairs",
{
-- nicer notification's
'rcarriga/nvim-notify',
config = function()
vim.notify = require("notify")
end
},
{
-- nicer notification's
"rcarriga/nvim-notify",
config = function()
vim.notify = require("notify")
end,
},
-- markdown editing super powered
'jakewvincent/mkdnflow.nvim',
-- markdown editing super powered
"jakewvincent/mkdnflow.nvim",
-- additional formater support
"stevearc/conform.nvim",
}, {
install = {
colorscheme = { "catppuccin" }
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
}
}
}
install = {
colorscheme = { "catppuccin" },
},
performance = {
rtp = {
disabled_plugins = {
"gzip",
"netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View file

@ -1,17 +1,17 @@
local map = vim.keymap.set
-- Leader
vim.g.mapleader = ' '
vim.g.maplocalleader = ';'
vim.g.mapleader = " "
vim.g.maplocalleader = ";"
-- Diagnostic keymaps
map('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' })
map('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
map('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
map('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
map("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
map("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
map("n", "<leader>e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
map("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
-- Lsp format
map('n', '<leader>f', vim.lsp.buf.format, { desc = "Format current buffer" })
-- map('n', '<leader>f', vim.lsp.buf.format, { desc = "Format current buffer" })
-- Move text easilly
map("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move selected text up" })
@ -28,7 +28,7 @@ map("x", "<leader>p", [["_dP]], { desc = "Paste while keeping the registry" })
-- source current lua config file
map("n", "<leader><leader>", function()
vim.cmd("so")
vim.cmd("so")
end, { desc = "Source current source file" })
-- better indenting

View file

@ -18,7 +18,7 @@ opt.expandtab = true
opt.smartindent = true
-- Enable the mouse, just to have it
opt.mouse = 'a'
opt.mouse = "a"
-- Enable break indent
opt.breakindent = true
@ -34,14 +34,14 @@ opt.ignorecase = true
opt.smartcase = true
-- Keep signcolumn on by default
opt.signcolumn = 'yes'
opt.signcolumn = "yes"
-- Decrease update time
opt.updatetime = 50
opt.timeoutlen = 300
-- Set completeopt to have a better completion experience
opt.completeopt = 'menuone,noselect'
opt.completeopt = "menuone,noselect"
-- Enable true color support
opt.termguicolors = true