Skip to content

Commit

Permalink
Update nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
y011d4 committed Oct 19, 2023
1 parent 8bfc23d commit ae94baa
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 52 deletions.
117 changes: 81 additions & 36 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
-- https://blog.atusy.net/2022/12/16/impatient-nvim/
-- impatient.nvimのクローン先をruntimepathに追加し、`require`で読めるようにする
-- vim.opt.runtimepath:append(vim.fn.stdpath('data') .. '/site/pack/jetpack/src/github.com/lewis6991/impatient.nvim')
vim.opt.runtimepath:append(vim.fn.stdpath('data') .. '/lazy/impatient.nvim')
vim.opt.runtimepath:append(vim.fn.stdpath("data") .. "/lazy/impatient.nvim")
-- impatient.nvimが読み込める場合のみ最適化する
local ok, impatient = pcall(require, 'impatient')
local ok, impatient = pcall(require, "impatient")
if ok then
impatient.enable_profile()
impatient.enable_profile()
else
-- vim.notify(tostring(ok), vim.log.levels.ERROR)
vim.notify("cache is not loaded", vim.log.levels.ERROR)
-- vim.notify(tostring(ok), vim.log.levels.ERROR)
vim.notify("cache is not loaded", vim.log.levels.ERROR)
end

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)

Expand All @@ -43,40 +43,85 @@ vim.opt.rtp:prepend(lazypath)
-- vim.g["loaded_zipPlugin"] = 1
-- vim.g["skip_loading_mswin"] = 1


require('plugins')
require("plugins")
-- require('coc')
require('keymap')
require("keymap")

local options = {
clipboard = "unnamedplus",
--set clipboard=unnamedplus,autoselect "クリップボード
mouse = "a", --マウスを全モードで有効化
-- clipboard = "unnamedplus", -- 起動が遅くなるので代わりに lazy に設定するようにしている
mouse = "a", --マウスを全モードで有効化

expandtab = true, --タブ入力を複数の空白入力に置き換える
tabstop = 4, --画面上でタブ文字が占める幅
shiftwidth = 2, --自動インデントでずれる幅
softtabstop = 2, --連続した空白に対してタブキーやバックスペースキーでカーソルが動く幅
autoindent = true, --改行時に前の行のインデントを継続する
smartindent = true, --改行時に入力された行の末尾に合わせて次の行のインデントを増減する
number = true, --行番号を表示する
title = true, --編集中のファイル名を表示
showmatch = true, --?
expandtab = true, --タブ入力を複数の空白入力に置き換える
tabstop = 4, --画面上でタブ文字が占める幅
shiftwidth = 2, --自動インデントでずれる幅
softtabstop = 2, --連続した空白に対してタブキーやバックスペースキーでカーソルが動く幅
autoindent = true, --改行時に前の行のインデントを継続する
smartindent = true, --改行時に入力された行の末尾に合わせて次の行のインデントを増減する
number = true, --行番号を表示する
title = true, --編集中のファイル名を表示
showmatch = true, --?

wrapscan = true, --検索時に最後まで行ったら最初に戻る
wrap = true,
wrapscan = true, --検索時に最後まで行ったら最初に戻る
wrap = true,

swapfile = false, --swap file is not created
autoread = true, --vim automatically reload when saved in other action
list = true, --invisible character is displayed
swapfile = false, --swap file is not created
autoread = true, --vim automatically reload when saved in other action
list = true, --invisible character is displayed
}

for k, v in pairs(options) do
vim.opt[k] = v
vim.opt[k] = v
end

-- vim.opt.clipboard = "unnamedplus" をすると起動が遅いので必要になったときに clipboard のロードをする設定をかく
-- https://www.reddit.com/r/neovim/comments/1293o2y/vimoptclipboard_unnamedplus_is_very_slow/
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
once = true,
callback = function()
print(123345667)
if vim.fn.has("win32") == 1 or vim.fn.has("wsl") == 1 then
vim.g.clipboard = {
copy = {
["+"] = "win32yank.exe -i --crlf",
["*"] = "win32yank.exe -i --crlf",
},
paste = {
["+"] = "win32yank.exe -o --lf",
["*"] = "win32yank.exe -o --lf",
},
}
elseif vim.fn.has("unix") == 1 then
if vim.fn.executable("xclip") == 1 then
vim.g.clipboard = {
copy = {
["+"] = "xclip -selection clipboard",
["*"] = "xclip -selection clipboard",
},
paste = {
["+"] = "xclip -selection clipboard -o",
["*"] = "xclip -selection clipboard -o",
},
}
elseif vim.fn.executable("xsel") == 1 then
vim.g.clipboard = {
copy = {
["+"] = "xsel --clipboard --input",
["*"] = "xsel --clipboard --input",
},
paste = {
["+"] = "xsel --clipboard --output",
["*"] = "xsel --clipboard --output",
},
}
end
end

