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