Merge branch 'main' of github.com:qwjyh/dotfiles into main

This commit is contained in:
qwjyh 2022-10-23 19:26:23 +09:00
commit 6a388f1b40
18 changed files with 373 additions and 98 deletions

View file

@ -33,6 +33,8 @@ Write-Output "Latest PSReadLine"
Install-Module -Name PSReadLine -Force # Override default version to get the latest one
Write-Output "CompletionPredictor"
Install-Module -Name CompletionPredictor
Write-Output "npm"
Install-Module -Name npm-completion
@ -43,13 +45,16 @@ if(!(Get-Command scoop -ErrorAction SilentlyContinue)) {
}
# install basic scoop apps
# import from exported json file
# to update the json file, execute ./bin/scoop_apps/update_scoop_list.ps1
scoop import .\bin\scoop_apps\scoop_minimal_apps.json
# to update the json file, execute ./bin/windows/scoop_apps/update_scoop_list.ps1
scoop import .\bin\windows\scoop_apps\scoop_minimal_apps.json
# make symbolic links
# neovim
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.vim -Target (Resolve-Path .\dotfiles\neovim\init.vim) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.lua -Target (Resolve-Path .\dotfiles\neovim\init.lua) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\plugins.lua -Target (Resolve-Path .\dotfiles\neovim\lua\plugins.lua) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lualine_setup.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lualine_setup.lua) -Force
New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lsp_client_config.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lsp_client_config.lua) -Force
# pwsh
New-Item -ItemType SymbolicLink -Path $PROFILE -Target (Resolve-Path .\dotfiles\pwsh\powershell_profile.ps1) -Force
New-Item -ItemType SymbolicLink -Path ~\.config\powershell\chezmoi_completion.ps1 -Target (Resolve-Path .\dotfiles\pwsh\chezmoi_completion.ps1) -Force

28
bin/install.sh Normal file → Executable file
View file

@ -1 +1,27 @@
ln -s (pwd)/dotfiles/fish/config.fish ~/.config/fish/config.fish
#!/usr/bin/bash
set -eu
# =========================================================
# check executing location
# =========================================================
if [ ! -d "bin" -a ! -d "dotfiles" ]; then
echo "Wrong execution location"
echo "Please run this script on dotfiles root folder."
exit 1
fi
# =========================================================
# links
# =========================================================
mkdir -p ~/.config/fish
ln -sf $(pwd)/dotfiles/fish/config.fish ~/.config/fish/config.fish
ln -sf $(pwd)/dotfiles/starship/starship.toml ~/.config/starship.toml
ln -sf $(pwd)/dotfiles/tmux.conf ~/.tmux.conf
mkdir -p ~/.config/nvim
ln -sf $(pwd)/dotfiles/neovim/init.lua ~/.config/nvim/init.lua
mkdir -p ~/.config/nvim/lua
ln -sf $(pwd)/dotfiles/neovim/lua/plugins.lua ~/.config/nvim/lua/plugins.lua
ln -sf $(pwd)/dotfiles/neovim/lua/lualine_setup.lua ~/.config/nvim/lua/lualine_setup.lua

5
bin/install_manjaro.sh Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/bash -euo
# alacritty config
ln -sf (pwd)/dotfiles/alacritty.yml ~/.config/alacritty/alacritty.yml

2
bin/install_ubuntu.sh Normal file
View file

@ -0,0 +1,2 @@
#!/usr/bin/bash -euo

29
bin/linux/fisher_plugins.fish Executable file
View file

@ -0,0 +1,29 @@
#!/bin/fish
#==========================================================
# fisher plugin install
#==========================================================
# check fisher existence
if ! type fisher &>/dev/null
echo "fisher does not exist."
echo "Please install fisher from https://github.com/jorgebucaran/fisher"
echo ""
echo "==Automatic install=="
echo "You can run `curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher` right here"
echo "be sure to check install command on the fisher project homepage."
read -p "echo Install\?(default Y / N):\ " ans
if [ $ans = 'N' ]
return 1
end
# install script from github page
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
end
fisher update
# installing packages
fisher install edc/bass
#fisher install jethrokuan/z
fisher install patrickf1/fzf.fish

