mirror of
https://github.com/danbee/dotfiles-local
synced 2025-03-04 08:49:07 +00:00
Add formatter and format files with Stylua
This commit is contained in:
parent
574eb3d8f6
commit
0dcfba8f9c
6
config/nvim/.stylua.toml
Normal file
6
config/nvim/.stylua.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
column_width = 80
|
||||||
|
indent_type = "Spaces"
|
||||||
|
indent_width = 2
|
||||||
|
|
||||||
|
[sort_requires]
|
||||||
|
enabled = true
|
||||||
@ -1,3 +1,3 @@
|
|||||||
require "config.keymaps"
|
require("config.keymaps")
|
||||||
require "config.lazy"
|
require("config.lazy")
|
||||||
require "config.options"
|
require("config.options")
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
|
||||||
|
"formatter.nvim": { "branch": "master", "commit": "ed949c13e1a942db29ababa35e8c7864ced90eb6" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "1a8ba635e511148801b55a1128aef933c296a301" },
|
"gruvbox.nvim": { "branch": "main", "commit": "1a8ba635e511148801b55a1128aef933c296a301" },
|
||||||
"kanagawa.nvim": { "branch": "master", "commit": "5c4037432f0ae2d0b75d3a7b7cfa3022d7054e4d" },
|
"kanagawa.nvim": { "branch": "master", "commit": "5c4037432f0ae2d0b75d3a7b7cfa3022d7054e4d" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" },
|
"lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" },
|
||||||
|
|||||||
15
config/nvim/lua/.luarc.json
Normal file
15
config/nvim/lua/.luarc.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"workspace.library": [
|
||||||
|
"/Users/danbarber/.config/nvim",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/lazy.nvim",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/nvim-lspconfig",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/nordic.nvim",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/plenary.nvim",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/telescope.nvim",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/tokyonight.nvim",
|
||||||
|
"/Users/danbarber/.local/share/nvim/lazy/which-key.nvim",
|
||||||
|
"/Applications/VimR.app/Contents/Resources/NvimView_NvimView.bundle/Contents/Resources/runtime",
|
||||||
|
"/Users/danbarber/.local/state/nvim/lazy/readme",
|
||||||
|
"${3rd}/luassert/library"
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
local keymap = vim.keymap.set
|
local keymap = vim.keymap.set
|
||||||
|
|
||||||
-- Space as leader
|
-- Space as leader
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
-- Better pane navigation
|
-- Better pane navigation
|
||||||
keymap("n", "<C-h>", "<C-w>h")
|
keymap("n", "<C-h>", "<C-w>h")
|
||||||
|
|||||||
15
config/nvim/lua/config/plugins/formatter.lua
Normal file
15
config/nvim/lua/config/plugins/formatter.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
return function()
|
||||||
|
require("formatter").setup({
|
||||||
|
logging = true,
|
||||||
|
log_level = vim.log.levels.WARN,
|
||||||
|
filetype = {
|
||||||
|
lua = {
|
||||||
|
require("formatter.filetypes.lua").stylua,
|
||||||
|
},
|
||||||
|
|
||||||
|
["*"] = {
|
||||||
|
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
@ -1 +1 @@
|
|||||||
require('lspconfig').emmet_ls.setup({})
|
require("lspconfig").emmet_ls.setup({})
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
require("lspconfig").lua_ls.setup {
|
require("lspconfig").lua_ls.setup({
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = {"vim"},
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
library = vim.api.nvim_get_runtime_file("", true),
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
@ -15,4 +15,4 @@ require("lspconfig").lua_ls.setup {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|||||||
@ -3,6 +3,6 @@ return function()
|
|||||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
|
||||||
require("neo-tree").setup({
|
require("neo-tree").setup({
|
||||||
hijack_netrw_behavior = "open_default"
|
hijack_netrw_behavior = "open_default",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
@ -23,6 +23,6 @@ return function()
|
|||||||
{ name = "vsnip" },
|
{ name = "vsnip" },
|
||||||
}, {
|
}, {
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
})
|
}),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
5
config/nvim/lua/plugins/formatter.lua
Normal file
5
config/nvim/lua/plugins/formatter.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
"mhartington/formatter.nvim",
|
||||||
|
|
||||||
|
config = require("config.plugins.formatter"),
|
||||||
|
}
|
||||||
@ -3,5 +3,5 @@ return {
|
|||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
require("config.plugins.lspconfig")
|
require("config.plugins.lspconfig")
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,5 +5,5 @@ return {
|
|||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
|
|
||||||
config = require("config.plugins.lualine")
|
config = require("config.plugins.lualine"),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
},
|
},
|
||||||
|
|
||||||
config = require("config.plugins.neo-tree")
|
config = require("config.plugins.neo-tree"),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
|
|
||||||
config = require("config.plugins.nvim-cmp")
|
config = require("config.plugins.nvim-cmp"),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
|
|
||||||
dependencies = { "nvim-lua/plenary.nvim" }
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,8 @@ return {
|
|||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
init = function()
|
init = function()
|
||||||
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
|
||||||
local plugin = require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
local plugin =
|
||||||
|
require("lazy.core.config").spec.plugins["nvim-treesitter"]
|
||||||
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
local opts = require("lazy.core.plugin").values(plugin, "opts", false)
|
||||||
local enabled = false
|
local enabled = false
|
||||||
if opts.textobjects then
|
if opts.textobjects then
|
||||||
@ -23,13 +24,15 @@ return {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not enabled then
|
if not enabled then
|
||||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
require("lazy.core.loader").disable_rtp_plugin(
|
||||||
|
"nvim-treesitter-textobjects"
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
---@type TSConfig
|
---@type TSConfig
|
||||||
opts = require("config.plugins.tree-sitter")
|
opts = require("config.plugins.tree-sitter"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
|
|
||||||
config = require("config.plugins.which-key")
|
config = require("config.plugins.which-key"),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user