add a multitude of fixes, modifications and lintings

This commit is contained in:
Nydragon 2023-11-27 11:33:28 +09:00
parent 25c57ba788
commit 9f22ffe6da
9 changed files with 239 additions and 159 deletions

1
nvim/cheatsheet.txt Normal file
View file

@ -0,0 +1 @@
Search, Preview and Open file | <leader>ff

View file

@ -1,5 +1,5 @@
set nocompatible set nocompatible
set number set relativenumber
set cc=80 set cc=80
set ignorecase set ignorecase
hi ColorColumn ctermbg=black guibg=black hi ColorColumn ctermbg=black guibg=black
@ -11,4 +11,9 @@ set completeopt=menu,menuone,noselect
filetype plugin on filetype plugin on
augroup FormatAutogroup
autocmd!
autocmd BufWritePost * FormatWrite
augroup END
lua require('plugins') lua require('plugins')

16
nvim/lua/ale-config.lua Normal file
View file

@ -0,0 +1,16 @@
vim.g.ale_fixers = {
['*'] = {
'remove_trailing_lines',
'trim_whitespace'
},
["lua"] = {
"lua-format"
},
["rust"] = {
"rustfmt"
}
}
vim.g.ale_fix_on_save = 1

View file

@ -0,0 +1,26 @@
require('autoclose').setup(
{
keys = {
["("] = { escape = false, close = true, pair = "()" },
["["] = { escape = false, close = true, pair = "[]" },
["{"] = { escape = false, close = true, pair = "{}" },
[">"] = { escape = true, close = false, pair = "<>" },
[")"] = { escape = true, close = false, pair = "()" },
["]"] = { escape = true, close = false, pair = "[]" },
["}"] = { escape = true, close = false, pair = "{}" },
['"'] = { escape = true, close = true, pair = '""' },
["'"] = { escape = true, close = true, pair = "''" },
["`"] = { escape = true, close = true, pair = "``" },
},
options = {
disabled_filetypes = { "text" },
disable_when_touch = false,
touch_regex = "[%w(%[{]",
pair_spaces = false,
auto_indent = true,
disable_command_mode = false,
},
}
)

View file