View file

@ -2,10 +2,10 @@
; mainly for inputting special characters
; Play/Pause
sc121::
Send {Media_Play_Pause}
return
;sc121::
; Send {Media_Play_Pause}
; return
;
; Henkan/Muhenkan + - -> en, em dash
vk1D & vkBD::

View file

@ -57,12 +57,11 @@ vk1C & d::
Send,{Blind}{PgDn}
return
; ==========================================
; include extra key remaps
#Include extra_remaps.ahk
; ==========================================
; HankakuZenkaku to esc
sc029::
Send, {Escape}
; ==========================================
; include extra key remaps
#Include extra_remaps.ahk

85
dotfiles/alacritty.yml Normal file
View file

@ -0,0 +1,85 @@
# Alacritty config file
# Window
window:
decorations: none
opacity: 0.85
# Font
font:
size: 11.0
# Color schemes
schemes:
# Campbell (Windows 10 default)
campbell: &campbell
# Default colors
primary:
background: '#0c0c0c'
foreground: '#cccccc'
# Normal colors
normal:
black: '#0c0c0c'
red: '#c50f1f'
green: '#13a10e'
yellow: '#c19c00'
blue: '#0037da'
magenta: '#881798'
cyan: '#3a96dd'
white: '#cccccc'
# Bright colors
bright:
black: '#767676'
red: '#e74856'
green: '#16c60c'
yellow: '#f9f1a5'
blue: '#3b78ff'
magenta: '#b4009e'
cyan: '#61d6d6'
white: '#f2f2f2'
# Colors (Iceberg Dark)
iceberg_dark: &iceberg_dark
# Default colors
primary:
background: '#161821'
foreground: '#d2d4de'
# Normal colors
normal:
black: '#161821'
red: '#e27878'
green: '#b4be82'
yellow: '#e2a478'
blue: '#84a0c6'
magenta: '#a093c7'
cyan: '#89b8c2'
white: '#c6c8d1'
# Bright colors
bright:
black: '#6b7089'
red: '#e98989'
green: '#c0ca8e'
yellow: '#e9b189'
blue: '#91acd1'
magenta: '#ada0d3'
cyan: '#95c4ce'
white: '#d2d4de'
# Colors (Monokai Dark)
monokai: &iceberg_dark
# startup shell
shell:
program: /usr/bin/tmux
args:
- a
# key bindings
key_bindings:
- { key: Key0, mods: Control, action: ResetFontSize }
- { key: Semicolon, mods: Control, action: IncreaseFontSize }
- { key: Minus, mods: Control, action: DecreaseFontSize }

2
dotfiles/fish/abbr.fish Normal file
View file

@ -0,0 +1,2 @@
abbr -a -U -- l less
abbr -a -U -- ll 'exa -la --icons --git'

View file

@ -16,13 +16,35 @@ if status is-interactive
set -x SHELL bash
# opam
source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true
#source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true
end
# starship
starship init fish | source
function set_win_title
echo -ne "\033]0; (basename "$PWD") \007"
end
set starship_precmd_uesr_func "set_win_title"
# keychain
set -x SHELL fish
keychain --eval --quiet -Q id_rsa, id_ed25519 | source
set -x SHELL bash
# opam
# source ~/.opam/opam-init/init.fish > /dev/null 2> /dev/null; or true
opam env --shell fish | source
# key bindings
bind \b backward-kill-word
# env
set -x LESS '-i -r -M -R -S -W -z-4 -x4'
set -x EDITOR "/usr/bin/nvim"
# save fish log to my custom file
set -gx my_fish_history "$HOME/my_fish_history.txt"
function save_myhistory --on-event fish_prompt -d "Save custom shell log to $my_fish_history"
@ -31,3 +53,7 @@ function save_myhistory --on-event fish_prompt -d "Save custom shell log to $my_
>> $my_fish_history
end
# load local patch
source ~/.config/fish/local_patch.fish

