Reformat all neovim configuration files with stylua
This commit is contained in:
parent
d69a00df7e
commit
bddcb64be8
16 changed files with 414 additions and 352 deletions
|
@ -24,10 +24,14 @@ fi
|
||||||
staged_lua=$(echo "$staged_files" | grep '.lua$' || true)
|
staged_lua=$(echo "$staged_files" | grep '.lua$' || true)
|
||||||
num_staged_lua=$(echo "$staged_lua" | grep -vce '^$' || true)
|
num_staged_lua=$(echo "$staged_lua" | grep -vce '^$' || true)
|
||||||
if [ "$num_staged_lua" -gt 0 ]; then
|
if [ "$num_staged_lua" -gt 0 ]; then
|
||||||
printf '\nFormatting %s staged Lua files with lua-format\n' "$num_staged_lua"
|
printf '\nFormatting %s staged Lua files with stylua\n' "$num_staged_lua"
|
||||||
stylua "$staged_lua"
|
|
||||||
|
for file in $staged_lua;do
|
||||||
|
stylua "$file"
|
||||||
|
done
|
||||||
|
|
||||||
printf "Re-staging\n\n"
|
printf "Re-staging\n\n"
|
||||||
git add "$staged_lua"
|
git add $staged_lua
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run shfmt on staged shell scripts
|
# Run shfmt on staged shell scripts
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
require('keybinds')
|
require("keybinds")
|
||||||
require('settings')
|
require("settings")
|
||||||
require('plugins.init')
|
require("plugins.init")
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
-- Navigate between buffers
|
-- Navigate between buffers
|
||||||
map('n', '<C-N>', vim.cmd.bn, {silent = true})
|
map("n", "<C-N>", vim.cmd.bn, { silent = true })
|
||||||
map('n', '<C-B>', vim.cmd.bp, {silent = true})
|
map("n", "<C-B>", vim.cmd.bp, { silent = true })
|
||||||
|
|
||||||
-- Run Neoformat
|
-- Run Neoformat
|
||||||
map('n', '<M-f>', vim.cmd.Neoformat, {})
|
map("n", "<M-f>", vim.cmd.Neoformat, {})
|
||||||
|
|
||||||
-- Exit terminal insert mode with esc
|
-- Exit terminal insert mode with esc
|
||||||
map('t', '<Esc>', '<C-\\><C-n>', {})
|
map("t", "<Esc>", "<C-\\><C-n>", {})
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
-- Settings for pager mode
|
-- Settings for pager mode
|
||||||
vim.keymap.set('n', 'q', vim.cmd.q)
|
vim.keymap.set("n", "q", vim.cmd.q)
|
||||||
|
|
|
@ -1,56 +1,65 @@
|
||||||
return function()
|
return function()
|
||||||
local cmp = require('cmp')
|
local cmp = require("cmp")
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
if not cmp then return end
|
if not cmp then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Setup git completion source
|
-- Setup git completion source
|
||||||
require("cmp_git").setup()
|
require("cmp_git").setup()
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
vim.o.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup({
|
||||||
snippet = {expand = function(args) luasnip.lsp_expand(args.body) end},
|
snippet = {
|
||||||
mapping = {
|
expand = function(args)
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
luasnip.lsp_expand(args.body)
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
end,
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
},
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
mapping = {
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
['<C-e>'] = cmp.mapping.close(),
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
select = true
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
},
|
["<C-e>"] = cmp.mapping.close(),
|
||||||
['<Tab>'] = function(fallback)
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
if cmp.visible() then
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
cmp.select_next_item()
|
select = true,
|
||||||
elseif luasnip.expand_or_jumpable() then
|
}),
|
||||||
luasnip.expand_or_jump()
|
["<Tab>"] = function(fallback)
|
||||||
else
|
if cmp.visible() then
|
||||||
fallback()
|
cmp.select_next_item()
|
||||||
end
|
elseif luasnip.expand_or_jumpable() then
|
||||||
end,
|
luasnip.expand_or_jump()
|
||||||
['<S-Tab>'] = function(fallback)
|
else
|
||||||
if cmp.visible() then
|
fallback()
|
||||||
cmp.select_prev_item()
|
end
|
||||||
elseif luasnip.jumpable(-1) then
|
end,
|
||||||
luasnip.jump(-1)
|
["<S-Tab>"] = function(fallback)
|
||||||
else
|
if cmp.visible() then
|
||||||
fallback()
|
cmp.select_prev_item()
|
||||||
end
|
elseif luasnip.jumpable(-1) then
|
||||||
end
|
luasnip.jump(-1)
|
||||||
},
|
else
|
||||||
sources = {
|
fallback()
|
||||||
{name = 'buffer'}, {name = 'git'}, {name = 'luasnip'},
|
end
|
||||||
{name = 'nvim_lsp'}, {name = 'nvim_lua'}, {name = 'path'}
|
end,
|
||||||
}
|
},
|
||||||
}
|
sources = {
|
||||||
|
{ name = "buffer" },
|
||||||
-- Enable autopairs when enter is processed
|
{ name = "git" },
|
||||||
-- on completion
|
{ name = "luasnip" },
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
{ name = "nvim_lsp" },
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
{ name = "nvim_lua" },
|
||||||
|
{ name = "path" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Enable autopairs when enter is processed
|
||||||
|
-- on completion
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
return function()
|
return function()
|
||||||
vim.opt.list = true
|
vim.opt.list = true
|
||||||
require('indent_blankline').setup {
|
require("indent_blankline").setup({
|
||||||
space_char_blankline = ' ',
|
space_char_blankline = " ",
|
||||||
show_current_context = true,
|
show_current_context = true,
|
||||||
show_current_context_start = true
|
show_current_context_start = true,
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,202 +1,219 @@
|
||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
|
|
||||||
-- Install packer if it's not yet installed
|
-- Install packer if it's not yet installed
|
||||||
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
print('Installing Packer')
|
print("Installing Packer")
|
||||||
Packer_bootstrap = fn.system({
|
Packer_bootstrap = fn.system({
|
||||||
'git', 'clone', '--depth', '1',
|
"git",
|
||||||
'https://github.com/wbthomason/packer.nvim', install_path
|
"clone",
|
||||||
})
|
"--depth",
|
||||||
vim.cmd [[packadd packer.nvim]]
|
"1",
|
||||||
print('Installed Packer')
|
"https://github.com/wbthomason/packer.nvim",
|
||||||
|
install_path,
|
||||||
|
})
|
||||||
|
vim.cmd([[packadd packer.nvim]])
|
||||||
|
print("Installed Packer")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Configure packer
|
-- Configure packer
|
||||||
require('packer').startup(function()
|
require("packer").startup(function()
|
||||||
local use = require('packer').use
|
local use = require("packer").use
|
||||||
|
|
||||||
-- The plugin manager itself
|
-- The plugin manager itself
|
||||||
use {'wbthomason/packer.nvim'}
|
use({ "wbthomason/packer.nvim" })
|
||||||
|
|
||||||
-- Colorscheme
|
-- Colorscheme
|
||||||
use {
|
use({
|
||||||
'rebelot/kanagawa.nvim',
|
"rebelot/kanagawa.nvim",
|
||||||
config = function() vim.cmd('colorscheme kanagawa') end
|
config = function()
|
||||||
}
|
vim.cmd("colorscheme kanagawa")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Statusline
|
-- Statusline
|
||||||
use {
|
use({
|
||||||
'nvim-lualine/lualine.nvim',
|
"nvim-lualine/lualine.nvim",
|
||||||
requires = {'kyazdani42/nvim-web-devicons', opt = true},
|
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||||
config = require('plugins.lualine')
|
config = require("plugins.lualine"),
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Startup screen/dashboard
|
-- Startup screen/dashboard
|
||||||
--use 'glepnir/dashboard-nvim'
|
--use 'glepnir/dashboard-nvim'
|
||||||
|
|
||||||
-- Git in signcolumn
|
-- Git in signcolumn
|
||||||
use 'airblade/vim-gitgutter'
|
use("airblade/vim-gitgutter")
|
||||||
|
|
||||||
-- Tabline/bufferline
|
-- Tabline/bufferline
|
||||||
use {
|
use({
|
||||||
'akinsho/nvim-bufferline.lua',
|
"akinsho/nvim-bufferline.lua",
|
||||||
tag = '*',
|
tag = "*",
|
||||||
requires = 'kyazdani42/nvim-web-devicons',
|
requires = "kyazdani42/nvim-web-devicons",
|
||||||
config = function() require('bufferline').setup {} end
|
config = function()
|
||||||
}
|
require("bufferline").setup({})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Git commands
|
-- Git commands
|
||||||
use 'tpope/vim-fugitive'
|
use("tpope/vim-fugitive")
|
||||||
|
|
||||||
-- Indent characters
|
-- Indent characters
|
||||||
use {
|
use({
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
config = require('plugins.indent-blankline')
|
config = require("plugins.indent-blankline"),
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Tree explorer
|
-- Tree explorer
|
||||||
use {
|
use({
|
||||||
'kyazdani42/nvim-tree.lua',
|
"kyazdani42/nvim-tree.lua",
|
||||||
requires = 'kyazdani42/nvim-web-devicons',
|
requires = "kyazdani42/nvim-web-devicons",
|
||||||
config = require('plugins.nvim-tree')
|
config = require("plugins.nvim-tree"),
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Telescope
|
-- Telescope
|
||||||
use {
|
use({
|
||||||
'nvim-telescope/telescope.nvim',
|
"nvim-telescope/telescope.nvim",
|
||||||
config = require('plugins.telescope'),
|
config = require("plugins.telescope"),
|
||||||
requires = {
|
requires = {
|
||||||
{'nvim-lua/plenary.nvim'}, -- Internal dep for telescope
|
{ "nvim-lua/plenary.nvim" }, -- Internal dep for telescope
|
||||||
{'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}, -- Use fzf for fuzzy finder
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = "make" }, -- Use fzf for fuzzy finder
|
||||||
{'nvim-telescope/telescope-ui-select.nvim'}, -- Replace vim built in select with telescope
|
{ "nvim-telescope/telescope-ui-select.nvim" }, -- Replace vim built in select with telescope
|
||||||
{'zane-/cder.nvim'}, -- cd plugin for telescope
|
{ "zane-/cder.nvim" }, -- cd plugin for telescope
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Do stuff as sudo
|
-- Do stuff as sudo
|
||||||
use 'lambdalisue/suda.vim'
|
use("lambdalisue/suda.vim")
|
||||||
|
|
||||||
-- Display possible keybinds
|
-- Display possible keybinds
|
||||||
use {'folke/which-key.nvim', config = require('plugins.which-key')}
|
use({ "folke/which-key.nvim", config = require("plugins.which-key") })
|
||||||
|
|
||||||
-- Read editorconfig settings
|
-- Read editorconfig settings
|
||||||
use 'editorconfig/editorconfig-vim'
|
use("editorconfig/editorconfig-vim")
|
||||||
|
|
||||||
-- Package manager for LSP servers, DAP servers etc.
|
-- Package manager for LSP servers, DAP servers etc.
|
||||||
use {'williamboman/mason.nvim', config = require('plugins.mason').setup}
|
use({ "williamboman/mason.nvim", config = require("plugins.mason").setup })
|
||||||
|
|
||||||
-- Install LSP server executables with Mason
|
-- Install LSP server executables with Mason
|
||||||
use {
|
use({
|
||||||
'williamboman/mason-lspconfig.nvim',
|
"williamboman/mason-lspconfig.nvim",
|
||||||
config = require('plugins.mason').lspconfig_setup
|
config = require("plugins.mason").lspconfig_setup,
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Configs for built-in LSP
|
-- Configs for built-in LSP
|
||||||
use {'neovim/nvim-lspconfig', config = require('plugins.lspconfig').setup}
|
use({ "neovim/nvim-lspconfig", config = require("plugins.lspconfig").setup })
|
||||||
|
|
||||||
-- Additional LSP features for Java
|
-- Additional LSP features for Java
|
||||||
use 'mfussenegger/nvim-jdtls'
|
use("mfussenegger/nvim-jdtls")
|
||||||
|
|
||||||
-- Display function signature
|
-- Display function signature
|
||||||
use 'ray-x/lsp_signature.nvim'
|
use("ray-x/lsp_signature.nvim")
|
||||||
|
|
||||||
-- Snippets plugin
|
-- Snippets plugin
|
||||||
use {
|
use({
|
||||||
'L3MON4D3/LuaSnip',
|
"L3MON4D3/LuaSnip",
|
||||||
requires = {'rafamadriz/friendly-snippets'}, -- Snippets collection
|
requires = { "rafamadriz/friendly-snippets" }, -- Snippets collection
|
||||||
config = require('plugins.luasnip')
|
config = require("plugins.luasnip"),
|
||||||
}
|
})
|
||||||
|
|
||||||
-- vim api documentation for lua lsp
|
-- vim api documentation for lua lsp
|
||||||
use {'ii14/emmylua-nvim'}
|
use({ "ii14/emmylua-nvim" })
|
||||||
|
|
||||||
-- Completion
|
-- Completion
|
||||||
use {
|
use({
|
||||||
'hrsh7th/nvim-cmp',
|
"hrsh7th/nvim-cmp",
|
||||||
requires = {
|
requires = {
|
||||||
{'hrsh7th/cmp-buffer'}, -- Buffer source
|
{ "hrsh7th/cmp-buffer" }, -- Buffer source
|
||||||
{'petertriho/cmp-git', requires = 'nvim-lua/plenary.nvim'}, -- Git source
|
{ "petertriho/cmp-git", requires = "nvim-lua/plenary.nvim" }, -- Git source
|
||||||
{'hrsh7th/cmp-nvim-lsp'}, -- LSP source
|
{ "hrsh7th/cmp-nvim-lsp" }, -- LSP source
|
||||||
{'hrsh7th/cmp-nvim-lua'}, -- Neovim Lua API documentation source
|
{ "hrsh7th/cmp-nvim-lua" }, -- Neovim Lua API documentation source
|
||||||
{'hrsh7th/cmp-path'}, -- Path source
|
{ "hrsh7th/cmp-path" }, -- Path source
|
||||||
{'saadparwaiz1/cmp_luasnip'} -- Snippets source
|
{ "saadparwaiz1/cmp_luasnip" }, -- Snippets source
|
||||||
},
|
},
|
||||||
config = require('plugins.cmp')
|
config = require("plugins.cmp"),
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Automatic brackets
|
-- Automatic brackets
|
||||||
use {
|
use({
|
||||||
'windwp/nvim-autopairs',
|
"windwp/nvim-autopairs",
|
||||||
config = function() require('nvim-autopairs').setup {} end
|
config = function()
|
||||||
}
|
require("nvim-autopairs").setup({})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- treesitter
|
-- treesitter
|
||||||
use {
|
use({
|
||||||
'nvim-treesitter/nvim-treesitter',
|
"nvim-treesitter/nvim-treesitter",
|
||||||
run = function()
|
run = function()
|
||||||
require('nvim-treesitter.install').update({with_sync = true})
|
require("nvim-treesitter.install").update({ with_sync = true })
|
||||||
end,
|
end,
|
||||||
config = require('plugins.treesitter')
|
config = require("plugins.treesitter"),
|
||||||
}
|
})
|
||||||
|
|
||||||
-- treesitter plugin for commentstring
|
-- treesitter plugin for commentstring
|
||||||
use 'JoosepAlviste/nvim-ts-context-commentstring'
|
use("JoosepAlviste/nvim-ts-context-commentstring")
|
||||||
|
|
||||||
-- Additional plugins for formats not supported
|
-- Additional plugins for formats not supported
|
||||||
-- by treesitter
|
-- by treesitter
|
||||||
use 'jamespeapen/swayconfig.vim'
|
use("jamespeapen/swayconfig.vim")
|
||||||
|
|
||||||
-- mappings for commenting in code
|
-- mappings for commenting in code
|
||||||
use 'tpope/vim-commentary'
|
use("tpope/vim-commentary")
|
||||||
|
|
||||||
-- we all know this one
|
-- we all know this one
|
||||||
use 'tpope/vim-surround'
|
use("tpope/vim-surround")
|
||||||
|
|
||||||
-- Formatter plugin
|
-- Formatter plugin
|
||||||
use 'sbdchd/neoformat'
|
use("sbdchd/neoformat")
|
||||||
|
|
||||||
-- Make editing passwords safer
|
-- Make editing passwords safer
|
||||||
use {
|
use({
|
||||||
'https://git.zx2c4.com/password-store',
|
"https://git.zx2c4.com/password-store",
|
||||||
rtp = 'contrib/vim/redact_pass.vim'
|
rtp = "contrib/vim/redact_pass.vim",
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Neovim inside Firefox
|
-- Neovim inside Firefox
|
||||||
use {
|
use({
|
||||||
'glacambre/firenvim',
|
"glacambre/firenvim",
|
||||||
run = function() vim.fn['firenvim#install'](0) end
|
run = function()
|
||||||
}
|
vim.fn["firenvim#install"](0)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Vim <3 Asciidoctor
|
-- Vim <3 Asciidoctor
|
||||||
use 'habamax/vim-asciidoctor'
|
use("habamax/vim-asciidoctor")
|
||||||
|
|
||||||
-- Markdown preview
|
-- Markdown preview
|
||||||
use({
|
use({
|
||||||
'iamcco/markdown-preview.nvim',
|
"iamcco/markdown-preview.nvim",
|
||||||
run = 'cd app && npm install',
|
run = "cd app && npm install",
|
||||||
setup = function() vim.g.mkdp_filetypes = {'markdown'} end,
|
setup = function()
|
||||||
ft = {'markdown'}
|
vim.g.mkdp_filetypes = { "markdown" }
|
||||||
})
|
end,
|
||||||
|
ft = { "markdown" },
|
||||||
|
})
|
||||||
|
|
||||||
-- Edit GPG encrypted files transparently
|
-- Edit GPG encrypted files transparently
|
||||||
use 'jamessan/vim-gnupg'
|
use("jamessan/vim-gnupg")
|
||||||
|
|
||||||
-- High performance color highlighter
|
-- High performance color highlighter
|
||||||
use {
|
use({
|
||||||
'norcalli/nvim-colorizer.lua',
|
"norcalli/nvim-colorizer.lua",
|
||||||
config = function() require('colorizer').setup() end
|
config = function()
|
||||||
}
|
require("colorizer").setup()
|
||||||
|
end,
|
||||||
-- If Packer was just installed,
|
})
|
||||||
-- sync plugins
|
|
||||||
if Packer_bootstrap then require('packer').sync() end
|
|
||||||
|
|
||||||
|
-- If Packer was just installed,
|
||||||
|
-- sync plugins
|
||||||
|
if Packer_bootstrap then
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Sync plugins if Packer was just
|
-- Sync plugins if Packer was just
|
||||||
-- installed
|
-- installed
|
||||||
if Packer_bootstrap then
|
if Packer_bootstrap then
|
||||||
print('Syncing plugins')
|
print("Syncing plugins")
|
||||||
require('packer').sync()
|
require("packer").sync()
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,95 +2,94 @@
|
||||||
-- This is iterated through and every
|
-- This is iterated through and every
|
||||||
-- server is setup with lspconfig
|
-- server is setup with lspconfig
|
||||||
Servers = {
|
Servers = {
|
||||||
bashls = {},
|
bashls = {},
|
||||||
html = {},
|
html = {},
|
||||||
jsonls = {},
|
jsonls = {},
|
||||||
lemminx = {},
|
lemminx = {},
|
||||||
marksman = {},
|
marksman = {},
|
||||||
yamlls = {},
|
yamlls = {},
|
||||||
taplo = {},
|
taplo = {},
|
||||||
tsserver = {},
|
tsserver = {},
|
||||||
sumneko_lua = {
|
sumneko_lua = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
version = 'LuaJIT'
|
version = "LuaJIT",
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = {'vim'}
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
library = vim.api.nvim_get_runtime_file('', true)
|
library = vim.api.nvim_get_runtime_file("", true),
|
||||||
},
|
},
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
telemetry = {enable = false}
|
telemetry = { enable = false },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
M = {}
|
M = {}
|
||||||
|
|
||||||
function M.map_keys()
|
function M.map_keys()
|
||||||
-- Register keybindings via which-key
|
-- Register keybindings via which-key
|
||||||
-- to get documentation in which-key
|
-- to get documentation in which-key
|
||||||
local wk = require('which-key')
|
local wk = require("which-key")
|
||||||
wk.register({
|
wk.register({
|
||||||
g = {
|
g = {
|
||||||
name = "Go to",
|
name = "Go to",
|
||||||
d = {vim.lsp.buf.definition, "Definition"},
|
d = { vim.lsp.buf.definition, "Definition" },
|
||||||
D = {vim.lsp.buf.declaration, "Declaration"},
|
D = { vim.lsp.buf.declaration, "Declaration" },
|
||||||
i = {vim.lsp.buf.implementation, "Implementation"},
|
i = { vim.lsp.buf.implementation, "Implementation" },
|
||||||
r = {vim.lsp.buf.references, "References"}
|
r = { vim.lsp.buf.references, "References" },
|
||||||
},
|
},
|
||||||
['<leader>'] = {
|
["<leader>"] = {
|
||||||
name = "Leader",
|
name = "Leader",
|
||||||
w = {
|
w = {
|
||||||
name = "Workspace",
|
name = "Workspace",
|
||||||
a = {vim.lsp.buf.add_workspace_folder, "Add folder"},
|
a = { vim.lsp.buf.add_workspace_folder, "Add folder" },
|
||||||
r = {vim.lsp.buf.remove_workspace_folder, "Remove folder"},
|
r = { vim.lsp.buf.remove_workspace_folder, "Remove folder" },
|
||||||
l = {
|
l = {
|
||||||
function()
|
function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, "List folders"
|
end,
|
||||||
}
|
"List folders",
|
||||||
},
|
},
|
||||||
D = {vim.lsp.buf.type_definition, "Type definition"},
|
},
|
||||||
rn = {vim.lsp.buf.rename, "Rename symbol"},
|
D = { vim.lsp.buf.type_definition, "Type definition" },
|
||||||
ca = {vim.lsp.buf.code_action, "Code action"},
|
rn = { vim.lsp.buf.rename, "Rename symbol" },
|
||||||
e = {vim.diagnostic.open_float, "Open diagnostics"},
|
ca = { vim.lsp.buf.code_action, "Code action" },
|
||||||
f = {vim.lsp.buf.format, "Format"}
|
e = { vim.diagnostic.open_float, "Open diagnostics" },
|
||||||
},
|
f = { vim.lsp.buf.format, "Format" },
|
||||||
K = {vim.lsp.buf.hover, "Hover"},
|
},
|
||||||
['['] = {d = {vim.diagnostic.goto_prev, "Previous diagnostic"}},
|
K = { vim.lsp.buf.hover, "Hover" },
|
||||||
[']'] = {d = {vim.diagnostic.goto_next, "Next diagnostic"}}
|
["["] = { d = { vim.diagnostic.goto_prev, "Previous diagnostic" } },
|
||||||
|
["]"] = { d = { vim.diagnostic.goto_next, "Next diagnostic" } },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
|
local function on_attach()
|
||||||
|
-- Setup lsp signature plugin
|
||||||
|
require("lsp_signature").setup({})
|
||||||
|
|
||||||
local function on_attach()
|
-- Setup keybinds
|
||||||
-- Setup lsp signature plugin
|
M.map_keys()
|
||||||
require('lsp_signature').setup {}
|
end
|
||||||
|
|
||||||
-- Setup keybinds
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
M.map_keys()
|
|
||||||
end
|
|
||||||
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
-- Setup every defined server
|
||||||
|
for server, settings in pairs(Servers) do
|
||||||
-- Setup every defined server
|
require("lspconfig")[server].setup({
|
||||||
for server, settings in pairs(Servers) do
|
on_attach = on_attach,
|
||||||
require('lspconfig')[server].setup {
|
settings = settings,
|
||||||
on_attach = on_attach,
|
-- Inform lsp server about client
|
||||||
settings = settings,
|
-- capabilities
|
||||||
-- Inform lsp server about client
|
capabilities = capabilities,
|
||||||
-- capabilities
|
})
|
||||||
capabilities = capabilities
|
end
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
return function() require('lualine').setup {} end
|
return function()
|
||||||
|
require("lualine").setup({})
|
||||||
|
end
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
return function()
|
return function()
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require("luasnip")
|
||||||
local wk = require('which-key')
|
local wk = require("which-key")
|
||||||
|
|
||||||
-- load friendly-snippets to luasnip
|
-- load friendly-snippets to luasnip
|
||||||
require('luasnip/loaders/from_vscode').lazy_load()
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
-- Register snippet navigation keybindings
|
-- Register snippet navigation keybindings
|
||||||
local snippet_mappings = {
|
local snippet_mappings = {
|
||||||
['<c-j>'] = {function()luasnip.jump(1) end},
|
["<c-j>"] = {
|
||||||
['<c-k>'] = {function() luasnip.jump(-1) end}
|
function()
|
||||||
}
|
luasnip.jump(1)
|
||||||
--wk.register(snippet_mappings, {mode = "i"})
|
end,
|
||||||
--wk.register(snippet_mappings, {mode = "s"})
|
},
|
||||||
|
["<c-k>"] = {
|
||||||
|
function()
|
||||||
|
luasnip.jump(-1)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
--wk.register(snippet_mappings, {mode = "i"})
|
||||||
|
--wk.register(snippet_mappings, {mode = "s"})
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
Opts = {mason = {}, lspconfig = {automatic_installation = true}}
|
Opts = { mason = {}, lspconfig = { automatic_installation = true } }
|
||||||
|
|
||||||
M.setup = function() require('mason').setup(Opts.mason) end
|
M.setup = function()
|
||||||
|
require("mason").setup(Opts.mason)
|
||||||
|
end
|
||||||
|
|
||||||
M.lspconfig_setup =
|
M.lspconfig_setup = function()
|
||||||
function() require('mason-lspconfig').setup(Opts.lspconfig) end
|
require("mason-lspconfig").setup(Opts.lspconfig)
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
return function()
|
return function()
|
||||||
require("nvim-tree").setup { -- BEGIN_DEFAULT_OPTS
|
require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = true,
|
enable = true,
|
||||||
show_on_dirs = true,
|
show_on_dirs = true,
|
||||||
},
|
},
|
||||||
renderer = {
|
renderer = {
|
||||||
highlight_git = true
|
highlight_git = true,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
-- Open/close with alt-o
|
-- Open/close with alt-o
|
||||||
vim.keymap.set('n', '<M-o>', vim.cmd.NvimTreeToggle)
|
vim.keymap.set("n", "<M-o>", vim.cmd.NvimTreeToggle)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
return function()
|
return function()
|
||||||
local telescope = require('telescope')
|
local telescope = require("telescope")
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require("telescope.builtin")
|
||||||
|
|
||||||
telescope.setup {
|
telescope.setup({
|
||||||
pickers = {find_files = {find_command = {"fd", "-Ht", "f"}}}
|
pickers = { find_files = { find_command = { "fd", "-Ht", "f" } } },
|
||||||
}
|
})
|
||||||
|
|
||||||
telescope.load_extension('fzf')
|
telescope.load_extension("fzf")
|
||||||
telescope.load_extension('ui-select')
|
telescope.load_extension("ui-select")
|
||||||
telescope.load_extension('cder')
|
telescope.load_extension("cder")
|
||||||
|
|
||||||
-- Keybinds
|
-- Keybinds
|
||||||
vim.keymap.set('n', '<C-t>', vim.cmd.Telescope)
|
vim.keymap.set("n", "<C-t>", vim.cmd.Telescope)
|
||||||
vim.keymap.set('n', '<C-f>', builtin.find_files)
|
vim.keymap.set("n", "<C-f>", builtin.find_files)
|
||||||
vim.keymap.set('n', '<C-g>', builtin.live_grep)
|
vim.keymap.set("n", "<C-g>", builtin.live_grep)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,17 +1,37 @@
|
||||||
return function()
|
return function()
|
||||||
require'nvim-treesitter.configs'.setup {
|
require("nvim-treesitter.configs").setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'bash', 'c', 'css', 'dockerfile', 'html', 'http', 'java', 'json',
|
"bash",
|
||||||
'json5', 'latex', 'lua', 'make', 'markdown', 'php', 'python',
|
"c",
|
||||||
'regex', 'rasi', 'rst', 'scss', 'toml', 'tsx', 'typescript',
|
"css",
|
||||||
'javascript', 'yaml'
|
"dockerfile",
|
||||||
},
|
"html",
|
||||||
highlight = {enable = true},
|
"http",
|
||||||
indent = {enable = true},
|
"java",
|
||||||
incremental_selection = {enable = true},
|
"json",
|
||||||
context_commentstring = {enable = true}
|
"json5",
|
||||||
}
|
"latex",
|
||||||
|
"lua",
|
||||||
|
"make",
|
||||||
|
"markdown",
|
||||||
|
"php",
|
||||||
|
"python",
|
||||||
|
"regex",
|
||||||
|
"rasi",
|
||||||
|
"rst",
|
||||||
|
"scss",
|
||||||
|
"toml",
|
||||||
|
"tsx",
|
||||||
|
"typescript",
|
||||||
|
"javascript",
|
||||||
|
"yaml",
|
||||||
|
},
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
incremental_selection = { enable = true },
|
||||||
|
context_commentstring = { enable = true },
|
||||||
|
})
|
||||||
|
|
||||||
-- vim.wo.foldmethod = 'expr'
|
-- vim.wo.foldmethod = 'expr'
|
||||||
-- im.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
-- im.wo.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
return function()
|
return function()
|
||||||
require('which-key').setup {spelling = {enabled = true}}
|
require("which-key").setup({ spelling = { enabled = true } })
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,17 +5,17 @@ local g = vim.g
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
|
|
||||||
-- Font for nvim GUI's
|
-- Font for nvim GUI's
|
||||||
o.guifont = 'Fira Code:h14'
|
o.guifont = "Fira Code:h14"
|
||||||
|
|
||||||
-- Floating window transparency
|
-- Floating window transparency
|
||||||
o.winblend = 10
|
o.winblend = 10
|
||||||
|
|
||||||
-- Set window title
|
-- Set window title
|
||||||
o.title = true
|
o.title = true
|
||||||
o.titlestring = 'NeoVim: ' .. vim.fn.getcwd()
|
o.titlestring = "NeoVim: " .. vim.fn.getcwd()
|
||||||
|
|
||||||
-- Diff settings
|
-- Diff settings
|
||||||
o.diffopt = 'filler,internal,algorithm:histogram,indent-heuristic'
|
o.diffopt = "filler,internal,algorithm:histogram,indent-heuristic"
|
||||||
|
|
||||||
-- Allow switching buffers with unsaved changes
|
-- Allow switching buffers with unsaved changes
|
||||||
o.hidden = true
|
o.hidden = true
|
||||||
|
@ -24,9 +24,9 @@ o.hidden = true
|
||||||
o.number = true
|
o.number = true
|
||||||
|
|
||||||
o.guicursor = table.concat({
|
o.guicursor = table.concat({
|
||||||
'i:ver1', -- Vertical bar cursor in insert mode
|
"i:ver1", -- Vertical bar cursor in insert mode
|
||||||
'a:blinkon1' -- Blinking cursor in all modes
|
"a:blinkon1", -- Blinking cursor in all modes
|
||||||
}, ',')
|
}, ",")
|
||||||
|
|
||||||
-- Enable global statusline
|
-- Enable global statusline
|
||||||
o.laststatus = 3
|
o.laststatus = 3
|
||||||
|
|
Loading…
Reference in a new issue