mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 18:27:34 +00:00
Run stylua on everything
This commit is contained in:
parent
d9a1d9b799
commit
d98e4fac72
@ -60,7 +60,7 @@ end
|
||||
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", {})
|
||||
|
||||
|
@ -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")]])
|
||||
|
@ -1,2 +1,2 @@
|
||||
require "_settings"
|
||||
require "_bindings"
|
||||
require("_settings")
|
||||
require("_bindings")
|
||||
|
@ -4,36 +4,36 @@ 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 })
|
||||
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 })
|
||||
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 })
|
||||
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 })
|
||||
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
|
||||
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 {
|
||||
})
|
||||
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" },
|
||||
}
|
||||
})
|
||||
|
||||
-- Auto sync after bootstrapping on a fresh box
|
||||
if packer_bootstrap then
|
||||
|
@ -16,7 +16,7 @@ vim.g.ale_linter_aliases = {
|
||||
local pretty_trim_fixer = {
|
||||
"prettier",
|
||||
"trim_whitespace",
|
||||
"remove_trailing_lines"
|
||||
"remove_trailing_lines",
|
||||
}
|
||||
vim.g.ale_fixers = {
|
||||
["*"] = { "trim_whitespace", "remove_trailing_lines" },
|
||||
|
@ -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,
|
||||
@ -17,22 +17,22 @@ function M.config_cmp()
|
||||
{ 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({
|
||||
end, { "i", "c" }),
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
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
|
||||
vim.api.nvim_set_keymap(
|
||||
|
@ -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
|
||||
]]
|
||||
]])
|
||||
|
@ -4,8 +4,8 @@ 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
|
||||
@ -15,15 +15,15 @@ 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
|
||||
|
@ -4,8 +4,8 @@ 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" },
|
||||
@ -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)
|
||||
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,10 +139,10 @@ 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{
|
||||
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 = {
|
||||
@ -148,16 +152,16 @@ function M.config_lsp()
|
||||
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 = "⚠️",
|
||||
hint_sign = "🤔",
|
||||
@ -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
|
||||
|
@ -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,23 +49,23 @@ 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,
|
||||
@ -73,7 +73,14 @@ function M.config_lualine(theme_name)
|
||||
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
|
||||
|
@ -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",
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
local function config_telescope()
|
||||
local actions = require("telescope.actions")
|
||||
require("telescope").setup{
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
@ -16,11 +16,11 @@ 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 }
|
||||
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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
-- Configures nvim-treesitter
|
||||
require'nvim-treesitter.configs'.setup{
|
||||
require("nvim-treesitter.configs").setup({
|
||||
incremental_selection = { enable = true },
|
||||
-- Indent appears to be broken right now
|
||||
indent = { enable = false },
|
||||
@ -21,4 +21,4 @@ require'nvim-treesitter.configs'.setup{
|
||||
"rust",
|
||||
"yaml",
|
||||
},
|
||||
}
|
||||
})
|
||||
|
@ -1,11 +1,11 @@
|
||||
local M = {}
|
||||
|
||||
function M.configure()
|
||||
require("which-key").setup {
|
||||
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
|
||||
|
@ -4,17 +4,12 @@ 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,
|
||||
{
|
||||
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
|
||||
}
|
||||
)
|
||||
script = opts.script or false,
|
||||
})
|
||||
end
|
||||
|
||||
function M.augroup(group, fn)
|
||||
@ -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
|
||||
@ -58,7 +59,7 @@ function M.can_require(name)
|
||||
else
|
||||
for _, searcher in ipairs(package.searchers or package.loaders) do
|
||||
local loader = searcher(name)
|
||||
if type(loader) == 'function' then
|
||||
if type(loader) == "function" then
|
||||
package.preload[name] = loader
|
||||
return true
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user