@ -0,0 +1,23 @@
local util = require("formatter.util")
require("formatter").setup({
logging = true,
log_level = vim.log.levels.WARN,
filetype = {
lua = {
require("formatter.filetypes.lua").stylua,
},
rust = {
function()
return {
exe = "rustfmt",
args = { "--edition 2021" },
stdin = true,
}
end,
},
["*"] = {
require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})

View file

@ -1,12 +1,29 @@
require('image').setup { -- default config
render = { require("image").setup({
min_padding = 5, backend = "kitty",
show_label = true, integrations = {
use_dither = true, markdown = {
foreground_color = true, enabled = true,
background_color = true, clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = false,
filetypes = { "markdown", "vimwiki" }, -- markdown extensions (ie. quarto) can go here
}, },
events = { neorg = {
update_on_nvim_resize = true, enabled = true,
clear_in_insert_mode = false,
download_remote_images = true,
only_render_image_at_cursor = false,
filetypes = { "norg" },
}, },
} },
max_width = nil,
max_height = nil,
max_width_window_percentage = nil,
max_height_window_percentage = 50,
window_overlap_clear_enabled = false, -- toggles images when windows are overlapped
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
editor_only_render_when_focused = false, -- auto show/hide images when the editor gains/looses focus
tmux_show_only_in_active_window = false, -- auto show/hide images in the correct Tmux window (needs visual-activity off)
hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, -- render image files as images when opened
})

View file

@ -42,4 +42,4 @@ require('lspconfig')['pyright'].setup {
flags = lsp_flags, flags = lsp_flags,
} }
require'lspconfig'.clangd.setup{} require 'lspconfig'.clangd.setup {}

View file

@ -1,9 +1,9 @@
local ensure_packer = function() local ensure_packer = function()
local fn = vim.fn local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd [[packadd packer.nvim]] vim.cmd([[packadd packer.nvim]])
return true return true
end end
return false return false
@ -11,46 +11,46 @@ end
local packer_bootstrap = ensure_packer() local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use) return require("packer").startup(function(use)
use 'wbthomason/packer.nvim' use("wbthomason/packer.nvim")
use { use({
'nvim-tree/nvim-tree.lua', "nvim-tree/nvim-tree.lua",
requires = { requires = {
'nvim-tree/nvim-web-devicons', -- optional, for file icons "nvim-tree/nvim-web-devicons", -- optional, for file icons
} },
} })
use { use({
'nvim-lualine/lualine.nvim', "nvim-lualine/lualine.nvim",
requires = { requires = {
'nvim-tree/nvim-web-devicons', -- optional, for file icons "nvim-tree/nvim-web-devicons", -- optional, for file icons
} },
})
} use({ "romgrk/barbar.nvim", requires = "nvim-web-devicons" })
use { 'romgrk/barbar.nvim', requires = 'nvim-web-devicons' } use("nvim-treesitter/nvim-treesitter")
use 'nvim-treesitter/nvim-treesitter' use("neovim/nvim-lspconfig") -- Configurations for Nvim LSP
use("simrat39/rust-tools.nvim")
use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
-- (batch)commenting tool -- (batch)commenting tool
use 'preservim/nerdcommenter' use("preservim/nerdcommenter")
use("m4xshen/autoclose.nvim")
use "lukas-reineke/indent-blankline.nvim" use("lukas-reineke/indent-blankline.nvim")
-- themeing -- themeing
use "EdenEast/nightfox.nvim" use("EdenEast/nightfox.nvim")
-- thin bar indicating an arbitray character limit -- thin bar indicating an arbitray character limit
use "lukas-reineke/virt-column.nvim" use("lukas-reineke/virt-column.nvim")
-- fuzzy file finder -- fuzzy file finder
use 'nvim-telescope/telescope.nvim' use("nvim-telescope/telescope.nvim")
-- autocompletion engine, plugs into lsp -- autocompletion engine, plugs into lsp
use { use({
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
requires = { requires = {
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
@ -58,28 +58,21 @@ return require('packer').startup(function(use)
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-cmdline",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lua",
}
}
-- renders images in nvim
use {
'samodostal/image.nvim',
requires = {
'nvim-lua/plenary.nvim',
'm00qek/baleia.nvim'
}, },
} })
--use 'dense-analysis/ale'
use("mhartington/formatter.nvim")
use({
"sudormrfbin/cheatsheet.nvim",
use {
'mrcjkb/haskell-tools.nvim',
requires = { requires = {
'nvim-lua/plenary.nvim', { "nvim-telescope/telescope.nvim" },
'nvim-telescope/telescope.nvim' { "nvim-lua/popup.nvim" },
{ "nvim-lua/plenary.nvim" },
}, },
branch = '1.x.x', })
}
use 'dense-analysis/ale'
vim.cmd([[ vim.cmd([[
augroup packer_user_config augroup packer_user_config
@ -89,20 +82,19 @@ return require('packer').startup(function(use)
]]) ]])
-- init configs -- init configs
require('nightfox-config') require("nightfox-config")
require('nvim-lsp-config') require("nvim-lsp-config")
require('nvim-tree-config') require("nvim-tree-config")
require('nvim-cmp-config') require("nvim-cmp-config")
require('image-config') require("autoclose-config")
require('haskell-config') require("image-config")
require('telescope-config') require("telescope-config")
require('lualine').setup() -- require('ale-config')
require("formatter-config")
require("lualine").setup()
require("virt-column").setup() require("virt-column").setup()
vim.g.ale_linters = { haskell = {'hlint', 'hdevtools', 'hfmt'} }
if packer_bootstrap then if packer_bootstrap then
require('packer').sync() require("packer").sync()
end end
end) end)