View file

@ -1,9 +1,11 @@
--print("init.lua loaded")
-----------------------------------------------------------
-- basic configurations
vim.o.number = true
vim.o.relativenumber = true
vim.cmd([[
highlight LineNr cterm=none ctermfg=256
highlight LineNr cterm=none ctermfg=243
highlight CursorLineNr cterm=none ctermfg=250
]])
vim.o.tabstop = 4
vim.o.shiftwidth = 4
@ -47,94 +49,108 @@ vim.cmd [[autocmd BufWritePost plugins.lua PackerCompile]]
-- LSP
-- https://zenn.dev/botamotch/articles/21073d78bc68bf
-- 1. LSP Sever management
require('mason').setup()
require('mason-lspconfig').setup_handlers({ function(server)
local opt = {
-- -- Function executed when the LSP server startup
-- on_attach = function(client, bufnr)
-- local opts = { noremap=true, silent=true }
-- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- vim.cmd 'autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 1000)'
-- end,
capabilities = require('cmp_nvim_lsp').update_capabilities(
vim.lsp.protocol.make_client_capabilities()
)
}
require('lspconfig')[server].setup(opt)
end })
-- 2. build-in LSP function
-- keyboard shortcut
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
vim.keymap.set('n', 'gf', '<cmd>lua vim.lsp.buf.formatting()<CR>')
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
vim.keymap.set('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
vim.keymap.set('n', 'gn', '<cmd>lua vim.lsp.buf.rename()<CR>')
vim.keymap.set('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>')
vim.keymap.set('n', 'ge', '<cmd>lua vim.diagnostic.open_float()<CR>')
vim.keymap.set('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>')
vim.keymap.set('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>')
-- LSP handlers
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false }
)
-- Reference highlight
vim.cmd [[
set updatetime=500
highlight LspReferenceText cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
highlight LspReferenceRead cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
highlight LspReferenceWrite cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
augroup lsp_document_highlight
autocmd!
autocmd CursorHold,CursorHoldI * lua vim.lsp.buf.document_highlight()
autocmd CursorMoved,CursorMovedI * lua vim.lsp.buf.clear_references()
augroup END
]]
-- 3. completion (hrsh7th/nvim-cmp)
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
sources = {
{ name = "nvim_lsp" },
-- { name = "buffer" },
-- { name = "path" },
},
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(),
["<CR>"] = cmp.mapping.confirm { select = true },
}),
experimental = {
ghost_text = true,
},
})
-- cmp.setup.cmdline('/', {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = {
-- { name = 'buffer' }
--require('mason').setup()
--require('mason-lspconfig').setup_handlers({ function(server)
-- local opt = {
-- -- -- Function executed when the LSP server startup
-- -- on_attach = function(client, bufnr)
-- -- local opts = { noremap=true, silent=true }
-- -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- -- vim.cmd 'autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 1000)'
-- -- end,
-- capabilities = require('cmp_nvim_lsp').update_capabilities(
-- vim.lsp.protocol.make_client_capabilities()
-- )
-- }
-- })
-- cmp.setup.cmdline(":", {
-- mapping = cmp.mapping.preset.cmdline(),
-- require('lspconfig')[server].setup(opt)
--end })
--
---- 2. build-in LSP function
---- keyboard shortcut
--vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
--vim.keymap.set('n', 'gf', '<cmd>lua vim.lsp.buf.formatting()<CR>')
--vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
--vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
--vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
--vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
--vim.keymap.set('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
--vim.keymap.set('n', 'gn', '<cmd>lua vim.lsp.buf.rename()<CR>')
--vim.keymap.set('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>')
--vim.keymap.set('n', 'ge', '<cmd>lua vim.diagnostic.open_float()<CR>')
--vim.keymap.set('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>')
--vim.keymap.set('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>')
---- LSP handlers
--vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
-- vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false }
--)
---- Reference highlight
--vim.cmd [[
--set updatetime=500
--highlight LspReferenceText cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
--highlight LspReferenceRead cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
--highlight LspReferenceWrite cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040
--augroup lsp_document_highlight
-- autocmd!
-- autocmd CursorHold,CursorHoldI * lua vim.lsp.buf.document_highlight()
-- autocmd CursorMoved,CursorMovedI * lua vim.lsp.buf.clear_references()
--augroup END
--]]
--
---- 3. completion (hrsh7th/nvim-cmp)
--local cmp = require("cmp")
--cmp.setup({
-- snippet = {
-- expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body)
-- end,
-- },
-- sources = {
-- { name = "path" },
-- { name = "cmdline" },
-- { name = "nvim_lsp" },
-- -- { name = "buffer" },
-- -- { name = "path" },
-- },
-- 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(),
-- ["<CR>"] = cmp.mapping.confirm { select = true },
-- }),
-- experimental = {
-- ghost_text = true,
-- },
--})
---- cmp.setup.cmdline('/', {
---- mapping = cmp.mapping.preset.cmdline(),
---- sources = {
---- { name = 'buffer' }
---- }
---- })
---- cmp.setup.cmdline(":", {
---- mapping = cmp.mapping.preset.cmdline(),
---- sources = {
---- { name = "path" },
---- { name = "cmdline" },
---- },
---- })
-- satysfi language server
--require('lspconfig')['satysfi-ls'].setup{
-- autostart = true
--}
-----------------------------------------------------------
-- Ctrl + P to invoke fzf file search
vim.api.nvim_set_keymap('n', '<c-P>',
"<cmd>lua require('fzf-lua').files()<CR>",
{ noremap = true, silent = true })
-----------------------------------------------------------
-- lualine
require('lualine_setup')
lualine = require('lualine')
lualine.setup({
options = { theme = 'iceberg_dark' }
})
lualine.setup()

