formatted init.lua

This commit is contained in:
qwjyh 2023-10-06 17:53:36 +09:00
parent 278f2b2261
commit 56b6f49a40

View file

@ -6,16 +6,16 @@ if not vim.loop.fs_stat(lazypath) then
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
-- Installing plugins -- Installing plugins
require('lazy').setup({ require('lazy').setup({
{ "catppuccin/nvim", name = "catppuccin" }, -- Color scheme { "catppuccin/nvim", name = "catppuccin" }, -- Color scheme
{ {
'folke/which-key.nvim', 'folke/which-key.nvim',
config = function() config = function()
@ -27,9 +27,9 @@ require('lazy').setup({
end, end,
}, },
{ 'RRethy/vim-illuminate', }, -- highlight keywords under cursor { 'RRethy/vim-illuminate', }, -- highlight keywords under cursor
{ -- comment { -- comment
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
config = function () config = function()
require('Comment').setup() require('Comment').setup()
end, end,
}, },
@ -69,7 +69,8 @@ require('lazy').setup({
} }
end, end,
-- build process(make environments and add JET.jl) -- build process(make environments and add JET.jl)
build = [[mkdir -p ~/.julia/environments/nvim-null-ls && julia --startup-file=no --project=~/.julia/environments/nvim-null-ls -e 'using Pkg; Pkg.add("JET")']], build =
[[mkdir -p ~/.julia/environments/nvim-null-ls && julia --startup-file=no --project=~/.julia/environments/nvim-null-ls -e 'using Pkg; Pkg.add("JET")']],
-- ft = { 'julia', }, -- ft = { 'julia', },
}, },
{ {
@ -82,14 +83,14 @@ require('lazy').setup({
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
event = "InsertEnter", event = "InsertEnter",
dependencies = { dependencies = {
'hrsh7th/cmp-nvim-lsp', -- LSP 'hrsh7th/cmp-nvim-lsp', -- LSP
'L3MON4D3/LuaSnip', -- snippets 'L3MON4D3/LuaSnip', -- snippets
'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip 'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip
'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words 'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words
'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths 'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths
'hrsh7th/cmp-cmdline', -- command line 'hrsh7th/cmp-cmdline', -- command line
'hrsh7th/cmp-omni', -- source for omnifunc 'hrsh7th/cmp-omni', -- source for omnifunc
'hrsh7th/cmp-nvim-lua', -- nvim lua 'hrsh7th/cmp-nvim-lua', -- nvim lua
'hrsh7th/cmp-nvim-lsp-signature-help', 'hrsh7th/cmp-nvim-lsp-signature-help',
}, },
}, },
@ -110,9 +111,9 @@ require('lazy').setup({
}, },
{ {
"andymass/vim-matchup", "andymass/vim-matchup",
config = function () config = function()
vim.g.matchup_matchparen_offscreen = { method = "popup" } vim.g.matchup_matchparen_offscreen = { method = "popup" }
require'nvim-treesitter.configs'.setup { require 'nvim-treesitter.configs'.setup {
matchup = { matchup = {
enable = true, enable = true,
} }
@ -168,7 +169,7 @@ vim.o.ignorecase = true -- keep signcolumn on
vim.o.smartcase = true vim.o.smartcase = true
vim.o.errorbells = true vim.o.errorbells = true
-- vim.o.visualbell = false -- this is default -- vim.o.visualbell = false -- this is default
vim.opt.undofile = true -- Save undo history vim.opt.undofile = true -- Save undo history
vim.o.completeopt = 'menuone,noselect' -- for better completion experience vim.o.completeopt = 'menuone,noselect' -- for better completion experience
vim.o.termguicolors = true vim.o.termguicolors = true
@ -180,10 +181,13 @@ vim.cmd.colorscheme "catppuccin"
----------------------------------------------------------- -----------------------------------------------------------
-- some terminalmode settings -- some terminalmode settings
vim.keymap.set('t', '<C-w>h', '<C-\\><C-N><C-w>h', { noremap = true, desc = "Exit terminal-mode and move to left window."}) vim.keymap.set('t', '<C-w>h', '<C-\\><C-N><C-w>h',
vim.keymap.set('t', '<C-w>j', '<C-\\><C-N><C-w>j', { noremap = true, desc = "Exit terminal-mode and move to down window."}) { noremap = true, desc = "Exit terminal-mode and move to left window." })
vim.keymap.set('t', '<C-w>k', '<C-\\><C-N><C-w>k', { noremap = true, desc = "Exit terminal-mode and move to up window."}) vim.keymap.set('t', '<C-w>j', '<C-\\><C-N><C-w>j',
vim.keymap.set('t', '<C-w>l', '<C-\\><C-N><C-w>l', { noremap = true, desc = "Exit terminal-mode and move to right window."}) { noremap = true, desc = "Exit terminal-mode and move to down window." })
vim.keymap.set('t', '<C-w>k', '<C-\\><C-N><C-w>k', { noremap = true, desc = "Exit terminal-mode and move to up window." })
vim.keymap.set('t', '<C-w>l', '<C-\\><C-N><C-w>l',
{ noremap = true, desc = "Exit terminal-mode and move to right window." })
----------------------------------------------------------- -----------------------------------------------------------
-- to use PowerShell on Windows -- to use PowerShell on Windows
@ -196,7 +200,8 @@ if vim.fn.has('win32') == 1 then
else else
vim.opt.shell = 'powershell' vim.opt.shell = 'powershell'
end end
vim.opt.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;' vim.opt.shellcmdflag =
'-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait' vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
vim.opt.shellquote = '' vim.opt.shellquote = ''
@ -271,12 +276,12 @@ require('gitsigns').setup {
if vim.wo.diff then return ']c' end if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end) vim.schedule(function() gs.next_hunk() end)
return '<Ignore>' return '<Ignore>'
end, {expr=true}) end, { expr = true })
map('n', '[c', function() map('n', '[c', function()
if vim.wo.diff then return '[c' end if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end) vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>' return '<Ignore>'
end, {expr=true}) end, { expr = true })
end end
} }
@ -303,7 +308,7 @@ parser_config.satysfi = {
} }
-- setup -- setup
require'nvim-treesitter.configs'.setup { require 'nvim-treesitter.configs'.setup {
ensure_installed = { ensure_installed = {
'julia', 'julia',
'satysfi', 'satysfi',
@ -444,7 +449,7 @@ lspconfig.lua_ls.setup {
version = 'LuaJIT', version = 'LuaJIT',
}, },
diagnostics = { diagnostics = {
globals = {'vim'}, globals = { 'vim' },
}, },
workspace = { workspace = {
library = vim.api.nvim_get_runtime_file("", true), library = vim.api.nvim_get_runtime_file("", true),
@ -479,7 +484,7 @@ lspconfig.powershell_es.setup {
-- lspconfig.jetls.setup {} -- lspconfig.jetls.setup {}
-- ccls -- ccls
local lss = {"pyright", "rust_analyzer", "texlab", "ccls", "clangd", "tsserver", --[["tailwindcss"]] "hls", "cmake",} local lss = { "pyright", "rust_analyzer", "texlab", "ccls", "clangd", "tsserver", --[["tailwindcss"]] "hls", "cmake", }
for _, ls in pairs(lss) do for _, ls in pairs(lss) do
lspconfig[ls].setup { lspconfig[ls].setup {
on_attach = on_attach, on_attach = on_attach,
@ -494,7 +499,7 @@ luasnip.config.setup {
enable_autosnippets = true, enable_autosnippets = true,
store_selection_key = "<Tab>", store_selection_key = "<Tab>",
} }
require 'luasnip.loaders.from_lua'.load({paths = './luasnippets'}) require 'luasnip.loaders.from_lua'.load({ paths = './luasnippets' })
cmp.setup { cmp.setup {
snippet = { snippet = {
@ -504,7 +509,7 @@ cmp.setup {
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up ['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down ['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
@ -533,7 +538,7 @@ cmp.setup {
priority_weight = 10, priority_weight = 10,
}, },
sources = { sources = {
{ name = 'luasnip', max_item_count = 10 }, { name = 'luasnip', max_item_count = 10 },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp_signature_help' },
{ name = 'buffer' }, { name = 'buffer' },
@ -551,10 +556,10 @@ cmp.setup {
-- cmdline completions -- cmdline completions
-- `/` cmdline setup. -- `/` cmdline setup.
cmp.setup.cmdline({ '/', '?' }, { cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { sources = {
{ name = 'buffer' } { name = 'buffer' }
} }
}) })
-- ':' -- ':'
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {