Compare commits
2 Commits
88d1681f4d
...
3902f3e598
| Author | SHA1 | Date | |
|---|---|---|---|
| 3902f3e598 | |||
| 56ccea6a7b |
@ -3,14 +3,48 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
local conform = require("conform")
|
local conform = require("conform")
|
||||||
|
|
||||||
|
local function file_exists(name)
|
||||||
|
local f = io.open(name, "r")
|
||||||
|
if f ~= nil then
|
||||||
|
io.close(f)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function decide_js_formatter()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if file_exists(cwd .. "/biome.json") then
|
||||||
|
return "biome"
|
||||||
|
else
|
||||||
|
return "prettier"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function decide_json_formatter()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if file_exists(cwd .. "/biome.json") then
|
||||||
|
return "biome"
|
||||||
|
elseif file_exists(cwd .. "/.prettierrc") then
|
||||||
|
return "prettier"
|
||||||
|
else
|
||||||
|
return "jq"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
conform.setup({
|
conform.setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
|
javascript = { decide_js_formatter() },
|
||||||
|
javascriptreact = { decide_js_formatter() },
|
||||||
|
json = { decide_json_formatter() },
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
|
markdown = { "mdformat" },
|
||||||
nginx = { "nginxfmt" },
|
nginx = { "nginxfmt" },
|
||||||
python = { "black", "flake8" },
|
python = { "isort", "black" },
|
||||||
|
sh = { "shfmt" },
|
||||||
|
typescript = { decide_js_formatter() },
|
||||||
|
typescriptreact = { decide_js_formatter() },
|
||||||
yaml = { "yamlfix" },
|
yaml = { "yamlfix" },
|
||||||
-- Use the "*" filetype to run formatters on all filetypes.
|
["*"] = { "codespell" },
|
||||||
-- ["*"] = { "codespell" },
|
|
||||||
},
|
},
|
||||||
|
|
||||||
default_format_opts = {
|
default_format_opts = {
|
||||||
|
|||||||
48
.config/nvim/lua/plugins/language_support/nvim-lint.lua
Normal file
48
.config/nvim/lua/plugins/language_support/nvim-lint.lua
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
return {
|
||||||
|
"mfussenegger/nvim-lint",
|
||||||
|
config = function()
|
||||||
|
local function file_exists(name)
|
||||||
|
local f = io.open(name, "r")
|
||||||
|
if f ~= nil then
|
||||||
|
io.close(f)
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function decide_linter()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
if file_exists(cwd .. "/biome.json") then
|
||||||
|
return "biome"
|
||||||
|
else
|
||||||
|
return "eslint_d"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local lint = require("lint")
|
||||||
|
|
||||||
|
lint.linters_by_ft = {
|
||||||
|
javascript = { "eslint_d" },
|
||||||
|
javascriptreact = { "eslint_d" },
|
||||||
|
markdown = { "markdownlint" },
|
||||||
|
python = { "flake8" },
|
||||||
|
sh = { "shellcheck" },
|
||||||
|
typescript = { "eslint_d" },
|
||||||
|
typescriptreact = { "eslint_d" },
|
||||||
|
yaml = { "yamllint" },
|
||||||
|
}
|
||||||
|
|
||||||
|
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||||
|
group = lint_augroup,
|
||||||
|
callback = function()
|
||||||
|
lint.try_lint()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>l", function()
|
||||||
|
lint.try_lint()
|
||||||
|
end, { desc = "Trigger linting for current file" })
|
||||||
|
end,
|
||||||
|
}
|
||||||
@ -18,9 +18,11 @@ return {
|
|||||||
|
|
||||||
require("mason-lspconfig").setup({
|
require("mason-lspconfig").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
|
"bashls",
|
||||||
"cssls",
|
"cssls",
|
||||||
"dockerls",
|
"dockerls",
|
||||||
"emmet_ls",
|
"emmet_ls",
|
||||||
|
"eslint",
|
||||||
"html",
|
"html",
|
||||||
"jdtls",
|
"jdtls",
|
||||||
"jsonls",
|
"jsonls",
|
||||||
@ -43,10 +45,15 @@ return {
|
|||||||
"eslint_d",
|
"eslint_d",
|
||||||
"firefox-debug-adapter",
|
"firefox-debug-adapter",
|
||||||
"flake8",
|
"flake8",
|
||||||
|
"isort",
|
||||||
"java-debug-adapter",
|
"java-debug-adapter",
|
||||||
"jq",
|
"jq",
|
||||||
|
"markdownlint",
|
||||||
|
"mdformat",
|
||||||
"nginx-config-formatter",
|
"nginx-config-formatter",
|
||||||
"prettierd",
|
"prettier",
|
||||||
|
"shellcheck",
|
||||||
|
"shfmt",
|
||||||
"stylua",
|
"stylua",
|
||||||
"yamlfix",
|
"yamlfix",
|
||||||
"yamllint",
|
"yamllint",
|
||||||
|
|||||||
@ -134,6 +134,17 @@ return {
|
|||||||
root_markers = { "tsconfig.json", "jsconfig.json", "package.json" },
|
root_markers = { "tsconfig.json", "jsconfig.json", "package.json" },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.lsp.config("jsonls", {
|
||||||
|
on_attach = function(client)
|
||||||
|
-- Disable formatting capability for tsserver
|
||||||
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
client.server_capabilities.documentRangeFormattingProvider = false
|
||||||
|
end,
|
||||||
|
filetypes = {
|
||||||
|
"json",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
vim.lsp.config("pylsp", {
|
vim.lsp.config("pylsp", {
|
||||||
on_attach = function(client)
|
on_attach = function(client)
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
@ -144,5 +155,15 @@ return {
|
|||||||
},
|
},
|
||||||
root_markers = { "requirements.txt" },
|
root_markers = { "requirements.txt" },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.lsp.config("bashls", {
|
||||||
|
on_attach = function(client)
|
||||||
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
client.server_capabilities.documentRangeFormattingProvider = false
|
||||||
|
end,
|
||||||
|
filetypes = {
|
||||||
|
"sh",
|
||||||
|
},
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@ -6,12 +6,10 @@
|
|||||||
|
|
||||||
!.config/neofetch/*
|
!.config/neofetch/*
|
||||||
|
|
||||||
!.config/nvim/init.lua
|
!.config/nvim/*
|
||||||
!.config/nvim/lua/**
|
|
||||||
|
|
||||||
!.config/tmux/tmux.conf
|
!.config/tmux/tmux.conf
|
||||||
!.config/tmux/catppuccin.conf
|
!.config/tmux/catppuccin.conf
|
||||||
.config/tmux/local.tmux.config
|
|
||||||
|
|
||||||
!.config/waybar/*
|
!.config/waybar/*
|
||||||
|
|
||||||
@ -20,3 +18,4 @@
|
|||||||
!.zinit.zsh
|
!.zinit.zsh
|
||||||
!.zshrc
|
!.zshrc
|
||||||
!.zstyle.zsh
|
!.zstyle.zsh
|
||||||
|
!.wslrc.zsh
|
||||||
|
|||||||
15
.wslrc.zsh
Normal file
15
.wslrc.zsh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Fix HOME, END, and DEL keys for zsh
|
||||||
|
bindkey "^[[H" beginning-of-line
|
||||||
|
bindkey "^[[F" end-of-line
|
||||||
|
bindkey "^[[3~" delete-char
|
||||||
|
|
||||||
|
# Fix HOME and END for tmux
|
||||||
|
bindkey "\E[1~" beginning-of-line
|
||||||
|
bindkey "\E[4~" end-of-line
|
||||||
|
|
||||||
|
# Set vals for C-Right, C-S-Right, C-Left, C-S-Left
|
||||||
|
# To move through words
|
||||||
|
bindkey "^[[1;6D" vi-backward-word
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
bindkey "^[[1;6C" vi-forward-word
|
||||||
|
bindkey "^[[1;5C" emacs-forward-word
|
||||||
4
.zshrc
4
.zshrc
@ -49,4 +49,8 @@ alias vim="nvim"
|
|||||||
alias vi="nvim"
|
alias vi="nvim"
|
||||||
alias python="python3"
|
alias python="python3"
|
||||||
|
|
||||||
|
# If wsl.conf exists we're probably in WSL and need some changes for terminal commands to work correctly
|
||||||
|
[[ ! -f /etc/wsl.conf ]] || source ~/.wslrc.zsh
|
||||||
|
|
||||||
[[ ! -f ~/.localrc.zsh ]] || source ~/.localrc.zsh
|
[[ ! -f ~/.localrc.zsh ]] || source ~/.localrc.zsh
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user