Run stylua on everything

This commit is contained in:
ViViDboarder 2021-12-15 09:37:51 -08:00
parent d9a1d9b799
commit d98e4fac72
16 changed files with 320 additions and 286 deletions

View File

@ -2,8 +2,8 @@ local utils = require("utils")
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
local opt_silent = {silent = true} local opt_silent = { silent = true }
local opt_default = {silent = true, noremap = true} local opt_default = { silent = true, noremap = true }
map("n", "<C-L><C-L>", ":set wrap!<CR>", opt_silent) map("n", "<C-L><C-L>", ":set wrap!<CR>", opt_silent)
map("n", "<leader>lw", ":set wrap!<CR>", opt_silent) map("n", "<leader>lw", ":set wrap!<CR>", opt_silent)
map("n", "<C-N><C-N>", ":set invnumber<CR>", opt_silent) map("n", "<C-N><C-N>", ":set invnumber<CR>", opt_silent)
@ -57,10 +57,10 @@ function _G.complete_space()
return utils.t("<C-x><C-o>") return utils.t("<C-x><C-o>")
end end
end end
map("i", "<C-Space>", "v:lua.complete_space()", {expr = true}) map("i", "<C-Space>", "v:lua.complete_space()", { expr = true })
-- Easily toggle spelling -- Easily toggle spelling
vim.cmd "command Spell setlocal spell! spelllang=en_us" vim.cmd("command Spell setlocal spell! spelllang=en_us")
-- Pop spelling completion for word under cursor -- Pop spelling completion for word under cursor
map("n", "<leader>s", "viw<esc>a<c-x>s", {}) map("n", "<leader>s", "viw<esc>a<c-x>s", {})

View File

@ -1,13 +1,13 @@
local o = vim.o local o = vim.o
-- Helpers -- Helpers
require "_settings" require("_settings")
require "_bindings" require("_bindings")
require "_colors" require("_colors")
-- Create commands -- Create commands
vim.cmd "command! TagsUpdate !ctags -R ." vim.cmd("command! TagsUpdate !ctags -R .")
vim.cmd "command! Todo grep TODO" vim.cmd("command! Todo grep TODO")
-- Use better grep programs -- Use better grep programs
if vim.fn.executable("rg") == 1 then if vim.fn.executable("rg") == 1 then
@ -25,4 +25,4 @@ vim.g.polyglot_disabled = { "go", "rust" }
-- Plugins -- Plugins
-- Packer auto installs and then lazy loads itself on PackerCommand and require the plugins module -- Packer auto installs and then lazy loads itself on PackerCommand and require the plugins module
-- This command should only really be needed to bootstrap a new system -- This command should only really be needed to bootstrap a new system
vim.cmd [[command! PackerBootstrap lua require("plugins")]] vim.cmd([[command! PackerBootstrap lua require("plugins")]])

View File

@ -1,2 +1,2 @@
require "_settings" require("_settings")
require "_bindings" require("_bindings")

View File

