Skip to content

Commit

Permalink
use lazy.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
ucpr committed Oct 9, 2024
1 parent d1fdd04 commit aaee2be
Show file tree
Hide file tree
Showing 60 changed files with 1,123 additions and 1,767 deletions.
2 changes: 1 addition & 1 deletion mise/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ go = ['latest']
nodejs = ['latest']
rust = ['latest']
terraform = ['latest']
neovim = ['v0.10.0']
neovim = ['v0.10.2']
128 changes: 0 additions & 128 deletions nvim/dpp.ts

This file was deleted.

21 changes: 6 additions & 15 deletions nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
vim.loader.enable()

require("settings/opts")
require("settings/disable")
require("settings/autocmd")
-- require("settings/usercmd")
require("settings/keymap")
require("plugins/dpp/config")

require("scripts/go_test")
require("scripts/list_loaded_plugins")

vim.cmd [[
filetype plugin on
]]
require("config.lazy")
require("core.disable")
require("core.autocmd")
require("core.options")
require("core.scripts")
require("core.keymap")
47 changes: 47 additions & 0 deletions nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" },
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f94f7ba948e32cd302caba1c2ca3f7c697fb4fcf" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"context_filetype.vim": { "branch": "master", "commit": "7ff5b43fc8d5b274aa19ade5af11e9fa57577ed6" },
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
"denops.vim": { "branch": "main", "commit": "ce5d290493b29968fd3afa4c1190ea27a876861d" },
"friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
"gitlinker.nvim": { "branch": "master", "commit": "a221c13fc3c7f5b8799933f4966ee8e618287292" },
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
"guise.vim": { "branch": "main", "commit": "1759cc936583490af76c36e0a25546329b2b9921" },
"hlargs.nvim": { "branch": "main", "commit": "53ec5d8ca6ed012de5545ba83ea1eb3d636b09fb" },
"hlchunk.nvim": { "branch": "main", "commit": "ba6e2347177fec8ec6af4ae26d11a468c9e0ca72" },
"lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" },
"lexima.vim": { "branch": "master", "commit": "5513d686801993b40c55baa65602f79cd3cf3c77" },
"lspkind.nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-hlslens": { "branch": "main", "commit": "07afd4dd14405ad14b142a501a3abea6ae44b21b" },
"nvim-lspconfig": { "branch": "master", "commit": "d3f169f436e1b44538bfe7e13b4721eec48dbc59" },
"nvim-treesitter": { "branch": "master", "commit": "9d2acd49976e2a9da72949008df03436f781fd23" },
"nvim-treesitter-context": { "branch": "master", "commit": "78a81c7494e7d1a08dd1200b556933e513fd9f29" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-web-devicons": { "branch": "master", "commit": "56f17def81478e406e3a8ec4aa727558e79786f3" },
"oil.nvim": { "branch": "master", "commit": "ccab9d5e09e2d0042fbbe5b6bd05e82426247067" },
"onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"quick-scope": { "branch": "master", "commit": "4d35d3b2bc6794666353dcc241b2680bd560416f" },
"spelunker.vim": { "branch": "master", "commit": "a0bc530f62798bbe053905555a4aa9ed713485eb" },
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"traces.vim": { "branch": "master", "commit": "9663fcf84de5776bee71b6c816c25ccb6ea11d1a" },
"vim-go-coverage": { "branch": "master", "commit": "d9b0c9f89fa5424db997c81e501fa2fd62628acd" },
"vim-goaddtags": { "branch": "master", "commit": "18cfa47cbcd9a8da9d022f0cd2f9f4075a1a7ae0" },
"vim-goimpl": { "branch": "master", "commit": "a18ec88cf5e8c4bd3177206416bc6fbd3c126a45" },
"vim-goimports": { "branch": "master", "commit": "e50dae830c3cc405003bbc79e90c2dfb5c8da7f5" },
"vim-gomod": { "branch": "main", "commit": "d6e736037290f08cf99296cb0407f22456022f48" },
"vim-smartword": { "branch": "master", "commit": "608d4883bb1eff4131f44857a21119220e55886d" },
"winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" }
}
35 changes: 35 additions & 0 deletions nvim/lua/config/lazy.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)

