feat: update vim

This commit is contained in:
Tosone committed 2023-05-01 23:12:21 +08:00
1 parent be74db1ac6
commit 5ec3f21f8b
27 files changed
+2675 -160

No files matched your search

+1
View File
@@ -1 +1,2 @@
bin/
dist/
+1 -1
View File
@@ -1,4 +1,4 @@
FROM golang:1.18-bullseye as builder
FROM golang:1.19-bullseye as builder
WORKDIR /go/src/code.byted.org/infcp/vecps
+2 -2
View File
@@ -12,9 +12,9 @@ docker build -t vecps:ktctl-v0.1.0 --build-arg KTCTL_VERSION=${version} .
clean_up
docker run -i --rm -v $PWD/out:/out vecps:ktctl-v0.1.0 /bin/sh <<EOF
docker run -i --rm -v "$PWD"/out:/out vecps:ktctl-v0.1.0 /bin/sh <<EOF
mkdir -p /out
cp -r /app/kt-connect/bin/* /out/
EOF
sudo chown -R $(id -u):$(id -g) out
sudo chown -R "$(id -u)":"$(id -g)" out
+3 -3
View File
@@ -1,6 +1,6 @@
#!/bin/bash
version=RELEASE.2023-02-28T00-12-59Z
version=RELEASE.2023-04-12T02-21-51Z
clean_up () {
if [ -d out ]; then
@@ -12,9 +12,9 @@ docker build -t vecps:mc-v0.1.0 --build-arg MC_VERSION=${version} .
clean_up
docker run -i --rm -v $PWD/out:/out vecps:mc-v0.1.0 /bin/sh <<EOF
docker run -i --rm -v "$PWD"/out:/out vecps:mc-v0.1.0 /bin/sh <<EOF
mkdir -p /out
cp -r /app/mc/bin/* /out/
EOF
sudo chown -R $(id -u):$(id -g) out
sudo chown -R "$(id -u)":"$(id -g)" out
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
version=7.0.10
version=7.0.11
clean_up () {
if [ -d redis ]; then
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
version=9.0.0063
version=9.0.1503
clean_up () {
if [ -d vim ]; then
+5 -5
View File
@@ -6,18 +6,18 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z
//go:generate wget -c -q -O mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate shasum -a 256 -c mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate wget -c -q -O mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z
//go:generate wget -c -q -O mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:generate shasum -a 256 -c mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:embed mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z
//go:embed mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mc-darwin-amd64-RELEASE.2023-01-11T03-14-16Z",
Filename: "mc-darwin-amd64-RELEASE.2023-04-12T02-21-51Z",
Core: "mc",
}
if err = archive.Save(); err != nil {
+5 -5
View File
@@ -6,18 +6,18 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z
//go:generate wget -c -q -O mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate shasum -a 256 -c mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate wget -c -q -O mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z
//go:generate wget -c -q -O mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:generate shasum -a 256 -c mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:embed mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z
//go:embed mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mc-darwin-arm64-RELEASE.2023-01-11T03-14-16Z",
Filename: "mc-darwin-arm64-RELEASE.2023-04-12T02-21-51Z",
Core: "mc",
}
if err = archive.Save(); err != nil {
+5 -5
View File
@@ -6,18 +6,18 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z
//go:generate wget -c -q -O mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate shasum -a 256 -c mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate wget -c -q -O mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z
//go:generate wget -c -q -O mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:generate shasum -a 256 -c mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:embed mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z
//go:embed mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mc-linux-amd64-RELEASE.2023-01-11T03-14-16Z",
Filename: "mc-linux-amd64-RELEASE.2023-04-12T02-21-51Z",
Core: "mc",
}
if err = archive.Save(); err != nil {
+5 -5
View File
@@ -6,18 +6,18 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z
//go:generate wget -c -q -O mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate shasum -a 256 -c mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z.sha256
//go:generate wget -c -q -O mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z
//go:generate wget -c -q -O mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z.sha256 https://fs.tosone.cn/vecps-cli/addons/mc/mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:generate shasum -a 256 -c mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z.sha256
//go:embed mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z
//go:embed mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mc-linux-arm64-RELEASE.2023-01-11T03-14-16Z",
Filename: "mc-linux-arm64-RELEASE.2023-04-12T02-21-51Z",
Core: "mc",
}
if err = archive.Save(); err != nil {
@@ -6,19 +6,19 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mongosh-1.8.1-darwin-x64.zip https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-darwin-x64.zip
//go:generate wget -c -q -O mongosh-1.8.1-darwin-x64.zip.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-darwin-x64.zip.sha256
//go:generate shasum -a 256 -c mongosh-1.8.1-darwin-x64.zip.sha256
//go:generate wget -c -q -O mongosh-1.8.2-darwin-x64.zip https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-darwin-x64.zip
//go:generate wget -c -q -O mongosh-1.8.2-darwin-x64.zip.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-darwin-x64.zip.sha256
//go:generate shasum -a 256 -c mongosh-1.8.2-darwin-x64.zip.sha256
//go:embed mongosh-1.8.1-darwin-x64.zip
//go:embed mongosh-1.8.2-darwin-x64.zip
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mongosh-1.8.1-darwin-x64.zip",
Core: "mongosh-1.8.1-darwin-x64/bin/mongosh",
Filename: "mongosh-1.8.2-darwin-x64.zip",
Core: "mongosh-1.8.2-darwin-x64/bin/mongosh",
}
if err = archive.Dump(); err != nil {
return
@@ -6,19 +6,19 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mongosh-1.8.1-darwin-arm64.zip https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-darwin-arm64.zip
//go:generate wget -c -q -O mongosh-1.8.1-darwin-arm64.zip.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-darwin-arm64.zip.sha256
//go:generate shasum -a 256 -c mongosh-1.8.1-darwin-arm64.zip.sha256
//go:generate wget -c -q -O mongosh-1.8.2-darwin-arm64.zip https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-darwin-arm64.zip
//go:generate wget -c -q -O mongosh-1.8.2-darwin-arm64.zip.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-darwin-arm64.zip.sha256
//go:generate shasum -a 256 -c mongosh-1.8.2-darwin-arm64.zip.sha256
//go:embed mongosh-1.8.1-darwin-arm64.zip
//go:embed mongosh-1.8.2-darwin-arm64.zip
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mongosh-1.8.1-darwin-arm64.zip",
Core: "mongosh-1.8.1-darwin-arm64/bin/mongosh",
Filename: "mongosh-1.8.2-darwin-arm64.zip",
Core: "mongosh-1.8.2-darwin-arm64/bin/mongosh",
}
if err = archive.Dump(); err != nil {
return
@@ -6,19 +6,19 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mongosh-1.8.1-linux-x64.tgz https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-linux-x64.tgz
//go:generate wget -c -q -O mongosh-1.8.1-linux-x64.tgz.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-linux-x64.tgz.sha256
//go:generate shasum -a 256 -c mongosh-1.8.1-linux-x64.tgz.sha256
//go:generate wget -c -q -O mongosh-1.8.2-linux-x64.tgz https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-linux-x64.tgz
//go:generate wget -c -q -O mongosh-1.8.2-linux-x64.tgz.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-linux-x64.tgz.sha256
//go:generate shasum -a 256 -c mongosh-1.8.2-linux-x64.tgz.sha256
//go:embed mongosh-1.8.1-linux-x64.tgz
//go:embed mongosh-1.8.2-linux-x64.tgz
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mongosh-1.8.1-linux-x64.tgz",
Core: "mongosh-1.8.1-linux-x64/bin/mongosh",
Filename: "mongosh-1.8.2-linux-x64.tgz",
Core: "mongosh-1.8.2-linux-x64/bin/mongosh",
}
if err = archive.Dump(); err != nil {
return
@@ -6,19 +6,19 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O mongosh-1.8.1-linux-arm64.tgz https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-linux-arm64.tgz
//go:generate wget -c -q -O mongosh-1.8.1-linux-arm64.tgz.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.1-linux-arm64.tgz.sha256
//go:generate shasum -a 256 -c mongosh-1.8.1-linux-arm64.tgz.sha256
//go:generate wget -c -q -O mongosh-1.8.2-linux-arm64.tgz https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-linux-arm64.tgz
//go:generate wget -c -q -O mongosh-1.8.2-linux-arm64.tgz.sha256 https://fs.tosone.cn/vecps-cli/addons/mongosh/mongosh-1.8.2-linux-arm64.tgz.sha256
//go:generate shasum -a 256 -c mongosh-1.8.2-linux-arm64.tgz.sha256
//go:embed mongosh-1.8.1-linux-arm64.tgz
//go:embed mongosh-1.8.2-linux-arm64.tgz
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "mongosh-1.8.1-linux-arm64.tgz",
Core: "mongosh-1.8.1-linux-arm64/bin/mongosh",
Filename: "mongosh-1.8.2-linux-arm64.tgz",
Core: "mongosh-1.8.2-linux-arm64/bin/mongosh",
}
if err = archive.Dump(); err != nil {
return
+14 -10
View File
@@ -8,6 +8,7 @@ import (
"path"
"code.byted.org/infcp/vecps-cli/internal/addons"
"code.byted.org/infcp/vecps-cli/pkg/util"
)
func init() {
@@ -31,31 +32,34 @@ func initConfig() error {
return err
}
home = fmt.Sprintf("%s/.config/nushell", home)
contentConfig, err := dataConfig.Open(configFilename)
if !util.IsDir(home) {
err = os.MkdirAll(home, os.ModePerm)
if err != nil {
return err
}
}
fileNuConfig, err := dataConfig.Open(configFilename)
if err != nil {
return err
}
target := path.Join(home, configFilename)
fileConfig, err := os.Create(target)
contentConfig, err := io.ReadAll(fileNuConfig)
if err != nil {
return err
}
defer fileConfig.Close() // nolint: errcheck
_, err = io.Copy(fileConfig, contentConfig)
err = util.RewriteFile(path.Join(home, configFilename), contentConfig)
if err != nil {
return err
}
contentEnv, err := dataEnv.Open(envFilename)
fileNuEnv, err := dataEnv.Open(envFilename)
if err != nil {
return err
}
target = path.Join(home, envFilename)
fileEnv, err := os.Create(target)
contentEnv, err := io.ReadAll(fileNuEnv)
if err != nil {
return err
}
defer fileEnv.Close() // nolint: errcheck
_, err = io.Copy(fileEnv, contentEnv)
err = util.RewriteFile(path.Join(home, envFilename), contentEnv)
if err != nil {
return err
}
+5 -5
View File
@@ -7,18 +7,18 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O redis-linux-amd64-7.0.10.tar.gz https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-amd64-7.0.10.tar.gz
//go:generate wget -c -q -O redis-linux-amd64-7.0.10.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-amd64-7.0.10.tar.gz.sha256
//go:generate shasum -a 256 -c redis-linux-amd64-7.0.10.tar.gz.sha256
//go:generate wget -c -q -O redis-linux-amd64-7.0.11.tar.gz https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-amd64-7.0.11.tar.gz
//go:generate wget -c -q -O redis-linux-amd64-7.0.11.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-amd64-7.0.11.tar.gz.sha256
//go:generate shasum -a 256 -c redis-linux-amd64-7.0.11.tar.gz.sha256
//go:embed redis-linux-amd64-7.0.10.tar.gz
//go:embed redis-linux-amd64-7.0.11.tar.gz
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "redis-linux-amd64-7.0.10.tar.gz",
Filename: "redis-linux-amd64-7.0.11.tar.gz",
Core: "redis/",
}
if err = archive.Dump(); err != nil {
+5 -5
View File
@@ -7,18 +7,18 @@ import (
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O redis-linux-arm64-7.0.10.tar.gz https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-arm64-7.0.10.tar.gz
//go:generate wget -c -q -O redis-linux-arm64-7.0.10.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-arm64-7.0.10.tar.gz.sha256
//go:generate shasum -a 256 -c redis-linux-arm64-7.0.10.tar.gz.sha256
//go:generate wget -c -q -O redis-linux-arm64-7.0.11.tar.gz https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-arm64-7.0.11.tar.gz
//go:generate wget -c -q -O redis-linux-arm64-7.0.11.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/redis/redis-linux-arm64-7.0.11.tar.gz.sha256
//go:generate shasum -a 256 -c redis-linux-arm64-7.0.11.tar.gz.sha256
//go:embed redis-linux-arm64-7.0.10.tar.gz
//go:embed redis-linux-arm64-7.0.11.tar.gz
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "redis-linux-arm64-7.0.10.tar.gz",
Filename: "redis-linux-arm64-7.0.11.tar.gz",
Core: "redis/",
}
if err = archive.Dump(); err != nil {
+1
View File
@@ -0,0 +1 @@
!plugins.tar.gz
File diff suppressed because it is too large. Load diff
+466
View File
@@ -0,0 +1,466 @@
# : << EOF
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- session creation ----------------------------------------------------------
# prompt for session name when creating a new session, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-session bindings)
tmux_conf_new_session_prompt=false
# -- windows & pane creation ---------------------------------------------------
# new window retains current path, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_retain_current_path=true
# new window tries to reconnect ssh sessions, possible values are:
# - true
# - false (default)
# - disabled (do not modify new-window bindings)
tmux_conf_new_window_reconnect_ssh=false
# new pane retains current path, possible values are:
# - true (default)
# - false
# - disabled (do not modify split-window bindings)
tmux_conf_new_pane_retain_current_path=true
# new pane tries to reconnect ssh sessions, possible values are:
# - true
# - false (default)
# - disabled (do not modify split-window bindings)
tmux_conf_new_pane_reconnect_ssh=false
# -- display -------------------------------------------------------------------
# RGB 24-bit colour support, possible values are:
# - true
# - false
# - auto (default)
#
# automatic detection relies on the COLORTERM environment variable being defined
# to 'truecolor' or '24bit' or '$ tput colors' answering '16777216'
# see https://github.com/termstandard/colors
tmux_conf_24b_colour=auto
# -- theming -------------------------------------------------------------------
# enable or disable theming:
# - enabled (default)
# - disabled
# when disabled, all tmux_conf_theme_xxx variables are ignored except:
# - tmux_conf_theme_pairing
# - tmux_conf_theme_prefix
# - tmux_conf_theme_mouse
# - tmux_conf_theme_root
# - tmux_conf_theme_synchronized
tmux_conf_theme=enabled
# default theme
tmux_conf_theme_colour_1="#080808" # dark gray
tmux_conf_theme_colour_2="#303030" # gray
tmux_conf_theme_colour_3="#8a8a8a" # light gray
tmux_conf_theme_colour_4="#00afff" # light blue
tmux_conf_theme_colour_5="#ffff00" # yellow
tmux_conf_theme_colour_6="#080808" # dark gray
tmux_conf_theme_colour_7="#e4e4e4" # white
tmux_conf_theme_colour_8="#080808" # dark gray
tmux_conf_theme_colour_9="#ffff00" # yellow
tmux_conf_theme_colour_10="#ff00af" # pink
tmux_conf_theme_colour_11="#5fff00" # green
tmux_conf_theme_colour_12="#8a8a8a" # light gray
tmux_conf_theme_colour_13="#e4e4e4" # white
tmux_conf_theme_colour_14="#080808" # dark gray
tmux_conf_theme_colour_15="#080808" # dark gray
tmux_conf_theme_colour_16="#d70000" # red
tmux_conf_theme_colour_17="#e4e4e4" # white
# default theme (ansi)
#tmux_conf_theme_colour_1="colour0"
#tmux_conf_theme_colour_2="colour8"
#tmux_conf_theme_colour_3="colour8"
#tmux_conf_theme_colour_4="colour14"
#tmux_conf_theme_colour_5="colour11"
#tmux_conf_theme_colour_6="colour0"
#tmux_conf_theme_colour_7="colour15"
#tmux_conf_theme_colour_8="colour0"
#tmux_conf_theme_colour_9="colour11"
#tmux_conf_theme_colour_10="colour13"
#tmux_conf_theme_colour_11="colour10"
#tmux_conf_theme_colour_12="colour8"
#tmux_conf_theme_colour_13="colour15"
#tmux_conf_theme_colour_14="colour0"
#tmux_conf_theme_colour_15="colour0"
#tmux_conf_theme_colour_16="colour1"
#tmux_conf_theme_colour_17="colour15"
# window style
tmux_conf_theme_window_fg="default"
tmux_conf_theme_window_bg="default"
# highlight focused pane, possible values are:
# - true
# - false (default)
tmux_conf_theme_highlight_focused_pane=false
# focused pane colours:
tmux_conf_theme_focused_pane_bg="$tmux_conf_theme_colour_1"
# pane border style, possible values are:
# - thin (default)
# - fat
tmux_conf_theme_pane_border_style=thin
# pane borders colours:
tmux_conf_theme_pane_border="$tmux_conf_theme_colour_2"
tmux_conf_theme_pane_active_border="$tmux_conf_theme_colour_4"
%if #{>=:#{version},3.2}
tmux_conf_theme_pane_active_border="#{?pane_in_mode,$tmux_conf_theme_colour_9,#{?synchronize-panes,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_4}}"
%endif
# pane indicator colours (when you hit <prefix> + q)
tmux_conf_theme_pane_indicator="$tmux_conf_theme_colour_4"
tmux_conf_theme_pane_active_indicator="$tmux_conf_theme_colour_4"
# status line style
tmux_conf_theme_message_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_message_bg="$tmux_conf_theme_colour_5"
tmux_conf_theme_message_attr="bold"
# status line command style (<prefix> : Escape)
tmux_conf_theme_message_command_fg="$tmux_conf_theme_colour_5"
tmux_conf_theme_message_command_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_message_command_attr="bold"
# window modes style
tmux_conf_theme_mode_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_mode_bg="$tmux_conf_theme_colour_5"
tmux_conf_theme_mode_attr="bold"
# status line style
tmux_conf_theme_status_fg="$tmux_conf_theme_colour_3"
tmux_conf_theme_status_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_status_attr="none"
# terminal title
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_terminal_title="#h ❐ #S ● #I #W"
# window status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_fg="$tmux_conf_theme_colour_3"
tmux_conf_theme_window_status_bg="$tmux_conf_theme_colour_1"
tmux_conf_theme_window_status_attr="none"
tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window current status style
# - built-in variables are:
# - #{circled_window_index}
# - #{circled_session_name}
# - #{hostname}
# - #{hostname_ssh}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{username}
# - #{username_ssh}
tmux_conf_theme_window_status_current_fg="$tmux_conf_theme_colour_1"
tmux_conf_theme_window_status_current_bg="$tmux_conf_theme_colour_4"
tmux_conf_theme_window_status_current_attr="bold"
tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window activity status style
tmux_conf_theme_window_status_activity_fg="default"
tmux_conf_theme_window_status_activity_bg="default"
tmux_conf_theme_window_status_activity_attr="underscore"
# window bell status style
tmux_conf_theme_window_status_bell_fg="$tmux_conf_theme_colour_5"
tmux_conf_theme_window_status_bell_bg="default"
tmux_conf_theme_window_status_bell_attr="blink,bold"
# window last status style
tmux_conf_theme_window_status_last_fg="$tmux_conf_theme_colour_4"
tmux_conf_theme_window_status_last_bg="$tmux_conf_theme_colour_2"
tmux_conf_theme_window_status_last_attr="none"
# status left/right sections separators
tmux_conf_theme_left_separator_main=""
tmux_conf_theme_left_separator_sub="|"
tmux_conf_theme_right_separator_main=""
tmux_conf_theme_right_separator_sub="|"
#tmux_conf_theme_left_separator_main='\uE0B0' # /!\ you don't need to install Powerline
#tmux_conf_theme_left_separator_sub='\uE0B1' # you only need fonts patched with
#tmux_conf_theme_right_separator_main='\uE0B2' # Powerline symbols or the standalone
#tmux_conf_theme_right_separator_sub='\uE0B3' # PowerlineSymbols.otf font, see README.md
# status left/right content:
# - separate main sections with "|"
# - separate subsections with ","
# - built-in variables are:
# - #{battery_bar}
# - #{battery_hbar}
# - #{battery_percentage}
# - #{battery_status}
# - #{battery_vbar}
# - #{circled_session_name}
# - #{hostname_ssh}
# - #{hostname}
# - #{hostname_full}
# - #{hostname_full_ssh}
# - #{loadavg}
# - #{mouse}
# - #{pairing}
# - #{prefix}
# - #{root}
# - #{synchronized}
# - #{uptime_y}
# - #{uptime_d} (modulo 365 when #{uptime_y} is used)
# - #{uptime_h}
# - #{uptime_m}
# - #{uptime_s}
# - #{username}
# - #{username_ssh}
# tmux_conf_theme_status_left="↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} #{loadavg}"
tmux_conf_theme_status_left=""
# tmux_conf_theme_status_right="#{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b"
tmux_conf_theme_status_right="#{mouse} | CPU: #{cpu_percentage} MEM: #{ram_percentage} | %R | %d %b %Y "
# status left style
tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8"
tmux_conf_theme_status_left_bg="$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_10,$tmux_conf_theme_colour_11"
tmux_conf_theme_status_left_attr="bold,none,none"
# status right style
tmux_conf_theme_status_right_fg="$tmux_conf_theme_colour_12,$tmux_conf_theme_colour_14,$tmux_conf_theme_colour_13,$tmux_conf_theme_colour_14"
tmux_conf_theme_status_right_bg="$tmux_conf_theme_colour_15,$tmux_conf_theme_colour_9,$tmux_conf_theme_colour_16,$tmux_conf_theme_colour_17"
tmux_conf_theme_status_right_attr="none,none,none,none"
# pairing indicator
tmux_conf_theme_pairing="⚇" # U+2687
tmux_conf_theme_pairing_fg="none"
tmux_conf_theme_pairing_bg="none"
tmux_conf_theme_pairing_attr="none"
# prefix indicator
tmux_conf_theme_prefix="⌨" # U+2328
tmux_conf_theme_prefix_fg="none"
tmux_conf_theme_prefix_bg="none"
tmux_conf_theme_prefix_attr="none"
# mouse indicator
tmux_conf_theme_mouse="↗" # U+2197
tmux_conf_theme_mouse_fg="none"
tmux_conf_theme_mouse_bg="none"
tmux_conf_theme_mouse_attr="none"
# root indicator
tmux_conf_theme_root="!"
tmux_conf_theme_root_fg="none"
tmux_conf_theme_root_bg="none"
tmux_conf_theme_root_attr="bold,blink"
# synchronized indicator
tmux_conf_theme_synchronized="⚏" # U+268F
tmux_conf_theme_synchronized_fg="none"
tmux_conf_theme_synchronized_bg="none"
tmux_conf_theme_synchronized_attr="none"
# battery bar symbols
tmux_conf_battery_bar_symbol_full="◼"
tmux_conf_battery_bar_symbol_empty="◻"
#tmux_conf_battery_bar_symbol_full="♥"
#tmux_conf_battery_bar_symbol_empty="·"
# battery bar length (in number of symbols), possible values are:
# - auto
# - a number, e.g. 5
tmux_conf_battery_bar_length="auto"
# battery bar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_full_fg,colour_empty_fg,colour_bg"
tmux_conf_battery_bar_palette="gradient"
#tmux_conf_battery_bar_palette="#d70000,#e4e4e4,#000000" # red, white, black
# battery hbar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_low,colour_half,colour_full"
tmux_conf_battery_hbar_palette="gradient"
#tmux_conf_battery_hbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green
# battery vbar palette, possible values are:
# - gradient (default)
# - heat
# - "colour_low,colour_half,colour_full"
tmux_conf_battery_vbar_palette="gradient"
#tmux_conf_battery_vbar_palette="#d70000,#ff5f00,#5fff00" # red, orange, green
# symbols used to indicate whether battery is charging or discharging
tmux_conf_battery_status_charging="↑" # U+2191
tmux_conf_battery_status_discharging="↓" # U+2193
#tmux_conf_battery_status_charging="🔌" # U+1F50C
#tmux_conf_battery_status_discharging="🔋" # U+1F50B
# clock style (when you hit <prefix> + t)
# you may want to use %I:%M %p in place of %R in tmux_conf_theme_status_right
tmux_conf_theme_clock_colour="$tmux_conf_theme_colour_4"
tmux_conf_theme_clock_style="24"
# -- clipboard -----------------------------------------------------------------
# in copy mode, copying selection also copies to the OS clipboard
# - true
# - false (default)
# - disabled
# on macOS, this requires installing reattach-to-user-namespace, see README.md
# on Linux, this requires xsel, xclip or wl-copy
tmux_conf_copy_to_os_clipboard=false
# -- user customizations -------------------------------------------------------
# this is the place to override or undo settings
# increase history size
set -g history-limit 10000
# start with mouse mode enabled
#set -g mouse on
# force Vi mode
# really you should export VISUAL or EDITOR environment variable, see manual
set -g status-keys vi
set -g mode-keys vi
# replace C-b by C-a instead of using both prefixes
# set -gu prefix2
# unbind C-a
# unbind C-b
# set -g prefix C-a
# bind C-a send-prefix
# if you don't want Oh my tmux! to alter a binding, use #!important
bind c new-window -c '#{pane_current_path}' #!important
# move status line to top
set -g status-position top
# -- tpm -----------------------------------------------------------------------
# while I don't use tpm myself, many people requested official support so here
# is a seamless integration that automatically installs plugins in parallel
# whenever a plugin introduces a variable to be used in 'status-left' or
# 'status-right', you can use it in 'tmux_conf_theme_status_left' and
# 'tmux_conf_theme_status_right' variables.
# by default, launching tmux will update tpm and all plugins
# - true (default)
# - false
tmux_conf_update_plugins_on_launch=false
# by default, reloading the configuration will update tpm and all plugins
# - true (default)
# - false
tmux_conf_update_plugins_on_reload=true
# by default, reloading the configuration will uninstall tpm and plugins when no
# plugins are enabled
# - true (default)
# - false
tmux_conf_uninstall_plugins_on_reload=true
# /!\ the tpm bindings differ slightly from upstream:
# - installing plugins: <prefix> + I
# - uninstalling plugins: <prefix> + Alt + u
# - updating plugins: <prefix> + u
# /!\ do not add set -g @plugin 'tmux-plugins/tpm'
# /!\ do not add run '~/.tmux/plugins/tpm/tpm'
# to enable a plugin, use the 'set -g @plugin' syntax:
# visit https://github.com/tmux-plugins for available plugins
#set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-cpu'
# prefix + C-s - save
# prefix + C-r - restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-continuum'
#set -g @continuum-restore 'on'
# split current window horizontally
bind - split-window -v #!important
# split current window vertically
bind | split-window -h #!important
# select previous window
bind -r p previous-window #!important
# select next window
bind -r n next-window #!important
# pane resizing
bind -r h resize-pane -L 2 #!important
bind -r j resize-pane -D 2 #!important
bind -r k resize-pane -U 2 #!important
bind -r l resize-pane -R 2 #!important
# -- custom variables ----------------------------------------------------------
# to define a custom #{foo} variable, define a POSIX shell function between the
# '# EOF' and the '# "$@"' lines. Please note that the opening brace { character
# must be on the same line as the function name otherwise the parse won't detect
# it.
#
# then, use #{foo} in e.g. the 'tmux_conf_theme_status_left' or the
# 'tmux_conf_theme_status_right' variables.
# # /!\ do not remove the following line
# EOF
#
# # /!\ do not "uncomment" the functions: the leading "# " characters are needed
#
# weather() { # see https://github.com/chubin/wttr.in#one-line-output
# curl -f -s -m 2 'wttr.in?format=3' || printf '\n' # /!\ make sure curl is installed
# sleep 900 # sleep for 15 minutes, throttle network requests whatever the value of status-interval
# }
#
# online() {
# ping -c 1 1.1.1.1 >/dev/null 2>&1 && printf '✔' || printf '✘'
# }
#
# "$@"
# # /!\ do not remove the previous line
Binary file not shown.
+65 -8
View File
@@ -1,31 +1,88 @@
package tmux
import (
"fmt"
"embed"
"io"
"os"
"os/exec"
"path"
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:embed .tmux.conf
var dataTmuxConf embed.FS
//go:embed .tmux.conf.local
var dataTmuxConfLocal embed.FS
//go:embed plugins.tar.gz
var dataPlugins embed.FS
func initTmuxConf() error {
home, err := os.UserHomeDir()
if err != nil {
return err
}
target := path.Join(home, ".tmux.conf")
file, err := os.OpenFile(target, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
fileTmuxConf, err := dataTmuxConf.Open(".tmux.conf")
if err != nil {
return err
}
tmuxConf, err := io.ReadAll(fileTmuxConf)
if err != nil {
return err
}
err = util.RewriteFile(target, tmuxConf)
if err != nil {
return err
}
defer file.Close() // nolint: errcheck
vecpsBinDir, err := util.VecpsBinDir()
target = path.Join(home, ".tmux.conf.local")
fileTmuxConfLocal, err := dataTmuxConfLocal.Open(".tmux.conf.local")
if err != nil {
return err
}
originalString := fmt.Sprintf(`set-option -g default-command "%s/nu"
set-option -g default-shell "%s/nu"`,
vecpsBinDir, vecpsBinDir)
return os.WriteFile(target, []byte(originalString), 0644)
tmuxConfLocal, err := io.ReadAll(fileTmuxConfLocal)
if err != nil {
return err
}
err = util.RewriteFile(target, tmuxConfLocal)
if err != nil {
return err
}
pluginsDir := path.Join(home, ".tmux/plugins")
if !util.IsDir(pluginsDir) {
err = os.MkdirAll(pluginsDir, os.ModePerm)
if err != nil {
return err
}
}
filePlugins, err := dataPlugins.Open("plugins.tar.gz")
if err != nil {
return err
}
defer filePlugins.Close()
filePluginsTemp, err := os.CreateTemp("", "plugins.tar.gz")
if err != nil {
return err
}
_, err = io.Copy(filePluginsTemp, filePlugins)
if err != nil {
return err
}
err = filePluginsTemp.Close()
if err != nil {
return err
}
defer os.Remove(filePluginsTemp.Name())
err = exec.Command("tar", "-zxf", filePluginsTemp.Name(), "-C", pluginsDir).Run()
if err != nil {
return err
}
return nil
}
+388
View File
@@ -0,0 +1,388 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic — @amix3k
"
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
"
" https://github.com/amix/vimrc
"
" Sections:
" -> General
" -> VIM user interface
" -> Colors and Fonts
" -> Files and backups
" -> Text, tab and indent related
" -> Visual mode related
" -> Moving around, tabs and buffers
" -> Status line
" -> Editing mappings
" -> vimgrep searching and cope displaying
" -> Spell checking
" -> Misc
" -> Helper functions
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=500
" Enable filetype plugins
filetype plugin on
filetype indent on
" Set to auto read when a file is changed from the outside
set autoread
au FocusGained,BufEnter * checktime
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
" Fast saving
nmap <leader>w :w!<cr>
" :W sudo saves the file
" (useful for handling the permission-denied error)
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
" no compatibility with vi
set nocompatible
" disable mouse
set mouse-=a
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Avoid garbled characters in Chinese language windows OS
let $LANG='en'
set langmenu=en
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" Turn on the Wild menu
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
if has("win16") || has("win32")
set wildignore+=.git\*,.hg\*,.svn\*
else
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
endif
" Always show current position
set ruler
" Height of the command bar
set cmdheight=1
" A buffer becomes hidden when it is abandoned
set hid
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" Properly disable sound on errors on MacVim
if has("gui_macvim")
autocmd GUIEnter * set vb t_vb=
endif
" Add a bit extra margin to the left
set foldcolumn=0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Colors and Fonts
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Enable syntax highlighting
syntax enable
" Enable 256 colors palette in Gnome Terminal
if $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
try
colorscheme desert
catch
endtry
set background=dark
" Set extra options when running in GUI mode
if has("gui_running")
set guioptions-=T
set guioptions-=e
set t_Co=256
set guitablabel=%M\ %t
endif
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Files, backups and undo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Turn backup off, since most stuff is in SVN, git etc. anyway...
set nobackup
set nowb
set noswapfile
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
""""""""""""""""""""""""""""""
" => Visual mode related
""""""""""""""""""""""""""""""
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> /
map <C-space> ?
" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Close the current buffer
map <leader>bd :Bclose<cr>:tabclose<cr>gT
" Close all the buffers
map <leader>ba :bufdo bd<cr>
map <leader>l :bnext<cr>
map <leader>h :bprevious<cr>
" Useful mappings for managing tabs
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
map <leader>t<leader> :tabnext
" Let 'tl' toggle between this and the last accessed tab
let g:lasttab = 1
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()
" Opens a new tab with the current buffer's path
" Super useful when editing files in the same directory
map <leader>te :tabedit <C-r>=expand("%:p:h")<cr>/
" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
" Specify the behavior when switching between buffers
try
set switchbuf=useopen,usetab,newtab
set stal=2
catch
endtry
" Return to last edit position when opening files (You want this!)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
" Format the status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c%=[%{strftime('%H:%M:%S',\ localtime())}]
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Editing mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remap VIM 0 to first non-blank character
map 0 ^
" Move a line of text using ALT+[jk] or Command+[jk] on mac
nmap <M-j> mz:m+<cr>`z
nmap <M-k> mz:m-2<cr>`z
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
if has("mac") || has("macunix")
nmap <D-j> <M-j>
nmap <D-k> <M-k>
vmap <D-j> <M-j>
vmap <D-k> <M-k>
endif
" Delete trailing white space on save, useful for some filetypes ;)
fun! CleanExtraSpaces()
let save_cursor = getpos(".")
let old_query = getreg('/')
silent! %s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfun
if has("autocmd")
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces()
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Spell checking
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>
" Shortcuts using <leader>
map <leader>sn ]s
map <leader>sp [s
map <leader>sa zg
map <leader>s? z=
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Quickly open a buffer for scribble
map <leader>q :e ~/buffer<cr>
" Quickly open a markdown buffer for scribble
map <leader>x :e ~/buffer.md<cr>
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
endif
return ''
endfunction
" Don't close window, when deleting a buffer
command! Bclose call <SID>BufcloseCloseIt()
function! <SID>BufcloseCloseIt()
let l:currentBufNum = bufnr("%")
let l:alternateBufNum = bufnr("#")
if buflisted(l:alternateBufNum)
buffer #
else
bnext
endif
if bufnr("%") == l:currentBufNum
new
endif
if buflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction
function! CmdLine(str)
call feedkeys(":" . a:str)
endfunction
function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", "\\/.*'$^~[]")
let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'gv'
call CmdLine("Ack '" . l:pattern . "' " )
elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/')
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
+9 -16
View File
@@ -5,15 +5,12 @@ import (
"io/ioutil"
"os"
"path"
"strings"
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O vimrc-20220826 https://fs.tosone.cn/vecps-cli/addons/vim/vimrc-20220826
//go:generate wget -c -q -O vimrc-20220826.sha256 https://fs.tosone.cn/vecps-cli/addons/vim/vimrc-20220826.sha256
//go:generate shasum -a 256 -c vimrc-20220826.sha256
//go:embed vimrc-20220826
var vimrc embed.FS
//go:embed .vimrc
var dataVimrc embed.FS
func initVimrc() error {
home, err := os.UserHomeDir()
@@ -21,22 +18,18 @@ func initVimrc() error {
return err
}
target := path.Join(home, ".vimrc")
file, err := os.OpenFile(target, os.O_CREATE, 0644)
fileVimrc, err := dataVimrc.Open(".vimrc")
if err != nil {
return err
}
content, err := ioutil.ReadAll(file)
vimrc, err := ioutil.ReadAll(fileVimrc)
if err != nil {
return err
}
err = file.Close()
err = util.RewriteFile(target, vimrc)
if err != nil {
return err
}
originalString := "set nocompatible\nset mouse-=a\n"
if strings.Contains(string(content), originalString) {
return nil
}
content = append(content, []byte(originalString)...)
return os.WriteFile(target, content, 0644)
return nil
}
+7 -32
View File
@@ -2,52 +2,27 @@ package vim
import (
"embed"
"fmt"
"io"
"io/fs"
"os"
"code.byted.org/infcp/vecps-cli/pkg/constant"
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O vim-linux-amd64-9.0.0063.tar.gz https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-amd64-9.0.0063.tar.gz
//go:generate wget -c -q -O vim-linux-amd64-9.0.0063.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-amd64-9.0.0063.tar.gz.sha256
//go:generate shasum -a 256 -c vim-linux-amd64-9.0.0063.tar.gz.sha256
//go:generate wget -c -q -O vim-linux-amd64-9.0.1503.tar.gz https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-amd64-9.0.1503.tar.gz
//go:generate wget -c -q -O vim-linux-amd64-9.0.1503.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-amd64-9.0.1503.tar.gz.sha256
//go:generate shasum -a 256 -c vim-linux-amd64-9.0.1503.tar.gz.sha256
//go:embed vim-linux-amd64-9.0.0063.tar.gz
//go:embed vim-linux-amd64-9.0.1503.tar.gz
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "vim-linux-amd64-9.0.0063.tar.gz",
Filename: "vim-linux-amd64-9.0.1503.tar.gz",
Core: "vim/",
}
if err = archive.Dump(); err != nil {
return
}
var home string
if home, err = util.VecpsHomeDir(); err != nil {
return
}
var target = fmt.Sprintf("%s/%s/%s/%s", home, constant.VecpsAddonsDir, "vim/share/vim", vimrcFilename)
if util.IsFile(target) {
if err = os.Remove(target); err != nil {
return
}
}
var file *os.File
if file, err = os.Create(target); err != nil {
return err
}
defer file.Close() // nolint: errcheck
var content fs.File
if content, err = vimrc.Open("vimrc-20220826"); err != nil {
return
}
if _, err = io.Copy(file, content); err != nil {
err = archive.Dump()
if err != nil {
return
}
return initVimrc()
+7 -32
View File
@@ -2,52 +2,27 @@ package vim
import (
"embed"
"fmt"
"io"
"io/fs"
"os"
"code.byted.org/infcp/vecps-cli/pkg/constant"
"code.byted.org/infcp/vecps-cli/pkg/util"
)
//go:generate wget -c -q -O vim-linux-arm64-9.0.0063.tar.gz https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-arm64-9.0.0063.tar.gz
//go:generate wget -c -q -O vim-linux-arm64-9.0.0063.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-arm64-9.0.0063.tar.gz.sha256
//go:generate shasum -a 256 -c vim-linux-arm64-9.0.0063.tar.gz.sha256
//go:generate wget -c -q -O vim-linux-arm64-9.0.1503.tar.gz https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-arm64-9.0.1503.tar.gz
//go:generate wget -c -q -O vim-linux-arm64-9.0.1503.tar.gz.sha256 https://fs.tosone.cn/vecps-cli/addons/vim/vim-linux-arm64-9.0.1503.tar.gz.sha256
//go:generate shasum -a 256 -c vim-linux-arm64-9.0.1503.tar.gz.sha256
//go:embed vim-linux-arm64-9.0.0063.tar.gz
//go:embed vim-linux-arm64-9.0.1503.tar.gz
var data embed.FS
// Initialize ...
func Initialize() (err error) {
var archive = &util.Archive{
EmbedFile: data,
Filename: "vim-linux-arm64-9.0.0063.tar.gz",
Filename: "vim-linux-arm64-9.0.1503.tar.gz",
Core: "vim/",
}
if err = archive.Dump(); err != nil {
return
}
var home string
if home, err = util.VecpsHomeDir(); err != nil {
return
}
var target = fmt.Sprintf("%s/%s/%s/%s", home, constant.VecpsAddonsDir, "vim/share/vim", vimrcFilename)
if util.IsFile(target) {
if err = os.Remove(target); err != nil {
return
}
}
var file *os.File
if file, err = os.Create(target); err != nil {
return err
}
defer file.Close() // nolint: errcheck
var content fs.File
if content, err = vimrc.Open("vimrc-20220826"); err != nil {
return
}
if _, err = io.Copy(file, content); err != nil {
err = archive.Dump()
if err != nil {
return
}
return initVimrc()
+12
View File
@@ -71,3 +71,15 @@ func VecpsAddonsDir() (dir string, err error) {
}
return
}
// RewriteFile rewrites the specific file.
func RewriteFile(target string, data []byte) error {
if IsFile(target) {
err := os.Remove(target)
if err != nil {
return err
}
}
return os.WriteFile(target, data, 0644)
}