autoformat

This commit is contained in:
2024-09-30 06:12:57 +02:00
parent 2bed3cbe6e
commit b9b77abfa4
8 changed files with 116 additions and 109 deletions

View File

@@ -8,13 +8,21 @@ require('mason').setup({
}
})
local servers = { 'pylsp', 'lua_ls', 'rust_analyzer', 'zls'}
local servers = { 'pylsp', 'lua_ls', 'rust_analyzer', 'zls' }
require('mason-lspconfig').setup({
-- A list of servers to automatically install if they're not already installed
ensure_installed = servers,
})
-- auto format on save
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = vim.b.buffer,
callback = function()
vim.lsp.buf.format { async = false }
end
})
-- Set different settings for different languages' LSP
-- LSP list: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
-- How to use setup({}): https://github.com/neovim/nvim-lspconfig/wiki/Understanding-setup-%7B%7D

View File

@@ -16,7 +16,7 @@ cmp.setup({
},
mapping = cmp.mapping.preset.insert({
-- Use <C-b/f> to scroll the docs
['K'] = cmp.mapping.scroll_docs( -4),
['K'] = cmp.mapping.scroll_docs(-4),
['J'] = cmp.mapping.scroll_docs(4),
-- Use <C-k/j> to switch in items
['k'] = cmp.mapping.select_prev_item(),
@@ -40,8 +40,8 @@ cmp.setup({
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable( -1) then
luasnip.jump( -1)
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end

View File

@@ -16,10 +16,10 @@ require("nvim-tree").setup({
},
},
},
})
})
local opts = {
noremap = true, -- non-recursive
silent = true, -- do not show message
}
vim.keymap.set('n', "<leader>e", function () require("nvim-tree.api").tree.toggle() end, opts)
vim.keymap.set('n', "<leader>e", function() require("nvim-tree.api").tree.toggle() end, opts)

View File

@@ -1,6 +1,6 @@
local onedark = require("onedark")
onedark.setup{
onedark.setup {
style = "darker"
}
onedark.load()

View File

@@ -10,4 +10,3 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
})
end
vim.opt.rtp:prepend(lazypath)

View File

@@ -18,10 +18,10 @@ map('n', '<leader>wk', '<C-w>k', opts)
map('n', '<leader>wl', '<C-w>l', opts)
local step_size = 4
map('n', '<leader>wJ', ':resize -'.. step_size ..'<CR>', opts)
map('n', '<leader>wK', ':resize +'.. step_size ..'<CR>', opts)
map('n', '<leader>wH', ':vertical resize -'.. step_size ..'<CR>', opts)
map('n', '<leader>wL', ':vertical resize +'.. step_size ..'<CR>', opts)
map('n', '<leader>wJ', ':resize -' .. step_size .. '<CR>', opts)
map('n', '<leader>wK', ':resize +' .. step_size .. '<CR>', opts)
map('n', '<leader>wH', ':vertical resize -' .. step_size .. '<CR>', opts)
map('n', '<leader>wL', ':vertical resize +' .. step_size .. '<CR>', opts)
map('n', '<leader>wn', ':windo new<CR>', opts)
map('n', '<leader>wc', ':close<CR>', opts)

View File

@@ -1,6 +1,6 @@
-- Hint: use `:h <option>` to figure out the meaning if needed
vim.opt.clipboard = 'unnamedplus' -- use system clipboard
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
vim.opt.mouse = 'a' -- allow the mouse to be used in Nvim
-- Tab