@ -1,39 +1,39 @@
-- Install packer -- Install packer
local install_path = vim.fn.stdpath("data").."/site/pack/packer/opt/packer.nvim" local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"
local packer_bootstrap = false local packer_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
packer_bootstrap = vim.fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path}) packer_bootstrap = vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
end end
vim.cmd "packadd packer.nvim" vim.cmd("packadd packer.nvim")
-- Configures dark-notify to use colors from my environment -- Configures dark-notify to use colors from my environment
local function config_dark_notify() local function config_dark_notify()
require("dark_notify").run { require("dark_notify").run({
onchange = function(_) onchange = function(_)
-- Defined in _colors -- Defined in _colors
_G.update_colors() _G.update_colors()
end, end,
} })
end end
-- Pin version dependent packages -- Pin version dependent packages
local pinned_commits = {} local pinned_commits = {}
if vim.fn.has('nvim-0.6.0') ~= 1 then if vim.fn.has("nvim-0.6.0") ~= 1 then
if vim.fn.has "nvim-0.5.1" == 1 then if vim.fn.has("nvim-0.5.1") == 1 then
-- Last commit compatible with 0.5.1 -- Last commit compatible with 0.5.1
pinned_commits["telescope"] = "80cdb00b221f69348afc4fb4b701f51eb8dd3120" pinned_commits["telescope"] = "80cdb00b221f69348afc4fb4b701f51eb8dd3120"
elseif vim.fn.has "nvim-0.5.0" == 1 then elseif vim.fn.has("nvim-0.5.0") == 1 then
-- Last commit compatible with 0.5.1 -- Last commit compatible with 0.5.1
pinned_commits["telescope"] = "587a10d1494d8ffa1229246228f0655db2f0a48a" pinned_commits["telescope"] = "587a10d1494d8ffa1229246228f0655db2f0a48a"
end end
end end
return require('packer').startup(function(use) return require("packer").startup(function(use)
-- Load things faster! -- Load things faster!
use {'lewis6991/impatient.nvim', config = [[require('impatient')]]} use({ "lewis6991/impatient.nvim", config = [[require('impatient')]] })
-- Let Packer manage and lazyload itself -- Let Packer manage and lazyload itself
use { use({
"wbthomason/packer.nvim", "wbthomason/packer.nvim",
cmd = { cmd = {
"PackerClean", "PackerClean",
@ -46,175 +46,187 @@ return require('packer').startup(function(use)
"PackerUpdate", "PackerUpdate",
}, },
config = [[require("plugins")]], config = [[require("plugins")]],
} })
-- Colorschemes -- Colorschemes
use { use({
"vim-scripts/wombat256.vim", "vim-scripts/wombat256.vim",
{ "ViViDboarder/wombat.nvim", requires = "rktjmp/lush.nvim" }, { "ViViDboarder/wombat.nvim", requires = "rktjmp/lush.nvim" },
{ "ViViDboarder/wombuddy.nvim", requires = "tjdevries/colorbuddy.vim" }, { "ViViDboarder/wombuddy.nvim", requires = "tjdevries/colorbuddy.vim" },
"ishan9299/nvim-solarized-lua", "ishan9299/nvim-solarized-lua",
{ {
"folke/tokyonight.nvim", "folke/tokyonight.nvim",
run = "fish -c 'echo \"set --path --prepend fish_themes_path \"(pwd)\"/extras\" > ~/.config/fish/conf.d/tokyonight.fish' || true", -- luacheck: no max line length run = 'fish -c \'echo "set --path --prepend fish_themes_path "(pwd)"/extras" > ~/.config/fish/conf.d/tokyonight.fish\' || true', -- luacheck: no max line length
}, },
} })
-- Auto and ends to some ifs and dos -- Auto and ends to some ifs and dos
use "tpope/vim-endwise" use("tpope/vim-endwise")
-- Unix commands from vim? Yup! -- Unix commands from vim? Yup!
use "tpope/vim-eunuch" use("tpope/vim-eunuch")
-- Adds repeats for custom motions -- Adds repeats for custom motions
use "tpope/vim-repeat" use("tpope/vim-repeat")
-- Readline shortcuts -- Readline shortcuts
use "tpope/vim-rsi" use("tpope/vim-rsi")
-- Surround motions -- Surround motions
use "tpope/vim-surround" use("tpope/vim-surround")
-- Better netrw -- Better netrw
use "tpope/vim-vinegar" use("tpope/vim-vinegar")
-- Easier jumping to lines -- Easier jumping to lines
use "vim-scripts/file-line" use("vim-scripts/file-line")
-- Auto ctags generation -- Auto ctags generation
use "ludovicchabant/vim-gutentags" use("ludovicchabant/vim-gutentags")
-- Make it easier to discover some of my keymaps -- Make it easier to discover some of my keymaps
use { use({
"folke/which-key.nvim", "folke/which-key.nvim",
config = function() require("plugins.whichkey").configure() end config = function()
} require("plugins.whichkey").configure()
end,
})
-- Better commenting -- Better commenting
use { use({
"tomtom/tcomment_vim", "tomtom/tcomment_vim",
config = function() config = function()
vim.api.nvim_set_keymap("n", "//", ":TComment<CR>", {silent=true, noremap=true}) vim.api.nvim_set_keymap("n", "//", ":TComment<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("v", "//", ":TCommentBlock<CR>", {silent=true, noremap=true}) vim.api.nvim_set_keymap("v", "//", ":TCommentBlock<CR>", { silent = true, noremap = true })
end, end,
} })
-- Allow wrapping and joining of arguments across multiple lines -- Allow wrapping and joining of arguments across multiple lines
use { use({
"FooSoft/vim-argwrap", "FooSoft/vim-argwrap",
config = function() config = function()
vim.api.nvim_set_keymap("n","<Leader>a", ":ArgWrap<CR>", {silent=true, noremap=true}) vim.api.nvim_set_keymap("n", "<Leader>a", ":ArgWrap<CR>", { silent = true, noremap = true })
end, end,
} })
-- Adds git operations to vim -- Adds git operations to vim
use { use({
"tpope/vim-fugitive", "tpope/vim-fugitive",
} })
-- Quick toggling of Location and Quickfix lists -- Quick toggling of Location and Quickfix lists
use { use({
"milkypostman/vim-togglelist", "milkypostman/vim-togglelist",
config = function() config = function()
vim.api.nvim_set_keymap("n", "<F6>", ":call ToggleQuickfixList()<CR>", {silent=true, noremap=true}) vim.api.nvim_set_keymap("n", "<F6>", ":call ToggleQuickfixList()<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", {silent=true, noremap=true}) vim.api.nvim_set_keymap("n", "<F7>", ":call ToggleLocationList()<CR>", { silent = true, noremap = true })
end, end,
} })
-- Find text everywhere! -- Find text everywhere!
use { use({
"mhinz/vim-grepper", "mhinz/vim-grepper",
config = function() require("plugins.grepper") end, config = function()
} require("plugins.grepper")
end,
})
-- Highlight inline colors -- Highlight inline colors
use { use({
"norcalli/nvim-colorizer.lua", "norcalli/nvim-colorizer.lua",
config = function() require("colorizer").setup() end, config = function()
} require("colorizer").setup()
end,
})
-- Custom status line -- Custom status line
use { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" } use({ "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" })
use { use({
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
config = function() require("plugins.lualine").config_lualine() end, config = function()
require("plugins.lualine").config_lualine()
end,
requires = { requires = {
-- Show my current location in my status bar -- Show my current location in my status bar
-- { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" }, -- { "SmiteshP/nvim-gps", requires = "nvim-treesitter/nvim-treesitter" },
}, },
after = { after = {
"nvim-gps" "nvim-gps",
} },
} })
-- On Mac, update colors when dark mode changes -- On Mac, update colors when dark mode changes
use { use({
"cormacrelf/dark-notify", "cormacrelf/dark-notify",
-- Download latest release on install -- Download latest release on install
run = "curl -s https://api.github.com/repos/cormacrelf/dark-notify/releases/latest | jq '.assets[].browser_download_url' | xargs curl -Ls | tar xz -C ~/.local/bin/", -- luacheck: no max line length run = "curl -s https://api.github.com/repos/cormacrelf/dark-notify/releases/latest | jq '.assets[].browser_download_url' | xargs curl -Ls | tar xz -C ~/.local/bin/", -- luacheck: no max line length
config = config_dark_notify, config = config_dark_notify,
requires = "nvim-lualine/lualine.nvim", requires = "nvim-lualine/lualine.nvim",
} })
-- Custom start screen -- Custom start screen
use { use({
'mhinz/vim-startify', "mhinz/vim-startify",
config = function() require("utils").require_with_local("plugins.startify") end, config = function()
} require("utils").require_with_local("plugins.startify")
end,
})
-- LSP -- LSP
-- Configure language servers -- Configure language servers
use "neovim/nvim-lspconfig" use("neovim/nvim-lspconfig")
-- Better display of diagnostics -- Better display of diagnostics
use "folke/trouble.nvim" use("folke/trouble.nvim")
-- Generic linter/formatters in diagnostics API -- Generic linter/formatters in diagnostics API
use { use({
"jose-elias-alvarez/null-ls.nvim", "jose-elias-alvarez/null-ls.nvim",
requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" }, requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
} })
-- Fancy LSP UIs -- Fancy LSP UIs
use { use({
"glepnir/lspsaga.nvim", "glepnir/lspsaga.nvim",
requires = "neovim/nvim-lspconfig", requires = "neovim/nvim-lspconfig",
-- NOTE: Disabled because it's got issues with Neovim 0.6.0 -- NOTE: Disabled because it's got issues with Neovim 0.6.0
disable = true, disable = true,
} })
-- Writing -- Writing
-- abolish/pencil -- abolish/pencil
use { use({
"preservim/vim-pencil", "preservim/vim-pencil",
cmd = {"Pencil"}, cmd = { "Pencil" },
} })
use { use({
"preservim/vim-textobj-sentence", "preservim/vim-textobj-sentence",
requires = "kana/vim-textobj-user", requires = "kana/vim-textobj-user",
} })
use { use({
"junegunn/goyo.vim", "junegunn/goyo.vim",
cmd = { "Goyo", "Zen" }, cmd = { "Goyo", "Zen" },
config = [[require("plugins.goyo-limelight")]], config = [[require("plugins.goyo-limelight")]],
requires = { "junegunn/limelight.vim", cmd = "Limelight" }, requires = { "junegunn/limelight.vim", cmd = "Limelight" },
} })
-- Treesitter -- Treesitter
use { use({
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
run = ":TSUpdate", run = ":TSUpdate",
config = function() require("utils").require_with_local("plugins.treesitter") end, config = function()
} require("utils").require_with_local("plugins.treesitter")
use { end,
})
use({
"nvim-treesitter/nvim-treesitter-refactor", "nvim-treesitter/nvim-treesitter-refactor",
requires = "nvim-treesitter/nvim-treesitter", requires = "nvim-treesitter/nvim-treesitter",
} })
use { use({
"nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/nvim-treesitter-textobjects",
requires = "nvim-treesitter/nvim-treesitter", requires = "nvim-treesitter/nvim-treesitter",
} })
--[[ --[[
use { use {
"nvim-treesitter/completion-treesitter", "nvim-treesitter/completion-treesitter",
@ -223,9 +235,11 @@ return require('packer').startup(function(use)
--]] --]]
-- Completion -- Completion
use { use({
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
config = function() require("plugins.completion").config_cmp() end, config = function()
require("plugins.completion").config_cmp()
end,
requires = { requires = {
{ "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }, { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" },
{ "hrsh7th/cmp-buffer", after = "nvim-cmp" }, { "hrsh7th/cmp-buffer", after = "nvim-cmp" },
@ -234,18 +248,20 @@ return require('packer').startup(function(use)
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
}, },
event = "InsertEnter *", event = "InsertEnter *",
} })
-- Fuzzy Finder -- Fuzzy Finder
use { use({
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
requires = { requires = {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
"nvim-lua/popup.nvim", "nvim-lua/popup.nvim",
}, },
commit = pinned_commits["telescope"], commit = pinned_commits["telescope"],
config = function() require("plugins.telescope") end, config = function()
} require("plugins.telescope")
end,
})
--[[ --[[
use { use {
'junegunn/fzf', 'junegunn/fzf',
@ -287,11 +303,11 @@ return require('packer').startup(function(use)
--]] --]]
-- Filetypes -- Filetypes
use "ViViDboarder/vim-forcedotcom" use("ViViDboarder/vim-forcedotcom")
use "rust-lang/rust.vim" use("rust-lang/rust.vim")
use "hsanson/vim-android" use("hsanson/vim-android")
use { use({
'sheerun/vim-polyglot', "sheerun/vim-polyglot",
config = function() config = function()
vim.cmd([[ vim.cmd([[
augroup ansible_playbook augroup ansible_playbook
@ -299,18 +315,20 @@ return require('packer').startup(function(use)
augroup end augroup end
]]) ]])
end, end,
} })
use { use({
"dense-analysis/ale", "dense-analysis/ale",
config = function() require("plugins.ale") end, config = function()
} require("plugins.ale")
end,
})
-- Debuging nvim config -- Debuging nvim config
use { use({
"tweekmonster/startuptime.vim", "tweekmonster/startuptime.vim",
cmd = {"StartupTime"}, cmd = { "StartupTime" },
} })
-- Auto sync after bootstrapping on a fresh box -- Auto sync after bootstrapping on a fresh box
if packer_bootstrap then if packer_bootstrap then

View File

@ -19,10 +19,10 @@ local function config_airline()
vim.g["airline#extensions#whitespace#trailing_format"] = "tw[%s]" vim.g["airline#extensions#whitespace#trailing_format"] = "tw[%s]"
vim.g["airline#extensions#whitespace#mixed_indent_format"] = "i[%s]" vim.g["airline#extensions#whitespace#mixed_indent_format"] = "i[%s]"
-- Vertical separators for all -- Vertical separators for all
vim.g.airline_left_sep="" vim.g.airline_left_sep = ""
vim.g.airline_left_alt_sep="" vim.g.airline_left_alt_sep = ""
vim.g.airline_right_sep="" vim.g.airline_right_sep = ""
vim.g.airline_right_alt_sep="" vim.g.airline_right_alt_sep = ""
vim.g["airline#extensions#tabline#enabled"] = 1 vim.g["airline#extensions#tabline#enabled"] = 1
vim.g["airline#extensions#tabline#left_sep"] = " " vim.g["airline#extensions#tabline#left_sep"] = " "
vim.g["airline#extensions#tabline#left_alt_sep"] = "|" vim.g["airline#extensions#tabline#left_alt_sep"] = "|"

View File

@ -8,18 +8,18 @@ vim.g.ale_linters = {
python = {}, python = {},
-- sh = {'language_server', 'shell', 'shellcheck'}, -- sh = {'language_server', 'shell', 'shellcheck'},
sh = {}, sh = {},
text = {"proselint", "alex"}, text = { "proselint", "alex" },
} }
vim.g.ale_linter_aliases = { vim.g.ale_linter_aliases = {
markdown = {"text"}, markdown = { "text" },
} }
local pretty_trim_fixer = { local pretty_trim_fixer = {
"prettier", "prettier",
"trim_whitespace", "trim_whitespace",
"remove_trailing_lines" "remove_trailing_lines",
} }
vim.g.ale_fixers = { vim.g.ale_fixers = {
["*"] = {"trim_whitespace", "remove_trailing_lines"}, ["*"] = { "trim_whitespace", "remove_trailing_lines" },
-- go = {"gofmt", "goimports"}, -- go = {"gofmt", "goimports"},
json = pretty_trim_fixer, json = pretty_trim_fixer,
-- rust = {"rustfmt"}, -- rust = {"rustfmt"},
@ -33,7 +33,7 @@ vim.g.ale_fixers = {
}, },
--]] --]]
markdown = pretty_trim_fixer, markdown = pretty_trim_fixer,
yaml = {"prettier", "remove_trailing_lines"}, yaml = { "prettier", "remove_trailing_lines" },
css = pretty_trim_fixer, css = pretty_trim_fixer,
javascript = pretty_trim_fixer, javascript = pretty_trim_fixer,
} }

View File

@ -2,7 +2,7 @@ local M = {}
function M.config_cmp() function M.config_cmp()
local cmp = require("cmp") local cmp = require("cmp")
cmp.setup { cmp.setup({
completion = { completion = {
completeopt = "menuone,noinsert,noselect", completeopt = "menuone,noinsert,noselect",
autocomplete = false, autocomplete = false,
@ -11,35 +11,35 @@ function M.config_cmp()
require("luasnip").lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end,
sources = { sources = {
{name = "nvim_lsp"}, { name = "nvim_lsp" },
{name = "luasnip"}, { name = "luasnip" },
{name = "buffer"}, { name = "buffer" },
{name = "spell"}, { name = "spell" },
}, },
mapping = { mapping = {
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), ["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), ["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
['<C-Space>'] = cmp.mapping(function() ["<C-Space>"] = cmp.mapping(function()
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
else else
cmp.complete() cmp.complete()
end end
end, { 'i', 'c' }), end, { "i", "c" }),
['<C-e>'] = cmp.mapping({ ["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(), i = cmp.mapping.abort(),
c = cmp.mapping.close(), c = cmp.mapping.close(),
}), }),
['<CR>'] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
}, },
} })
-- Add a plug mapping to use in C-Space binding -- Add a plug mapping to use in C-Space binding
vim.api.nvim_set_keymap( vim.api.nvim_set_keymap(
"i", "i",
"<Plug>(cmp_complete)", "<Plug>(cmp_complete)",
"<cmd>lua require('cmp').complete()<CR>", "<cmd>lua require('cmp').complete()<CR>",
{silent = true, noremap = true} { silent = true, noremap = true }
) )
end end

View File

@ -1,6 +1,6 @@
vim.g.goyo_width = 120 vim.g.goyo_width = 120
vim.cmd [[ vim.cmd([[
command Zen :Goyo command Zen :Goyo
function! s:goyo_enter() function! s:goyo_enter()
@ -15,4 +15,4 @@ augroup zenevents
autocmd! User GoyoEnter nested call <SID>goyo_enter() autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave() autocmd! User GoyoLeave nested call <SID>goyo_leave()
augroup end augroup end
]] ]])

View File

@ -4,26 +4,26 @@ vim.g.grepper = {
open = 1, open = 1,
switch = 0, switch = 0,
jump = 0, jump = 0,
tools = {'git', 'rg', 'ag', 'ack', 'pt', 'grep'}, tools = { "git", "rg", "ag", "ack", "pt", "grep" },
dir = 'repo,cwd', dir = "repo,cwd",
} }
local map = vim.api.nvim_set_keymap local map = vim.api.nvim_set_keymap
local opt_silent = {silent = true} local opt_silent = { silent = true }
map("n", "gs", "<plug>(GrepperOperator)", opt_silent) map("n", "gs", "<plug>(GrepperOperator)", opt_silent)
map("x", "gs", "<plug>(GrepperOperator)", opt_silent) map("x", "gs", "<plug>(GrepperOperator)", opt_silent)
map("n", "<leader>*", ":Grepper -cword -noprompt<cr>", opt_silent) map("n", "<leader>*", ":Grepper -cword -noprompt<cr>", opt_silent)
-- Override Todo command to use Grepper -- Override Todo command to use Grepper
vim.cmd "command! Todo :Grepper -noprompt -query TODO" vim.cmd("command! Todo :Grepper -noprompt -query TODO")
-- Make some shortands for various grep programs -- Make some shortands for various grep programs
if vim.fn.executable('rg') == 1 then if vim.fn.executable("rg") == 1 then
vim.cmd "command -nargs=+ Rg :GrepperRg <args>" vim.cmd("command -nargs=+ Rg :GrepperRg <args>")
end end
if vim.fn.executable('ag') == 1 then if vim.fn.executable("ag") == 1 then
vim.cmd "command -nargs=+ Ag :GrepperAg <args>" vim.cmd("command -nargs=+ Ag :GrepperAg <args>")
end end
if vim.fn.executable('ack') == 1 then if vim.fn.executable("ack") == 1 then
vim.cmd "command -nargs=+ Ack :GrepperAck <args>" vim.cmd("command -nargs=+ Ack :GrepperAck <args>")
end end

View File

@ -4,17 +4,17 @@ local utils = require("utils")
function M.config_lsp_ui() function M.config_lsp_ui()
-- Add floating window boarders -- Add floating window boarders
vim.cmd [[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]] vim.cmd([[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]])
vim.cmd [[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]] vim.cmd([[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]])
local border = { local border = {
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
{"", "FloatBorder"}, { "", "FloatBorder" },
} }
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
@ -31,7 +31,7 @@ function M.config_lsp_ui()
end end
if utils.is_plugin_loaded("trouble") then if utils.is_plugin_loaded("trouble") then
require("trouble").setup { require("trouble").setup({
fold_open = "", fold_open = "",
fold_closed = "", fold_closed = "",
signs = { signs = {
@ -41,38 +41,42 @@ function M.config_lsp_ui()
information = signs.Info, information = signs.Info,
other = "", other = "",
}, },
} })
end end
end end
local function default_attach(client, bufnr) local function default_attach(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_keymap(...)
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings -- Mappings
-- TODO: Maybe prefix all of these for easier discovery -- TODO: Maybe prefix all of these for easier discovery
local opts = { noremap=true, silent=true } local opts = { noremap = true, silent = true }
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts) buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) buf_set_keymap("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap("n", "<leader>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts) buf_set_keymap("n", "<leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts) buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts) buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts) buf_set_keymap("n", "<leader>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- Open diagnostic on hold -- Open diagnostic on hold
if vim["diagnostic"] ~= nil then if vim["diagnostic"] ~= nil then
vim.cmd [[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]] vim.cmd([[autocmd CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]])
end end
-- Set some keybinds conditional on server capabilities -- Set some keybinds conditional on server capabilities
@ -114,14 +118,14 @@ local function default_attach(client, bufnr)
-- Use LspSaga features, if possible -- Use LspSaga features, if possible
if utils.is_plugin_loaded("lspsaga.nvim") then if utils.is_plugin_loaded("lspsaga.nvim") then
buf_set_keymap('n', 'K', "<Cmd>lua require('lspsaga.hover').render_hover_doc()<CR>", opts) buf_set_keymap("n", "K", "<Cmd>lua require('lspsaga.hover').render_hover_doc()<CR>", opts)
buf_set_keymap('n', '<leader>rn', "<cmd>lua require('lspsaga.rename').rename()<CR>", opts) buf_set_keymap("n", "<leader>rn", "<cmd>lua require('lspsaga.rename').rename()<CR>", opts)
buf_set_keymap('n', '<leader>e', "<cmd>lua require('lspsaga.diagnostic').show_line_diagnostics()<CR>", opts) buf_set_keymap("n", "<leader>e", "<cmd>lua require('lspsaga.diagnostic').show_line_diagnostics()<CR>", opts)
buf_set_keymap('n', '[d', "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_prev()<CR>", opts) buf_set_keymap("n", "[d", "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_prev()<CR>", opts)
buf_set_keymap('n', ']d', "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_next()<CR>", opts) buf_set_keymap("n", "]d", "<cmd>lua require('lspsaga.diagnostic').lsp_jump_diagnostic_next()<CR>", opts)
buf_set_keymap('n', '<C-k>', "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>", opts) buf_set_keymap("n", "<C-k>", "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>", opts)
-- Code actions -- Code actions
buf_set_keymap('n', '<leader>ca', "<cmd>lua require('lspsaga.codeaction').code_action()<CR>", opts) buf_set_keymap("n", "<leader>ca", "<cmd>lua require('lspsaga.codeaction').code_action()<CR>", opts)
end end
end end
@ -135,31 +139,31 @@ function M.config_lsp()
end end
-- Configure each server -- Configure each server
lsp_config.bashls.setup{ capabilities=capabilities, on_attach=default_attach } lsp_config.bashls.setup({ capabilities = capabilities, on_attach = default_attach })
lsp_config.gopls.setup{ capabilities=capabilities, on_attach=default_attach } lsp_config.gopls.setup({ capabilities = capabilities, on_attach = default_attach })
lsp_config.pyright.setup{ capabilities=capabilities, on_attach=default_attach } lsp_config.pyright.setup({ capabilities = capabilities, on_attach = default_attach })
lsp_config.rls.setup{ lsp_config.rls.setup({
capabilities=capabilities, capabilities = capabilities,
on_attach=default_attach, on_attach = default_attach,
settings={ settings = {
rust={ rust = {
build_on_save = false, build_on_save = false,
all_features = true, all_features = true,
unstable_features = true, unstable_features = true,
}, },
}, },
} })
if utils.is_plugin_loaded("null-ls.nvim") then if utils.is_plugin_loaded("null-ls.nvim") then
M.config_null_ls() M.config_null_ls()
lsp_config["null-ls"].setup{ capabilities=capabilities, on_attach=default_attach } lsp_config["null-ls"].setup({ capabilities = capabilities, on_attach = default_attach })
end end
end end
function M.config_lsp_saga() function M.config_lsp_saga()
local saga = require("lspsaga") local saga = require("lspsaga")
saga.init_lsp_saga{ saga.init_lsp_saga({
error_sign = "🔥", error_sign = "🔥",
warn_sign ="⚠️", warn_sign = "⚠️",
hint_sign = "🤔", hint_sign = "🤔",
dianostic_header_icon = " 💬 ", dianostic_header_icon = " 💬 ",
code_action_icon = "💡", code_action_icon = "💡",
@ -167,12 +171,12 @@ function M.config_lsp_saga()
enable = false, enable = false,
sign = false, sign = false,
}, },
} })
end end
function M.config_null_ls() function M.config_null_ls()
local null_ls = require("null-ls") local null_ls = require("null-ls")
null_ls.setup{ null_ls.setup({
sources = { sources = {
-- Generic -- Generic
-- null_ls.builtins.formatting.preittier, -- null_ls.builtins.formatting.preittier,
@ -197,7 +201,7 @@ function M.config_null_ls()
-- Lua -- Lua
null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.stylua,
}, },
} })
end end
return M return M

View File

@ -13,12 +13,12 @@ function M.custom_ffenc()
end end
function M.mixed_indent() function M.mixed_indent()
local mixed = vim.fn.search([[\v^(\t+ | +\t)]], 'nw') local mixed = vim.fn.search([[\v^(\t+ | +\t)]], "nw")
if mixed > 0 then if mixed > 0 then
return "i:" .. mixed return "i:" .. mixed
end end
local space_indent = vim.fn.search([[\v^ +]], 'nw') local space_indent = vim.fn.search([[\v^ +]], "nw")
local tab_indent = vim.fn.search([[\v^\t+]], 'nw') local tab_indent = vim.fn.search([[\v^\t+]], "nw")
if tab_indent > 0 and space_indent > 0 then if tab_indent > 0 and space_indent > 0 then
return "i:" .. require("math").max(tab_indent, space_indent) return "i:" .. require("math").max(tab_indent, space_indent)
end end
@ -27,7 +27,7 @@ function M.mixed_indent()
end end
function M.trailing_whitespace() function M.trailing_whitespace()
local line = vim.fn.search([[\s\+$]], 'nw') local line = vim.fn.search([[\s\+$]], "nw")
if line ~= 0 then if line ~= 0 then
return "tw:" .. line return "tw:" .. line
end end
@ -49,31 +49,38 @@ function M.config_lualine(theme_name)
local gps = {} local gps = {}
if utils.is_plugin_loaded("nvim-gps") then if utils.is_plugin_loaded("nvim-gps") then
gps = require("nvim-gps") gps = require("nvim-gps")
gps.setup{ gps.setup({
icons = { icons = {
["class-name"] = "(c) ", ["class-name"] = "(c) ",
["function-name"] = "(ƒ) ", ["function-name"] = "(ƒ) ",
["method-name"] = "(m) ", ["method-name"] = "(m) ",
["container-name"] = "", ["container-name"] = "",
["tag-name"] = "(t) ", ["tag-name"] = "(t) ",
} },
} })
end end
local diagnostic_plugin = "nvim_diagnostic" local diagnostic_plugin = "nvim_diagnostic"
if vim.fn.has('nvim-0.6.0') ~= 1 then if vim.fn.has("nvim-0.6.0") ~= 1 then
diagnostic_plugin = "nvim_lsp" diagnostic_plugin = "nvim_lsp"
end end
require("lualine").setup { require("lualine").setup({
options = { options = {
theme = theme_name, theme = theme_name,
icons_enabled = false, icons_enabled = false,
component_separators = {left = "|", right = "|"}, component_separators = { left = "|", right = "|" },
section_separators = {left = "", right = ""}, section_separators = { left = "", right = "" },
}, },
sections = { sections = {
lualine_a = {{ "mode", fmt = function(str) return str:sub(1, 1) end }}, lualine_a = {
{
"mode",
fmt = function(str)
return str:sub(1, 1)
end,
},
},
lualine_b = { "FugitiveHead", "diff" }, lualine_b = { "FugitiveHead", "diff" },
lualine_c = { "filename", { gps.get_location, cond = gps.is_available } }, lualine_c = { "filename", { gps.get_location, cond = gps.is_available } },
lualine_x = { M.custom_ffenc, "filetype" }, lualine_x = { M.custom_ffenc, "filetype" },
@ -84,7 +91,7 @@ function M.config_lualine(theme_name)
{ M.trailing_whitespace, color = { bg = "#de4f1f" } }, { M.trailing_whitespace, color = { bg = "#de4f1f" } },
}, },
}, },
} })
end end
return M return M

View File

@ -1,6 +1,10 @@
vim.g.startify_list_order = { vim.g.startify_list_order = {
{' My Bookmarks'}, 'bookmarks', { " My Bookmarks" },
{' Most recently used files in the current directory'}, 'dir', "bookmarks",
{' Most recently used files'}, 'files', { " Most recently used files in the current directory" },
{' My Sessions'}, 'sessions' "dir",
{ " Most recently used files" },
"files",
{ " My Sessions" },
"sessions",
} }

View File

@ -1,6 +1,6 @@
local function config_telescope() local function config_telescope()
local actions = require("telescope.actions") local actions = require("telescope.actions")
require("telescope").setup{ require("telescope").setup({
defaults = { defaults = {
vimgrep_arguments = { vimgrep_arguments = {
"rg", "rg",
@ -16,12 +16,12 @@ local function config_telescope()
["<esc>"] = actions.close, ["<esc>"] = actions.close,
-- Disable scroll-up to allow clearing prompt -- Disable scroll-up to allow clearing prompt
["<C-u>"] = false, ["<C-u>"] = false,
} },
}, },
layout_strategy = "flex", layout_strategy = "flex",
} },
} })
local opts = {silent=true, noremap=true} local opts = { silent = true, noremap = true }
vim.api.nvim_set_keymap("n", "<C-t>", "<cmd>Telescope find_files<CR>", opts) vim.api.nvim_set_keymap("n", "<C-t>", "<cmd>Telescope find_files<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>ff", "<cmd>Telescope find_files<CR>", opts) vim.api.nvim_set_keymap("n", "<leader>ff", "<cmd>Telescope find_files<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", opts) vim.api.nvim_set_keymap("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", opts)

View File

@ -1,9 +1,9 @@
-- Configures nvim-treesitter -- Configures nvim-treesitter
require'nvim-treesitter.configs'.setup{ require("nvim-treesitter.configs").setup({
incremental_selection = {enable = true}, incremental_selection = { enable = true },
-- Indent appears to be broken right now -- Indent appears to be broken right now
indent = {enable = false}, indent = { enable = false },
textobjects = {enable = true}, textobjects = { enable = true },
highlight = { highlight = {
enable = true, enable = true,
disable = {}, disable = {},
@ -21,4 +21,4 @@ require'nvim-treesitter.configs'.setup{
"rust", "rust",
"yaml", "yaml",
}, },
} })

View File

@ -1,11 +1,11 @@
local M = {} local M = {}
function M.configure() function M.configure()
require("which-key").setup { require("which-key").setup({
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below -- refer to the configuration section below
} })
end end
return M return M

View File

@ -4,17 +4,12 @@ local M = {}
-- Utils taken from https://github.com/zzzeyez/dots/blob/master/nvim/lua/utils.lua -- Utils taken from https://github.com/zzzeyez/dots/blob/master/nvim/lua/utils.lua
-- Key mapping -- Key mapping
function M.map(mode, key, result, opts) function M.map(mode, key, result, opts)
vim.fn.nvim_set_keymap( vim.fn.nvim_set_keymap(mode, key, result, {
mode,
key,
result,
{
noremap = true, noremap = true,
silent = opts.silent or false, silent = opts.silent or false,
expr = opts.expr or false, expr = opts.expr or false,
script = opts.script or false script = opts.script or false,
} })
)
end end
function M.augroup(group, fn) function M.augroup(group, fn)
@ -33,11 +28,17 @@ end
-- Create an autocmd -- Create an autocmd
function M.autocmd(group, cmds, clear) function M.autocmd(group, cmds, clear)
clear = clear == nil and false or clear clear = clear == nil and false or clear
if type(cmds) == "string" then cmds = {cmds} end if type(cmds) == "string" then
cmds = { cmds }
end
vim.cmd("augroup " .. group) vim.cmd("augroup " .. group)
if clear then vim.cmd [[au!]] end if clear then
for _, cmd in ipairs(cmds) do vim.cmd("autocmd " .. cmd) end vim.cmd([[au!]])
vim.cmd [[augroup END]] end
for _, cmd in ipairs(cmds) do
vim.cmd("autocmd " .. cmd)
end
vim.cmd([[augroup END]])
end end
-- Terminal escape a given string -- Terminal escape a given string
@ -58,7 +59,7 @@ function M.can_require(name)
else else
for _, searcher in ipairs(package.searchers or package.loaders) do for _, searcher in ipairs(package.searchers or package.loaders) do
local loader = searcher(name) local loader = searcher(name)
if type(loader) == 'function' then if type(loader) == "function" then
package.preload[name] = loader package.preload[name] = loader
return true return true
end end