Skip to content

Commit

Permalink
adds stylua
Browse files Browse the repository at this point in the history
  • Loading branch information
harryob committed Feb 26, 2024
1 parent 5bc7a69 commit 2a2fd88
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 191 deletions.
4 changes: 4 additions & 0 deletions .stylelua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
indent_type = "Spaces"
indent_width = 2
[sort_requires]
enabled = true
66 changes: 32 additions & 34 deletions dot_config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,47 @@ vim.opt.number = true

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)

require("lazy").setup("plugins")

require("telescope").load_extension "file_browser"
require("telescope").load_extension("file_browser")

local wk = require("which-key")
wk.register({
f = {
name = "file",
f = { "<cmd>Telescope find_files<cr>", "Find File" },
g = { "<cmd>Telescope live_grep<cr>", "Grep Files" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
},
d = {
name = "dir",
f = { "<cmd>Telescope file_browser<cr>", "Find Directory" },
r = { "<cmd>NvimTreeFindFile!<cr>", "Root Here" },
t = { "<cmd>NvimTreeToggle<cr>", "Toggle Tree"},
},
b = {
name = "browser",
o = { "<cmd>BrowserPreview<cr>", "Open Browser" },
},
g = {
name = "git",
g = { "<cmd>LazyGit<cr>", "LazyGit" },
},
f = {
name = "file",
f = { "<cmd>Telescope find_files<cr>", "Find File" },
g = { "<cmd>Telescope live_grep<cr>", "Grep Files" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
},
d = {
name = "dir",
f = { "<cmd>Telescope file_browser<cr>", "Find Directory" },
r = { "<cmd>NvimTreeFindFile!<cr>", "Root Here" },
t = { "<cmd>NvimTreeToggle<cr>", "Toggle Tree" },
},
b = {
name = "browser",
o = { "<cmd>BrowserPreview<cr>", "Open Browser" },
},
g = {
name = "git",
g = { "<cmd>LazyGit<cr>", "LazyGit" },
},
}, { prefix = "<leader>" })

wk.register({
["B"] = { name = "+buffer"},
["B,"] = { "<cmd>BufferPrevious<CR>", "Previous Tab" },
["B."] = { "<cmd>BufferNext<CR>", "Next Tab" },
["B"] = { name = "+buffer" },
["B,"] = { "<cmd>BufferPrevious<CR>", "Previous Tab" },
["B."] = { "<cmd>BufferNext<CR>", "Next Tab" },
})


24 changes: 21 additions & 3 deletions dot_config/nvim/lua/plugins/formatter.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
return {
{ 'steevearc/conform.nvim',
opts = {},
}
"stevearc/conform.nvim",
lazy = true,
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
-- Customize or remove this keymap to your liking
"<leader>c",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
desc = "Format buffer",
},
},
opts = {
formatters_by_ft = {
lua = { "styleua" },
},
format_on_save = { timeout_ms = 500, lsp_fallback = true },
},
}
18 changes: 10 additions & 8 deletions dot_config/nvim/lua/plugins/keybinds.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
return {
{ "folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {} }
}
{
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {},
},
}
136 changes: 70 additions & 66 deletions dot_config/nvim/lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,73 +1,77 @@
return {
{ 'neovim/nvim-lspconfig', priority = 1,
config = function()
local lspconfig = require('lspconfig')
lspconfig.tsserver.setup {}
lspconfig.rust_analyzer.setup {}
lspconfig.html.setup {}
end },
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-cmdline',
{ 'williamboman/mason.nvim', priority = 51, opts = {} },
{ 'williamboman/mason-lspconfig.nvim',
opts = { automatic_installation = true } },
{ 'hrsh7th/nvim-cmp',
config = function()
local cmp = require('cmp')

cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
{ name = 'buffer' },
{
"neovim/nvim-lspconfig",
priority = 1,
config = function()
local lspconfig = require("lspconfig")
lspconfig.tsserver.setup({})
lspconfig.rust_analyzer.setup({})
lspconfig.html.setup({})
end,
},
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
{ "williamboman/mason.nvim", priority = 51, opts = {} },
{ "williamboman/mason-lspconfig.nvim", opts = { automatic_installation = true } },
{
"hrsh7th/nvim-cmp",
config = function()
local cmp = require("cmp")

cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "vsnip" }, -- For vsnip users.
{ name = "buffer" },
}),
})

-- Set configuration for specific filetype.
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = "buffer" },
}),
})
})

-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = 'buffer' },
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
})
})

-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
})
end },
end,
},
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
}
13 changes: 10 additions & 3 deletions dot_config/nvim/lua/plugins/theme.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,21 @@ return {
require('vscode').load()
end },
]]--
{ "EdenEast/nightfox.nvim", init = function() vim.cmd.colorscheme "nordfox" end },
]]
--
{
"EdenEast/nightfox.nvim",
init = function()
vim.cmd.colorscheme("nordfox")
end,
},
--[[
{ "catppuccin/nvim",
name = "catppuccin",
priority = 1000,
init = function() vim.cmd.colorscheme "catppuccin" end,
opts = { flavour = "frappe" }
}
]]--
]]
--
}
Loading

0 comments on commit 2a2fd88

Please sign in to comment.