Begun, the dotfiles have.
This commit is contained in:
parent
a6e31c9975
commit
8d9e9ea04d
18 changed files with 549 additions and 0 deletions
35
dotfiles/README.md
Normal file
35
dotfiles/README.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# dotfiles
|
||||
|
||||
My personalized set of configurations.
|
||||
|
||||
## nvim (Neovim)
|
||||
|
||||
Here are the plugins I'm currently using:
|
||||
|
||||
- [lazy](https://github.com/folke/lazy.nvim) - Neovim plugin manager.
|
||||
- [autopairs](https://github.com/windwp/nvim-autopairs) - "Autopairs" parentheses/brackets/braces/etc.
|
||||
- [cmp](https://github.com/hrsh7th/nvim-cmp) - Autocompletion.
|
||||
- [colorizer](https://github.com/norcalli/nvim-colorizer.lua) - Syntax highlighting.
|
||||
- [conform](https://github.com/stevearc/conform.nvim) - Autoformatting.
|
||||
- [gitsigns](https://github.com/lewis6991/gitsigns.nvim) - Git integration within buffer.
|
||||
- [lspconfig](https://github.com/neovim/nvim-lspconfig) - Quick setup for LSP.
|
||||
- [lualine](https://github.com/nvim-lualine/lualine.nvim) - Helpful status line.
|
||||
- [mason](https://github.com/williamboman/mason.nvim) - Plugin manager specific to external tools (LSP/linters/formatters/etc.)
|
||||
- [neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) - File manager.
|
||||
- [telescope](https://github.com/nvim-telescope/telescope.nvim) - Fuzzy finder.
|
||||
- [toggleterm](https://github.com/akinsho/toggleterm.nvim) - Terminal switcher.
|
||||
- [tree-sitter](https://github.com/nvim-treesitter/nvim-treesitter) - Syntax parsing for opened files.
|
||||
|
||||
### Requirements
|
||||
|
||||
- [luarocks](https://github.com/luarocks/luarocks)
|
||||
- npm
|
||||
|
||||
### Setup
|
||||
|
||||
A couple of the plugins need some Node.JS packages installed first.
|
||||
|
||||
```
|
||||
$ sudo npm install -g tree-sitter tree-sitter-cli typescript typescript-language-server
|
||||
```
|
||||
|
1
dotfiles/nvim/.gitignore
vendored
Normal file
1
dotfiles/nvim/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
lazy-lock.json
|
2
dotfiles/nvim/init.lua
Normal file
2
dotfiles/nvim/init.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
require("jodhus.settings")
|
||||
require("jodhus.lazy")
|
15
dotfiles/nvim/lua/jodhus/lazy.lua
Normal file
15
dotfiles/nvim/lua/jodhus/lazy.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup("jodhus.plugins")
|
||||
|
9
dotfiles/nvim/lua/jodhus/plugins/autopairs.lua
Normal file
9
dotfiles/nvim/lua/jodhus/plugins/autopairs.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
})
|
||||
end,
|
||||
}
|
64
dotfiles/nvim/lua/jodhus/plugins/cmp.lua
Normal file
64
dotfiles/nvim/lua/jodhus/plugins/cmp.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
"rafamadriz/friendly-snippets",
|
||||
"onsails/lspkind.nvim",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local lspkind = require("lspkind")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
expandable_indicator = true,
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 64,
|
||||
ellipsis_char = "...",
|
||||
show_labelDetails = true,
|
||||
before = function(entry, vim_item)
|
||||
return vim_item
|
||||
end,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd([[
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
highlight! default link CmpItemKind CmpItemMenuDefault
|
||||
]])
|
||||
end,
|
||||
}
|
6
dotfiles/nvim/lua/jodhus/plugins/colorizer.lua
Normal file
6
dotfiles/nvim/lua/jodhus/plugins/colorizer.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup({ "*" })
|
||||
end,
|
||||
}
|
32
dotfiles/nvim/lua/jodhus/plugins/colorscheme.lua
Normal file
32
dotfiles/nvim/lua/jodhus/plugins/colorscheme.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("gruvbox").setup({
|
||||
terminal_colors = true,
|
||||
undercurl = true,
|
||||
underline = true,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = true,
|
||||
emphasis = true,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true,
|
||||
contrast = "",
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
})
|
||||
vim.cmd("colorscheme gruvbox")
|
||||
end,
|
||||
opts = ...,
|
||||
}
|
37
dotfiles/nvim/lua/jodhus/plugins/formatter.lua
Normal file
37
dotfiles/nvim/lua/jodhus/plugins/formatter.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local conform = require("conform")
|
||||
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
markdown = { "prettier" },
|
||||
lua = { "stylua" },
|
||||
python = { "isort", "black" },
|
||||
rust = { "rustfmt" },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 1000,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>f", function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 1000,
|
||||
})
|
||||
end, { desc = "Format file or range (in visual mode)" })
|
||||
end,
|
||||
}
|
45
dotfiles/nvim/lua/jodhus/plugins/gitsigns.lua
Normal file
45
dotfiles/nvim/lua/jodhus/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
local gitsigns = require("gitsigns")
|
||||
gitsigns.setup({
|
||||
signs = {
|
||||
add = { text = "│" },
|
||||
change = { text = "│" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
untracked = { text = "┆" },
|
||||
},
|
||||
signcolumn = true,
|
||||
numhl = false,
|
||||
linehl = false,
|
||||
word_diff = false,
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false,
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol",
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil,
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
border = "single",
|
||||
sytle = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
-- yadm = { enable = false },
|
||||
})
|
||||
end,
|
||||
}
|
85
dotfiles/nvim/lua/jodhus/plugins/lspconfig.lua
Normal file
85
dotfiles/nvim/lua/jodhus/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,85 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
local nvim_lsp = require("lspconfig")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
local protocol = require("vim.lsp.protocol")
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
-- format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("Format", { clear = true }),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server)
|
||||
nvim_lsp[server].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["basedpyright"] = function()
|
||||
nvim_lsp["basedpyright"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["cssls"] = function()
|
||||
nvim_lsp["cssls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["eslint"] = function()
|
||||
nvim_lsp["eslint"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["html"] = function()
|
||||
nvim_lsp["html"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["jsonls"] = function()
|
||||
nvim_lsp["jsonls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["rust_analyzer"] = function()
|
||||
nvim_lsp["rust_analyzer"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["ts_ls"] = function()
|
||||
nvim_lsp["ts_ls"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["tailwindcss"] = function()
|
||||
nvim_lsp["tailwindcss"].setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
7
dotfiles/nvim/lua/jodhus/plugins/lualine.lua
Normal file
7
dotfiles/nvim/lua/jodhus/plugins/lualine.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("lualine").setup()
|
||||
end,
|
||||
}
|
36
dotfiles/nvim/lua/jodhus/plugins/mason.lua
Normal file
36
dotfiles/nvim/lua/jodhus/plugins/mason.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
automatic_installation = true,
|
||||
ensure_installed = {
|
||||
"basedpyright",
|
||||
"cssls",
|
||||
"eslint",
|
||||
"html",
|
||||
"jsonls",
|
||||
"rust_analyzer",
|
||||
"ts_ls",
|
||||
"tailwindcss",
|
||||
},
|
||||
})
|
||||
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
"stylua",
|
||||
"isort",
|
||||
"black",
|
||||
"pylint",
|
||||
"eslint_d",
|
||||
"rustfmt",
|
||||
}
|
||||
})
|
||||
end,
|
||||
}
|
16
dotfiles/nvim/lua/jodhus/plugins/neotree.lua
Normal file
16
dotfiles/nvim/lua/jodhus/plugins/neotree.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup({
|
||||
filesystem = {
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
15
dotfiles/nvim/lua/jodhus/plugins/telescope.lua
Normal file
15
dotfiles/nvim/lua/jodhus/plugins/telescope.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
config = function()
|
||||
require("telescope").setup()
|
||||
|
||||
local keymap = vim.keymap
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd." })
|
||||
keymap.set("n", "<leader>fg", "<cmd>Telescope live_grep<cr>", { desc = "Fuzzy find recent files." })
|
||||
keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>", { desc = "Find string in cwd." })
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope git_status<cr>", { desc = "Find string under cursor in cwd." })
|
||||
keymap.set("n", "<leader>fc", "<cmd>Telescope git_commits<cr>", { desc = "Find todos." })
|
||||
end,
|
||||
}
|
19
dotfiles/nvim/lua/jodhus/plugins/toggleterm.lua
Normal file
19
dotfiles/nvim/lua/jodhus/plugins/toggleterm.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
config = function()
|
||||
require("toggleterm").setup({
|
||||
size = 10,
|
||||
open_mapping = [[<F7>]],
|
||||
shading_factor = 2,
|
||||
direction = "float",
|
||||
float_opts={
|
||||
border = "curved",
|
||||
highlights = {
|
||||
border = "Normal",
|
||||
beackground = "Normal",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
97
dotfiles/nvim/lua/jodhus/plugins/treesitter.lua
Normal file
97
dotfiles/nvim/lua/jodhus/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,97 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
"windwp/nvim-ts-autotag",
|
||||
},
|
||||
config = function()
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
|
||||
treesitter.setup({
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = { enable = true },
|
||||
autotag = { enable = true },
|
||||
modules = {},
|
||||
auto_install = false,
|
||||
ignore_install = {},
|
||||
sync_install = false,
|
||||
ensure_installed = {
|
||||
"asm",
|
||||
"bash",
|
||||
"c",
|
||||
"c_sharp",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"csv",
|
||||
"diff",
|
||||
"dockerfile",
|
||||
"elixir",
|
||||
"git_config",
|
||||
"gitattributes",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"go",
|
||||
"gomod",
|
||||
"graphql",
|
||||
"html",
|
||||
"http",
|
||||
"ini",
|
||||
"java",
|
||||
"javascript",
|
||||
"json",
|
||||
"json5",
|
||||
"latex",
|
||||
"liquidsoap",
|
||||
"lua",
|
||||
"m68k",
|
||||
"make",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"meson",
|
||||
"nasm",
|
||||
"nginx",
|
||||
"php",
|
||||
"python",
|
||||
"regex",
|
||||
"ruby",
|
||||
"rust",
|
||||
"scss",
|
||||
"sql",
|
||||
"ssh_config",
|
||||
"tmux",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vue",
|
||||
"xml",
|
||||
"yaml",
|
||||
"zig",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
disable = { "html" },
|
||||
extended_mode = false,
|
||||
max_file_lines = nil,
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
28
dotfiles/nvim/lua/jodhus/settings.lua
Normal file
28
dotfiles/nvim/lua/jodhus/settings.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
local global = vim.g
|
||||
local o = vim.opt
|
||||
|
||||
-- Editor options
|
||||
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.clipboard = "unnamedplus"
|
||||
o.syntax = ON
|
||||
o.autoindent = true
|
||||
o.cursorline = true
|
||||
o.expandtab = true
|
||||
o.shiftwidth = 4
|
||||
o.tabstop = 4
|
||||
o.encoding = "UTF-8"
|
||||
o.ruler = true
|
||||
o.mouse = "a"
|
||||
o.title = true
|
||||
o.hidden = true
|
||||
o.ttimeoutlen = 0
|
||||
o.wildmenu = true
|
||||
o.showcmd = true
|
||||
o.showmatch = true
|
||||
o.inccommand = "split"
|
||||
o.splitright = true
|
||||
o.splitbelow = true
|
||||
o.termguicolors = true
|
||||
o.background = "dark"
|
Loading…
Reference in a new issue