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 opt_silent = {silent = true}
local opt_default = {silent = true, noremap = true}
local opt_silent = { silent = true }
local opt_default = { silent = true, noremap = true }
map("n", "<C-L><C-L>", ":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)
@ -57,10 +57,10 @@ function _G.complete_space()
return utils.t("<C-x><C-o>")
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
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
map("n", "<leader>s", "viw<esc>a<c-x>s", {})

View File

@ -1,13 +1,13 @@
local o = vim.o
-- Helpers
require "_settings"
require "_bindings"
require "_colors"
require("_settings")
require("_bindings")
require("_colors")
-- Create commands
vim.cmd "command! TagsUpdate !ctags -R ."
vim.cmd "command! Todo grep TODO"
vim.cmd("command! TagsUpdate !ctags -R .")
vim.cmd("command! Todo grep TODO")
-- Use better grep programs
if vim.fn.executable("rg") == 1 then
@ -25,4 +25,4 @@ vim.g.polyglot_disabled = { "go", "rust" }
-- Plugins
-- 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
vim.cmd [[command! PackerBootstrap lua require("plugins")]]
vim.cmd([[command! PackerBootstrap lua require("plugins")]])

View File

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

View File

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

View File

@ -2,27 +2,27 @@ local function config_airline()
-- Use short-form mode text
vim.g.airline_mode_map = {
["__"] = "-",
["n"] = "N",
["i"] = "I",
["R"] = "R",
["c"] = "C",
["v"] = "V",
["V"] = "V",
["n"] = "N",
["i"] = "I",
["R"] = "R",
["c"] = "C",
["v"] = "V",
["V"] = "V",
[""] = "V",
["s"] = "S",
["S"] = "S",
["s"] = "S",
["S"] = "S",
[""] = "S",
["t"] = "T",
["t"] = "T",
}
-- abbreviate trailing whitespace and mixed indent
vim.g["airline#extensions#whitespace#trailing_format"] = "tw[%s]"
vim.g["airline#extensions#whitespace#mixed_indent_format"] = "i[%s]"
-- Vertical separators for all
vim.g.airline_left_sep=""
vim.g.airline_left_alt_sep=""
vim.g.airline_right_sep=""
vim.g.airline_right_alt_sep=""
vim.g.airline_left_sep = ""
vim.g.airline_left_alt_sep = ""
vim.g.airline_right_sep = ""
vim.g.airline_right_alt_sep = ""
vim.g["airline#extensions#tabline#enabled"] = 1
vim.g["airline#extensions#tabline#left_sep"] = " "
vim.g["airline#extensions#tabline#left_alt_sep"] = "|"

View File

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

View File

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

View File

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

View File

@ -4,26 +4,26 @@ vim.g.grepper = {
open = 1,
switch = 0,
jump = 0,
tools = {'git', 'rg', 'ag', 'ack', 'pt', 'grep'},
dir = 'repo,cwd',
tools = { "git", "rg", "ag", "ack", "pt", "grep" },
dir = "repo,cwd",
}
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("x", "gs", "<plug>(GrepperOperator)", opt_silent)
map("n", "<leader>*", ":Grepper -cword -noprompt<cr>", opt_silent)
-- 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
if vim.fn.executable('rg') == 1 then
vim.cmd "command -nargs=+ Rg :GrepperRg <args>"
if vim.fn.executable("rg") == 1 then
vim.cmd("command -nargs=+ Rg :GrepperRg <args>")
end
if vim.fn.executable('ag') == 1 then
vim.cmd "command -nargs=+ Ag :GrepperAg <args>"
if vim.fn.executable("ag") == 1 then
vim.cmd("command -nargs=+ Ag :GrepperAg <args>")
end
if vim.fn.executable('ack') == 1 then
vim.cmd "command -nargs=+ Ack :GrepperAck <args>"
if vim.fn.executable("ack") == 1 then
vim.cmd("command -nargs=+ Ack :GrepperAck <args>")
end

View File

@ -4,17 +4,17 @@ local utils = require("utils")
function M.config_lsp_ui()
-- Add floating window boarders
vim.cmd [[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]]
vim.cmd [[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]]
vim.cmd([[autocmd ColorScheme * highlight NormalFloat guibg=#1f2335]])
vim.cmd([[autocmd ColorScheme * highlight FloatBorder guifg=white guibg=#1f2335]])
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
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
@ -31,7 +31,7 @@ function M.config_lsp_ui()
end
if utils.is_plugin_loaded("trouble") then
require("trouble").setup {
require("trouble").setup({
fold_open = "",
fold_closed = "",
signs = {
@ -41,38 +41,42 @@ function M.config_lsp_ui()
information = signs.Info,
other = "",
},
}
})
end
end
local function default_attach(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
local function buf_set_keymap(...)
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
-- TODO: Maybe prefix all of these for easier discovery
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.definition()<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', '<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>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>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', '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', '[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', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
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.definition()<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", "<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>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>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", "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", "[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", "<leader>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- Open diagnostic on hold
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
-- Set some keybinds conditional on server capabilities
@ -114,14 +118,14 @@ local function default_attach(client, bufnr)
-- Use LspSaga features, if possible
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', '<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', '[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', '<C-k>', "<cmd>lua require('lspsaga.signaturehelp').signature_help()<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>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_next()<CR>", opts)
buf_set_keymap("n", "<C-k>", "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>", opts)
-- 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
@ -135,31 +139,31 @@ function M.config_lsp()
end
-- Configure each server
lsp_config.bashls.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.rls.setup{
capabilities=capabilities,
on_attach=default_attach,
settings={
rust={
lsp_config.bashls.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.rls.setup({
capabilities = capabilities,
on_attach = default_attach,
settings = {
rust = {
build_on_save = false,
all_features = true,
unstable_features = true,
},
},
}
})
if utils.is_plugin_loaded("null-ls.nvim") then
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
function M.config_lsp_saga()
local saga = require("lspsaga")
saga.init_lsp_saga{
saga.init_lsp_saga({
error_sign = "🔥",
warn_sign ="⚠️",
warn_sign = "⚠️",
hint_sign = "🤔",
dianostic_header_icon = " 💬 ",
code_action_icon = "💡",
@ -167,12 +171,12 @@ function M.config_lsp_saga()
enable = false,
sign = false,
},
}
})
end
function M.config_null_ls()
local null_ls = require("null-ls")
null_ls.setup{
null_ls.setup({
sources = {
-- Generic
-- null_ls.builtins.formatting.preittier,
@ -197,7 +201,7 @@ function M.config_null_ls()
-- Lua
null_ls.builtins.formatting.stylua,
},
}
})
end
return M

View File

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

View File

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

View File

@ -1,6 +1,6 @@
local function config_telescope()
local actions = require("telescope.actions")
require("telescope").setup{
require("telescope").setup({
defaults = {
vimgrep_arguments = {
"rg",
@ -16,12 +16,12 @@ local function config_telescope()
["<esc>"] = actions.close,
-- Disable scroll-up to allow clearing prompt
["<C-u>"] = false,
}
},
},
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", "<leader>ff", "<cmd>Telescope find_files<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
require'nvim-treesitter.configs'.setup{
incremental_selection = {enable = true},
require("nvim-treesitter.configs").setup({
incremental_selection = { enable = true },
-- Indent appears to be broken right now
indent = {enable = false},
textobjects = {enable = true},
indent = { enable = false },
textobjects = { enable = true },
highlight = {
enable = true,
disable = {},
@ -21,4 +21,4 @@ require'nvim-treesitter.configs'.setup{
"rust",
"yaml",
},
}
})

View File

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

View File

@ -4,28 +4,23 @@ local M = {}
-- Utils taken from https://github.com/zzzeyez/dots/blob/master/nvim/lua/utils.lua
-- Key mapping
function M.map(mode, key, result, opts)
vim.fn.nvim_set_keymap(
mode,
key,
result,
{
noremap = true,
silent = opts.silent or false,
expr = opts.expr or false,
script = opts.script or false
}
)
vim.fn.nvim_set_keymap(mode, key, result, {
noremap = true,
silent = opts.silent or false,
expr = opts.expr or false,
script = opts.script or false,
})
end
function M.augroup(group, fn)
vim.api.nvim_command("augroup " .. group)
vim.api.nvim_command("autocmd!")
fn()
vim.api.nvim_command("augroup END")
vim.api.nvim_command("augroup " .. group)
vim.api.nvim_command("autocmd!")
fn()
vim.api.nvim_command("augroup END")
end
function M.get_color(synID, what, mode)
return vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID(synID)), what, mode)
return vim.fn.synIDattr(vim.fn.synIDtrans(vim.fn.hlID(synID)), what, mode)
end
-- end zzzeyez utils
@ -33,11 +28,17 @@ end
-- Create an autocmd
function M.autocmd(group, cmds, 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)
if clear then vim.cmd [[au!]] end
for _, cmd in ipairs(cmds) do vim.cmd("autocmd " .. cmd) end
vim.cmd [[augroup END]]
if clear then
vim.cmd([[au!]])
end
for _, cmd in ipairs(cmds) do
vim.cmd("autocmd " .. cmd)
end
vim.cmd([[augroup END]])
end
-- Terminal escape a given string
@ -53,48 +54,48 @@ end
-- Checks to see if a package can be required
function M.can_require(name)
if package.loaded[name] then
return false
else
for _, searcher in ipairs(package.searchers or package.loaders) do
local loader = searcher(name)
if type(loader) == 'function' then
package.preload[name] = loader
return true
if package.loaded[name] then
return false
else
for _, searcher in ipairs(package.searchers or package.loaders) do
local loader = searcher(name)
if type(loader) == "function" then
package.preload[name] = loader
return true
end
end
end
return false
return false
end
end
-- Require a package if possible
function M.maybe_require(name)
if M.can_require(name) then
return require(name)
end
if M.can_require(name) then
return require(name)
end
return nil
return nil
end
-- Require a package and a "_local" suffixed one
function M.require_with_local(name)
-- TODO: Decide if local should completely override the versioned module
-- In that case, the local file would probably start with a `require` for the
-- non-local version. This would allow more control but at the cost of a bit
-- of boiler plate
local rmod = require(name)
local lmod = M.maybe_require(name .. "_local")
if lmod ~= nil then
return lmod
end
-- TODO: Decide if local should completely override the versioned module
-- In that case, the local file would probably start with a `require` for the
-- non-local version. This would allow more control but at the cost of a bit
-- of boiler plate
local rmod = require(name)
local lmod = M.maybe_require(name .. "_local")
if lmod ~= nil then
return lmod
end
return rmod
return rmod
end
-- Returns whether or not packer plugin is loaded
function M.is_plugin_loaded(name)
return _G["packer_plugins"] and packer_plugins[name] and packer_plugins[name].loaded
return _G["packer_plugins"] and packer_plugins[name] and packer_plugins[name].loaded
end
return M