-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nvim: setup formatter for lua using conform
- Loading branch information
Showing
18 changed files
with
350 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +0,0 @@ | ||
{ | ||
"runtime.version": "LuaJIT", | ||
"runtime.path": ["lua/?.lua", "lua/?/init.lua"], | ||
"diagnostics.globals": ["vim"], | ||
"workspace.checkThirdParty": false, | ||
"workspace.library": ["$VIMRUNTIME"] | ||
} | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
require("core.options") | ||
require("core.keymaps") | ||
require("core.lazy") | ||
require('core.options') | ||
require('core.keymaps') | ||
require('core.lazy') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") | ||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv") | ||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv") | ||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv") | ||
|
||
vim.keymap.set("n", "J", "mzJ`z") | ||
vim.keymap.set("n", "<C-d>", "<C-d>zz") | ||
vim.keymap.set("n", "<C-u>", "<C-u>zz") | ||
vim.keymap.set("n", "n", "nzzzv") | ||
vim.keymap.set('n', 'J', 'mzJ`z') | ||
vim.keymap.set('n', '<C-d>', '<C-d>zz') | ||
vim.keymap.set('n', '<C-u>', '<C-u>zz') | ||
vim.keymap.set('n', 'n', 'nzzzv') | ||
|
||
vim.keymap.set("n", "N", "nzzzv") | ||
vim.keymap.set('n', 'N', 'nzzzv') | ||
|
||
vim.keymap.set("x", "<leader>p", '"_dP') | ||
vim.keymap.set('x', '<leader>p', '"_dP') | ||
|
||
vim.keymap.set("v", "<", "<gv") | ||
vim.keymap.set("v", ">", ">gv") | ||
vim.keymap.set('v', '<', '<gv') | ||
vim.keymap.set('v', '>', '>gv') | ||
|
||
vim.keymap.set("v", "~", "~gv") | ||
vim.keymap.set("v", "U", "Ugv") | ||
vim.keymap.set("v", "u", "ugv") | ||
vim.keymap.set('v', '~', '~gv') | ||
vim.keymap.set('v', 'U', 'Ugv') | ||
vim.keymap.set('v', 'u', 'ugv') | ||
|
||
vim.keymap.set("n", "<Up>", ":resize -2<CR>") | ||
vim.keymap.set("n", "<Down>", ":resize +2<CR>") | ||
vim.keymap.set("n", "<Left>", ":vertical resize -2<CR>") | ||
vim.keymap.set("n", "<Right>", ":vertical resize +2<CR>") | ||
vim.keymap.set('n', '<Up>', ':resize -2<CR>') | ||
vim.keymap.set('n', '<Down>', ':resize +2<CR>') | ||
vim.keymap.set('n', '<Left>', ':vertical resize -2<CR>') | ||
vim.keymap.set('n', '<Right>', ':vertical resize +2<CR>') | ||
|
||
vim.keymap.set("n", "<leader>|", "<C-w>v") | ||
vim.keymap.set("n", "<leader>-", "<C-w>s") | ||
vim.keymap.set("n", "<leader>se", "<C-w>=") | ||
vim.keymap.set("n", "<leader>xs", ":close<CR>") | ||
vim.keymap.set('n', '<leader>|', '<C-w>v') | ||
vim.keymap.set('n', '<leader>-', '<C-w>s') | ||
vim.keymap.set('n', '<leader>se', '<C-w>=') | ||
vim.keymap.set('n', '<leader>xs', ':close<CR>') | ||
|
||
vim.keymap.set("n", "<leader>k", ":wincmd k<CR>") | ||
vim.keymap.set("n", "<leader>j", ":wincmd j<CR>") | ||
vim.keymap.set("n", "<leader>h", ":wincmd h<CR>") | ||
vim.keymap.set("n", "<leader>l", ":wincmd l<CR>") | ||
vim.keymap.set('n', '<leader>k', ':wincmd k<CR>') | ||
vim.keymap.set('n', '<leader>j', ':wincmd j<CR>') | ||
vim.keymap.set('n', '<leader>h', ':wincmd h<CR>') | ||
vim.keymap.set('n', '<leader>l', ':wincmd l<CR>') | ||
|
||
vim.keymap.set("n", "<leader>c", ":bd!<CR>") | ||
vim.keymap.set("n", "<leader>kw", ":%bd!<CR><CR>") | ||
vim.keymap.set('n', '<leader>c', ':bd!<CR>') | ||
vim.keymap.set('n', '<leader>kw', ':%bd!<CR><CR>') | ||
|
||
vim.keymap.set("n", "Q", "<nop>") | ||
vim.keymap.set('n', 'Q', '<nop>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
return { | ||
'hrsh7th/nvim-cmp', | ||
event = 'InsertEnter', | ||
dependencies = { | ||
'hrsh7th/cmp-buffer', | ||
'hrsh7th/cmp-path', | ||
'L3MON4D3/LuaSnip', | ||
'saadparwaiz1/cmp_luasnip', | ||
'rafamadriz/friendly-snippets', | ||
}, | ||
config = function() | ||
local cmp = require('cmp') | ||
local luasnip = require('luasnip') | ||
|
||
require('luasnip.loaders.from_vscode').lazy_load() | ||
|
||
cmp.setup({ | ||
completion = { | ||
completeopt = 'menu,menuone,preview,noselect', | ||
}, | ||
snippet = { | ||
expand = function(args) | ||
luasnip.lsp_expand(args.body) | ||
end, | ||
}, | ||
sources = { | ||
{ name = 'nvim_lsp' }, | ||
{ name = 'luasnip' }, | ||
{ name = 'buffer' }, | ||
{ name = 'path' }, | ||
}, | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
return { | ||
"scottmckendry/cyberdream.nvim", | ||
lazy = false, | ||
priority = 1000, | ||
config = function() | ||
require("cyberdream").setup({ | ||
transparent = true, | ||
terminal_colors = true, | ||
theme = { | ||
saturation = 1, | ||
}, | ||
extensions = { | ||
telescope = false, | ||
}, | ||
}) | ||
'scottmckendry/cyberdream.nvim', | ||
lazy = false, | ||
priority = 1000, | ||
config = function() | ||
require('cyberdream').setup({ | ||
transparent = true, | ||
terminal_colors = true, | ||
theme = { | ||
saturation = 1, | ||
}, | ||
extensions = { | ||
telescope = false, | ||
}, | ||
}) | ||
|
||
vim.cmd("colorscheme cyberdream") | ||
end, | ||
vim.cmd('colorscheme cyberdream') | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
return { | ||
'stevearc/conform.nvim', | ||
lazy = false, | ||
event = { 'BufWritePre' }, | ||
cmd = { 'ConformInfo' }, | ||
keys = { | ||
{ | ||
'<leader>f', | ||
function() | ||
require('conform').format({ async = true }) | ||
end, | ||
mode = { 'n', 'v' }, | ||
desc = 'Format buffer', | ||
}, | ||
}, | ||
---@module "conform" | ||
---@type conform.setupOpts | ||
opts = { | ||
formatters_by_ft = { | ||
lua = { 'stylua' }, | ||
}, | ||
default_format_opts = { | ||
lsp_format = 'fallback', | ||
}, | ||
format_on_save = { timeout_ms = 500 }, | ||
formatters = {}, | ||
}, | ||
init = function() | ||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
return { | ||
"github/copilot.vim", | ||
config = function() | ||
vim.keymap.set("i", "<C-O>", 'copilot#Accept("\\<CR>")', { | ||
expr = true, | ||
replace_keycodes = false, | ||
}) | ||
vim.g.copilot_no_tab_map = true | ||
end, | ||
'github/copilot.vim', | ||
config = function() | ||
vim.keymap.set('i', '<C-O>', 'copilot#Accept("\\<CR>")', { | ||
expr = true, | ||
replace_keycodes = false, | ||
}) | ||
vim.g.copilot_no_tab_map = true | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
return { | ||
'neovim/nvim-lspconfig', | ||
event = { 'BufReadPre', 'BufNewFile' }, | ||
dependencies = { | ||
'hrsh7th/cmp-nvim-lsp', | ||
{ 'antosha417/nvim-lsp-file-operations', config = true }, | ||
}, | ||
config = function() | ||
local mason_lspconfig = require('mason-lspconfig') | ||
local cmp_nvim_lsp = require('cmp_nvim_lsp') | ||
|
||
local lspconfig = require('lspconfig') | ||
local lsp_defaults = require('lspconfig').util.default_config | ||
|
||
lsp_defaults.capabilities = | ||
vim.tbl_deep_extend('force', lsp_defaults.capabilities, cmp_nvim_lsp.default_capabilities()) | ||
|
||
vim.api.nvim_create_autocmd('LspAttach', { | ||
desc = 'LSP actions', | ||
callback = function(event) | ||
local opts = { buffer = event.buf } | ||
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts) | ||
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts) | ||
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts) | ||
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts) | ||
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts) | ||
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts) | ||
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts) | ||
vim.keymap.set('n', 'gc', '<cmd>lua vim.lsp.buf.rename()<cr>', opts) | ||
vim.keymap.set('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts) | ||
end, | ||
}) | ||
|
||
mason_lspconfig.setup({ | ||
ensure_installed = { | ||
'lua_ls', | ||
}, | ||
handlers = { | ||
function(server_name) | ||
require('lspconfig')[server_name].setup({}) | ||
end, | ||
}, | ||
}) | ||
|
||
lspconfig.lua_ls.setup({ | ||
settings = { | ||
Lua = { | ||
diagnostics = { | ||
globals = { 'vim' }, | ||
}, | ||
workspace = { | ||
-- library = { | ||
-- [vim.fn.expand("$VIMRUNTIME/lua")] = true, | ||
-- [vim.fn.stdpath("config") .. "/lua"] = true | ||
-- }, | ||
library = vim.api.nvim_get_runtime_file('', true), | ||
checkThirdParty = false, | ||
}, | ||
codeLens = { | ||
enable = true, | ||
}, | ||
completion = { | ||
callSnippet = 'Replace', | ||
}, | ||
doc = { | ||
privateName = { '^_' }, | ||
}, | ||
hint = { | ||
enable = true, | ||
setType = false, | ||
paramType = true, | ||
paramName = 'Disable', | ||
semicolon = 'Disable', | ||
arrayIndex = 'Disable', | ||
}, | ||
}, | ||
}, | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
return { | ||
'williamboman/mason.nvim', | ||
dependencies = { | ||
'williamboman/mason-lspconfig.nvim', | ||
}, | ||
config = function() | ||
local mason = require('mason') | ||
|
||
mason.setup({ | ||
ui = { | ||
icons = { | ||
package_installed = '✓', | ||
package_pending = '➜', | ||
package_uninstalled = '✗', | ||
}, | ||
}, | ||
}) | ||
end, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
return { | ||
{ | ||
"L3MON4D3/LuaSnip", | ||
lazy = true, | ||
build = "make install_jsregexp", | ||
dependencies = { | ||
{ | ||
"rafamadriz/friendly-snippets", | ||
config = function() | ||
require("luasnip.loaders.from_vscode").lazy_load() | ||
end, | ||
}, | ||
}, | ||
opts = { | ||
history = true, | ||
delete_check_events = "TextChanged", | ||
}, | ||
}, | ||
{ | ||
'L3MON4D3/LuaSnip', | ||
lazy = true, | ||
build = 'make install_jsregexp', | ||
dependencies = { | ||
{ | ||
'rafamadriz/friendly-snippets', | ||
config = function() | ||
require('luasnip.loaders.from_vscode').lazy_load() | ||
end, | ||
}, | ||
}, | ||
opts = { | ||
history = true, | ||
delete_check_events = 'TextChanged', | ||
}, | ||
}, | ||
} |
Oops, something went wrong.