-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"

-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions nvim/lua/settings/keymap.lua → nvim/lua/core/keymap.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--
vim.keymap.set("n", "<C-q>", ":<C-u>q!<CR>")

-- buffer
Expand All @@ -24,5 +23,6 @@ vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
-- custom script
vim.keymap.set("n", "got", ":<C-u>lua go_test()<CR>")

-- vim-smartword
vim.keymap.set("n", "w", "<Plug>(smartword-w)")
-- user command
vim.api.nvim_create_user_command("Sterm", function() vim.cmd(":split | resize 20 | term ") end, {})
vim.api.nvim_create_user_command("Vterm", function() vim.cmd [[ :vsplit | term ]] end, {})
12 changes: 7 additions & 5 deletions nvim/lua/settings/opts.lua → nvim/lua/core/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local options = {
encoding = "utf-8",
fileencodings = "utf-8,iso-2022-jp,cp932,sjis,euc-jpset",
fencs = "utf-8,iso-2022-jp,enc-jp,cp932",

-- etc
confirm = true,
hidden = true,
Expand All @@ -16,6 +17,7 @@ local options = {
mouse = "a",
-- pastetoggle = "<F5>",
helplang = "ja",

-- theme
spell = false, -- spelunker.vim を使うためfalseにする
title = false,
Expand All @@ -35,7 +37,7 @@ local options = {
cmdheight = 0,
laststatus = 2,
showtabline = 2,
statusline = '%f %y%m %r%h%w%=[%{&fileencoding!=""?&fileencoding:&encoding},%{&ff}] [Pos %02l,%02c] [%p%%/%L]',
-- statusline = '%f %y%m %r%h%w%=[%{&fileencoding!=""?&fileencoding:&encoding},%{&ff}] [Pos %02l,%02c] [%p%%/%L]',
-- pumblend = 30,
winblend = 5,
-- syntax
Expand All @@ -58,7 +60,7 @@ for k, v in pairs(options) do
end

-- cmdline.vim でこれを入れていないと statusline の下のコマンドでも cursor が動き回る
vim.cmd [[
set guicursor=n-v-c-sm:block-Cursor
set guicursor+=i:ver25-CursorInsert
]]
-- vim.cmd [[
-- set guicursor=n-v-c-sm:block-Cursor
-- set guicursor+=i:ver25-CursorInsert
-- ]]
2 changes: 0 additions & 2 deletions nvim/lua/scripts/go_test.lua → nvim/lua/core/scripts.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
vim.keymap.set("n", "got", ":<C-u>lua go_test()<CR>")

local function get_split_window_type()
local id = vim.fn.win_getid()
local width = vim.fn.winwidth(id)
Expand Down
81 changes: 81 additions & 0 deletions nvim/lua/plugins/cmp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-buffer", -- source for text in buffer
"hrsh7th/cmp-path", -- source for file system paths
{
"L3MON4D3/LuaSnip",
version = "v2.*",
-- install jsregexp (optional!).
build = "make install_jsregexp",
},
"hrsh7th/cmp-nvim-lsp-document-symbol",
"hrsh7th/cmp-nvim-lsp-signature-help",
"rafamadriz/friendly-snippets",
"onsails/lspkind.nvim", -- vs-code like pictograms
},
config = function()
local cmp = require("cmp")
local lspkind = require("lspkind")
local luasnip = require("luasnip")

local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end

require("luasnip.loaders.from_vscode").lazy_load()

cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
['<C-l>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
["<CR>"] = cmp.mapping.confirm { select = true },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
}),
experimental = {
ghost_text = true,
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
})

vim.cmd([[
set completeopt=menuone,noinsert,noselect
highlight! default link CmpItemKind CmpItemMenuDefault
]])
end,
}
Loading

0 comments on commit aaee2be

Please sign in to comment.