View file

@ -0,0 +1,20 @@
# https://zenn.dev/monaqa/articles/2021-12-10-satysfi-language-server
local util = require 'lspconfig.util'
return {
default_config = {
cmd = { 'satysfi-language-server' },
filetypes = { 'satysfi' },
root_dir = util.root_pattern('.git'),
single_file_support = true,
},
docs = {
description = [[
https://github.com/monaqa/satysfi-language-server
Language server for SATySFi.
]],
default_config = {
root_dir = [[root_pattern(".git")]],
},
},
}

View file

@ -0,0 +1,40 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '|', right = '|'},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View file

@ -9,6 +9,12 @@ return require('packer').startup(function(use)
--requires = { 'kyazdan142/nvim-web/devicons' } -- not found
}
-- lualine(statusline)
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
-- LSP
use 'neovim/nvim-lspconfig'
use "williamboman/mason.nvim"

View file

@ -31,9 +31,16 @@ Set-Alias whereis where.exe
# starship
# change window name
# save my history
$My_Pwsh_History = "$HOME\my_pwsh_history.txt"
function Invoke-Starship-PreCommand {
# window title
$ParentFolder = Split-Path $PWD -Leaf
$host.ui.Write("`e]0; $ParentFolder `a")
# save log
Write-Output "$(Get-Date -UFormat '+%Y-%m-%d %H:%M:%S') $env:COMPUTERNAME`:$PID [$Global:LASTEXITCODE] $(Get-History -Count 1)"
| Out-File -FilePath $My_Pwsh_History -Append -Encoding utf8
}
Invoke-Expression (&starship init powershell)
$ENV:STARSHIP_CONFIG = "$HOME\.config\starship.toml"
@ -185,3 +192,10 @@ $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# rclone
rclone completion powershell | Out-String | Invoke-Expression
# node
Import-Module npm-completion