vim.opt.clipboard = "unnamedplus"
end,
desc = "Lazy load clipboard",
})

vim.cmd[[
vim.cmd([[
syntax on "コードの色分け
au BufRead,BufNewFile *.md set filetype=markdown
Expand All @@ -99,4 +144,4 @@ set cursorcolumn
let g:python3_host_prog = '/usr/bin/python'
let g:python_host_prog = '/home/y011d4/.virtualenvs/python2-env/bin/python'
]]
]])
3 changes: 2 additions & 1 deletion .config/nvim/lua/mason-lspconfig-setting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ require("neodev").setup({
})
require('mason').setup()
require('mason-lspconfig').setup {
ensure_installed = { "sumneko_lua", "rust_analyzer", "gopls", "tsserver", "pylsp" }
-- ensure_installed = { "sumneko_lua", "rust_analyzer", "gopls", "tsserver", "pylsp" }
ensure_installed = { "lua_ls", "rust_analyzer", "gopls", "tsserver", "pylsp" }
}
require('mason-lspconfig').setup_handlers({ function(server)
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
Expand Down
35 changes: 20 additions & 15 deletions .config/nvim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ require("lazy").setup({
-- file を探したり文字列検索したり
{
"nvim-telescope/telescope.nvim",
tag = "0.1.0",
tag = "0.1.4",
dependencies = {
"nvim-lua/plenary.nvim",
},
Expand Down Expand Up @@ -307,7 +307,7 @@ require("lazy").setup({
lazy = false,
dependencies = {
{ "folke/neodev.nvim", config = true },
"y011d4/mason.nvim",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
},
Expand All @@ -324,9 +324,9 @@ require("lazy").setup({
},
-- LSP サーバーを UI からインストールできる
{
-- 'williamboman/mason.nvim',
"y011d4/mason.nvim",
branch = "feature/add-pysen",
'williamboman/mason.nvim',
-- "y011d4/mason.nvim",
-- branch = "feature/add-pysen",
},
-- mason でいれた LSP サーバー経由で設定
{
Expand All @@ -336,7 +336,7 @@ require("lazy").setup({
require("mason-lspconfig-setting")
end,
dependencies = {
"y011d4/mason.nvim",
"williamboman/mason.nvim",
"folke/neodev.nvim",
},
},
Expand Down Expand Up @@ -474,9 +474,9 @@ require("lazy").setup({
-- 'airblade/vim-gitgutter',
-- linter や formatter のために使用
{
-- "jose-elias-alvarez/null-ls.nvim",
"y011d4/null-ls.nvim",
branch = "feature/add-pysen",
"jose-elias-alvarez/null-ls.nvim",
-- "y011d4/null-ls.nvim",
-- branch = "feature/add-pysen",
dependencies = {
"nvim-lua/plenary.nvim",
},
Expand Down Expand Up @@ -566,6 +566,7 @@ require("lazy").setup({
-- 右下に LSP の状態を表示
{
"j-hui/fidget.nvim",
tag = "legacy",
lazy = true,
event = "VeryLazy",
config = function()
Expand Down Expand Up @@ -595,13 +596,13 @@ require("lazy").setup({
end,
},
-- notification を右上に表示
{
--[[ {
"rcarriga/nvim-notify",
lazy = false,
config = function()
vim.notify = require("notify")
end,
},
}, ]]
-- nvim 読み込み時の cache を作り、起動を高速化する
{
"lewis6991/impatient.nvim",
Expand All @@ -625,12 +626,12 @@ require("lazy").setup({
{
"jay-babu/mason-null-ls.nvim",
dependencies = {
"y011d4/mason.nvim",
"y011d4/null-ls.nvim",
"williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim",
},
},
-- cmdline やエラー表示がいい感じに
{
--[[ {
"folke/noice.nvim",
lazy = false,
event = { "BufRead", "BufNewFile", "InsertEnter", "CmdlineEnter" },
Expand All @@ -645,7 +646,7 @@ require("lazy").setup({
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
},
}, ]]
-- dap
{
"mfussenegger/nvim-dap",
Expand Down Expand Up @@ -821,4 +822,8 @@ require("lazy").setup({
require("refactoring-setting")
end,
},
{
"alaviss/tree-sitter-nim",
dependencies = "nvim-treesitter/nvim-treesitter",
},
})
9 changes: 9 additions & 0 deletions .config/nvim/lua/treesitter-setting.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-- https://github.com/aMOPel/tree-sitter-nim/issues/20
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
parser_configs.nim = {
install_info = {
url = "~/.local/share/nvim/lazy/tree-sitter-nim", -- or where ever you cloned the repo to
files = { "src/parser.c", "src/scanner.cc"}
},
}

require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "c", "lua", "rust", "bash", "dockerfile", "css", "cmake", "diff", "go", "html", "http", "java",
Expand Down

0 comments on commit ae94baa

Please sign in to comment.