diff --git a/.config/vis/plugins/commentary b/.config/vis/plugins/commentary new file mode 160000 index 0000000..26db90c --- /dev/null +++ b/.config/vis/plugins/commentary @@ -0,0 +1 @@ +Subproject commit 26db90cca7b062446a6cf5bc9317baf62bdf9a9b diff --git a/.config/vis/plugins/cursors b/.config/vis/plugins/cursors new file mode 160000 index 0000000..c19a2ce --- /dev/null +++ b/.config/vis/plugins/cursors @@ -0,0 +1 @@ +Subproject commit c19a2ceb71607aea6c34491fa325a1de2da8dfaf diff --git a/.config/vis/plugins/fzf-mru b/.config/vis/plugins/fzf-mru new file mode 160000 index 0000000..aafc3d1 --- /dev/null +++ b/.config/vis/plugins/fzf-mru @@ -0,0 +1 @@ +Subproject commit aafc3d18af1edefc117baffd1e3d0f073b2d3bd2 diff --git a/.config/vis/plugins/fzf-open b/.config/vis/plugins/fzf-open new file mode 160000 index 0000000..b1666a3 --- /dev/null +++ b/.config/vis/plugins/fzf-open @@ -0,0 +1 @@ +Subproject commit b1666a31e14338ff1bba0b39c729016048ca4b2d diff --git a/.config/vis/themes/minimal-light.lua b/.config/vis/themes/minimal-light.lua new file mode 100644 index 0000000..e3259a0 --- /dev/null +++ b/.config/vis/themes/minimal-light.lua @@ -0,0 +1,49 @@ +-- vis-minimal-theme (https://github.com/erf/vis-minimal-theme) +-- light by Erlend Lind Madsen +-- Modified by Nulo + +local black0 = '#000000' +local black1 = '#383838' +local black2 = '#686868' + +local white0 = '#ffffff' +local white1 = '#c8c8c8' +local white2 = '#989898' + +local lexers = vis.lexers + +lexers.STYLE_DEFAULT ='back:'..white0..',fore:'..black0 +lexers.STYLE_NOTHING = 'back:'..white0 +lexers.STYLE_CLASS = 'fore:'..black0 +lexers.STYLE_COMMENT = 'fore:'..white2 +lexers.STYLE_CONSTANT = 'fore:'..black0 +lexers.STYLE_DEFINITION = 'fore:'..black0 +lexers.STYLE_ERROR = 'fore:'..black0 +lexers.STYLE_FUNCTION = 'fore:'..black0 +lexers.STYLE_KEYWORD = 'fore:'..black2 +lexers.STYLE_LABEL = 'fore:'..black0 +lexers.STYLE_NUMBER = 'fore:'..black1 +lexers.STYLE_OPERATOR = 'fore:'..black0 +lexers.STYLE_REGEX = 'fore:'..black1 +lexers.STYLE_STRING = 'fore:'..black1 +lexers.STYLE_PREPROCESSOR = 'fore:'..black0 +lexers.STYLE_TAG = 'fore:'..black0 +lexers.STYLE_TYPE = 'fore:'..black0 +lexers.STYLE_VARIABLE = 'fore:'..black0 +lexers.STYLE_WHITESPACE = '' +lexers.STYLE_EMBEDDED = 'back:'..white1 +lexers.STYLE_IDENTIFIER = 'fore:'..black0 + +lexers.STYLE_LINENUMBER = 'fore:'..black1 +lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER +lexers.STYLE_CURSOR = 'back:'..white2 +lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:'..black1 +lexers.STYLE_CURSOR_LINE = 'underlined' +lexers.STYLE_COLOR_COLUMN = 'back:'..white1 +lexers.STYLE_SELECTION = 'back:'..white1 +lexers.STYLE_STATUS = 'back:'..white0..',fore:'..black2 +lexers.STYLE_STATUS_FOCUSED = 'back:'..white1..',fore:'..black1 +lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT +lexers.STYLE_INFO = 'fore:default,back:default' +lexers.STYLE_EOF = '' + diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua new file mode 100644 index 0000000..e8701fa --- /dev/null +++ b/.config/vis/visrc.lua @@ -0,0 +1,49 @@ +require 'vis' + +plugins = { + -- Open files in directory + ["fzf-open"] = require 'plugins/fzf-open', + -- Search recently opened files + ["fzf-mru"] = require 'plugins/fzf-mru/fzf-mru', + -- Saves cursor position + ["cursors"] = require 'plugins/cursors', +} + +vis.events.subscribe(vis.events.INIT, function() + require 'themes/minimal-light' + require 'plugins/commentary' + + vis:map(vis.modes.NORMAL, ',f', ':fzf') + vis:map(vis.modes.NORMAL, ',b', ':fzfmru') +end) + +vis.events.subscribe(vis.events.WIN_OPEN, function(win) + vis:command('set relativenumber') +end) + +local function format(file, path) + local win = vis.win + local fmt = nil + if win.syntax == "javascript" or win.syntax == "typescript" or win.syntax == "json" or win.syntax == "css" then + fmt = "prettier --stdin-filepath "..file.path + end + + if fmt == nil then + return true + end + + local pos = win.selection.pos + local status, out, err = vis:pipe(file, { start = 0, finish = file.size }, fmt) + if status ~= 0 or not out then + if err then vis:info(err) end + return false + end + + file:delete(0, file.size) + file:insert(0, out) + win.selection.pos = pos + return true +end + +vis.events.subscribe(vis.events.FILE_SAVE_PRE, format) + diff --git a/.gitmodules b/.gitmodules index bf46333..3b224d5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,3 +37,15 @@ [submodule ".config/kak/plugins/kakoune-buffers"] path = .config/kak/plugins/kakoune-buffers url = https://github.com/Delapouite/kakoune-buffers +[submodule ".config/vis/plugins/cursors"] + path = .config/vis/plugins/cursors + url = https://github.com/erf/vis-cursors +[submodule ".config/vis/plugins/commentary"] + path = .config/vis/plugins/commentary + url = https://github.com/lutobler/vis-commentary +[submodule ".config/vis/plugins/fzf-open"] + path = .config/vis/plugins/fzf-open + url = https://git.sr.ht/~mcepl/vis-fzf-open +[submodule ".config/vis/plugins/fzf-mru"] + path = .config/vis/plugins/fzf-mru + url = https://github.com/peaceant/vis-fzf-mru diff --git a/.profile b/.profile index 33724c0..9e023e9 100755 --- a/.profile +++ b/.profile @@ -7,7 +7,7 @@ ulimit -c unlimited export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/go/bin:$PATH" -export EDITOR=kak +export EDITOR=vis export FZF_DEFAULT_OPTS='--color=light' export FZF_DEFAULT_COMMAND='rg -L --hidden --files'