1.1.0 Added dotfiles from my old PC

This commit is contained in:
2020-10-02 22:43:43 +02:00
parent 1d0d2bdd53
commit 49f2ea379d
102 changed files with 10692 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Comment Plugin for Micro
This plugin provides automatic commenting/uncommenting for micro.
Install with `> plugin install comment`.
See the [docs](https://github.com/micro-editor/comment-plugin/blob/master/help/comment-plugin.md) for more details.

View File

@@ -0,0 +1,105 @@
VERSION = "1.0.6"
ft = {}
ft["c"] = "// %s"
ft["go"] = "// %s"
ft["python"] = "# %s"
ft["python3"] = "# %s"
ft["html"] = "<!-- %s -->"
ft["java"] = "// %s"
ft["perl"] = "# %s"
ft["rust"] = "// %s"
ft["shell"] = "# %s"
ft["lua"] = "-- %s"
ft["javascript"] = "// %s"
ft["ruby"] = "# %s"
ft["d"] = "// %s"
ft["swift"] = "// %s"
function onViewOpen(v)
if v.Buf.Settings["commenttype"] == nil then
if ft[v.Buf.Settings["filetype"]] ~= nil then
v.Buf.Settings["commenttype"] = ft[v.Buf.Settings["filetype"]]
else
v.Buf.Settings["commenttype"] = "# %s"
end
end
end
function commentLine(lineN)
local v = CurView()
local line = v.Buf:Line(lineN)
local commentType = v.Buf.Settings["commenttype"]
local commentRegex = "^%s*" .. commentType:gsub("%*", "%*"):gsub("%-", "%-"):gsub("%.", "%."):gsub("%+", "%+"):gsub("%]", "%]"):gsub("%[", "%["):gsub("%%s", "(.*)")
local sel = -v.Buf.Cursor.CurSelection
local curpos = -v.Buf.Cursor.Loc
local index = string.find(commentType, "%%s") - 1
if string.match(line, commentRegex) then
uncommentedLine = string.match(line, commentRegex)
v.Buf:Replace(Loc(0, lineN), Loc(#line, lineN), GetLeadingWhitespace(line) .. uncommentedLine)
if v.Buf.Cursor:HasSelection() then
v.Buf.Cursor.CurSelection[1].Y = sel[1].Y
v.Buf.Cursor.CurSelection[2].Y = sel[2].Y
v.Buf.Cursor.CurSelection[1].X = sel[1].X
v.Buf.Cursor.CurSelection[2].X = sel[2].X
else
v.Buf.Cursor.X = curpos.X - index
v.Buf.Cursor.Y = curpos.Y
end
else
local commentedLine = commentType:gsub("%%s", trim(line))
v.Buf:Replace(Loc(0, lineN), Loc(#line, lineN), GetLeadingWhitespace(line) .. commentedLine)
if v.Buf.Cursor:HasSelection() then
v.Buf.Cursor.CurSelection[1].Y = sel[1].Y
v.Buf.Cursor.CurSelection[2].Y = sel[2].Y
v.Buf.Cursor.CurSelection[1].X = sel[1].X
v.Buf.Cursor.CurSelection[2].X = sel[2].X
else
v.Buf.Cursor.X = curpos.X + index
v.Buf.Cursor.Y = curpos.Y
end
end
v.Cursor:Relocate()
v.Cursor.LastVisualX = v.Cursor:GetVisualX()
end
function commentSelection(startLine, endLine)
for line = startLine, endLine do
commentLine(line)
end
end
function comment()
local v = CurView()
if v.Cursor:HasSelection() then
if v.Cursor.CurSelection[1]:GreaterThan(-v.Cursor.CurSelection[2]) then
local endLine = v.Cursor.CurSelection[1].Y
if v.Cursor.CurSelection[1].X == 0 then
endLine = endLine - 1
end
commentSelection(v.Cursor.CurSelection[2].Y, endLine)
else
local endLine = v.Cursor.CurSelection[2].Y
if v.Cursor.CurSelection[2].X == 0 then
endLine = endLine - 1
end
commentSelection(v.Cursor.CurSelection[1].Y, endLine)
end
else
commentLine(v.Cursor.Y)
end
end
function trim(s)
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
MakeCommand("comment", "comment.comment")
BindKey("Alt-/", "comment.comment")
AddRuntimeFile("comment", "help", "help/comment-plugin.md")

View File

@@ -0,0 +1,59 @@
# Comment Plugin
The comment plugin provides auto commenting/uncommenting.
The default binding to comment/uncomment a line is `Alt-/`,
but you can easily modify that in your `bindings.json` file:
```json
{
"Alt-g": "comment.comment"
}
```
You can also execute a command which will do the same thing as
the binding:
```
> comment
```
If you have a selection, the plugin will comment all the lines
selected.
The comment type will be auto detected based on the filetype,
but it is only available for certain filetypes:
* c: `// %s`
* c++: `// %s`
* d: `// %s`
* go: `// %s`
* html: `<!-- %s -->`
* java: `// %s`
* javascript: `// %s`
* julia: `# %s`
* lua: `-- %s`
* perl: `# %s`
* php: `// %s`
* python: `# %s`
* python3: `# %s`
* ruby: `# %s`
* rust: `// %s`
* shell: `# %s`
* swift: `// %s`
If your filetype is not available here, you can simply modify
the `commenttype` option:
```
set commenttype "/* %s */"
```
Or in your `settings.json`:
```json
{
"*.c": {
"commenttype": "/* %s */"
}
}
```

View File

@@ -0,0 +1,14 @@
[{
"Name": "comment",
"Description": "Plugin to auto comment or uncomment lines",
"Tags": ["comment", "uncomment"],
"Versions": [
{
"Version": "1.0.6",
"Url": "https://github.com/micro-editor/comment-plugin/archive/v1.0.6.zip",
"Require": {
"micro": ">=1.1.0"
}
}
]
}]

View File

@@ -0,0 +1,12 @@
Copyright (c) 2016, Samantha Marshall
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Samantha Marshall nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,11 @@
function fzf
set -l epoch (date "+%s")
set -l file_path $TMPDIR/fzf-$epoch.result
command fzf $argv >$file_path
if test $status -eq 0 -a -s $file_path
cat $file_path
end
if test -e $file_path
rm $file_path
end
end

View File

@@ -0,0 +1,16 @@
VERSION = "2.0.0"
MakeCommand("fzf", "fzf.fzf", 0)
function fzf()
if CurView():CanClose() then
RunTermEmulator("fzf", false, true, "fzf.handleFzfOutput")
end
end
function handleFzfOutput(output)
local strings = import("strings")
CurView():Open(strings.TrimSpace(output))
end
AddRuntimeFile("fzf", "help", "help/fzf.md")

View File

@@ -0,0 +1,31 @@
# About the fzf plugin
This plugin provides support for opening files via [fzf](https://github.com/junegunn/fzf).
# Commands
The plugin providies the following commands:
* `fzf`: launch `fzf` to find a file to open.
# Troubleshooting
There is a [known issue](https://github.com/fish-shell/fish-shell/issues/1362) when using fzf with fish shell. To work around this, you should create a new fish shell function called `fzf` to be trigged instead of the `fzf` command directly. You can copy and past the following snippet into the file:
$FISH_CONFIG_PATH/functions/fzf.fish
```
function fzf
set -l epoch (date "+%s")
set -l file_path $TMPDIR/fzf-$epoch.result
command fzf $argv >$file_path
if test $status -eq 0 -a -s $file_path
cat $file_path
end
if test -e $file_path
rm $file_path
end
end
```

View File

@@ -0,0 +1,23 @@
# fzf plugin for micro
This repository holds the [fzf](https://github.com/junegunn/fzf) plugin for [micro](https://github.com/zyedidia/micro)
# Troubleshooting
There is a [known issue](https://github.com/fish-shell/fish-shell/issues/1362) when using fzf with fish shell. To work around this, you should create a new fish shell function called `fzf` to be trigged instead of the `fzf` command directly. You can copy and past the following snippet into the file:
$FISH_CONFIG_PATH/functions/fzf.fish
```
function fzf
set -l epoch (date "+%s")
set -l file_path $TMPDIR/fzf-$epoch.result
command fzf $argv >$file_path
if test $status -eq 0 -a -s $file_path
cat $file_path
end
if test -e $file_path
rm $file_path
end
end
```

View File

@@ -0,0 +1,16 @@
[
{
"Name": "fzf",
"Description": "adds support to opening files via fzf",
"Tags": ["fzf"],
"Versions": [
{
"Version": "1.0.5",
"Url": "https://github.com/samdmarshall/micro-fzf-plugin/archive/v1.0.5.zip",
"Require": {
"micro": ">=1.1.2"
}
}
]
}
]