diff options
| author | Jacob McDonnell <jacob@simplelittledream.com> | 2022-10-26 11:10:13 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@simplelittledream.com> | 2022-10-26 11:10:13 -0400 |
| commit | 6b6e91707ecf621a0bedad154351db8f1ccc2123 (patch) | |
| tree | e0bed306b683c344e3f429817b1ef04daba1c2f6 /.config/micro/plug | |
| parent | 161a1bfb0b3e75e9f5241cd7dd8aafec455a67d5 (diff) | |
Working on merging to one branch
Diffstat (limited to '.config/micro/plug')
68 files changed, 0 insertions, 11199 deletions
diff --git a/.config/micro/plug/filemanager/.editorconfig b/.config/micro/plug/filemanager/.editorconfig deleted file mode 100644 index a34d753..0000000 --- a/.config/micro/plug/filemanager/.editorconfig +++ /dev/null @@ -1,17 +0,0 @@ -# EditorConfig is awesome: http://EditorConfig.org - -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -charset = utf-8 -end_of_line = lf -indent_style = tab -indent_size = 2 -insert_final_newline = true -trim_trailing_whitespace = true - -# Ignore .md files, because 2 spaces at end-of-line has meaning -[*.md] -trim_trailing_whitespace = false diff --git a/.config/micro/plug/filemanager/CHANGELOG.md b/.config/micro/plug/filemanager/CHANGELOG.md deleted file mode 100644 index 46d51c4..0000000 --- a/.config/micro/plug/filemanager/CHANGELOG.md +++ /dev/null @@ -1,109 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [3.4.0] - 2018-10-22 - -### Fixed - -- Issues with Lua's `io.popen` on some systems by using Micro's built-in `RunShellCommand` instead, [thanks to @scottbilas](https://github.com/NicolaiSoeborg/filemanager-plugin/pull/38) - -### Added - -- Adds the option `filemanager-openonstart` to allow auto-opening the file tree when Micro is started (default OFF) - -### Changed - -- Update README's option's documentation - -## [3.3.1] - 2018-10-03 - -### Changed - -- Performance improvement by removing unnecessary refresh of the opened file, [thanks to @jackwilsdon](https://github.com/NicolaiSoeborg/filemanager-plugin/pull/37) - -## [3.3.0] - 2018-09-13 - -### Added - -- The ability to sort folders above files, [thanks to @cbrown1](https://github.com/NicolaiSoeborg/filemanager-plugin/pull/33) - -### Fixed - -- The displayed filenames are now correctly only showing their "basename" on Windows - -## [3.2.0] - 2018-02-15 - -### Added - -- The ability to go to parent directory with left arrow (when not minimizing). Thanks @avently -- The ability to jump to the `..` as a "parent directory". Thanks @avently - -## [3.1.2] - 2018-02-07 - -### Fixed - -- The minimum Micro version, which was incorrectly set to v1.4.0. Ref [issue #28](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/28) - -## [3.1.1] - 2018-02-04 - -### Fixed - -Ref https://github.com/zyedidia/micro/issues/992 for both of these fixes. - -- The syntax parser not loading correctly (mostly block comments) on opened files. **Requires Micro >= v1.4.0** -- An errant tab being inserted into the newly opened file. - -## [3.1.0] - 2018-01-30 - -### Added - -- The ability to hide dotfiles using the `filemanager-showdotfiles` option. -- The ability to hide files ignored in your VCS (aka `.gitignore`'d) using the `filemanager-showignored` option. Only works with Git at the moment. -- This `CHANGELOG.md` - -### Fixed - -- A bug with the `rm` command that caused weird, undefined behaviour to contents within the same dir as the file/dir deleted. -- Issue [#24](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/24) - -## [3.0.0] - 2018-01-10 - -### Fixed - -- Issues [#13](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/13), [#14](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/14), [#15](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/15), [#19](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/19), [#20](https://github.com/NicolaiSoeborg/filemanager-plugin/issues/20) -- The broken syntax highlighting - -### Added - -- Directory expansion/compression below itself for viewing more akin to a file tree. -- The `rm` command, which deletes the file/directory under the cursor. -- The `touch` command, which creates a file with the passed filename. -- The `mkdir` command, which creates a directory with the passed filename. -- An API, of sorts, for the user to rebind their keys to if they dislike the defaults. -- An [editorconfig](http://editorconfig.org/) file. - -### Changed - -- The view that it spawns in to read-only, which requires Micro version >= 1.3.5 -- The functionality of some keybindings (when in the view) so they work safetly, or at all, with the plugin. -- From the `enter` key to `tab` for opening/going into files/dirs (a side-effect of using the read-only setting) - -### Removed - -- The ability to use a lot of keybindings that would otherwise mess with the view, and have no benifit. -- The pointless `.gitignore` file. - -[unreleased]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.4.0...HEAD -[3.4.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.3.1...v3.4.0 -[3.3.1]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.3.0...v3.3.1 -[3.3.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.2.0...v3.3.0 -[3.2.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.1.2...v3.2.0 -[3.1.2]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.1.1...v3.1.2 -[3.1.1]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.1.0...v3.1.1 -[3.1.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v3.0.0...v3.1.0 -[3.0.0]: https://github.com/NicolaiSoeborg/filemanager-plugin/compare/v2.1.1...v3.0.0 diff --git a/.config/micro/plug/filemanager/LICENSE b/.config/micro/plug/filemanager/LICENSE deleted file mode 100644 index ae6fb2f..0000000 --- a/.config/micro/plug/filemanager/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Nicolai Søborg - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/.config/micro/plug/filemanager/README.md b/.config/micro/plug/filemanager/README.md deleted file mode 100644 index 79d983d..0000000 --- a/.config/micro/plug/filemanager/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Filemanager Plugin - -A simple plugin that allows for easy navigation of a file tree. - - - -**Installation:** run `plugin install filemanager` and restart Micro. - -## Basics - -The top line always has the current directory's path to show you where you are.\ -The `..` near the top is used to move back a directory, from your current position. - -All directories have a `/` added to the end of it, and are syntax-highlighted as a `special` character.\ -If the directory is expanded, there will be a `+` to the left of it. If it is collapsed there will be a `-` instead. - -**NOTE:** If you change files without using the plugin, it can't know what you did. The only fix is to close and open the tree. - -### Options - -| Option | Purpose | Default | -| :--------------------------- | :----------------------------------------------------------- | :------ | -| `filemanager-showdotfiles` | Show dotfiles (hidden if false) | `true` | -| `filemanager-showignored` | Show gitignore'd files (hidden if false) | `true` | -| `filemanager-compressparent` | Collapse the parent dir when left is pressed on a child file | `true` | -| `filemanager-foldersfirst` | Sorts folders above any files | `true` | -| `filemanager-openonstart` | Automatically open the file tree when starting Micro | `false` | - -### Commands and Keybindings - -The keybindings below are the equivalent to Micro's defaults, and not actually set by the plugin. If you've changed any of those keybindings, then that key is used instead. - -If you want to [keybind](https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md#rebinding-keys) any of the operations/commands, bind to the labeled API in the table below. - -| Command | Keybinding(s) | What it does | API for `bindings.json` | -| :------- | :------------------------- | :------------------------------------------------------------------------------------------ | :------------------------------------ | -| `tree` | - | Open/close the tree | `filemanager.toggle_tree` | -| - | <kbd>Tab</kbd> & MouseLeft | Open a file, or go into the directory. Goes back a dir if on `..` | `filemanager.try_open_at_cursor` | -| - | <kbd>→</kbd> | Expand directory in tree listing | `filemanager.uncompress_at_cursor` | -| - | <kbd>←</kbd> | Collapse directory listing | `filemanager.compress_at_cursor` | -| - | <kbd>Shift ⬆</kbd> | Go to the target's parent directory | `filemanager.goto_parent_dir` | -| - | <kbd>Alt Shift {</kbd> | Jump to the previous directory in the view | `filemanager.goto_next_dir` | -| - | <kbd>Alt Shift }</kbd> | Jump to the next directory in the view | `filemanager.goto_prev_dir` | -| `rm` | - | Prompt to delete the target file/directory your cursor is on | `filemanager.prompt_delete_at_cursor` | -| `rename` | - | Rename the file/directory your cursor is on, using the passed name | `filemanager.rename_at_cursor` | -| `touch` | - | Make a new file under/into the file/directory your cursor is on, using the passed name | `filemanager.new_file` | -| `mkdir` | - | Make a new directory under/into the file/directory your cursor is on, using the passed name | `filemanager.new_dir` | - -#### Notes - -- `rename`, `touch`, and `mkdir` require a name to be passed when calling.\ - Example: `rename newnamehere`, `touch filenamehere`, `mkdir dirnamehere`.\ - If the passed name already exists in the current dir, it will cancel instead of overwriting (for safety). - -- The <kbd>Ctrl w</kbd> keybinding is to switch which buffer your cursor is on.\ - This isn't specific to the plugin, it's just part of Micro, but many people seem to not know this. diff --git a/.config/micro/plug/filemanager/example.jpg b/.config/micro/plug/filemanager/example.jpg Binary files differdeleted file mode 100644 index ab5bf1c..0000000 --- a/.config/micro/plug/filemanager/example.jpg +++ /dev/null diff --git a/.config/micro/plug/filemanager/filemanager.lua b/.config/micro/plug/filemanager/filemanager.lua deleted file mode 100644 index 9f3b4fc..0000000 --- a/.config/micro/plug/filemanager/filemanager.lua +++ /dev/null @@ -1,1366 +0,0 @@ -VERSION = "3.5.0" - -local micro = import("micro") -local config = import("micro/config") -local shell = import("micro/shell") -local buffer = import("micro/buffer") -local os = import("os") -local filepath = import("path/filepath") - --- Clear out all stuff in Micro's messenger -local function clear_messenger() - -- messenger:Reset() - -- messenger:Clear() -end - --- Holds the micro.CurPane() we're manipulating -local tree_view = nil --- Keeps track of the current working directory -local current_dir = os.Getwd() --- Keep track of current highest visible indent to resize width appropriately -local highest_visible_indent = 0 --- Holds a table of paths -- objects from new_listobj() calls -local scanlist = {} - --- Get a new object used when adding to scanlist -local function new_listobj(p, d, o, i) - return { - ["abspath"] = p, - ["dirmsg"] = d, - ["owner"] = o, - ["indent"] = i, - -- Since decreasing/increasing is common, we include these with the object - ["decrease_owner"] = function(self, minus_num) - self.owner = self.owner - minus_num - end, - ["increase_owner"] = function(self, plus_num) - self.owner = self.owner + plus_num - end - } -end - --- Repeats a string x times, then returns it concatenated into one string -local function repeat_str(str, len) - -- Do NOT try to concat in a loop, it freezes micro... - -- instead, use a temporary table to hold values - local string_table = {} - for i = 1, len do - string_table[i] = str - end - -- Return the single string of repeated characters - return table.concat(string_table) -end - --- A check for if a path is a dir -local function is_dir(path) - -- Used for checking if dir - local golib_os = import("os") - -- Returns a FileInfo on the current file/path - local file_info, stat_error = golib_os.Stat(path) - -- Wrap in nil check for file/dirs without read permissions - if file_info ~= nil then - -- Returns true/false if it's a dir - return file_info:IsDir() - else - -- Couldn't stat the file/dir, usually because no read permissions - micro.InfoBar():Error("Error checking if is dir: ", stat_error) - -- Nil since we can't read the path - return nil - end -end - --- Returns a list of files (in the target dir) that are ignored by the VCS system (if exists) --- aka this returns a list of gitignored files (but for whatever VCS is found) -local function get_ignored_files(tar_dir) - -- True/false if the target dir returns a non-fatal error when checked with 'git status' - local function has_git() - local git_rp_results = RunShellCommand('git -C "' .. tar_dir .. '" rev-parse --is-inside-work-tree') - return git_rp_results:match("^true%s*$") - end - local readout_results = {} - -- TODO: Support more than just Git, such as Mercurial or SVN - if has_git() then - -- If the dir is a git dir, get all ignored in the dir - local git_ls_results = - RunShellCommand('git -C "' .. tar_dir .. '" ls-files . --ignored --exclude-standard --others --directory') - -- Cut off the newline that is at the end of each result - for split_results in string.gmatch(git_ls_results, "([^\r\n]+)") do - -- git ls-files adds a trailing slash if it's a dir, so we remove it (if it is one) - readout_results[#readout_results + 1] = - (string.sub(split_results, -1) == "/" and string.sub(split_results, 1, -2) or split_results) - end - end - - -- Make sure we return a table - return readout_results -end - --- Returns the basename of a path (aka a name without leading path) -local function get_basename(path) - if path == nil then - micro.Log("Bad path passed to get_basename") - return nil - else - -- Get Go's path lib for a basename callback - local golib_path = import("filepath") - return golib_path.Base(path) - end -end - --- Returns true/false if the file is a dotfile -local function is_dotfile(file_name) - -- Check if the filename starts with a dot - if string.sub(file_name, 1, 1) == "." then - return true - else - return false - end -end - --- Structures the output of the scanned directory content to be used in the scanlist table --- This is useful for both initial creation of the tree, and when nesting with uncompress_target() -local function get_scanlist(dir, ownership, indent_n) - local golib_ioutil = import("ioutil") - -- Gets a list of all the files in the current dir - local dir_scan, scan_error = golib_ioutil.ReadDir(dir) - - -- dir_scan will be nil if the directory is read-protected (no permissions) - if dir_scan == nil then - micro.InfoBar():Error("Error scanning dir: ", scan_error) - return nil - end - - -- The list of files to be returned (and eventually put in the view) - local results = {} - local files = {} - - local function get_results_object(file_name) - local abs_path = filepath.Join(dir, file_name) - -- Use "+" for dir's, "" for files - local dirmsg = (is_dir(abs_path) and "+" or "") - return new_listobj(abs_path, dirmsg, ownership, indent_n) - end - - -- Save so we don't have to rerun GetOption a bunch - local show_dotfiles = config.GetGlobalOption("filemanager.showdotfiles") - local show_ignored = config.GetGlobalOption("filemanager.showignored") - local folders_first = config.GetGlobalOption("filemanager.foldersfirst") - - -- The list of VCS-ignored files (if any) - -- Only bother getting ignored files if we're not showing ignored - local ignored_files = (not show_ignored and get_ignored_files(dir) or {}) - -- True/false if the file is an ignored file - local function is_ignored_file(filename) - for i = 1, #ignored_files do - if ignored_files[i] == filename then - return true - end - end - return false - end - - -- Hold the current scan's filename in most of the loops below - local filename - - for i = 1, #dir_scan do - local showfile = true - filename = dir_scan[i]:Name() - -- If we should not show dotfiles, and this is a dotfile, don't show - if not show_dotfiles and is_dotfile(filename) then - showfile = false - end - -- If we should not show ignored files, and this is an ignored file, don't show - if not show_ignored and is_ignored_file(filename) then - showfile = false - end - if showfile then - -- This file is good to show, proceed - if folders_first and not is_dir(filepath.Join(dir, filename)) then - -- If folders_first and this is a file, add it to (temporary) files - files[#files + 1] = get_results_object(filename) - else - -- Otherwise, add to results - results[#results + 1] = get_results_object(filename) - end - end - end - if #files > 0 then - -- Append any files to results, now that all folders have been added - -- files will be > 0 only if folders_first and there are files - for i = 1, #files do - results[#results + 1] = files[i] - end - end - - -- Return the list of scanned files - return results -end - --- A short "get y" for when acting on the scanlist --- Needed since we don't store the first 3 visible indicies in scanlist -local function get_safe_y(optional_y) - -- Default to 0 so we can check against and see if it's bad - local y = 0 - -- Make the passed y optional - if optional_y == nil then - -- Default to cursor's Y loc if nothing was passed, instead of declaring another y - optional_y = tree_view.Cursor.Loc.Y - end - -- 0/1/2 would be the top "dir, separator, .." so check if it's past - if optional_y > 2 then - -- -2 to conform to our scanlist, since zero-based Go index & Lua's one-based - y = tree_view.Cursor.Loc.Y - 2 - end - return y -end - --- Joins the target dir's leading path to the passed name -local function dirname_and_join(path, join_name) - -- The leading path to the dir we're in - local leading_path = DirectoryName(path) - -- Joins with OS-specific slashes - return filepath.Join(leading_path, join_name) -end - --- Hightlights the line when you move the cursor up/down -local function select_line(last_y) - -- Make last_y optional - if last_y ~= nil then - -- Don't let them move past ".." by checking the result first - if last_y > 1 then - -- If the last position was valid, move back to it - tree_view.Cursor.Loc.Y = last_y - end - elseif tree_view.Cursor.Loc.Y < 2 then - -- Put the cursor on the ".." if it's above it - tree_view.Cursor.Loc.Y = 2 - end - - -- Puts the cursor back in bounds (if it isn't) for safety - tree_view.Cursor:Relocate() - - -- Makes sure the cursor is visible (if it isn't) - -- (false) means no callback - tree_view:Center() - - -- Highlight the current line where the cursor is - tree_view.Cursor:SelectLine() -end - --- Simple true/false if scanlist is currently empty -local function scanlist_is_empty() - if next(scanlist) == nil then - return true - else - return false - end -end - -local function refresh_view() - clear_messenger() - - -- If it's less than 30, just use 30 for width. Don't want it too small - - if tree_view:GetView().Width < 30 then - tree_view:ResizePane(30) - end - - -- Delete everything in the view/buffer - tree_view.Buf.EventHandler:Remove(tree_view.Buf:Start(), tree_view.Buf:End()) - - -- Insert the top 3 things that are always there - -- Current dir - tree_view.Buf.EventHandler:Insert(buffer.Loc(0, 0), current_dir .. "\n") - -- An ASCII separator - tree_view.Buf.EventHandler:Insert(buffer.Loc(0, 1), repeat_str("─", tree_view:GetView().Width) .. "\n") - -- The ".." and use a newline if there are things in the current dir - tree_view.Buf.EventHandler:Insert(buffer.Loc(0, 2), (#scanlist > 0 and "..\n" or "..")) - - -- Holds the current basename of the path (purely for display) - local display_content - - -- NOTE: might want to not do all these concats in the loop, it can get slow - for i = 1, #scanlist do - -- The first 3 indicies are the dir/separator/"..", so skip them - if scanlist[i].dirmsg ~= "" then - -- Add the + or - to the left to signify if it's compressed or not - -- Add a forward slash to the right to signify it's a dir - display_content = scanlist[i].dirmsg .. " " .. get_basename(scanlist[i].abspath) .. "/" - else - -- Use the basename from the full path for display - -- Two spaces to align with any directories, instead of being "off" - display_content = " " .. get_basename(scanlist[i].abspath) - end - - if scanlist[i].owner > 0 then - -- Add a space and repeat it * the indent number - display_content = repeat_str(" ", 2 * scanlist[i].indent) .. display_content - end - - -- Newlines are needed for all inserts except the last - -- If you insert a newline on the last, it leaves a blank spot at the bottom - if i < #scanlist then - display_content = display_content .. "\n" - end - - -- Insert line-by-line to avoid out-of-bounds on big folders - -- +2 so we skip the 0/1/2 positions that hold the top dir/separator/.. - tree_view.Buf.EventHandler:Insert(buffer.Loc(0, i + 2), display_content) - end - - -- Resizes all views after messing with ours - tree_view:Tab():Resize() -end - --- Moves the cursor to the ".." in tree_view -local function move_cursor_top() - -- 2 is the position of the ".." - tree_view.Cursor.Loc.Y = 2 - - -- select the line after moving - select_line() -end - -local function refresh_and_select() - -- Save the cursor position before messing with the view.. - -- because changing contents in the view causes the Y loc to move - local last_y = tree_view.Cursor.Loc.Y - -- Actually refresh - refresh_view() - -- Moves the cursor back to it's original position - select_line(last_y) -end - --- Find everything nested under the target, and remove it from the scanlist -local function compress_target(y, delete_y) - -- Can't compress the top stuff, or if there's nothing there, so exit early - if y == 0 or scanlist_is_empty() then - return - end - -- Check if the target is a dir, since files don't have anything to compress - -- Also make sure it's actually an uncompressed dir by checking the gutter message - if scanlist[y].dirmsg == "-" then - local target_index, delete_index - -- Add the original target y to stuff to delete - local delete_under = {[1] = y} - local new_table = {} - local del_count = 0 - -- Loop through the whole table, looking for nested content, or stuff with ownership == y... - -- and delete matches. y+1 because we want to start under y, without actually touching y itself. - for i = 1, #scanlist do - delete_index = false - -- Don't run on y, since we don't always delete y - if i ~= y then - -- On each loop, check if the ownership matches - for x = 1, #delete_under do - -- Check for something belonging to a thing to delete - if scanlist[i].owner == delete_under[x] then - -- Delete the target if it has an ownership to our delete target - delete_index = true - -- Keep count of total deleted (can't use #delete_under because it's for deleted dir count) - del_count = del_count + 1 - -- Check if an uncompressed dir - if scanlist[i].dirmsg == "-" then - -- Add the index to stuff to delete, since it holds nested content - delete_under[#delete_under + 1] = i - end - -- See if we're on the "deepest" nested content - if scanlist[i].indent == highest_visible_indent and scanlist[i].indent > 0 then - -- Save the lower indent, since we're minimizing/deleting nested dirs - highest_visible_indent = highest_visible_indent - 1 - end - -- Nothing else to do, so break this inner loop - break - end - end - end - if not delete_index then - -- Save the index in our new table - new_table[#new_table + 1] = scanlist[i] - end - end - - scanlist = new_table - - if del_count > 0 then - -- Ownership adjusting since we're deleting an index - for i = y + 1, #scanlist do - -- Don't touch root file/dirs - if scanlist[i].owner > y then - -- Minus ownership, on everything below i, the number deleted - scanlist[i]:decrease_owner(del_count) - end - end - end - - -- If not deleting, then update the gutter message to be + to signify compressed - if not delete_y then - -- Update the dir message - scanlist[y].dirmsg = "+" - end - elseif config.GetGlobalOption("filemanager.compressparent") and not delete_y then - goto_parent_dir() - -- Prevent a pointless refresh of the view - return - end - - -- Put outside check above because we call this to delete targets as well - if delete_y then - local second_table = {} - -- Quickly remove y - for i = 1, #scanlist do - if i == y then - -- Reduce everything's ownership by 1 after y - for x = i + 1, #scanlist do - -- Don't touch root file/dirs - if scanlist[x].owner > y then - -- Minus 1 since we're just deleting y - scanlist[x]:decrease_owner(1) - end - end - else - -- Put everything but y into the temporary table - second_table[#second_table + 1] = scanlist[i] - end - end - -- Put everything (but y) back into scanlist, with adjusted ownership values - scanlist = second_table - end - - if tree_view:GetView().Width > (30 + highest_visible_indent) then - -- Shave off some width - tree_view:ResizePane(30 + highest_visible_indent) - end - - refresh_and_select() -end - --- Prompts the user for deletion of a file/dir when triggered --- Not local so Micro can access it -function prompt_delete_at_cursor() - local y = get_safe_y() - -- Don't let them delete the top 3 index dir/separator/.. - if y == 0 or scanlist_is_empty() then - micro.InfoBar():Error("You can't delete that") - -- Exit early if there's nothing to delete - return - end - - micro.InfoBar():YNPrompt("Do you want to delete the " .. (scanlist[y].dirmsg ~= "" and "dir" or "file") .. ' "' .. scanlist[y].abspath .. '"? ', function(yes, canceled) - if yes and not canceled then - -- Use Go's os.Remove to delete the file - local go_os = import("os") - -- Delete the target (if its a dir then the children too) - local remove_log = go_os.RemoveAll(scanlist[y].abspath) - if remove_log == nil then - micro.InfoBar():Message("Filemanager deleted: ", scanlist[y].abspath) - -- Remove the target (and all nested) from scanlist[y + 1] - -- true to delete y - compress_target(get_safe_y(), true) - else - micro.InfoBar():Error("Failed deleting file/dir: ", remove_log) - end - else - micro.InfoBar():Message("Nothing was deleted") - end - end) -end - --- Changes the current dir in the top of the tree.. --- then scans that dir, and prints it to the view -local function update_current_dir(path) - -- Clear the highest since this is a full refresh - highest_visible_indent = 0 - -- Set the width back to 30 - tree_view:ResizePane(30) - -- Update the current dir to the new path - current_dir = path - - -- Get the current working dir's files into our list of files - -- 0 ownership because this is a scan of the base dir - -- 0 indent because this is the base dir - local scan_results = get_scanlist(path, 0, 0) - -- Safety check with not-nil - if scan_results ~= nil then - -- Put in the new scan stuff - scanlist = scan_results - else - -- If nil, just empty it - scanlist = {} - end - - refresh_view() - -- Since we're going into a new dir, move cursor to the ".." by default - move_cursor_top() -end - --- (Tries to) go back one "step" from the current directory -local function go_back_dir() - -- Use Micro's dirname to get everything but the current dir's path - local one_back_dir = filepath.Dir(current_dir) - -- Try opening, assuming they aren't at "root", by checking if it matches last dir - if one_back_dir ~= current_dir then - -- If DirectoryName returns different, then they can move back.. - -- so we update the current dir and refresh - update_current_dir(one_back_dir) - end -end - --- Tries to open the current index --- If it's the top dir indicator, or separator, nothing happens --- If it's ".." then it tries to go back a dir --- If it's a dir then it moves into the dir and refreshes --- If it's actually a file, open it in a new vsplit --- THIS EXPECTS ZERO-BASED Y -local function try_open_at_y(y) - -- 2 is the zero-based index of ".." - if y == 2 then - go_back_dir() - elseif y > 2 and not scanlist_is_empty() then - -- -2 to conform to our scanlist "missing" first 3 indicies - y = y - 2 - if scanlist[y].dirmsg ~= "" then - -- if passed path is a directory, update the current dir to be one deeper.. - update_current_dir(scanlist[y].abspath) - else - -- If it's a file, then open it - micro.InfoBar():Message("Filemanager opened ", scanlist[y].abspath) - -- Opens the absolute path in new vertical view - micro.CurPane():VSplitIndex(buffer.NewBufferFromFile(scanlist[y].abspath), true) - -- Resizes all views after opening a file - -- tabs[curTab + 1]:Resize() - end - else - micro.InfoBar():Error("Can't open that") - end -end - --- Opens the dir's contents nested under itself -local function uncompress_target(y) - -- Exit early if on the top 3 non-list items - if y == 0 or scanlist_is_empty() then - return - end - -- Only uncompress if it's a dir and it's not already uncompressed - if scanlist[y].dirmsg == "+" then - -- Get a new scanlist with results from the scan in the target dir - local scan_results = get_scanlist(scanlist[y].abspath, y, scanlist[y].indent + 1) - -- Don't run any of this if there's nothing in the dir we scanned, pointless - if scan_results ~= nil then - -- Will hold all the old values + new scan results - local new_table = {} - -- By not inserting in-place, some unexpected results can be avoided - -- Also, table.insert actually moves values up (???) instead of down - for i = 1, #scanlist do - -- Put the current val into our new table - new_table[#new_table + 1] = scanlist[i] - if i == y then - -- Fill in the scan results under y - for x = 1, #scan_results do - new_table[#new_table + 1] = scan_results[x] - end - -- Basically "moving down" everything below y, so ownership needs to increase on everything - for inner_i = y + 1, #scanlist do - -- When root not pushed by inserting, don't change its ownership - -- This also has a dual-purpose to make it not effect root file/dirs - -- since y is always >= 3 - if scanlist[inner_i].owner > y then - -- Increase each indicies ownership by the number of scan results inserted - scanlist[inner_i]:increase_owner(#scan_results) - end - end - end - end - - -- Update our scanlist with the new values - scanlist = new_table - end - - -- Change to minus to signify it's uncompressed - scanlist[y].dirmsg = "-" - - -- Check if we actually need to resize, or if we're nesting at the same indent - -- Also check if there's anything in the dir, as we don't need to expand on an empty dir - if scan_results ~= nil then - if scanlist[y].indent > highest_visible_indent and #scan_results >= 1 then - -- Save the new highest indent - highest_visible_indent = scanlist[y].indent - -- Increase the width to fit the new nested content - tree_view:ResizePane(tree_view:GetView().Width + scanlist[y].indent) - end - end - - refresh_and_select() - end -end - --- Stat a path to check if it exists, returning true/false -local function path_exists(path) - local go_os = import("os") - -- Stat the file/dir path we created - -- file_stat should be non-nil, and stat_err should be nil on success - local file_stat, stat_err = go_os.Stat(path) - -- Check if what we tried to create exists - if stat_err ~= nil then - -- true/false if the file/dir exists - return go_os.IsExist(stat_err) - elseif file_stat ~= nil then - -- Assume it exists if no errors - return true - end - return false -end - --- Prompts for a new name, then renames the file/dir at the cursor's position --- Not local so Micro can use it -function rename_at_cursor(new_name) - if micro.CurPane() ~= tree_view then - micro.InfoBar():Message("Rename only works with the cursor in the tree!") - return - end - - -- Safety check they actually passed a name - if new_name == nil then - micro.InfoBar():Error('When using "rename" you need to input a new name') - return - end - - -- +1 since Go uses zero-based indices - local y = get_safe_y() - -- Check if they're trying to rename the top stuff - if y == 0 then - -- Error since they tried to rename the top stuff - micro.InfoBar():Message("You can't rename that!") - return - end - - -- The old file/dir's path - local old_path = scanlist[y].abspath - -- Join the path into their supplied rename, so that we have an absolute path - local new_path = dirname_and_join(old_path, new_name) - -- Use Go's os package for renaming the file/dir - local golib_os = import("os") - -- Actually rename the file - local log_out = golib_os.Rename(old_path, new_path) - -- Output the log, if any, of the rename - if log_out ~= nil then - micro.Log("Rename log: ", log_out) - end - - -- Check if the rename worked - if not path_exists(new_path) then - micro.InfoBar():Error("Path doesn't exist after rename!") - return - end - - -- NOTE: doesn't alphabetically sort after refresh, but it probably should - -- Replace the old path with the new path - scanlist[y].abspath = new_path - -- Refresh the tree with our new name - refresh_and_select() -end - --- Prompts the user for the file/dir name, then creates the file/dir using Go's os package -local function create_filedir(filedir_name, make_dir) - if micro.CurPane() ~= tree_view then - micro.InfoBar():Message("You can't create a file/dir if your cursor isn't in the tree!") - return - end - - -- Safety check they passed a name - if filedir_name == nil then - micro.InfoBar():Error('You need to input a name when using "touch" or "mkdir"!') - return - end - - -- The target they're trying to create on top of/in/at/whatever - local y = get_safe_y() - -- Holds the path passed to Go for the eventual new file/dir - local filedir_path - -- A true/false if scanlist is empty - local scanlist_empty = scanlist_is_empty() - - -- Check there's actually anything in the list, and that they're not on the ".." - if not scanlist_empty and y ~= 0 then - -- If they're inserting on a folder, don't strip its path - if scanlist[y].dirmsg ~= "" then - -- Join our new file/dir onto the dir - filedir_path = filepath.Join(scanlist[y].abspath, filedir_name) - else - -- The current index is a file, so strip its name and join ours onto it - filedir_path = dirname_and_join(scanlist[y].abspath, filedir_name) - end - else - -- if nothing in the list, or cursor is on top of "..", use the current dir - filedir_path = filepath.Join(current_dir, filedir_name) - end - - -- Check if the name is already taken by a file/dir - if path_exists(filedir_path) then - micro.InfoBar():Error("You can't create a file/dir with a pre-existing name") - return - end - - -- Use Go's os package for creating the files - local golib_os = import("os") - -- Create the dir or file - if make_dir then - -- Creates the dir - golib_os.Mkdir(filedir_path, golib_os.ModePerm) - micro.Log("Filemanager created directory: " .. filedir_path) - else - -- Creates the file - golib_os.Create(filedir_path) - micro.Log("Filemanager created file: " .. filedir_path) - end - - -- If the file we tried to make doesn't exist, fail - if not path_exists(filedir_path) then - micro.InfoBar():Error("The file/dir creation failed") - - return - end - - -- Creates a sort of default object, to be modified below - -- If creating a dir, use a "+" - local new_filedir = new_listobj(filedir_path, (make_dir and "+" or ""), 0, 0) - - -- Refresh with our new value(s) - local last_y - - -- Only insert to scanlist if not created into a compressed dir, since it'd be hidden if it was - -- Wrap the below checks so a y=0 doesn't break something - if not scanlist_empty and y ~= 0 then - -- +1 so it's highlighting the new file/dir - last_y = tree_view.Cursor.Loc.Y + 1 - - -- Only actually add the object to the list if it's not created on an uncompressed folder - if scanlist[y].dirmsg == "+" then - -- Exit early, since it was created into an uncompressed folder - - return - elseif scanlist[y].dirmsg == "-" then - -- Check if created on top of an uncompressed folder - -- Change ownership to the folder it was created on top of.. - -- otherwise, the ownership would be incorrect - new_filedir.owner = y - -- We insert under the folder, so increment the indent - new_filedir.indent = scanlist[y].indent + 1 - else - -- This triggers if the cursor is on top of a file... - -- so we copy the properties of it - new_filedir.owner = scanlist[y].owner - new_filedir.indent = scanlist[y].indent - end - - -- A temporary table for adding our new object, and manipulation - local new_table = {} - -- Insert the new file/dir, and update ownership of everything below it - for i = 1, #scanlist do - -- Don't use i as index, as it will be off by one on the next pass after below "i == y" - new_table[#new_table + 1] = scanlist[i] - if i == y then - -- Insert our new file/dir (below the last item) - new_table[#new_table + 1] = new_filedir - -- Increase ownership of everything below it, since we're inserting - -- Basically "moving down" everything below y, so ownership needs to increase on everything - for inner_i = y + 1, #scanlist do - -- When root not pushed by inserting, don't change its ownership - -- This also has a dual-purpose to make it not effect root file/dirs - -- since y is always >= 3 - if scanlist[inner_i].owner > y then - -- Increase each indicies ownership by 1 since we're only inserting 1 file/dir - scanlist[inner_i]:increase_owner(1) - end - end - end - end - -- Update the scanlist with the new object & updated ownerships - scanlist = new_table - else - -- The scanlist is empty (or cursor is on ".."), so we add on our new file/dir at the bottom - scanlist[#scanlist + 1] = new_filedir - -- Add current position so it takes into account where we are - last_y = #scanlist + tree_view.Cursor.Loc.Y - end - - refresh_view() - select_line(last_y) -end - --- Triggered with "touch filename" -function new_file(input_name) - -- False because not a dir - create_filedir(input_name, false) -end - --- Triggered with "mkdir dirname" -function new_dir(input_name) - -- True because dir - create_filedir(input_name, true) -end - --- open_tree setup's the view -local function open_tree() - -- Open a new Vsplit (on the very left) - micro.CurPane():VSplitIndex(buffer.NewBuffer("", "filemanager"), false) - -- Save the new view so we can access it later - tree_view = micro.CurPane() - - -- Set the width of tree_view to 30% & lock it - tree_view:ResizePane(30) - -- Set the type to unsavable - -- tree_view.Buf.Type = buffer.BTLog - tree_view.Buf.Type.Scratch = true - tree_view.Buf.Type.Readonly = true - - -- Set the various display settings, but only on our view (by using SetLocalOption instead of SetOption) - -- NOTE: Micro requires the true/false to be a string - -- Softwrap long strings (the file/dir paths) - tree_view.Buf:SetOptionNative("softwrap", true) - -- No line numbering - tree_view.Buf:SetOptionNative("ruler", false) - -- Is this needed with new non-savable settings from being "vtLog"? - tree_view.Buf:SetOptionNative("autosave", false) - -- Don't show the statusline to differentiate the view from normal views - tree_view.Buf:SetOptionNative("statusformatr", "") - tree_view.Buf:SetOptionNative("statusformatl", "filemanager") - tree_view.Buf:SetOptionNative("scrollbar", false) - - -- Fill the scanlist, and then print its contents to tree_view - update_current_dir(os.Getwd()) -end - --- close_tree will close the tree plugin view and release memory. -local function close_tree() - if tree_view ~= nil then - tree_view:Quit() - tree_view = nil - clear_messenger() - end -end - --- toggle_tree will toggle the tree view visible (create) and hide (delete). -function toggle_tree() - if tree_view == nil then - open_tree() - else - close_tree() - end -end - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- Functions exposed specifically for the user to bind --- Some are used in callbacks as well --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -function uncompress_at_cursor() - if micro.CurPane() == tree_view then - uncompress_target(get_safe_y()) - end -end - -function compress_at_cursor() - if micro.CurPane() == tree_view then - -- False to not delete y - compress_target(get_safe_y(), false) - end -end - --- Goes up 1 visible directory (if any) --- Not local so it can be bound -function goto_prev_dir() - if micro.CurPane() ~= tree_view or scanlist_is_empty() then - return - end - - local cur_y = get_safe_y() - -- If they try to run it on the ".." do nothing - if cur_y ~= 0 then - local move_count = 0 - for i = cur_y - 1, 1, -1 do - move_count = move_count + 1 - -- If a dir, stop counting - if scanlist[i].dirmsg ~= "" then - -- Jump to its parent (the ownership) - tree_view.Cursor:UpN(move_count) - select_line() - break - end - end - end -end - --- Goes down 1 visible directory (if any) --- Not local so it can be bound -function goto_next_dir() - if micro.CurPane() ~= tree_view or scanlist_is_empty() then - return - end - - local cur_y = get_safe_y() - local move_count = 0 - -- If they try to goto_next on "..", pretends the cursor is valid - if cur_y == 0 then - cur_y = 1 - move_count = 1 - end - -- Only do anything if it's even possible for there to be another dir - if cur_y < #scanlist then - for i = cur_y + 1, #scanlist do - move_count = move_count + 1 - -- If a dir, stop counting - if scanlist[i].dirmsg ~= "" then - -- Jump to its parent (the ownership) - tree_view.Cursor:DownN(move_count) - select_line() - break - end - end - end -end - --- Goes to the parent directory (if any) --- Not local so it can be keybound -function goto_parent_dir() - if micro.CurPane() ~= tree_view or scanlist_is_empty() then - return - end - - local cur_y = get_safe_y() - -- Check if the cursor is even in a valid location for jumping to the owner - if cur_y > 0 then - -- Jump to its parent (the ownership) - tree_view.Cursor:UpN(cur_y - scanlist[cur_y].owner) - select_line() - end -end - -function try_open_at_cursor() - if micro.CurPane() ~= tree_view or scanlist_is_empty() then - return - end - - try_open_at_y(tree_view.Cursor.Loc.Y) -end - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- Shorthand functions for actions to reduce repeat code --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --- Used to fail certain actions that we shouldn't allow on the tree_view -local function false_if_tree(view) - if view == tree_view then - return false - end -end - --- Select the line at the cursor -local function selectline_if_tree(view) - if view == tree_view then - select_line() - end -end - --- Move the cursor to the top, but don't allow the action -local function aftermove_if_tree(view) - if view == tree_view then - if tree_view.Cursor.Loc.Y < 2 then - -- If it went past the "..", move back onto it - tree_view.Cursor:DownN(2 - tree_view.Cursor.Loc.Y) - end - select_line() - end -end - -local function clearselection_if_tree(view) - if view == tree_view then - -- Clear the selection when doing a find, so it doesn't copy the current line - tree_view.Cursor:ResetSelection() - end -end - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- All the events for certain Micro keys go below here --- Other than things we flat-out fail --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --- Close current -function preQuit(view) - if view == tree_view then - -- A fake quit function - close_tree() - -- Don't actually "quit", otherwise it closes everything without saving for some reason - return false - end -end - --- Close all -function preQuitAll(view) - close_tree() -end - --- FIXME: Workaround for the weird 2-index movement on cursordown -function preCursorDown(view) - if view == tree_view then - tree_view.Cursor:Down() - select_line() - -- Don't actually go down, as it moves 2 indicies for some reason - return false - end -end - --- Up -function onCursorUp(view) - selectline_if_tree(view) -end - --- Alt-Shift-{ --- Go to target's parent directory (if exists) -function preParagraphPrevious(view) - if view == tree_view then - goto_prev_dir() - -- Don't actually do the action - return false - end -end - --- Alt-Shift-} --- Go to next dir (if exists) -function preParagraphNext(view) - if view == tree_view then - goto_next_dir() - -- Don't actually do the action - return false - end -end - --- PageUp -function onCursorPageUp(view) - aftermove_if_tree(view) -end - --- Ctrl-Up -function onCursorStart(view) - aftermove_if_tree(view) -end - --- PageDown -function onCursorPageDown(view) - selectline_if_tree(view) -end - --- Ctrl-Down -function onCursorEnd(view) - selectline_if_tree(view) -end - -function onNextSplit(view) - selectline_if_tree(view) -end - -function onPreviousSplit(view) - selectline_if_tree(view) -end - --- On click, open at the click's y -function preMousePress(view, event) - if view == tree_view then - local x, y = event:Position() - -- Fixes the y because softwrap messes with it - local new_x, new_y = tree_view:GetMouseClickLocation(x, y) - -- Try to open whatever is at the click's y index - -- Will go into/back dirs based on what's clicked, nothing gets expanded - try_open_at_y(new_y) - -- Don't actually allow the mousepress to trigger, so we avoid highlighting stuff - return false - end -end - --- Up -function preCursorUp(view) - if view == tree_view then - -- Disallow selecting past the ".." in the tree - if tree_view.Cursor.Loc.Y == 2 then - return false - end - end -end - --- Left -function preCursorLeft(view) - if view == tree_view then - -- +1 because of Go's zero-based index - -- False to not delete y - compress_target(get_safe_y(), false) - -- Don't actually move the cursor, as it messes with selection - return false - end -end - --- Right -function preCursorRight(view) - if view == tree_view then - -- +1 because of Go's zero-based index - uncompress_target(get_safe_y()) - -- Don't actually move the cursor, as it messes with selection - return false - end -end - --- Workaround for tab getting inserted into opened files --- Ref https://github.com/zyedidia/micro/issues/992 -local tab_pressed = false - --- Tab -function preIndentSelection(view) - if view == tree_view then - tab_pressed = true - -- Open the file - -- Using tab instead of enter, since enter won't work with Readonly - try_open_at_y(tree_view.Cursor.Loc.Y) - -- Don't actually insert a tab - return false - end -end - --- Workaround for tab getting inserted into opened files --- Ref https://github.com/zyedidia/micro/issues/992 -function preInsertTab(view) - if tab_pressed then - tab_pressed = false - return false - end -end -function preInsertNewline(view) - if view == tree_view then - return false - end - return true -end --- CtrlL -function onJumpLine(view) - -- Highlight the line after jumping to it - -- Also moves you to index 3 (2 in zero-base) if you went to the first 2 lines - aftermove_if_tree(view) -end - --- ShiftUp -function preSelectUp(view) - if view == tree_view then - -- Go to the file/dir's parent dir (if any) - goto_parent_dir() - -- Don't actually selectup - return false - end -end - --- CtrlF -function preFind(view) - -- Since something is always selected, clear before a find - -- Prevents copying the selection into the find input - clearselection_if_tree(view) -end - --- FIXME: doesn't work for whatever reason -function onFind(view) - -- Select the whole line after a find, instead of just the input txt - selectline_if_tree(view) -end - --- CtrlN after CtrlF -function onFindNext(view) - selectline_if_tree(view) -end - --- CtrlP after CtrlF -function onFindPrevious(view) - selectline_if_tree(view) -end - --- NOTE: This is a workaround for "cd" not having its own callback -local precmd_dir - -function preCommandMode(view) - precmd_dir = os.Getwd() -end - --- Update the current dir when using "cd" -function onCommandMode(view) - local new_dir = os.Getwd() - -- Only do anything if the tree is open, and they didn't cd to nothing - if tree_view ~= nil and new_dir ~= precmd_dir and new_dir ~= current_dir then - update_current_dir(new_dir) - end -end - ------------------------------------------------------------------- --- Fail a bunch of useless actions --- Some of these need to be removed (read-only makes some useless) ------------------------------------------------------------------- - -function preStartOfLine(view) - return false_if_tree(view) -end - -function preStartOfText(view) - return false_if_tree(view) -end - -function preEndOfLine(view) - return false_if_tree(view) -end - -function preMoveLinesDown(view) - return false_if_tree(view) -end - -function preMoveLinesUp(view) - return false_if_tree(view) -end - -function preWordRight(view) - return false_if_tree(view) -end - -function preWordLeft(view) - return false_if_tree(view) -end - -function preSelectDown(view) - return false_if_tree(view) -end - -function preSelectLeft(view) - return false_if_tree(view) -end - -function preSelectRight(view) - return false_if_tree(view) -end - -function preSelectWordRight(view) - return false_if_tree(view) -end - -function preSelectWordLeft(view) - return false_if_tree(view) -end - -function preSelectToStartOfLine(view) - return false_if_tree(view) -end - -function preSelectToStartOfText(view) - return false_if_tree(view) -end - -function preSelectToEndOfLine(view) - return false_if_tree(view) -end - -function preSelectToStart(view) - return false_if_tree(view) -end - -function preSelectToEnd(view) - return false_if_tree(view) -end - -function preDeleteWordLeft(view) - return false_if_tree(view) -end - -function preDeleteWordRight(view) - return false_if_tree(view) -end - -function preOutdentSelection(view) - return false_if_tree(view) -end - -function preOutdentLine(view) - return false_if_tree(view) -end - -function preSave(view) - return false_if_tree(view) -end - -function preCut(view) - return false_if_tree(view) -end - -function preCutLine(view) - return false_if_tree(view) -end - -function preDuplicateLine(view) - return false_if_tree(view) -end - -function prePaste(view) - return false_if_tree(view) -end - -function prePastePrimary(view) - return false_if_tree(view) -end - -function preMouseMultiCursor(view) - return false_if_tree(view) -end - -function preSpawnMultiCursor(view) - return false_if_tree(view) -end - -function preSelectAll(view) - return false_if_tree(view) -end - -function init() - -- Let the user disable showing of dotfiles like ".editorconfig" or ".DS_STORE" - config.RegisterCommonOption("filemanager", "showdotfiles", true) - -- Let the user disable showing files ignored by the VCS (i.e. gitignored) - config.RegisterCommonOption("filemanager", "showignored", true) - -- Let the user disable going to parent directory via left arrow key when file selected (not directory) - config.RegisterCommonOption("filemanager", "compressparent", true) - -- Let the user choose to list sub-folders first when listing the contents of a folder - config.RegisterCommonOption("filemanager", "foldersfirst", true) - -- Lets the user have the filetree auto-open any time Micro is opened - -- false by default, as it's a rather noticable user-facing change - config.RegisterCommonOption("filemanager", "openonstart", false) - - -- Open/close the tree view - config.MakeCommand("tree", toggle_tree, config.NoComplete) - -- Rename the file/dir under the cursor - config.MakeCommand("rename", rename_at_cursor, config.NoComplete) - -- Create a new file - config.MakeCommand("touch", new_file, config.NoComplete) - -- Create a new dir - config.MakeCommand("mkdir", new_dir, config.NoComplete) - -- Delete a file/dir, and anything contained in it if it's a dir - config.MakeCommand("rm", prompt_delete_at_cursor, config.NoComplete) - -- Adds colors to the ".." and any dir's in the tree view via syntax highlighting - -- TODO: Change it to work with git, based on untracked/changed/added/whatever - config.AddRuntimeFile("filemanager", config.RTSyntax, "syntax.yaml") - - -- NOTE: This must be below the syntax load command or coloring won't work - -- Just auto-open if the option is enabled - -- This will run when the plugin first loads - if config.GetGlobalOption("filemanager.openonstart") then - -- Check for safety on the off-chance someone's init.lua breaks this - if tree_view == nil then - open_tree() - -- Puts the cursor back in the empty view that initially spawns - -- This is so the cursor isn't sitting in the tree view at startup - micro.CurPane():NextSplit() - else - -- Log error so they can fix it - micro.Log( - "Warning: filemanager.openonstart was enabled, but somehow the tree was already open so the option was ignored." - ) - end - end -end diff --git a/.config/micro/plug/filemanager/repo.json b/.config/micro/plug/filemanager/repo.json deleted file mode 100644 index eb814d4..0000000 --- a/.config/micro/plug/filemanager/repo.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "Name": "filemanager", - "Description": "File manager for Micro", - "Tags": ["filetree", "filemanager", "file", "manager"], - "Website": "", - "Versions": [ - { - "Version": "2.1.1", - "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v2.1.1.zip", - "Require": { - "micro": ">=1.3.2" - } - }, - { - "Version": "3.1.0", - "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v3.1.0.zip", - "Require": { - "micro": ">=1.3.5" - } - }, - { - "Version": "3.4.0", - "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v3.4.0.zip", - "Require": { - "micro": ">=1.4.1" - } - }, - { - "Version": "3.5.0", - "Url": "https://github.com/NicolaiSoeborg/filemanager-plugin/archive/v3.4.0.zip", - "Require": { - "micro": ">=2.0.0-1" - } - } - ] - } -] diff --git a/.config/micro/plug/filemanager/syntax.yaml b/.config/micro/plug/filemanager/syntax.yaml deleted file mode 100644 index da001cf..0000000 --- a/.config/micro/plug/filemanager/syntax.yaml +++ /dev/null @@ -1,9 +0,0 @@ -filetype: filemanager - -detect: - filename: "^filemanager$" - -rules: - # The "..", the separator line thing, and directories - # Optionally, add this below to highlight the ascii line: "^─*$" - - special: "^\\.\\.$|\\-\\s.*|\\+\\s.*" diff --git a/.config/micro/plug/fzf/README.md b/.config/micro/plug/fzf/README.md deleted file mode 100644 index 2f03afd..0000000 --- a/.config/micro/plug/fzf/README.md +++ /dev/null @@ -1 +0,0 @@ -Provides a `fzf` command in micro to open a file in the current pane using fzf. diff --git a/.config/micro/plug/fzf/main.lua b/.config/micro/plug/fzf/main.lua deleted file mode 100644 index fbdcd97..0000000 --- a/.config/micro/plug/fzf/main.lua +++ /dev/null @@ -1,38 +0,0 @@ -VERSION = "1.1.1" - -local micro = import("micro") -local shell = import("micro/shell") -local config = import("micro/config") -local buffer = import("micro/buffer") - -function fzf(bp) - if shell.TermEmuSupported then - local err = shell.RunTermEmulator(bp, "fzf", false, true, fzfOutput, {bp}) - if err ~= nil then - micro.InfoBar():Error(err) - end - else - local output, err = shell.RunInteractiveShell("fzf", false, true) - if err ~= nil then - micro.InfoBar():Error(err) - else - fzfOutput(output, {bp}) - end - end -end - -function fzfOutput(output, args) - local bp = args[1] - local strings = import("strings") - output = strings.TrimSpace(output) - if output ~= "" then - local buf, err = buffer.NewBufferFromFile(output) - if err == nil then - bp:OpenBuffer(buf) - end - end -end - -function init() - config.MakeCommand("fzf", fzf, config.NoComplete) -end diff --git a/.config/micro/plug/fzf/repo.json b/.config/micro/plug/fzf/repo.json deleted file mode 100644 index 592bab8..0000000 --- a/.config/micro/plug/fzf/repo.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "Name": "fzf", - "Description": "adds support to opening files via fzf", - "Website": "https://github.com/samdmarshall/micro-fzf-plugin", - "Tags": ["fzf"], - "Versions": [ - { - "Version": "1.1.1", - "Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/fzf-1.1.1.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "1.1.0", - "Url": "https://github.com/micro-editor/updated-plugins/releases/download/v1.0.0/fzf-1.1.0.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "1.0.5", - "Url": "https://github.com/samdmarshall/micro-fzf-plugin/archive/v1.0.5.zip", - "Require": { - "micro": ">=1.1.2" - } - } - ] - } -] - diff --git a/.config/micro/plug/go/README.md b/.config/micro/plug/go/README.md deleted file mode 100644 index 8002e0e..0000000 --- a/.config/micro/plug/go/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Go Plugin for Micro - -This repository holds the Go plugin for micro. This plugin -has been updated for use with micro 2.0. - -Install by cloning this into your plug directory: - -``` -git clone https://github.com/micro-editor/go-plugin ~/.config/micro/plug/go-plugin -``` diff --git a/.config/micro/plug/go/go.lua b/.config/micro/plug/go/go.lua deleted file mode 100644 index d030316..0000000 --- a/.config/micro/plug/go/go.lua +++ /dev/null @@ -1,84 +0,0 @@ -VERSION = "2.0.2" - -local micro = import("micro") -local config = import("micro/config") -local shell = import("micro/shell") -local buffer = import("micro/buffer") - --- outside init because we want these options to take effect before --- buffers are initialized -config.RegisterCommonOption("go", "goimports", false) -config.RegisterCommonOption("go", "gofmt", true) - -function init() - config.MakeCommand("goimports", goimports, config.NoComplete) - config.MakeCommand("gofmt", gofmt, config.NoComplete) - config.MakeCommand("gorename", gorenameCmd, config.NoComplete) - - config.AddRuntimeFile("go", config.RTHelp, "help/go-plugin.md") - config.TryBindKey("F6", "command-edit:gorename ", false) -end - -function onSave(bp) - if bp.Buf:FileType() == "go" then - if bp.Buf.Settings["go.goimports"] then - goimports(bp) - elseif bp.Buf.Settings["go.gofmt"] then - gofmt(bp) - end - end - return true -end - -function gofmt(bp) - bp:Save() - local _, err = shell.RunCommand("gofmt -w " .. bp.Buf.Path) - if err ~= nil then - micro.InfoBar():Error(err) - return - end - - bp.Buf:ReOpen() -end - -function gorenameCmd(bp, args) - micro.Log(args) - if #args == 0 then - micro.InfoBar():Message("Not enough arguments") - else - bp:Save() - local buf = bp.Buf - if #args == 1 then - local c = bp.Cursor - local loc = buffer.Loc(c.X, c.Y) - local offset = buffer.ByteOffset(loc, buf) - local cmdargs = {"--offset", buf.Path .. ":#" .. tostring(offset), "--to", args[1]} - shell.JobSpawn("gorename", cmdargs, nil, renameStderr, renameExit, bp) - else - local cmdargs = {"--from", args[1], "--to", args[2]} - shell.JobSpawn("gorename", cmdargs, nil, renameStderr, renameExit, bp) - end - micro.InfoBar():Message("Renaming...") - end -end - -function renameStderr(err) - micro.Log(err) - micro.InfoBar():Message(err) -end - -function renameExit(output, args) - local bp = args[1] - bp.Buf:ReOpen() -end - -function goimports(bp) - bp:Save() - local _, err = shell.RunCommand("goimports -w " .. bp.Buf.Path) - if err ~= nil then - micro.InfoBar():Error(err) - return - end - - bp.Buf:ReOpen() -end diff --git a/.config/micro/plug/go/help/go-plugin.md b/.config/micro/plug/go/help/go-plugin.md deleted file mode 100644 index a4cdb33..0000000 --- a/.config/micro/plug/go/help/go-plugin.md +++ /dev/null @@ -1,42 +0,0 @@ -# Go Plugin - -The go plugin provides some extra niceties for using micro with -the Go programming language. The main thing this plugin does is -run `gofmt` and `goimports` for you automatically. If you would also -like automatically error linting, check out the `linter` plugin. -The plugin also provides `gorename` functionality. - -You can run - -``` -> gofmt -``` - -or - -``` -> goimports -``` - -To automatically run these when you save the file, use the following -options: - -* `gofmt`: run gofmt on file saved. Default value: `on` -* `goimports`: run goimports on file saved. Default value: `off` - -To use `gorename`, place your cursor over the variable you would like -to rename and enter the command `> gorename newName`. - -You also press F6 (the default binding) to open a prompt to rename. You -can rebind this in your `bindings.json` file with the action `go.gorename`. - -The go plugin also provides an interface for using `gorename` if you have -it installed. The gorename command behaves in two ways: - -* With one argument: `> gorename newname` will rename the identifier - under the cursor with the new name `newname`. - -* With two arguments: `> gorename oldname newname` will rename the old - identifier with the new one. This uses gorename's syntax for specifying - the old identifier, so please see `gorename --help` for the details - for how to specify the variable. diff --git a/.config/micro/plug/go/repo.json b/.config/micro/plug/go/repo.json deleted file mode 100644 index f4e914c..0000000 --- a/.config/micro/plug/go/repo.json +++ /dev/null @@ -1,37 +0,0 @@ -[{ - "Name": "go", - "Description": "Go language support (gofmt and goimports)", - "Tags": ["go", "golang"], - "Website": "https://github.com/micro-editor/go-plugin", - "Versions": [ - { - "Version": "2.0.2", - "Url": "https://github.com/micro-editor/go-plugin/archive/v2.0.2.zip", - "Require": { - "micro": ">=2.0.0" - } - }, - { - "Version": "2.0.1", - "Url": "https://github.com/micro-editor/go-plugin/archive/v2.0.1.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "2.0.0", - "Url": "https://github.com/micro-editor/go-plugin/archive/v2.0.0.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "1.0.1", - "Url": "https://github.com/micro-editor/go-plugin/archive/v1.0.1.zip", - "Require": { - "micro": ">=1.0.3 <2.0.0-1" - } - } - ] -}] - diff --git a/.config/micro/plug/snippets/LICENSE b/.config/micro/plug/snippets/LICENSE deleted file mode 100644 index 11b0566..0000000 --- a/.config/micro/plug/snippets/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2016: Florian Sundermann. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file diff --git a/.config/micro/plug/snippets/README.md b/.config/micro/plug/snippets/README.md deleted file mode 100644 index 54cf3b9..0000000 --- a/.config/micro/plug/snippets/README.md +++ /dev/null @@ -1,26 +0,0 @@ -This project was originally created by [boombuler](https://github.com/boombuler) - -## Introduction - -This is a simple snippet plugin for the [Micro](https://github.com/zyedidia/micro) editor. - -The plugin comes with some snippet files which are taken from [vim-snippets](https://github.com/honza/vim-snippets) - -Have a look at those repositories for their license and additional information! - -Other [plugins](https://github.com/micro-editor/plugin-channel) for Micro editor - -## Install Snippet Plugin - -### From Micro Version 1 - -'ctrl-e' - -'plugin install snippets' - -### From Micro Version 2 - -```bash -cd ~/.config/micro/plug -git clone https://github.com/tommyshem/micro-snippets-plugin.git snippets -``` diff --git a/.config/micro/plug/snippets/help/snippets.md b/.config/micro/plug/snippets/help/snippets.md deleted file mode 100644 index aeeaab3..0000000 --- a/.config/micro/plug/snippets/help/snippets.md +++ /dev/null @@ -1,82 +0,0 @@ -# About the snippet plugin - -This plugin is designed to work with simple VIM snippets like the once from -[here](https://github.com/honza/vim-snippets/tree/master/snippets) -The plugin itself doesn't provide any snippets. To add snippets for a language -place a file containing the snippets at `~/.config/micro/plugins/snippets/[filetype].snippets` - -## Commands - -The plugin provides the following commands: - - | Command | Description of function | Key | - | ------------- | :--------------------------------------------------- | :---: | - | snippetinsert | with an optional parameter to specify which snippet | Alt+S | - | ' | should be inserted. | - | ' | If the parameter is absent, the word right | - | ' | before the cursor will be used for this. | - | snippetnext | proceeds to the next placeholder | Alt+W | - | snippetcancel | removes all the current snippet | Alt+D | - | snippetaccept | finishes the snippet editing for the current snippet | Alt+A | - -## Snippet Files - -The snippet files have a very simple syntax: - -* lines starting with `#` are ignored -* a line starts with `snippet` starts a new snippet. -* after `snippet` you can add one or more shortcuts for the snippets, - like `snippet aFunc bFunc` (at least one shortcut is required) -* every line of code within the snippet must start with a tab (`\t`) -* a snippet can have multiple placeholders which are indicated by ` - ${num[:name]}` where num is a numeric value. Placeholders with the - same number share the same value. You also have the option to give - a placeholder a name / description / default value. - -Plugins can provide snippet files they just need to publish them as a runtime file with type `snippets`. -See the plugins help for additional details. - -Sample for go: - -```go -# creates a function that prints a value -snippet fmtfunc - func ${0:name}() { - fmt.Println("${0} prints:", ${1:value}) - } -``` - -## Custom Key Bindings - -Add a file, if not already created in `~/.config/micro/bindings.json` - -Change the default keys you want to use. - -Micro editor as a help file here https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md - -```json -{ -"Alt-w": "snippets.Next", -"Alt-a": "snippets.Accept", -"Alt-s": "snippets.Insert", -"Alt-d": "snippets.Cancel" -} -``` - -## Raw key codes - -Micro has a command `raw` - -Micro will open a new tab and show the escape sequence for every event it receives from the terminal. - -This shows you what micro actually sees from the terminal and helps you see which bindings aren't possible and why. - -This is most useful for debugging keybindings. - -Example - -\x1b turns into \u001 then the same as the raw output. - -`"\u001bctrlback": "DeleteWordLeft"` - -Micro editor help file https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md diff --git a/.config/micro/plug/snippets/info.json b/.config/micro/plug/snippets/info.json deleted file mode 100644 index fd6450b..0000000 --- a/.config/micro/plug/snippets/info.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "snippets", - "description": "Snippets plugin", - "website": "", - "install": "", - "version": "1.0.0", - "require": [ - "micro >= 2.0.0" - ] -} diff --git a/.config/micro/plug/snippets/repo.json b/.config/micro/plug/snippets/repo.json deleted file mode 100644 index 8e66336..0000000 --- a/.config/micro/plug/snippets/repo.json +++ /dev/null @@ -1,29 +0,0 @@ -[{ - "Name": "snippets", - "Description": "plugin to insert language specific code snippets.", - "Website": "https://github.com/tommyshem/micro-snippets-plugin", - "Tags": ["snippet"], - "Versions": [ - { - "Version": "0.2.0", - "Url": "https://github.com/tommyshem/micro-snippets-plugin/archive/v0.2.0.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "0.1.4", - "Url": "https://github.com/tommyshem/micro-snippets-plugin/archive/v0.1.4.zip", - "Require": { - "micro": ">=1.3.4" - } - }, - { - "Version": "0.1.2", - "Url": "https://github.com/tommyshem/micro-snippets-plugin/archive/v0.1.2.zip", - "Require": { - "micro": ">1.0.3 <1.3.4" - } - } - ] -}] diff --git a/.config/micro/plug/snippets/snippets.lua b/.config/micro/plug/snippets/snippets.lua deleted file mode 100644 index d5d71b3..0000000 --- a/.config/micro/plug/snippets/snippets.lua +++ /dev/null @@ -1,586 +0,0 @@ -VERSION = "0.2.0" - -local micro = import("micro") -local buffer = import("micro/buffer") -local config = import("micro/config") -local util = import("micro/util") - -local debugflag = true -local curFileType = "" -local snippets = {} -local currentSnippet = nil -local RTSnippets = config.NewRTFiletype() - -local Location = {} -Location.__index = Location - -local Snippet = {} -Snippet.__index = Snippet - --- Snippets --- --> Snippet --- --> Location - -function Location.new(idx, ph, snippet) - debug1("Location.new(idx, ph, snip) idx = " , idx) - --debugt("Location.new(idx, ph, snip) ph = ", ph) - --debugt("Location.new(idx, ph, snippet) snippet = ", snippet) - - local self = setmetatable({}, Location) - self.idx = idx - self.ph = ph - self.snippet = snippet - return self -end - --- offset of the location relative to the snippet start -function Location.offset(self) - debug("Location.offset(self)") - local add = 0 - for i = 1, #self.snippet.locations do - local loc = self.snippet.locations[i] - debug1("loc = ",loc) - if loc == self then - break - end - - local val = loc.ph.value - micro.Log("VAL", val) - if val then - add = add + val:len() - end - end - return self.idx+add -end - -function Location.startPos(self) - --debugt("Location.startPos(self) = ",self) - local loc = self.snippet.startPos - return loc:Move(self:offset(), self.snippet.view.buf) -end - --- returns the length of the location (but at least 1) -function Location.len(self) - debug("Location.len(self)") - local len = 0 - if self.ph.value then - len = self.ph.value:len() - end - if len <= 0 then - len = 1 - end - return len -end - -function Location.endPos(self) - debug("Location.endPos(self)") - local start = self:startPos() - micro.Log("ENDPOS", self.ph.value) - return start:Move(self:len(), self.snippet.view.buf) -end - --- check if the given loc is within the location -function Location.isWithin(self, loc) - debug("Location.isWithin(self, loc)") - return loc:GreaterEqual(self:startPos()) and loc:LessEqual(self:endPos()) -end - -function Location.focus(self) - debug("Location.focus(self)") - local view = self.snippet.view - local startP = self:startPos():Move(-1, view.Buf) - local endP = self:endPos():Move(-1, view.Buf) - micro.Log(startP, endP) - - if view.Cursor:LessThan(startP) then - while view.Cursor:LessThan(startP) do - view.Cursor:Right() - end - elseif view.Cursor:GreaterEqual(endP) then - while view.Cursor:GreaterEqual(endP) do - view.Cursor:Left() - end - end - - if self.ph.value:len() > 0 then - view.Cursor:SetSelectionStart(startP) - view.Cursor:SetSelectionEnd(endP) - else - view.Cursor:ResetSelection() - end -end - -function Location.handleInput(self, ev) - debug("Location.handleInput(self, ev)") - if ev.EventType == 1 then - -- TextInput - if util.String(ev.Deltas[1].Text) == "\n" then - Accept() - return false - else - local offset = 1 - local sp = self:startPos() - while sp:LessEqual(-ev.Deltas[1].Start) do - sp = sp:Move(1, self.snippet.view.Buf) - offset = offset + 1 - end - - self.snippet:remove() - local v = self.ph.value - if v == nil then - v = "" - end - - self.ph.value = v:sub(0, offset-1) .. util.String(ev.Deltas[1].Text) .. v:sub(offset) - self.snippet:insert() - return true - end - elseif ev.EventType == -1 then - -- TextRemove - local offset = 1 - local sp = self:startPos() - while sp:LessEqual(-ev.Deltas[1].Start) do - sp = sp:Move(1, self.snippet.view.Buf) - offset = offset + 1 - end - - if ev.Deltas[1].Start.Y ~= ev.Deltas[1].End.Y then - return false - end - - self.snippet:remove() - - local v = self.ph.value - if v == nil then - v = "" - end - - local len = ev.Deltas[1].End.X - ev.Deltas[1].Start.X - - self.ph.value = v:sub(0, offset-1) .. v:sub(offset+len) - self.snippet:insert() - return true - end - - return false -end - --- new snippet -function Snippet.new() - debug("Snippet.new()") - local self = setmetatable({}, Snippet) - self.code = "" - return self -end - --- add line of code to snippet -function Snippet.AddCodeLine(self, line) - --debugt("Snippet.AddCodeLine(self,line) self = " , self) - debug1("Snippet.AddCodeLine(self, line) line = " , line) - if self.code ~= "" then - self.code = self.code .. "\n" - end - self.code = self.code .. line -end - -function Snippet.Prepare(self) - debug("Snippet.Prepare(self)") - if not self.placeholders then - self.placeholders = {} - self.locations = {} - local count = 0 - local pattern = "${(%d+):?([^}]*)}" - while true do - local num, value = self.code:match(pattern) - if not num then - break - end - count = count+1 - num = tonumber(num) - local idx = self.code:find(pattern) - self.code = self.code:gsub(pattern, "", 1) - micro.Log("IDX", idx, self.code) - - local placeHolders = self.placeholders[num] - if not placeHolders then - placeHolders = {num = num} - self.placeholders[#self.placeholders+1] = placeHolders - end - self.locations[#self.locations+1] = Location.new(idx, placeHolders, self) - debug1("location total = ",#self.locations) - if value then - placeHolders.value = value - end - end - end -end - -function Snippet.clone(self) - debug("Snippet.clone(self)") - local result = Snippet.new() - result:AddCodeLine(self.code) - result:Prepare() - return result -end - -function Snippet.str(self) - debug("Snippet.str(self)") - local res = self.code - for i = #self.locations, 1, -1 do - local loc = self.locations[i] - res = res:sub(0, loc.idx-1) .. loc.ph.value .. res:sub(loc.idx) - end - return res -end - -function Snippet.findLocation(self, loc) - debug1("Snippet.findLocation(self, loc) loc = ",loc) - for i = 1, #self.locations do - if self.locations[i]:isWithin(loc) then - return self.locations[i] - end - end - return nil -end - -function Snippet.remove(self) - debug("Snippet.remove(self)") - local endPos = self.startPos:Move(self:str():len(), self.view.Buf) - self.modText = true - self.view.Cursor:SetSelectionStart(self.startPos) - self.view.Cursor:SetSelectionEnd(endPos) - self.view.Cursor:DeleteSelection() - self.view.Cursor:ResetSelection() - self.modText = false -end - -function Snippet.insert(self) - debug("Snippet.insert(self)") - self.modText = true - self.view.Buf:insert(self.startPos, self:str()) - self.modText = false -end - -function Snippet.focusNext(self) - debug("Snippet.focusNext(self)") - if self.focused == nil then - self.focused = 0 - else - self.focused = (self.focused + 1) % #self.placeholders - end - - local ph = self.placeholders[self.focused+1] - - for i = 1, #self.locations do - if self.locations[i].ph == ph then - self.locations[i]:focus() - return - end - end -end - -local function CursorWord(bp) - debug1("CursorWord(bp)",bp) - local c = bp.Cursor - local x = c.X-1 -- start one rune before the cursor - local result = "" - while x >= 0 do - local r = util.RuneStr(c:RuneUnder(x)) - if (r == " ") then -- IsWordChar(r) then - break - else - result = r .. result - end - x = x-1 - end - - return result -end - -local function ReadSnippets(filetype) - debug1("ReadSnippets(filetype)",filetype) - local snippets = {} - local allSnippetFiles = config.ListRuntimeFiles(RTSnippets) - local exists = false - - for i = 1, #allSnippetFiles do - if allSnippetFiles[i] == filetype then - exists = true - break - end - end - - if not exists then - micro.InfoBar():Error("No snippets file for \""..filetype.."\"") - return snippets - end - - local snippetFile = config.ReadRuntimeFile(RTSnippets, filetype) - - local curSnip = nil - local lineNo = 0 - for line in string.gmatch(snippetFile, "(.-)\r?\n") do - lineNo = lineNo + 1 - if string.match(line,"^#") then - -- comment - elseif line:match("^snippet") then - curSnip = Snippet.new() - for snipName in line:gmatch("%s(.+)") do -- %s space .+ one or more non-empty sequence - snippets[snipName] = curSnip - end - else - local codeLine = line:match("^\t(.*)$") - if codeLine ~= nil then - curSnip:AddCodeLine(codeLine) - elseif line ~= "" then - micro.InfoBar():Error("Invalid snippets file (Line #"..tostring(lineNo)..")") - end - end - end - debugt("ReadSnippets(filetype) snippets = ",snippets) - return snippets -end - --- Check filetype and load snippets --- Return true is snippets loaded for filetype --- Return false if no snippets loaded -local function EnsureSnippets(bp) - debug("EnsureSnippets()") - local filetype = bp.Buf.Settings["filetype"] - if curFileType ~= filetype then - snippets = ReadSnippets(filetype) - curFileType = filetype - end - if next(snippets) == nil then - return false - end - return true -end - -function onBeforeTextEvent(sb, ev) - debug1("onBeforeTextEvent(ev)",ev) - if currentSnippet ~= nil and currentSnippet.view.Buf.SharedBuffer == sb then - if currentSnippet.modText then - -- text event from the snippet. simply ignore it... - return true - end - - local locStart = nil - local locEnd = nil - - if ev.Deltas[1].Start ~= nil and currentSnippet ~= nil then - locStart = currentSnippet:findLocation(ev.Deltas[1].Start:Move(1, currentSnippet.view.Buf)) - locEnd = currentSnippet:findLocation(ev.Deltas[1].End) - end - if locStart ~= nil and ((locStart == locEnd) or (ev.Deltas[1].End.Y==0 and ev.Deltas[1].End.X==0)) then - if locStart:handleInput(ev) then - currentSnippet.view.Cursor:Goto(-ev.C) - return false - end - end - Accept() - end - - return true - -end - --- Insert snippet if found. --- Pass in the name of the snippet to be inserted by command mode --- No name passed in then it will check the text left of the cursor -function Insert(bp, args) - local snippetName = nil - if args ~= nil and #args > 0 then - snippetName = args[1] - end - debug1("Insert(snippetName)",snippetName) - - local c = bp.Cursor - local buf = bp.Buf - local xy = buffer.Loc(c.X, c.Y) - -- check if a snippet name was passed in - local noArg = false - if not snippetName then - snippetName = CursorWord(bp) - noArg = true - end - -- check filetype and load snippets - local result = EnsureSnippets(bp) - -- if no snippets return early - if (result == false) then return end - - -- curSn cloned into currentSnippet if snippet found - local curSn = snippets[snippetName] - if curSn then - currentSnippet = curSn:clone() - currentSnippet.view = bp - -- remove snippet keyword from micro buffer before inserting snippet - if noArg then - currentSnippet.startPos = xy:Move(-snippetName:len(), buf) - - currentSnippet.modText = true - - c:SetSelectionStart(currentSnippet.startPos) - c:SetSelectionEnd(xy) - c:DeleteSelection() - c:ResetSelection() - - currentSnippet.modText = false - else - -- no need to remove snippet keyword from buffer as run from command mode - currentSnippet.startPos = xy - end - -- insert snippet to micro buffer - currentSnippet:insert() - micro.InfoBar():Message("Snippet Inserted \""..snippetName.."\"") - - -- Placeholders - if #currentSnippet.placeholders == 0 then - local pos = currentSnippet.startPos:Move(currentSnippet:str():len(), bp.Buf) - while bp.Cursor:LessThan(pos) do - bp.Cursor:Right() - end - while bp.Cursor:GreaterThan(pos) do - bp.Cursor:Left() - end - else - currentSnippet:focusNext() - end - else - -- Snippet not found - micro.InfoBar():Message("Unknown snippet \""..snippetName.."\"") - end -end - -function Next() - debug("Next()") - if currentSnippet then - currentSnippet:focusNext() - end -end - -function Accept() - debug("Accept()") - currentSnippet = nil -end - -function Cancel() - debug("Cancel()") - if currentSnippet then - currentSnippet:remove() - Accept() - end -end - - -local function StartsWith(String,Start) - debug1("StartsWith(String,Start) String ",String) - debug1("StartsWith(String,Start) start ",start) - String = String:upper() - Start = Start:upper() - return string.sub(String,1,string.len(Start))==Start -end - --- Used for auto complete in the command prompt -function findSnippet(input) - debug1("findSnippet(input)",input) - local result = {} - -- TODO: pass bp - EnsureSnippets() - - for name,v in pairs(snippets) do - if StartsWith(name, input) then - table.insert(result, name) - end - end - return result -end - --- Debug functions below --- debug1 is for logging functionName and 1 argument passed -function debug1(functionName, argument) - if debugflag == false then return end - if argument == nil then - micro.Log("snippets-plugin -> function " .. functionName .. " = nil") - elseif argument == "" then - micro.Log("snippets-plugin -> function " .. functionName .. " = empty string") - else micro.Log("snippets-plugin -> function " .. functionName .. " = " .. tostring(argument)) - end -end - --- debug is for logging functionName only -function debug(functionName) - if debugflag == false then return end - micro.Log("snippets-plugin -> function " .. functionName) -end - --- debug is for logging functionName and table -function debugt(functionName,tablepassed) - if debugflag == false then return end - micro.Log("snippets-plugin -> function " .. functionName ) - tprint(tablepassed) --- if (tablepassed == nil) then return end --- for key,value in pairs(tablepassed) do --- micro.Log("key - " .. tostring(key) .. "value = " .. tostring(value[1]) ) --- end -end - --- dump table -function dump(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end - end - - function tprint (tbl, indent) - if not indent then indent = 0 end - for k, v in pairs(tbl) do - formatting = string.rep(" ", indent) .. k .. ": " - if type(v) == "table" then - micro.Log(formatting .. "Table ->") - tprint(v, indent+1) - elseif type(v) == nil then - micro.Log(formatting .. " nil") - else - micro.Log(formatting .. tostring(v)) - end - end - end - - function checkTableisEmpty(myTable) - if next(myTable) == nil then - -- myTable is empty - end -end - -function tablePrint(tbl) - for index = 1, #tbl do - micro.Log(tostring(index) .. " = " .. tostring(tbl[index])) - end -end - -function init() - -- Insert a snippet - config.MakeCommand("snippetinsert", Insert, config.NoComplete) - -- Mark next placeholder - config.MakeCommand("snippetnext", Next, config.NoComplete) - -- Cancel current snippet (removes the text) - config.MakeCommand("snippetcancel", Cancel, config.NoComplete) - -- Acceptes snipped editing - config.MakeCommand("snippetaccept", Accept, config.NoComplete) - - config.AddRuntimeFile("snippets", config.RTHelp, "help/snippets.md") - config.AddRuntimeFilesFromDirectory("snippets", RTSnippets, "snippets", "*.snippets") - - config.TryBindKey("Alt-w", "lua:snippets.Next", false) - config.TryBindKey("Alt-a", "lua:snippets.Accept", false) - config.TryBindKey("Alt-s", "lua:snippets.Insert", false) - config.TryBindKey("Alt-d", "lua:snippets.Cancel", false) -end diff --git a/.config/micro/plug/snippets/snippets/apacheconf.snippets b/.config/micro/plug/snippets/snippets/apacheconf.snippets deleted file mode 100644 index db3256e..0000000 --- a/.config/micro/plug/snippets/snippets/apacheconf.snippets +++ /dev/null @@ -1,35 +0,0 @@ -# Snippets for code blocks used oftenly in Apache files. -# <Directory> -snippet dir - <Directory ${1:/}> - DirectoryIndex ${0:index.html} - Order Deny,Allow - Deny from All - </Directory> -# <FilesMatch> -snippet filesmatch - <FilesMatch "${1:regex}"> - ${0} - </FilesMatch> -# <IfModule> -snippet ifmodule - <IfModule ${1:mod_example.c}> - ${0} - </IfModule> -# <LimitExcept> -snippet limitexcept - <LimitExcept ${1:POST GET}> - ${0} - </LimitExcept> -# <Proxy> -snippet proxy - <Proxy ${1:*}> - ${0} - </Proxy> -# <VirtualHost> -snippet virtualhost - <VirtualHost ${1:*}:${2:80}> - ServerAdmin ${3:webmaster@example.com} - DocumentRoot ${4:/www/example.com} - ServerName ${0:www.example.com} - </VirtualHost> diff --git a/.config/micro/plug/snippets/snippets/awk.snippets b/.config/micro/plug/snippets/snippets/awk.snippets deleted file mode 100644 index 32e56f2..0000000 --- a/.config/micro/plug/snippets/snippets/awk.snippets +++ /dev/null @@ -1,102 +0,0 @@ -# cannot use /usr/bin/env because it does not support parameters (as -f) -snippet #! #!/usr/bin/awk -f - #!/usr/bin/awk -f - -# @include is a gawk extension -snippet inc @include - @include "${1}"${0} - -# @load is a gawk extension -snippet loa @load - @load "${1}"${0} - -snippet beg BEGIN { ... } - BEGIN { - ${0} - } - -# BEGINFILE is a gawk extension -snippet begf BEGINFILE { ... } - BEGINFILE { - ${0} - } - -snippet end END { ... } - END { - ${0} - } - -# ENDFILE is a gawk extension -snippet endf ENDFILE { ... } - ENDFILE { - ${0} - } - -snippet pri print - print ${1:"${2}"}${0} - -snippet printf printf - printf("${1:%s}\n", ${2})${0} - -snippet ign IGNORECASE - IGNORECASE = ${1:1} - -snippet if if {...} - if (${1}) { - ${0} - } - -snippet ife if ... else ... - if (${1}) { - ${2} - } else { - ${0} - } - -snippet eif else if ... - else if (${1}) { - ${0} - } - -snippet el else {...} - else { - ${0} - } - -snippet wh while - while (${1}) { - ${2} - } - -snippet do do ... while - do { - ${0} - } while (${1}) - -snippet for for - for (${2:i} = 0; i < ${1:n}; ${3:++i}) { - ${0} - } - -snippet fore for each - for (${1:i} in ${2:array}) { - ${0} - } - -# the switch is a gawk extension -snippet sw switch - switch (${1}) { - case ${2}: - ${3} - break - default: - ${0} - break - } - -# the switch is a gawk extension -snippet case case - case ${1}: - ${0} - break - diff --git a/.config/micro/plug/snippets/snippets/c#.snippets b/.config/micro/plug/snippets/snippets/c#.snippets deleted file mode 100644 index 40e9c8f..0000000 --- a/.config/micro/plug/snippets/snippets/c#.snippets +++ /dev/null @@ -1,470 +0,0 @@ -# cs.snippets -# =========== -# -# Standard C-Sharp snippets for snipmate. -# -# Largely ported over from Visual Studio 2010 snippets plus -# a few snippets from Resharper plus a few widely known snippets. -# -# Most snippets on elements (i.e. classes, properties) -# follow suffix conventions. The order of suffixes to a snippet -# is fixed. -# -# Snippet Suffix Order -# -------------------- -# 1. Access Modifiers -# 2. Class Modifiers -# -# Access Modifier Suffix Table -# ---------------------------- -# + = public -# & = internal -# | = protected -# - = private -# -# Example: `cls&` expands to `internal class $1`. -# Access modifiers might be doubled to indicate -# different modifiers for get/set on properties. -# Example: `pb+-` expands to `public bool $1 { get; private set; }` -# -# Class Modifier Table -# -------------------- -# ^ = static -# % = abstract -# -# Example: `cls|%` expands to `protected abstract class $1` -# -# On method and property snippets, you can directly set -# one of the common types int, string and bool, if desired, -# just by appending the type modifier. -# -# Type Modifier Table -# ------------------- -# i = integer -# s = string -# b = bool -# -# Example: `pi+&` expands to `public int $1 { get; internal set; }` -# -# I'll most propably add more stuff in here like -# * List/Array constructio -# * Mostly used generics -# * Linq -# * Funcs, Actions, Predicates -# * Lambda -# * Events -# -# Feedback is welcome! -# -# Main -snippet sim - ${1:public }static int Main(string[] args) { - ${0} - return 0; - } -snippet simc - public class Application { - ${1:public }static int Main(string[] args) { - ${0} - return 0; - } - } -snippet svm - ${1:public }static void Main(string[] args) { - ${0} - } -# if condition -snippet if - if (${1:true}) { - ${0} - } -snippet el - else { - ${0} - } -snippet ifs - if (${1}) - ${0} -# ternary conditional -snippet t - ${1} ? ${2} : ${0} -snippet ? - ${1} ? ${2} : ${0} -# do while loop -snippet do - do { - ${0} - } while (${1:true}); -# while loop -snippet wh - while (${1:true}) { - ${0} - } -# for loop -snippet for - for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) { - ${0} - } -snippet forr - for (int ${1:i} = ${2:length}; $1 >= 0; $1--) { - ${0} - } -# foreach -snippet fore - foreach (${1:var} ${2:entry} in ${3}) { - ${0} - } -snippet foreach - foreach (${1:var} ${2:entry} in ${3}) { - ${0} - } -snippet each - foreach (${1:var} ${2:entry} in ${3}) { - ${0} - } -# interfaces -snippet interface - public interface ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet if+ - public interface ${1:`vim_snippets#Filename()`} { - ${0} - } -# class bodies -snippet class - public class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls - ${2:public} class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls+ - public class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls+^ - public static class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls& - internal class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls&^ - internal static class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls| - protected class ${1:`vim_snippets#Filename()`} { - ${0} - } -snippet cls|% - protected abstract class ${1:`vim_snippets#Filename()`} { - ${0} - } -# constructor -snippet ctor - public ${1:`vim_snippets#Filename()`}() { - ${0} - } -# properties - auto properties by default. -# default type is int with layout get / set. -snippet prop - ${1:public} ${2:int} ${3} { get; set; } -snippet p - ${1:public} ${2:int} ${3} { get; set; } -snippet p+ - public ${1:int} ${2} { get; set; } -snippet p+& - public ${1:int} ${2} { get; internal set; } -snippet p+| - public ${1:int} ${2} { get; protected set; } -snippet p+- - public ${1:int} ${2} { get; private set; } -snippet p& - internal ${1:int} ${2} { get; set; } -snippet p&| - internal ${1:int} ${2} { get; protected set; } -snippet p&- - internal ${1:int} ${2} { get; private set; } -snippet p| - protected ${1:int} ${2} { get; set; } -snippet p|- - protected ${1:int} ${2} { get; private set; } -snippet p- - private ${1:int} ${2} { get; set; } -# property - bool -snippet pi - ${1:public} int ${2} { get; set; } -snippet pi+ - public int ${1} { get; set; } -snippet pi+& - public int ${1} { get; internal set; } -snippet pi+| - public int ${1} { get; protected set; } -snippet pi+- - public int ${1} { get; private set; } -snippet pi& - internal int ${1} { get; set; } -snippet pi&| - internal int ${1} { get; protected set; } -snippet pi&- - internal int ${1} { get; private set; } -snippet pi| - protected int ${1} { get; set; } -snippet pi|- - protected int ${1} { get; private set; } -snippet pi- - private int ${1} { get; set; } -# property - bool -snippet pb - ${1:public} bool ${2} { get; set; } -snippet pb+ - public bool ${1} { get; set; } -snippet pb+& - public bool ${1} { get; internal set; } -snippet pb+| - public bool ${1} { get; protected set; } -snippet pb+- - public bool ${1} { get; private set; } -snippet pb& - internal bool ${1} { get; set; } -snippet pb&| - internal bool ${1} { get; protected set; } -snippet pb&- - internal bool ${1} { get; private set; } -snippet pb| - protected bool ${1} { get; set; } -snippet pb|- - protected bool ${1} { get; private set; } -snippet pb- - private bool ${1} { get; set; } -# property - string -snippet ps - ${1:public} string ${2} { get; set; } -snippet ps+ - public string ${1} { get; set; } -snippet ps+& - public string ${1} { get; internal set; } -snippet ps+| - public string ${1} { get; protected set; } -snippet ps+- - public string ${1} { get; private set; } -snippet ps& - internal string ${1} { get; set; } -snippet ps&| - internal string ${1} { get; protected set; } -snippet ps&- - internal string ${1} { get; private set; } -snippet ps| - protected string ${1} { get; set; } -snippet ps|- - protected string ${1} { get; private set; } -snippet ps- - private string ${1} { get; set; } -# members - void -snippet m - ${1:public} ${2:void} ${3}(${4}) { - ${0} - } -snippet m+ - public ${1:void} ${2}(${3}) { - ${0} - } -snippet m& - internal ${1:void} ${2}(${3}) { - ${0} - } -snippet m| - protected ${1:void} ${2}(${3}) { - ${0} - } -snippet m- - private ${1:void} ${2}(${3}) { - ${0} - } -# members - int -snippet mi - ${1:public} int ${2}(${3}) { - ${0:return 0;} - } -snippet mi+ - public int ${1}(${2}) { - ${0:return 0;} - } -snippet mi& - internal int ${1}(${2}) { - ${0:return 0;} - } -snippet mi| - protected int ${1}(${2}) { - ${0:return 0;} - } -snippet mi- - private int ${1}(${2}) { - ${0:return 0;} - } -# members - bool -snippet mb - ${1:public} bool ${2}(${3}) { - ${0:return false;} - } -snippet mb+ - public bool ${1}(${2}) { - ${0:return false;} - } -snippet mb& - internal bool ${1}(${2}) { - ${0:return false;} - } -snippet mb| - protected bool ${1}(${2}) { - ${0:return false;} - } -snippet mb- - private bool ${1}(${2}) { - ${0:return false;} - } -# members - string -snippet ms - ${1:public} string ${2}(${3}) { - ${0:return "";} - } -snippet ms+ - public string ${1}(${2}) { - ${0:return "";} - } -snippet ms& - internal string ${1}(${2}) { - ${0:return "";} - } -snippet ms| - protected string ${1:}(${2:}) { - ${0:return "";} - } -snippet ms- - private string ${1}(${2}) { - ${0:return "";} - } -# structure -snippet struct - public struct ${1:`vim_snippets#Filename()`} { - ${0} - } -# enumeration -snippet enum - enum ${1} { - ${0} - } - -snippet enum+ - public enum ${1} { - ${0} - } -# preprocessor directives -snippet #if - #if - ${0} - #endif -# inline xml documentation -snippet /// - /// <summary> - /// ${0} - /// </summary> -snippet <p - <param name="${1}">${2:$1}</param> -snippet <ex - <exception cref="${1:System.Exception}">${2}</exception> -snippet <r - <returns>${1}</returns>{ -snippet <s - <see cref="${1}"/> -snippet <rem - <remarks>${1}</remarks> -snippet <c - <code>${1}</code> - -snippet cw - Console.WriteLine(${1}); - -# equals override -snippet eq - public override bool Equals(object obj) { - if (obj == null || GetType() != obj.GetType()) { - return false; - } - ${0:throw new NotImplementedException();} - return base.Equals(obj); - } -# exception -snippet exc - public class ${1:MyException} : ${2:Exception} { - public $1() { } - public $1(string message) : base(message) { } - public $1(string message, Exception inner) : base(message, inner) { } - protected $1( - System.Runtime.Serialization.SerializationInfo info, - System.Runtime.Serialization.StreamingContext context) - : base(info, context) { } - } -# indexer -snippet index - public ${1:object} this[${2:int} index] { - get { ${0} } - set { ${0} } - } -# eventhandler -snippet inv - EventHandler temp = ${1:MyEvent}; - if (${2:temp} != null) { - $2(); - } -# lock -snippet lock - lock (${1:this}) { - ${0} - } -# namespace -snippet namespace - namespace ${1:MyNamespace} { - ${0} - } -# property -snippet prop - public ${1:int} ${2:MyProperty} { get; set; } -snippet propf - private ${1:int} ${2:myVar}; - public $1 ${3:MyProperty} { - get { return $2; } - set { $2 = value; } - } -snippet propg - public ${1:int} ${2:MyProperty} { get; private set; } -# switch -snippet switch - switch (${1:switch_on}) { - ${0} - default: - } -# try -snippet try - try { - ${0} - } - catch (${1:System.Exception}) { - throw; - } -snippet tryf - try { - ${0} - } - finally { - ${1} - } -# using -snippet usi - using(${1:resource}) { - ${0} - } diff --git a/.config/micro/plug/snippets/snippets/c.snippets b/.config/micro/plug/snippets/snippets/c.snippets deleted file mode 100644 index f4745c2..0000000 --- a/.config/micro/plug/snippets/snippets/c.snippets +++ /dev/null @@ -1,228 +0,0 @@ -## Main -# main -snippet main - int main(int argc, const char *argv[]) - { - ${0} - return 0; - } -# main(void) -snippet mainn - int main(void) - { - ${0} - return 0; - } -## -## Preprocessor -# #include <...> -snippet inc - #include <${1:stdio}.h> -# #include "..." -snippet Inc - #include "${1:`vim_snippets#Filename("$1.h")`}" -# ifndef...define...endif -snippet ndef - #ifndef $1 - #define ${1:SYMBOL} ${2:value} - #endif /* ifndef $1 */ -# define -snippet def - #define -# ifdef...endif -snippet ifdef - #ifdef ${1:FOO} - ${2:#define } - #endif -# if -snippet #if - #if ${1:FOO} - ${0} - #endif -# header include guard -snippet once - #ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`} - - #define $1 - - ${0} - - #endif /* end of include guard: $1 */ -## -## Control Statements -# if -snippet if - if (${1:true}) { - ${0} - } -snippet ife - if (${1:true}) { - ${2} - } else { - ${0} - } -# else -snippet el - else { - ${0} - } -# else if -snippet elif - else if (${1:true}) { - ${0} - } -# ifi -snippet ifi - if (${1:true}) ${0}; -# ternary -snippet t - ${1:/* condition */} ? ${2:a} : ${3:b} -# switch -snippet switch - switch (${1:/* variable */}) { - case ${2:/* variable case */}: - ${3} - ${4:break;}${5} - default: - ${6} - } -# switch without default -snippet switchndef - switch (${1:/* variable */}) { - case ${2:/* variable case */}: - ${3} - ${4:break;}${5} - } -# case -snippet case - case ${1:/* variable case */}: - ${2} - ${3:break;} -snippet ret - return ${0}; -## -## Loops -# for -snippet for - for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4} - } -# for (custom) -snippet forr - for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5} - } -# while -snippet wh - while (${1:/* condition */}) { - ${2} - } -# do... while -snippet do - do { - ${2} - } while (${1:/* condition */}); -## -## Functions -# function definition -snippet fun - ${1:void} ${2:function_name}(${3}) - { - ${4} - } -# function declaration -snippet fund - ${1:void} ${2:function_name}(${3}); -## -## Types -# typedef -snippet td - typedef ${1:int} ${2:MyCustomType}; -# struct -snippet st - struct ${1:`vim_snippets#Filename('$1_t', 'name')`} { - ${2:/* data */} - }${3: /* optional variable list */}; -# typedef struct -snippet tds - typedef struct ${2:_$1 }{ - ${3:/* data */} - } ${1:`vim_snippets#Filename('$1_t', 'name')`}; - -snippet enum - enum ${1:name} { ${0} }; -# typedef enum -snippet tde - typedef enum { - ${1:/* data */} - } ${2:foo}; -## -## Input/Output -# printf -snippet pr - printf("${1:%s}\n"${2}); -# fprintf (again, this isn't as nice as TextMate's version, but it works) -snippet fpr - fprintf(${1:stderr}, "${2:%s}\n"${3}); -# getopt -snippet getopt - int choice; - while (1) - { - static struct option long_options[] = - { - /* Use flags like so: - {"verbose", no_argument, &verbose_flag, 'V'}*/ - /* Argument styles: no_argument, required_argument, optional_argument */ - {"version", no_argument, 0, 'v'}, - {"help", no_argument, 0, 'h'}, - ${1} - {0,0,0,0} - }; - - int option_index = 0; - - /* Argument parameters: - no_argument: " " - required_argument: ":" - optional_argument: "::" */ - - choice = getopt_long( argc, argv, "vh", - long_options, &option_index); - - if (choice == -1) - break; - - switch( choice ) - { - case 'v': - ${2} - break; - - case 'h': - ${3} - break; - - case '?': - /* getopt_long will have already printed an error */ - break; - - default: - /* Not sure how to get here... */ - return EXIT_FAILURE; - } - } - - /* Deal with non-option arguments here */ - if ( optind < argc ) - { - while ( optind < argc ) - { - ${0} - } - } -## -## Miscellaneous -# This is kind of convenient -snippet . - [${1}] diff --git a/.config/micro/plug/snippets/snippets/cmake.snippets b/.config/micro/plug/snippets/snippets/cmake.snippets deleted file mode 100644 index 3a0b920..0000000 --- a/.config/micro/plug/snippets/snippets/cmake.snippets +++ /dev/null @@ -1,83 +0,0 @@ -snippet init - cmake_minimum_required(version ${1:2.8.2}) - project(${2:ProjectName}) - - find_package(${3:library}) - - include_directories(${$3_INCLUDE_DIRS}) - - add_subdirectory(${0:src}) - - add_executable($2) - - target_link_libraries($2 ${$3_LIBRARIES}) - -snippet proj - project(${0:Name}) - -snippet min - cmake_minimum_required(version ${0:2.8.2}) - -snippet include - include_directories(${${0:include_dir}}) - -snippet find - find_package(${1:library} ${0:REQUIRED}) - -snippet glob - file(glob ${1:srcs} *.${0:cpp}) - -snippet subdir - add_subdirectory(${0:src}) - -snippet lib - add_library(${1:lib} ${${0:srcs}}) - -snippet link - target_link_libraries(${1:bin} ${0:somelib}) - -snippet bin - add_executable(${1:bin}) - -snippet set - set(${1:var} ${0:val}) - -snippet dep - add_dependencies(${1:target} - ${0:dep} - ) - -snippet Ext_url - include(ExternalProject) - ExternalProject_Add(${1:googletest} - URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip} - URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af} - SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}" - BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - ) - -snippet Ext_git - include(ExternalProject) - ExternalProject_Add(${1:googletest} - GIT_REPOSITORY ${2:https://github.com/google/googletest.git} - GIT_TAG ${3:master} - SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}" - BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}" - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - TEST_COMMAND "" - ) - -snippet props - set_target_properties(${1:target} - ${2:properties} ${3:compile_flags} - ${0:"-O3 -Wall -pedantic"} - ) - -snippet test - add_test(${1:ATestName} ${0:testCommand --options}) diff --git a/.config/micro/plug/snippets/snippets/css.snippets b/.config/micro/plug/snippets/snippets/css.snippets deleted file mode 100644 index c4a74de..0000000 --- a/.config/micro/plug/snippets/snippets/css.snippets +++ /dev/null @@ -1,987 +0,0 @@ -snippet . - ${1} { - ${0} - } -snippet ! - !important -snippet bdi:m+ - -moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; -snippet bdi:m - -moz-border-image: ${0}; -snippet bdrz:m - -moz-border-radius: ${0}; -snippet bxsh:m+ - -moz-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; -snippet bxsh:m - -moz-box-shadow: ${0}; -snippet bdi:w+ - -webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; -snippet bdi:w - -webkit-border-image: ${0}; -snippet bdrz:w - -webkit-border-radius: ${0}; -snippet bxsh:w+ - -webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; -snippet bxsh:w - -webkit-box-shadow: ${0}; -snippet @f - @font-face { - font-family: ${1}; - src: url(${0}); - } -snippet @i - @import url(${0}); -snippet @m - @media ${1:print} { - ${0} - } -snippet bg+ - background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${0:no-repeat}; -snippet bga - background-attachment: ${0}; -snippet bga:f - background-attachment: fixed; -snippet bga:s - background-attachment: scroll; -snippet bgbk - background-break: ${0}; -snippet bgbk:bb - background-break: bounding-box; -snippet bgbk:c - background-break: continuous; -snippet bgbk:eb - background-break: each-box; -snippet bgcp - background-clip: ${0}; -snippet bgcp:bb - background-clip: border-box; -snippet bgcp:cb - background-clip: content-box; -snippet bgcp:nc - background-clip: no-clip; -snippet bgcp:pb - background-clip: padding-box; -snippet bgc - background-color: #${0:FFF}; -snippet bgc:t - background-color: transparent; -snippet bgi - background-image: url(${0}); -snippet bgi:n - background-image: none; -snippet bgo - background-origin: ${0}; -snippet bgo:bb - background-origin: border-box; -snippet bgo:cb - background-origin: content-box; -snippet bgo:pb - background-origin: padding-box; -snippet bgpx - background-position-x: ${0}; -snippet bgpy - background-position-y: ${0}; -snippet bgp - background-position: ${1:0} ${0:0}; -snippet bgr - background-repeat: ${0}; -snippet bgr:n - background-repeat: no-repeat; -snippet bgr:x - background-repeat: repeat-x; -snippet bgr:y - background-repeat: repeat-y; -snippet bgr:r - background-repeat: repeat; -snippet bgz - background-size: ${0}; -snippet bgz:a - background-size: auto; -snippet bgz:ct - background-size: contain; -snippet bgz:cv - background-size: cover; -snippet bg - background: ${0}; -snippet bg:ie - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${0:crop}'); -snippet bg:n - background: none; -snippet bd+ - border: ${1:1px} ${2:solid} #${0:000}; -snippet bdb+ - border-bottom: ${1:1px} ${2:solid} #${0:000}; -snippet bdbc - border-bottom-color: #${0:000}; -snippet bdbi - border-bottom-image: url(${0}); -snippet bdbi:n - border-bottom-image: none; -snippet bdbli - border-bottom-left-image: url(${0}); -snippet bdbli:c - border-bottom-left-image: continue; -snippet bdbli:n - border-bottom-left-image: none; -snippet bdblrz - border-bottom-left-radius: ${0}; -snippet bdbri - border-bottom-right-image: url(${0}); -snippet bdbri:c - border-bottom-right-image: continue; -snippet bdbri:n - border-bottom-right-image: none; -snippet bdbrrz - border-bottom-right-radius: ${0}; -snippet bdbs - border-bottom-style: ${0}; -snippet bdbs:n - border-bottom-style: none; -snippet bdbw - border-bottom-width: ${0}; -snippet bdb - border-bottom: ${0}; -snippet bdb:n - border-bottom: none; -snippet bdbk - border-break: ${0}; -snippet bdbk:c - border-break: close; -snippet bdcl - border-collapse: ${0}; -snippet bdcl:c - border-collapse: collapse; -snippet bdcl:s - border-collapse: separate; -snippet bdc - border-color: #${0:000}; -snippet bdci - border-corner-image: url(${0}); -snippet bdci:c - border-corner-image: continue; -snippet bdci:n - border-corner-image: none; -snippet bdf - border-fit: ${0}; -snippet bdf:c - border-fit: clip; -snippet bdf:of - border-fit: overwrite; -snippet bdf:ow - border-fit: overwrite; -snippet bdf:r - border-fit: repeat; -snippet bdf:sc - border-fit: scale; -snippet bdf:sp - border-fit: space; -snippet bdf:st - border-fit: stretch; -snippet bdi - border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${0:stretch}; -snippet bdi:n - border-image: none; -snippet bdl+ - border-left: ${1:1px} ${2:solid} #${0:000}; -snippet bdlc - border-left-color: #${0:000}; -snippet bdli - border-left-image: url(${0}); -snippet bdli:n - border-left-image: none; -snippet bdls - border-left-style: ${0}; -snippet bdls:n - border-left-style: none; -snippet bdlw - border-left-width: ${0}; -snippet bdl - border-left: ${0}; -snippet bdl:n - border-left: none; -snippet bdlt - border-length: ${0}; -snippet bdlt:a - border-length: auto; -snippet bdrz - border-radius: ${0}; -snippet bdr+ - border-right: ${1:1px} ${2:solid} #${0:000}; -snippet bdrc - border-right-color: #${0:000}; -snippet bdri - border-right-image: url(${0}); -snippet bdri:n - border-right-image: none; -snippet bdrs - border-right-style: ${0}; -snippet bdrs:n - border-right-style: none; -snippet bdrw - border-right-width: ${0}; -snippet bdr - border-right: ${0}; -snippet bdr:n - border-right: none; -snippet bdsp - border-spacing: ${0}; -snippet bds - border-style: ${0}; -snippet bds:ds - border-style: dashed; -snippet bds:dtds - border-style: dot-dash; -snippet bds:dtdtds - border-style: dot-dot-dash; -snippet bds:dt - border-style: dotted; -snippet bds:db - border-style: double; -snippet bds:g - border-style: groove; -snippet bds:h - border-style: hidden; -snippet bds:i - border-style: inset; -snippet bds:n - border-style: none; -snippet bds:o - border-style: outset; -snippet bds:r - border-style: ridge; -snippet bds:s - border-style: solid; -snippet bds:w - border-style: wave; -snippet bdt+ - border-top: ${1:1px} ${2:solid} #${0:000}; -snippet bdtc - border-top-color: #${0:000}; -snippet bdti - border-top-image: url(${0}); -snippet bdti:n - border-top-image: none; -snippet bdtli - border-top-left-image: url(${0}); -snippet bdtli:c - border-corner-image: continue; -snippet bdtli:n - border-corner-image: none; -snippet bdtlrz - border-top-left-radius: ${0}; -snippet bdtri - border-top-right-image: url(${0}); -snippet bdtri:c - border-top-right-image: continue; -snippet bdtri:n - border-top-right-image: none; -snippet bdtrrz - border-top-right-radius: ${0}; -snippet bdts - border-top-style: ${0}; -snippet bdts:n - border-top-style: none; -snippet bdtw - border-top-width: ${0}; -snippet bdt - border-top: ${0}; -snippet bdt:n - border-top: none; -snippet bdw - border-width: ${0}; -snippet bd - border: ${0}; -snippet bd:n - border: none; -snippet b - bottom: ${0}; -snippet b:a - bottom: auto; -snippet bxsh+ - box-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; -snippet bxsh - box-shadow: ${0}; -snippet bxsh:n - box-shadow: none; -snippet bxz - box-sizing: ${0}; -snippet bxz:bb - box-sizing: border-box; -snippet bxz:cb - box-sizing: content-box; -snippet cps - caption-side: ${0}; -snippet cps:b - caption-side: bottom; -snippet cps:t - caption-side: top; -snippet cl - clear: ${0}; -snippet cl:b - clear: both; -snippet cl:l - clear: left; -snippet cl:n - clear: none; -snippet cl:r - clear: right; -snippet cp - clip: ${0}; -snippet cp:a - clip: auto; -snippet cp:r - clip: rect(${1:0} ${2:0} ${3:0} ${0:0}); -snippet c - color: #${0:000}; -snippet ct - content: ${0}; -snippet ct:a - content: attr(${0}); -snippet ct:cq - content: close-quote; -snippet ct:c - content: counter(${0}); -snippet ct:cs - content: counters(${0}); -snippet ct:ncq - content: no-close-quote; -snippet ct:noq - content: no-open-quote; -snippet ct:n - content: normal; -snippet ct:oq - content: open-quote; -snippet coi - counter-increment: ${0}; -snippet cor - counter-reset: ${0}; -snippet cur - cursor: ${0}; -snippet cur:a - cursor: auto; -snippet cur:c - cursor: crosshair; -snippet cur:d - cursor: default; -snippet cur:ha - cursor: hand; -snippet cur:he - cursor: help; -snippet cur:m - cursor: move; -snippet cur:p - cursor: pointer; -snippet cur:t - cursor: text; -snippet d - display: ${0}; -snippet d:mib - display: -moz-inline-box; -snippet d:mis - display: -moz-inline-stack; -snippet d:b - display: block; -snippet d:cp - display: compact; -snippet d:ib - display: inline-block; -snippet d:itb - display: inline-table; -snippet d:i - display: inline; -snippet d:li - display: list-item; -snippet d:n - display: none; -snippet d:ri - display: run-in; -snippet d:tbcp - display: table-caption; -snippet d:tbc - display: table-cell; -snippet d:tbclg - display: table-column-group; -snippet d:tbcl - display: table-column; -snippet d:tbfg - display: table-footer-group; -snippet d:tbhg - display: table-header-group; -snippet d:tbrg - display: table-row-group; -snippet d:tbr - display: table-row; -snippet d:tb - display: table; -snippet ec - empty-cells: ${0}; -snippet ec:h - empty-cells: hide; -snippet ec:s - empty-cells: show; -snippet exp - expression() -snippet fl - float: ${0}; -snippet fl:l - float: left; -snippet fl:n - float: none; -snippet fl:r - float: right; -snippet f+ - font: ${1:1em} ${2:Arial},${0:sans-serif}; -snippet fef - font-effect: ${0}; -snippet fef:eb - font-effect: emboss; -snippet fef:eg - font-effect: engrave; -snippet fef:n - font-effect: none; -snippet fef:o - font-effect: outline; -snippet femp - font-emphasize-position: ${0}; -snippet femp:a - font-emphasize-position: after; -snippet femp:b - font-emphasize-position: before; -snippet fems - font-emphasize-style: ${0}; -snippet fems:ac - font-emphasize-style: accent; -snippet fems:c - font-emphasize-style: circle; -snippet fems:ds - font-emphasize-style: disc; -snippet fems:dt - font-emphasize-style: dot; -snippet fems:n - font-emphasize-style: none; -snippet fem - font-emphasize: ${0}; -snippet ff - font-family: ${0}; -snippet ff:c - font-family: ${0:'Monotype Corsiva','Comic Sans MS'},cursive; -snippet ff:f - font-family: ${0:Capitals,Impact},fantasy; -snippet ff:m - font-family: ${0:Monaco,'Courier New'},monospace; -snippet ff:ss - font-family: ${0:Helvetica,Arial},sans-serif; -snippet ff:s - font-family: ${0:Georgia,'Times New Roman'},serif; -snippet fza - font-size-adjust: ${0}; -snippet fza:n - font-size-adjust: none; -snippet fz - font-size: ${0}; -snippet fsm - font-smooth: ${0}; -snippet fsm:aw - font-smooth: always; -snippet fsm:a - font-smooth: auto; -snippet fsm:n - font-smooth: never; -snippet fst - font-stretch: ${0}; -snippet fst:c - font-stretch: condensed; -snippet fst:e - font-stretch: expanded; -snippet fst:ec - font-stretch: extra-condensed; -snippet fst:ee - font-stretch: extra-expanded; -snippet fst:n - font-stretch: normal; -snippet fst:sc - font-stretch: semi-condensed; -snippet fst:se - font-stretch: semi-expanded; -snippet fst:uc - font-stretch: ultra-condensed; -snippet fst:ue - font-stretch: ultra-expanded; -snippet fs - font-style: ${0}; -snippet fs:i - font-style: italic; -snippet fs:n - font-style: normal; -snippet fs:o - font-style: oblique; -snippet fv - font-variant: ${0}; -snippet fv:n - font-variant: normal; -snippet fv:sc - font-variant: small-caps; -snippet fw - font-weight: ${0}; -snippet fw:b - font-weight: bold; -snippet fw:br - font-weight: bolder; -snippet fw:lr - font-weight: lighter; -snippet fw:n - font-weight: normal; -snippet f - font: ${0}; -snippet h - height: ${0}; -snippet h:a - height: auto; -snippet l - left: ${0}; -snippet l:a - left: auto; -snippet lts - letter-spacing: ${0}; -snippet lh - line-height: ${0}; -snippet lisi - list-style-image: url(${0}); -snippet lisi:n - list-style-image: none; -snippet lisp - list-style-position: ${0}; -snippet lisp:i - list-style-position: inside; -snippet lisp:o - list-style-position: outside; -snippet list - list-style-type: ${0}; -snippet list:c - list-style-type: circle; -snippet list:dclz - list-style-type: decimal-leading-zero; -snippet list:dc - list-style-type: decimal; -snippet list:d - list-style-type: disc; -snippet list:lr - list-style-type: lower-roman; -snippet list:n - list-style-type: none; -snippet list:s - list-style-type: square; -snippet list:ur - list-style-type: upper-roman; -snippet lis - list-style: ${0}; -snippet lis:n - list-style: none; -snippet mb - margin-bottom: ${0}; -snippet mb:a - margin-bottom: auto; -snippet ml - margin-left: ${0}; -snippet ml:a - margin-left: auto; -snippet mr - margin-right: ${0}; -snippet mr:a - margin-right: auto; -snippet mt - margin-top: ${0}; -snippet mt:a - margin-top: auto; -snippet m - margin: ${0}; -snippet m:4 - margin: ${1:0} ${2:0} ${3:0} ${0:0}; -snippet m:3 - margin: ${1:0} ${2:0} ${0:0}; -snippet m:2 - margin: ${1:0} ${0:0}; -snippet m:0 - margin: 0; -snippet m:a - margin: auto; -snippet mah - max-height: ${0}; -snippet mah:n - max-height: none; -snippet maw - max-width: ${0}; -snippet maw:n - max-width: none; -snippet mih - min-height: ${0}; -snippet miw - min-width: ${0}; -snippet op - opacity: ${0}; -snippet op:ie - filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100}); -snippet op:ms - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${0:100})'; -snippet orp - orphans: ${0}; -snippet o+ - outline: ${1:1px} ${2:solid} #${0:000}; -snippet oc - outline-color: ${0:#000}; -snippet oc:i - outline-color: invert; -snippet oo - outline-offset: ${0}; -snippet os - outline-style: ${0}; -snippet ow - outline-width: ${0}; -snippet o - outline: ${0}; -snippet o:n - outline: none; -snippet ovs - overflow-style: ${0}; -snippet ovs:a - overflow-style: auto; -snippet ovs:mq - overflow-style: marquee; -snippet ovs:mv - overflow-style: move; -snippet ovs:p - overflow-style: panner; -snippet ovs:s - overflow-style: scrollbar; -snippet ovx - overflow-x: ${0}; -snippet ovx:a - overflow-x: auto; -snippet ovx:h - overflow-x: hidden; -snippet ovx:s - overflow-x: scroll; -snippet ovx:v - overflow-x: visible; -snippet ovy - overflow-y: ${0}; -snippet ovy:a - overflow-y: auto; -snippet ovy:h - overflow-y: hidden; -snippet ovy:s - overflow-y: scroll; -snippet ovy:v - overflow-y: visible; -snippet ov - overflow: ${0}; -snippet ov:a - overflow: auto; -snippet ov:h - overflow: hidden; -snippet ov:s - overflow: scroll; -snippet ov:v - overflow: visible; -snippet pb - padding-bottom: ${0}; -snippet pl - padding-left: ${0}; -snippet pr - padding-right: ${0}; -snippet pt - padding-top: ${0}; -snippet p - padding: ${0}; -snippet p:4 - padding: ${1:0} ${2:0} ${3:0} ${0:0}; -snippet p:3 - padding: ${1:0} ${2:0} ${0:0}; -snippet p:2 - padding: ${1:0} ${0:0}; -snippet p:0 - padding: 0; -snippet pgba - page-break-after: ${0}; -snippet pgba:aw - page-break-after: always; -snippet pgba:a - page-break-after: auto; -snippet pgba:l - page-break-after: left; -snippet pgba:r - page-break-after: right; -snippet pgbb - page-break-before: ${0}; -snippet pgbb:aw - page-break-before: always; -snippet pgbb:a - page-break-before: auto; -snippet pgbb:l - page-break-before: left; -snippet pgbb:r - page-break-before: right; -snippet pgbi - page-break-inside: ${0}; -snippet pgbi:a - page-break-inside: auto; -snippet pgbi:av - page-break-inside: avoid; -snippet pos - position: ${0}; -snippet pos:a - position: absolute; -snippet pos:f - position: fixed; -snippet pos:r - position: relative; -snippet pos:s - position: static; -snippet q - quotes: ${0}; -snippet q:en - quotes: '\201C' '\201D' '\2018' '\2019'; -snippet q:n - quotes: none; -snippet q:ru - quotes: '\00AB' '\00BB' '\201E' '\201C'; -snippet rz - resize: ${0}; -snippet rz:b - resize: both; -snippet rz:h - resize: horizontal; -snippet rz:n - resize: none; -snippet rz:v - resize: vertical; -snippet r - right: ${0}; -snippet r:a - right: auto; -snippet tbl - table-layout: ${0}; -snippet tbl:a - table-layout: auto; -snippet tbl:f - table-layout: fixed; -snippet tal - text-align-last: ${0}; -snippet tal:a - text-align-last: auto; -snippet tal:c - text-align-last: center; -snippet tal:l - text-align-last: left; -snippet tal:r - text-align-last: right; -snippet ta - text-align: ${0}; -snippet ta:c - text-align: center; -snippet ta:l - text-align: left; -snippet ta:r - text-align: right; -snippet td - text-decoration: ${0}; -snippet td:l - text-decoration: line-through; -snippet td:n - text-decoration: none; -snippet td:o - text-decoration: overline; -snippet td:u - text-decoration: underline; -snippet te - text-emphasis: ${0}; -snippet te:ac - text-emphasis: accent; -snippet te:a - text-emphasis: after; -snippet te:b - text-emphasis: before; -snippet te:c - text-emphasis: circle; -snippet te:ds - text-emphasis: disc; -snippet te:dt - text-emphasis: dot; -snippet te:n - text-emphasis: none; -snippet th - text-height: ${0}; -snippet th:a - text-height: auto; -snippet th:f - text-height: font-size; -snippet th:m - text-height: max-size; -snippet th:t - text-height: text-size; -snippet ti - text-indent: ${0}; -snippet ti:- - text-indent: -9999px; -snippet tj - text-justify: ${0}; -snippet tj:a - text-justify: auto; -snippet tj:d - text-justify: distribute; -snippet tj:ic - text-justify: inter-cluster; -snippet tj:ii - text-justify: inter-ideograph; -snippet tj:iw - text-justify: inter-word; -snippet tj:k - text-justify: kashida; -snippet tj:t - text-justify: tibetan; -snippet to+ - text-outline: ${1:0} ${2:0} #${0:000}; -snippet to - text-outline: ${0}; -snippet to:n - text-outline: none; -snippet tr - text-replace: ${0}; -snippet tr:n - text-replace: none; -snippet tsh+ - text-shadow: ${1:0} ${2:0} ${3:0} #${0:000}; -snippet tsh - text-shadow: ${0}; -snippet tsh:n - text-shadow: none; -snippet tt - text-transform: ${0}; -snippet tt:c - text-transform: capitalize; -snippet tt:l - text-transform: lowercase; -snippet tt:n - text-transform: none; -snippet tt:u - text-transform: uppercase; -snippet tw - text-wrap: ${0}; -snippet tw:no - text-wrap: none; -snippet tw:n - text-wrap: normal; -snippet tw:s - text-wrap: suppress; -snippet tw:u - text-wrap: unrestricted; -snippet t - top: ${0}; -snippet t:a - top: auto; -snippet va - vertical-align: ${0}; -snippet va:bl - vertical-align: baseline; -snippet va:b - vertical-align: bottom; -snippet va:m - vertical-align: middle; -snippet va:sub - vertical-align: sub; -snippet va:sup - vertical-align: super; -snippet va:tb - vertical-align: text-bottom; -snippet va:tt - vertical-align: text-top; -snippet va:t - vertical-align: top; -snippet v - visibility: ${0}; -snippet v:c - visibility: collapse; -snippet v:h - visibility: hidden; -snippet v:v - visibility: visible; -snippet whsc - white-space-collapse: ${0}; -snippet whsc:ba - white-space-collapse: break-all; -snippet whsc:bs - white-space-collapse: break-strict; -snippet whsc:k - white-space-collapse: keep-all; -snippet whsc:l - white-space-collapse: loose; -snippet whsc:n - white-space-collapse: normal; -snippet whs - white-space: ${0}; -snippet whs:n - white-space: normal; -snippet whs:nw - white-space: nowrap; -snippet whs:pl - white-space: pre-line; -snippet whs:pw - white-space: pre-wrap; -snippet whs:p - white-space: pre; -snippet wid - widows: ${0}; -snippet w - width: ${0}; -snippet w:a - width: auto; -snippet wob - word-break: ${0}; -snippet wob:ba - word-break: break-all; -snippet wob:bs - word-break: break-strict; -snippet wob:k - word-break: keep-all; -snippet wob:l - word-break: loose; -snippet wob:n - word-break: normal; -snippet wos - word-spacing: ${0}; -snippet wow - word-wrap: ${0}; -snippet wow:no - word-wrap: none; -snippet wow:n - word-wrap: normal; -snippet wow:s - word-wrap: suppress; -snippet wow:u - word-wrap: unrestricted; -snippet z - z-index: ${0}; -snippet z:a - z-index: auto; -snippet zoo - zoom: 1; -snippet :h - :hover -snippet :fc - :first-child -snippet :lc - :last-child -snippet :nc - :nth-child(${0}) -snippet :nlc - :nth-last-child(${0}) -snippet :oc - :only-child -snippet :a - :after -snippet :b - :before -snippet ::a - ::after -snippet ::b - ::before diff --git a/.config/micro/plug/snippets/snippets/d.snippets b/.config/micro/plug/snippets/snippets/d.snippets deleted file mode 100644 index 216a4d8..0000000 --- a/.config/micro/plug/snippets/snippets/d.snippets +++ /dev/null @@ -1,338 +0,0 @@ -### Import -snippet imp - import -snippet pimp - public import -### My favorite modules -snippet io - std.stdio -snippet traits - std.traits -snippet conv - std.conv -snippet arr - std.array -snippet algo - std.algorithm -snippet theusual - import std.stdio, std.string, std.array; - import std.traits, std.conv, std.algorithm; - import std.math, std.regex; -### Control Structures -snippet for - for(int ${1:i} = 0; $1 < ${2:count}; $1++) { - ${0} - } -snippet fe - foreach(${1:elem}; ${2:range}) { - ${0} - } -snippet fei - foreach(${1:i}, ${2:elem}; ${3:range}) { - ${0} - } -snippet fer - foreach_reverse(${1:elem}; ${2:range}) { - ${0} - } -snippet feri - foreach_reverse(${1:i}, ${2:elem}; ${3:range}) { - ${0} - } -snippet sce - scope(exit) ${1:f.close();} -snippet scs - scope(success) ${1} -snippet scf - scope(failure) ${1} -snippet el - else { - ${1} - } -snippet eif - else if(${1}) { - ${0} - } -snippet if - if(${1}) { - ${0} - } -snippet ife - if(${1}) { - ${2} - } else { - ${3} - } -snippet ifee - if(${1}) { - ${2} - } else if(${3}) { - ${4} - } else { - ${5} - } -snippet sw - switch(${1}) { - ${0} - } -snippet cs - case ${1:0}: - ${2} - break; -snippet def - default: - ${0} -snippet fsw - final switch(${1}) { - ${0} - } -snippet try - try { - ${1} - } catch(${2:Exception} ${3:e}) { - ${4} - } -snippet tcf - try { - ${0} - } catch(${1:Exception} ${2:e}) { - ${3} - } finally { - ${4} - } -snippet wh - while(${1:cond}) { - ${0} - } -snippet dowh - do { - ${1} - } while(${2}); -snippet sif - static if(${1:cond}) { - ${2} - } -snippet sife - static if(${1}) { - ${2} - } else { - ${3} - } -snippet sifee - static if(${1}) { - ${2} - } else static if(${3}) { - ${4} - } else { - ${5} - } -snippet seif - else static if(${1}) { - ${2} - } -snippet ? - (${1: a > b}) ? ${2:a} : ${3:b}; -snippet with - with(${1:exp}) { - ${2} - } ${0} -### Functions -snippet fun - ${1:auto} ${2:func}(${3:params}) { - ${0} - } -snippet contr - in { - ${1} - } out { - ${2} - } body { - ${0} - } -snippet l - (${1:x}) => ${2:x}${0:;} -snippet funl - function (${1:int x}) => ${2}${3:;} -snippet del - delegate (${1:int x}) => ${2}${3:;} -### Templates -snippet temp - template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) { - ${0} - } -snippet tempif - template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) if(${3:isSomeString!}$2) { - ${0} - } -snippet opApply - int opApply(Dg)(Dg dg) if(ParameterTypeTuble!Dg.length == 2) { - ${0} - } -snippet psn - pure @safe nothrow -snippet safe - @safe -snippet trusted - @trusted -snippet system - @system -### OOPs -snippet cl - class${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} { - ${0} - } -snippet str - struct${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} { - ${0} - } -snippet uni - union${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} { - ${0} - } -snippet inter - interface I${1:`vim_snippets#Filename("$2", "untitled")`} { - ${0} - } -snippet enum - enum ${1} { - ${0} - } -snippet pu - public -snippet pr - private -snippet po - protected -snippet ctor - this(${1}) { - ${0} - } -snippet dtor - ~this(${1}) { - ${0} - } -### Type Witchery -snippet al - alias ${1:b} = ${2:a}; - ${0} -snippet alth - alias ${1:value} this; - ${0} -### The Commonplace -snippet main - void main() { - ${0} - } -snippet maina - void main(string[] args) { - ${0} - } -snippet mod - module ${1:main};${0} -snippet var - ${1:auto} ${2:var} = ${0:1}; -snippet new - ${1:auto} ${2:var} = new ${3:Object}(${4}); - ${0} -snippet file - auto ${1:f} = File(${2:"useful_info.xml"}, ${3:"rw"}); - ${0} -snippet map - map!(${1:f})(${2:xs}); - ${0} -snippet filter - filter!(${1:p})(${2:xs}); - ${0} -snippet reduce - reduce!(${1:f})(${2:xs}); - ${0} -snippet find - find!(${1:p})($2:xs); - ${0} -snippet aa - ${1:int}[${2:string}] ${3:dict} = ${0}; -### Misc -snippet #! - #!/usr/bin/env rdmd -snippet bang - #!/usr/bin/env rdmd -snippet rdmd - #!/usr/bin/env rdmd -snippet isstr - isSomeString!${1:S} -snippet isnum - isNumeric!${1:N} -snippet tos - to!string(${1:x}); - ${0} -snippet toi - to!int(${1:str}); - ${0} -snippet tod - to!double(${1:str}); - ${0} -snippet un - unittest { - ${0} - } -snippet ver - version(${1:Posix}) { - ${0} - } -snippet de - debug { - ${0} - } -snippet sst - shared static this(${1}) { - ${0} - } -snippet td - // Typedef is deprecated. Use alias instead. - typedef -snippet ino - inout -snippet imm - immutable -snippet fin - final -snippet con - const -snippet psi - private static immutable ${1:int} ${2:Constant} = ${3:1}; - ${0} -snippet prag - pragma(${1}) -snippet pms - pragma(msg, ${1:Warning}); -snippet asm - asm { - ${1} - } -snippet mixin - mixin(${1:`writeln("Hello, World!");`}); -snippet over - override -snippet ret - return ${1}; -snippet FILE - __FILE__ -snippet MOD - __MODULE__ -snippet LINE - __LINE__ -snippet FUN - __FUNCTION__ -snippet PF - __PRETTY_FUNCTION__ -snippet cast - cast(${1:T})(${2:val}); -snippet /* - /* - * ${1} - */ -### Fun stuff -snippet idk - // I don't know how this works. Don't touch it. -snippet idfk - // Don't FUCKING touch this. diff --git a/.config/micro/plug/snippets/snippets/dart.snippets b/.config/micro/plug/snippets/snippets/dart.snippets deleted file mode 100644 index 0093f2b..0000000 --- a/.config/micro/plug/snippets/snippets/dart.snippets +++ /dev/null @@ -1,82 +0,0 @@ -snippet lib - #library('${1}'); - ${0} -snippet im - #import('${1}'); - ${0} -snippet so - #source('${1}'); - ${0} -snippet main - static void main() { - ${0} - } -snippet st - static ${0} -snippet fi - final ${0} -snippet re - return ${0} -snippet br - break; -snippet th - throw ${0} -snippet cl - class ${1:`vim_snippets#Filename("", "untitled")`} ${0} -snippet in - interface ${1:`vim_snippets#Filename("", "untitled")`} ${0} -snippet imp - implements ${0} -snippet ext - extends ${0} -snippet if - if (${1:true}) { - ${0} - } -snippet ife - if (${1:true}) { - ${2} - } else { - ${0} - } -snippet el - else -snippet sw - switch (${1}) { - ${0} - } -snippet cs - case ${1}: - ${0} -snippet de - default: - ${0} -snippet for - for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) { - ${0:$1[$2]} - } -snippet fore - for (final ${2:item} in ${1:itemList}) { - ${0} - } -snippet wh - while (${1:/* condition */}) { - ${0} - } -snippet dowh - do { - ${0} - } while (${0:/* condition */}); -snippet as - assert(${0:/* condition */}); -snippet try - try { - ${0} - } catch (${1:Exception e}) { - } -snippet tryf - try { - ${0} - } catch (${1:Exception e}) { - } finally { - } diff --git a/.config/micro/plug/snippets/snippets/fish.snippets b/.config/micro/plug/snippets/snippets/fish.snippets deleted file mode 100644 index 3549fe1..0000000 --- a/.config/micro/plug/snippets/snippets/fish.snippets +++ /dev/null @@ -1,29 +0,0 @@ -# Shebang. Executing bash via /usr/bin/env makes scripts more portable. -snippet #! - #!/usr/bin/env fish - -snippet if - if ${1:condition} - ${0:#statements} - end - -snippet for - for ${1:needle} in ${1:haystack} - ${0:#statements} - end - -snippet while - while ${1:condition} - ${0:#statements} - end - -snippet switch - switch ${1:word} - case ${2:pattern} - ${0:#statements} - end - -snippet function - function ${1:name} - ${0:#body} - end diff --git a/.config/micro/plug/snippets/snippets/fortran.snippets b/.config/micro/plug/snippets/snippets/fortran.snippets deleted file mode 100644 index c9ab060..0000000 --- a/.config/micro/plug/snippets/snippets/fortran.snippets +++ /dev/null @@ -1,93 +0,0 @@ -snippet impl - implicit none - $0 -snippet prog - program ${1:main} - $0 - end program $1 -snippet mod - module ${1:modulename} - $0 - end module $1 -snippet proc - procedure ${1:name} - ${0} - end procedure $1 -snippet iface - interface ${1:name} - ${0} - end interface $1 -snippet doc - ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - ! File: ${2:`vim_snippets#Filename('$1')`} - ! Author: `g:snips_author` - ! Email: `g:snips_email` - ! Github: `g:snips_github` - ! Description: $1 - ! """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - $0 -# Variables definitions -# Boolean -snippet bool - logical :: $0 -# Integer -snippet int - integer :: $0 -snippet real - real :: $0 -# Double Precision -snippet double - double precision :: $0 -# Char -snippet str - character(len=${1:*}) :: ${0:} -# Types -snippet type - type(${1:name}) - $0 - end type -snippet const - ${1:type}, parameter :: $2 = $0 -snippet arr - ${1:type}, allocatable, dimension(${2::}) :: $0 -snippet intent - ${1:type}, intent(inout) :: $0 -# Array -snippet / - (/ $1 /) ${2:,&} $0 -snippet if - if (${1:condition}) then - $2 - end if -snippet case - select case (${1:expr}) - case ($2) - case default - $3 - end select $0 -snippet do - do ${1:i} = ${2:start},${3:end}, ${4:incr} - $4 - end do -snippet dow - do while (${1:condition}) - $2 - end do -snippet sub - subroutine ${1:name}($2) - $0 - end subroutine $1 -snippet func - function ${1:name}($2) result($3) - $0 - end function $1 -snippet pr - write(*,*) $0 -snippet read - read( unit = ${1:fp}, file = ${2:filename}${3:, iostat = IERR }) $0 -snippet write - write( unit = ${1:fp}, file = ${2:filename}${3:, iostat = IERR }) $0 -snippet open - open (unit = ${1:fp}, file = ${2:filename}, status = unknown${3:, iostat = IERR }) $0 -snippet close - close ( unit = ${1:fp} ) $0 diff --git a/.config/micro/plug/snippets/snippets/go.snippets b/.config/micro/plug/snippets/snippets/go.snippets deleted file mode 100644 index b2bdc9e..0000000 --- a/.config/micro/plug/snippets/snippets/go.snippets +++ /dev/null @@ -1,237 +0,0 @@ -# shorthand variable declaration -snippet v - ${1} := ${2} -# variable initialization -snippet vr - var ${1:t} ${0:string} -# variable declaration -snippet var - var ${1} ${2} = ${3} -# variables declaration -snippet vars - var ( - ${1} ${2} = ${3} - ) -# append -snippet ap - append(${1:slice}, ${0:value}) -# bool -snippet bl - bool -# byte -snippet bt - byte -# break -snippet br - break -# channel -snippet ch - chan ${0:int} -# case -snippet cs - case ${1:value}: - ${0} -# const -snippet c - const ${1:NAME} = ${0:0} -# constants with iota -snippet co - const ( - ${1:NAME1} = iota - ${0:NAME2} - ) -# continue -snippet cn - continue -# defer -snippet df - defer ${0:func}() -# defer recover -snippet dfr - defer func() { - if err := recover(); err != nil { - ${0} - } - }() -# int -snippet i - int -# import -snippet im - import ( - "${1:package}" - ) -# interface -snippet in - interface{} -# full interface snippet -snippet inf - interface ${1:name} { - ${2:/* methods */} - } -# if condition -snippet if - if ${1:/* condition */} { - ${2} - } -snippet ife - if ${1:/* condition */} { - ${2} - } else { - ${0} - } -# else snippet -snippet el - else { - ${1} - } -# error snippet -snippet ir - if err != nil { - return err - } - ${0} -# false -snippet f - false -# fallthrough -snippet ft - fallthrough -# float -snippet fl - float32 -# float32 -snippet f3 - float32 -# float64 -snippet f6 - float64 -# if else -snippet ie - if ${1:/* condition */} { - ${2} - } else { - ${3} - } - ${0} -# for int loop -snippet for - for ${1}{ - ${0} - } -# for int loop -snippet fori - for ${2:i} := 0; $2 < ${1:count}; $2${3:++} { - ${0} - } -# for range loop -snippet forr - for ${1:e} := range ${2:collection} { - ${0} - } -# function simple -snippet fun - func ${1:funcName}(${2}) ${3:error} { - ${4} - } - ${0} -# function on receiver -snippet fum - func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} { - ${6} - } - ${0} -# log printf -snippet lf - log.Printf("%${1:s}", ${2:var}) -# log printf -snippet lp - log.Println("${1}") -# make -snippet mk - make(${1:[]string}, ${0:0}) -# map -snippet mp - map[${1:string}]${0:int} -# main() -snippet main - func main() { - ${1} - } - ${0} -# new -snippet nw - new(${0:type}) -# package -snippet pa - package ${1:main} -# panic -snippet pn - panic("${0:msg}") -# print -snippet pr - fmt.Printf("%${1:s}\n", ${2:var}) -# println -snippet pl - fmt.Println("${1:s}") -# range -snippet rn - range ${0} -# return -snippet rt - return ${0} -# result -snippet rs - result -# select -snippet sl - select { - case ${1:v1} := <-${2:chan1} - ${3} - default: - ${0} - } -# string -snippet sr - string -# struct -snippet st - struct ${1:name} { - ${2:/* data */} - } - ${0} -# switch -snippet sw - switch ${1:var} { - case ${2:value1}: - ${3} - case ${4:value2}: - ${5} - default: - ${0} - } -snippet sp - fmt.Sprintf("%${1:s}", ${2:var}) -# true -snippet t - true -# goroutine named function -snippet g - go ${1:funcName}(${0}) -# goroutine anonymous function -snippet ga - go func(${1} ${2:type}) { - ${3:/* code */} - }(${0}) -snippet test test function - func Test${1:name}(t *testing.T) { - ${2} - } - ${0} -snippet bench benchmark function - func Benchmark${1:name}(b *testing.B) { - for i := 0; i < b.N; i++ { - ${2} - } - } - ${0} diff --git a/.config/micro/plug/snippets/snippets/haml.snippets b/.config/micro/plug/snippets/snippets/haml.snippets deleted file mode 100644 index 09217c6..0000000 --- a/.config/micro/plug/snippets/snippets/haml.snippets +++ /dev/null @@ -1,37 +0,0 @@ -snippet t - %table - %tr - %th - ${1:headers} - %tr - %td - ${0:headers} -snippet ul - %ul - %li - ${0:item} - %li -snippet rp - = render :partial => "${0:item}" -snippet rpc - = render :partial => "${1:item}", :collection => ${0:@$1s} -snippet rpl - = render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} -snippet rpo - = render :partial => "${1:item}", :object => ${0:@$1} -snippet lt - = link_to ${1:name}, ${2:dest} -snippet mt - = mail_to ${1:email_address}, ${2:name} -snippet mts - = mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4} -snippet ife - - if ${1:condition} - ${2} - - else - ${0} -snippet ifp - - if ${1:condition}.presence? - ${0} -snippet ntc - = number_to_currency(${1}) diff --git a/.config/micro/plug/snippets/snippets/haskell.snippets b/.config/micro/plug/snippets/snippets/haskell.snippets deleted file mode 100644 index e4957e4..0000000 --- a/.config/micro/plug/snippets/snippets/haskell.snippets +++ /dev/null @@ -1,115 +0,0 @@ -snippet lang - {-# LANGUAGE ${0:OverloadedStrings} #-} -snippet haddock - {-# OPTIONS_HADDOCK ${0:hide} #-} -snippet ghc - {-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-} -snippet inline - {-# INLINE ${0:name} #-} -snippet info - -- | - -- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`} - -- Copyright : ${2:Author} ${3:2011-2012} - -- License : ${4:BSD3} - -- - -- Maintainer : ${5:email@something.com} - -- Stability : ${6:experimental} - -- Portability : ${7:unknown} - -- - -- ${0:Description} - -- -snippet imp - import ${0:Data.Text} -snippet import - import ${0:Data.Text} -snippet import2 - import ${1:Data.Text} (${0:head}) -snippet impq - import qualified ${1:Data.Text} as ${0:T} -snippet importq - import qualified ${1:Data.Text} as ${0:T} -snippet inst - instance ${1:Monoid} ${2:Type} where - ${0} -snippet type - type ${1:Type} = ${0:Type} -snippet data - data ${1:Type} = ${2:$1} ${0:Int} -snippet newtype - newtype ${1:Type} = ${2:$1} ${0:Int} -snippet class - class ${1:Class} a where - ${0} -snippet module - module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` ( - ) where - `expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""` - -snippet main - main :: IO () - main = ${0:undefined} -snippet const - ${1:name} :: ${2:a} - $1 = ${0:undefined} -snippet fn - ${1:fn} :: ${2:a} -> ${3:a} - $1 ${4} = ${0:undefined} -snippet fn2 - ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} - $1 ${5} = ${0:undefined} -snippet fn3 - ${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a} - $1 ${6} = ${0:undefined} -snippet => "Type constraint" - (${1:Class} ${2:a}) => $2 -snippet ap - ${1:map} ${2:fn} ${0:list} -snippet \ - \\${1:x} -> ${0:expression} -snippet (\ - (\\${1:x} -> ${0:expression}) -snippet <- - ${1:a} <- ${0:m a} -snippet -> - ${1:m a} -> ${0:a} -snippet tup - (${1:a}, ${0:b}) -snippet tup2 - (${1:a}, ${2:b}, ${0:c}) -snippet tup3 - (${1:a}, ${2:b}, ${3:c}, ${0:d}) -snippet rec - ${1:Record} { ${2:recFieldA} = ${3:undefined} - , ${4:recFieldB} = ${0:undefined} - } -snippet case - case ${1:something} of - ${2} -> ${0} -snippet let - let ${1} = ${2} - in ${3} -snippet where - where - ${1:fn} = ${0:undefined} -snippet spec - module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where - - import Test.Hspec - import Test.QuickCheck - - main :: IO () - main = hspec spec - - spec :: Spec - spec = - describe "${1}" $ do - $0 -snippet desc - describe "${1}" $ do - $0 -snippet it - it "${1}" $ - $0 -snippet itp - it "${1}" $ property $ - $0 diff --git a/.config/micro/plug/snippets/snippets/html.snippets b/.config/micro/plug/snippets/snippets/html.snippets deleted file mode 100644 index 5ae8e74..0000000 --- a/.config/micro/plug/snippets/snippets/html.snippets +++ /dev/null @@ -1,877 +0,0 @@ -# Some useful Unicode entities -# Non-Breaking Space -snippet nbs - -# ← -snippet left - ← -# → -snippet right - → -# ↑ -snippet up - ↑ -# ↓ -snippet down - ↓ -# ↩ -snippet return - ↩ -# ⇤ -snippet backtab - ⇤ -# ⇥ -snippet tab - ⇥ -# ⇧ -snippet shift - ⇧ -# ⌃ -snippet ctrl - ⌃ -# ⌅ -snippet enter - ⌅ -# ⌘ -snippet cmd - ⌘ -# ⌥ -snippet option - ⌥ -# ⌦ -snippet delete - ⌦ -# ⌫ -snippet backspace - ⌫ -# ⎋ -snippet esc - ⎋ -# comment -snippet // - <!-- ${1} -->${0} -# Generic Doctype -snippet doctype HTML 4.01 Strict - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> -snippet doctype HTML 4.01 Transitional - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -snippet doctype HTML 5 - <!DOCTYPE HTML> -snippet doctype XHTML 1.0 Frameset - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -snippet doctype XHTML 1.0 Strict - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -snippet doctype XHTML 1.0 Transitional - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -snippet doctype XHTML 1.1 - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -# HTML Doctype 4.01 Strict -snippet docts - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" - "http://www.w3.org/TR/html4/strict.dtd"> -# HTML Doctype 4.01 Transitional -snippet doct - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -# HTML Doctype 5 -snippet doct5 - <!DOCTYPE HTML> -# XHTML Doctype 1.0 Frameset -snippet docxf - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> -# XHTML Doctype 1.0 Strict -snippet docxs - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -# XHTML Doctype 1.0 Transitional -snippet docxt - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -# XHTML Doctype 1.1 -snippet docx - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -# Attributes -snippet attr - ${1:attribute}="${0:property}" -snippet attr+ - ${1:attribute}="${2:property}" attr+ -snippet . - class="${1}" -snippet # - id="${1}" -snippet alt - alt="${1}" -snippet charset - charset="${1:utf-8}" -snippet data - data-${1}="${2:$1}" -snippet for - for="${1}" -snippet height - height="${1}" -snippet href - href="${1:#}" -snippet lang - lang="${1:en}" -snippet media - media="${1}" -snippet name - name="${1}" -snippet rel - rel="${1}" -snippet scope - scope="${1:row}" -snippet src - src="${1}" -snippet title= - title="${1}" -snippet type - type="${1}" -snippet value - value="${1}" -snippet width - width="${1}" -# Elements -snippet a - <a href="${1:#}">${0:$1}</a> -snippet a. - <a class="${1}" href="${2:#}">${0:$1}</a> -snippet a# - <a id="${1}" href="${2:#}">${0:$1}</a> -snippet a:ext - <a href="http://${1:example.com}">${0:$1}</a> -snippet a:mail - <a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${0:email me}</a> -snippet ac - <a href="`@+`">${0:`@+`}</a> -snippet abbr - <abbr title="${1}">${0}</abbr> -snippet address - <address> - ${0} - </address> -snippet area - <area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}" /> -snippet area+ - <area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" /> - area+ -snippet area:c - <area shape="circle" coords="${1}" href="${2}" alt="${0}" /> -snippet area:d - <area shape="default" coords="${1}" href="${2}" alt="${0}" /> -snippet area:p - <area shape="poly" coords="${1}" href="${2}" alt="${0}" /> -snippet area:r - <area shape="rect" coords="${1}" href="${2}" alt="${0}" /> -snippet article - <article> - ${0} - </article> -snippet article. - <article class="${1}"> - ${0} - </article> -snippet article# - <article id="${1}"> - ${0} - </article> -snippet aside - <aside> - ${0} - </aside> -snippet aside. - <aside class="${1}"> - ${0} - </aside> -snippet aside# - <aside id="${1}"> - ${0} - </aside> -snippet audio - <audio src="${1}>${0}</audio> -snippet b - <b>${0}</b> -snippet base - <base href="${1}" target="${0}" /> -snippet bdi - <bdi>${0}</bdo> -snippet bdo - <bdo dir="${1}">${0}</bdo> -snippet bdo:l - <bdo dir="ltr">${0}</bdo> -snippet bdo:r - <bdo dir="rtl">${0}</bdo> -snippet blockquote - <blockquote> - ${0} - </blockquote> -snippet body - <body> - ${0} - </body> -snippet br - <br /> -snippet button - <button type="${1:submit}">${0}</button> -snippet button. - <button class="${1:button}" type="${2:submit}">${0}</button> -snippet button# - <button id="${1}" type="${2:submit}">${0}</button> -snippet button:s - <button type="submit">${0}</button> -snippet button:r - <button type="reset">${0}</button> -snippet canvas - <canvas> - ${0} - </canvas> -snippet caption - <caption>${0}</caption> -snippet cite - <cite>${0}</cite> -snippet code - <code>${0}</code> -snippet col - <col /> -snippet col+ - <col /> - col+ -snippet colgroup - <colgroup> - ${0} - </colgroup> -snippet colgroup+ - <colgroup> - <col /> - col+${0} - </colgroup> -snippet command - <command type="command" label="${1}" icon="${0}"> -snippet command:c - <command type="checkbox" label="${1}" icon="${0}"> -snippet command:r - <command type="radio" radiogroup="${1}" label="${2}" icon="${0}"> -snippet datagrid - <datagrid> - ${0} - </datagrid> -snippet datalist - <datalist> - ${0} - </datalist> -snippet datatemplate - <datatemplate> - ${0} - </datatemplate> -snippet dd - <dd>${0}</dd> -snippet dd. - <dd class="${1}">${0}</dd> -snippet dd# - <dd id="${1}">${0}</dd> -snippet del - <del>${0}</del> -snippet details - <details>${0}</details> -snippet dfn - <dfn>${0}</dfn> -snippet dialog - <dialog> - ${0} - </dialog> -snippet div - <div> - ${0} - </div> -snippet div. - <div class="${1}"> - ${0} - </div> -snippet div# - <div id="${1}"> - ${0} - </div> -snippet dl - <dl> - ${0} - </dl> -snippet dl. - <dl class="${1}"> - ${0} - </dl> -snippet dl# - <dl id="${1}"> - ${0} - </dl> -snippet dl+ - <dl> - <dt>${1}</dt> - <dd>${2}</dd> - dt+${0} - </dl> -snippet dt - <dt>${0}</dt> -snippet dt. - <dt class="${1}">${0}</dt> -snippet dt# - <dt id="${1}">${0}</dt> -snippet dt+ - <dt>${1}</dt> - <dd>${2}</dd> - dt+${0} -snippet em - <em>${0}</em> -snippet embed - <embed src="${1}" type="${0}" /> -snippet fieldset - <fieldset> - ${0} - </fieldset> -snippet fieldset. - <fieldset class="${1}"> - ${0} - </fieldset> -snippet fieldset# - <fieldset id="${1}"> - ${0} - </fieldset> -snippet fieldset+ - <fieldset> - <legend><span>${1}</span></legend> - ${2} - </fieldset> - fieldset+${0} -snippet figcaption - <figcaption>${0}</figcaption> -snippet figure - <figure>${0}</figure> -snippet figure# - <figure id="${1}"> - ${0} - </figure> -snippet figure. - <figure class="${1}"> - ${0} - </figure> -snippet footer - <footer> - ${0} - </footer> -snippet footer. - <footer class="${1}"> - ${0} - </footer> -snippet footer# - <footer id="${1}"> - ${0} - </footer> -snippet form - <form action="${1}" method="${2:post}"> - ${0} - </form> -snippet form. - <form class="${1}" action="${2}" method="${3:post}"> - ${0} - </form> -snippet form# - <form id="${1}" action="${2}" method="${3:post}"> - ${0} - </form> -snippet h1 - <h1>${0}</h1> -snippet h1. - <h1 class="${1}">${0}</h1> -snippet h1# - <h1 id="${1}">${0}</h1> -snippet h2 - <h2>${0}</h2> -snippet h2. - <h2 class="${1}">${0}</h2> -snippet h2# - <h2 id="${1}">${0}</h2> -snippet h3 - <h3>${0}</h3> -snippet h3. - <h3 class="${1}">${0}</h3> -snippet h3# - <h3 id="${1}">${0}</h3> -snippet h4 - <h4>${0}</h4> -snippet h4. - <h4 class="${1}">${0}</h4> -snippet h4# - <h4 id="${1}">${0}</h4> -snippet h5 - <h5>${0}</h5> -snippet h5. - <h5 class="${1}">${0}</h5> -snippet h5# - <h5 id="${1}">${0}</h5> -snippet h6 - <h6>${0}</h6> -snippet h6. - <h6 class="${1}">${0}</h6> -snippet h6# - <h6 id="${1}">${0}</h6> -snippet head - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - - <title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title> - ${0} - </head> -snippet header - <header> - ${0} - </header> -snippet header. - <header class="${1}"> - ${0} - </header> -snippet header# - <header id="${1}"> - ${0} - </header> -snippet hgroup - <hgroup> - ${0} - </hgroup> -snippet hgroup. - <hgroup class="${1}> - ${0} - </hgroup> -snippet hr - <hr /> -snippet html - <html> - ${0} - </html> -snippet xhtml - <html xmlns="http://www.w3.org/1999/xhtml"> - ${0} - </html> -snippet html5 - <!DOCTYPE html> - <html> - <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width" /> - <title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title> - ${2:link} - </head> - <body> - ${0:body} - </body> - </html> -snippet html5l - <!DOCTYPE html> - <html lang="${1:es}"> - <head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width" /> - <title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title> - ${3:link} - </head> - <body> - ${0:body} - </body> - </html> -snippet i - <i>${0}</i> -snippet iframe - <iframe src="${1}" frameborder="0"></iframe> -snippet iframe. - <iframe class="${1}" src="${2}" frameborder="0"></iframe> -snippet iframe# - <iframe id="${1}" src="${2}" frameborder="0"></iframe> -snippet img - <img src="${1}" alt="${2}" /> -snippet img. - <img class="${1}" src="${2}" alt="${3}" /> -snippet img# - <img id="${1}" src="${2}" alt="${3}" /> -snippet input - <input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" /> -snippet input. - <input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" /> -snippet input:text - <input type="text" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:submit - <input type="submit" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:hidden - <input type="hidden" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:button - <input type="button" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:image - <input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" /> -snippet input:checkbox - <input type="checkbox" name="${1}" id="${2:$1}" /> -snippet input:radio - <input type="radio" name="${1}" id="${2:$1}" /> -snippet input:color - <input type="color" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:date - <input type="date" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:datetime - <input type="datetime" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:datetime-local - <input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:email - <input type="email" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:file - <input type="file" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:month - <input type="month" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:number - <input type="number" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:password - <input type="password" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:range - <input type="range" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:reset - <input type="reset" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:search - <input type="search" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:time - <input type="time" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:url - <input type="url" name="${1}" id="${2:$1}" value="${3}" /> -snippet input:week - <input type="week" name="${1}" id="${2:$1}" value="${3}" /> -snippet ins - <ins>${0}</ins> -snippet kbd - <kbd>${0}</kbd> -snippet label - <label for="${0:$1}">${1}</label> -snippet label:i - <label for="${2:$1}">${1}</label> - <input type="${3:text/submit/hidden/button}" name="${4:$2}" id="${5:$2}" value="${6}" /> -snippet label:s - <label for="${2:$1}">${1}</label> - <select name="${3:$2}" id="${4:$2}"> - <option value="${5}">${0:$5}</option> - </select> -snippet legend - <legend>${0}</legend> -snippet legend+ - <legend><span>${0}</span></legend> -snippet li - <li>${0}</li> -snippet li. - <li class="${1}">${0}</li> -snippet li+ - <li>${1}</li> - li+ -snippet lia - <li><a href="${0:#}">${1}</a></li> -snippet lia+ - <li><a href="${2:#}">${1}</a></li> - lia+ -snippet link - <link rel="${1}" href="${2}" title="${3}" type="${4}" /> -snippet link:atom - <link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" /> -snippet link:s - <link rel="stylesheet" href="${1:style.css}" /> -snippet link:css - <link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" /> -snippet link:favicon - <link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" /> -snippet link:rss - <link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" /> -snippet link:touch - <link rel="apple-touch-icon" href="${1:favicon.png}" /> -snippet main - <main role="main"> - ${0} - </main> -snippet map - <map name="${1}"> - ${0} - </map> -snippet map. - <map class="${1}" name="${2}"> - ${0} - </map> -snippet map# - <map name="${1}" id="${2:$1}> - ${0} - </map> -snippet map+ - <map name="${1}"> - <area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6} - </map> -snippet mark - <mark>${0}</mark> -snippet menu - <menu> - ${0} - </menu> -snippet menu:c - <menu type="context"> - ${0} - </menu> -snippet menu:t - <menu type="toolbar"> - ${0} - </menu> -snippet meta - <meta http-equiv="${1}" content="${2}" /> -snippet meta:s - <meta ${0} /> -snippet meta:d - <meta name="description" content="${0}" /> -snippet meta:compat - <meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" /> -snippet meta:refresh - <meta http-equiv="refresh" content="text/html;charset=UTF-8" /> -snippet meta:utf - <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> -snippet meter - <meter>${0}</meter> -snippet nav - <nav> - ${0} - </nav> -snippet nav. - <nav class="${1}"> - ${0} - </nav> -snippet nav# - <nav id="${1}"> - ${0} - </nav> -snippet noscript - <noscript> - ${0} - </noscript> -snippet object - <object data="${1}" type="${2}"> - ${3} - </object> -# Embed QT Movie -snippet movie - <object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" - codebase="http://www.apple.com/qtactivex/qtplugin.cab"> - <param name="src" value="$1" /> - <param name="controller" value="$4" /> - <param name="autoplay" value="$5" /> - <embed src="${1:movie.mov}" - width="${2:320}" height="${3:240}" - controller="${4:true}" autoplay="${5:true}" - scale="tofit" cache="true" - pluginspage="http://www.apple.com/quicktime/download/" /> - </object> -snippet ol - <ol> - ${0} - </ol> -snippet ol. - <ol class="${1}"> - ${0} - </ol> -snippet ol# - <ol id="${1}"> - ${0} - </ol> -snippet ol+ - <ol> - <li>${1}</li> - li+${0} - </ol> -snippet opt - <option value="${1}">${0:$1}</option> -snippet opt+ - <option value="${1}">${2:$1}</option> - opt+${0} -snippet optt - <option>${0}</option> -snippet optgroup - <optgroup> - <option value="${1}">${2:$1}</option> - opt+${0} - </optgroup> -snippet output - <output>${0}</output> -snippet p - <p>${0}</p> -snippet p. - <p class="${1}">${0}</p> -snippet p# - <p id="${1}">${0}</p> -snippet param - <param name="${1}" value="${2}" /> -snippet pre - <pre> - ${0} - </pre> -snippet progress - <progress>${0}</progress> -snippet q - <q>${0}</q> -snippet rp - <rp>${0}</rp> -snippet rt - <rt>${0}</rt> -snippet ruby - <ruby> - <rp><rt>${0}</rt></rp> - </ruby> -snippet s - <s>${0}</s> -snippet samp - <samp> - ${0} - </samp> -snippet script - <script type="text/javascript" charset="utf-8"> - ${0} - </script> -snippet scripts - <script src="${0}.js"></script> -snippet scriptt - <script type="${1}" id="${2}"> - ${0} - </script> -snippet scriptsrc - <script src="${0}.js" type="text/javascript" charset="utf-8"></script> -snippet section - <section> - ${0} - </section> -snippet section. - <section class="${1}"> - ${0} - </section> -snippet section# - <section id="${1}"> - ${0} - </section> -snippet select - <select name="${1}" id="${2:$1}"> - ${0} - </select> -snippet select. - <select name="${1}" id="${2:$1}" class="${3}> - ${0} - </select> -snippet select+ - <select name="${1}" id="${2:$1}"> - <option value="${3}">${4:$3}</option> - opt+${0} - </select> -snippet small - <small>${0}</small> -snippet source - <source src="${1}" type="${2}" media="${0}" /> -snippet span - <span>${0}</span> -snippet span. - <span class="${1}">${0}</span> -snippet span# - <span id="${1}">${0}</span> -snippet strong - <strong>${0}</strong> -snippet style - <style type="text/css" media="${1:all}"> - ${0} - </style> -snippet sub - <sub>${0}</sub> -snippet summary - <summary> - ${0} - </summary> -snippet sup - <sup>${0}</sup> -snippet table - <table> - ${0} - </table> -snippet table. - <table class="${1}"> - ${0} - </table> -snippet table# - <table id="${1}"> - ${0} - </table> -snippet tbody - <tbody> - ${0} - </tbody> -snippet td - <td>${0}</td> -snippet td. - <td class="${1}">${0}</td> -snippet td# - <td id="${1}">${0}</td> -snippet td+ - <td>${1}</td> - td+${0} -snippet textarea - <textarea name="${1}" id="${2:$1}" rows="${3:8}" cols="${4:40}">${5}</textarea> -snippet tfoot - <tfoot> - ${0} - </tfoot> -snippet th - <th>${0}</th> -snippet th. - <th class="${1}">${0}</th> -snippet th# - <th id="${1}">${0}</th> -snippet th+ - <th>${1}</th> - th+${0} -snippet thead - <thead> - ${0} - </thead> -snippet time - <time datetime="${1}" pubdate="${2:$1}">${0:$1}</time> -snippet title - <title>${0:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title> -snippet tr - <tr> - ${0} - </tr> -snippet tr+ - <tr> - <td>${1}</td> - td+${0} - </tr> -snippet track - <track src="${1}" srclang="${2}" label="${3}" default="${4:default} />${5} -snippet ul - <ul> - ${0} - </ul> -snippet ul. - <ul class="${1}"> - ${0} - </ul> -snippet ul# - <ul id="${1}"> - ${0} - </ul> -snippet ul+ - <ul> - <li>${1}</li> - li+${0} - </ul> -snippet var - <var>${0}</var> -snippet video - <video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video> -snippet wbr - <wbr /> diff --git a/.config/micro/plug/snippets/snippets/ino.snippets b/.config/micro/plug/snippets/snippets/ino.snippets deleted file mode 100644 index 77ee46f..0000000 --- a/.config/micro/plug/snippets/snippets/ino.snippets +++ /dev/null @@ -1,106 +0,0 @@ -snippet setup - void setup() - { - ${0} - Serial.begin(9600); - } - -snippet loop - void loop() - { - ${0} - } - -snippet inc - #include <${1}.h> - -# if -snippet if - if (${1:/* condition */}) { - ${2} - } -# else -snippet el - else { - ${1} - } -# else if -snippet elif - else if (${1:/* condition */}) { - ${2} - } -# ifi -snippet ifi - if (${1:/* condition */}) ${2}; - -# switch -snippet switch - switch (${1:/* variable */}) { - case ${2:/* variable case */}: - ${3} - ${4:break;}${5} - default: - ${6} - } - -snippet case - case ${1:/* variable case */}: - ${2} - ${3:break;} - -# for -snippet for - for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) { - ${4} - } -# for (custom) -snippet forr - for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) { - ${5} - } -# while -snippet wh - while (${1:/* condition */}) { - ${2} - } -# do... while -snippet do - do { - ${2} - } while (${1:/* condition */}); -## -## Functions -# function definition -snippet fun - ${1:void} ${2:function_name}(${3}) - { - ${4} - } - -## IO -# pinMode OUTPUT -snippet pinout - pinMode(${1}, OUTPUT); -# pinMode INPUT -snippet pinin - pinMode(${1}, INPUT); -# digitalWrite HIGH -snippet dwHigh - digitalWrite(${1}, HIGH); -# digitalWrite LOW -snippet dwLow - digitalWrite(${1}, LOW); -# digitalRead -snippet dr - digitalRead(${1}); -# serialRead -snippet sr - serialRead(); -# serial.println -snippet sp - serial.println(${1}); - - -# delay -snippet dl - delay(${1}); diff --git a/.config/micro/plug/snippets/snippets/java.snippets b/.config/micro/plug/snippets/snippets/java.snippets deleted file mode 100644 index e40bbf5..0000000 --- a/.config/micro/plug/snippets/snippets/java.snippets +++ /dev/null @@ -1,287 +0,0 @@ -## Access Modifiers -snippet po - protected ${0} -snippet pu - public ${0} -snippet pr - private ${0} -## -## Annotations -snippet before - @Before - static void ${1:intercept}(${2:args}) { ${0} } -snippet mm - @ManyToMany - ${0} -snippet mo - @ManyToOne - ${0} -snippet om - @OneToMany${1:(cascade=CascadeType.ALL)} - ${0} -snippet oo - @OneToOne - ${1} -## -## Basic Java packages and import -snippet im - import ${0} -snippet j.b - java.beans. -snippet j.i - java.io. -snippet j.m - java.math. -snippet j.n - java.net. -snippet j.u - java.util. -## -## Class -snippet cl - class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0} -snippet pcl - public class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0} -snippet in - interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent} -snippet tc - public class ${1:`vim_snippets#Filename("$1")`} extends ${0:TestCase} -## -## Class Enhancements -snippet ext - extends ${0} -snippet imp - implements ${0} -## -## Comments -snippet /* - /* - * ${0} - */ -## -## Constants -snippet co - static public final ${1:String} ${2:var} = ${3}; -snippet cos - static public final String ${1:var} = "${2}"; -## -## Control Statements -snippet case - case ${1}: - ${0} -snippet def - default: - ${0} -snippet el - else -snippet eif - else if (${1}) ${0} -snippet if - if (${1}) ${0} -snippet sw - switch (${1}) { - ${0} - } -## -## Create a Method -snippet m - ${1:void} ${2:method}(${3}) ${4:throws } -## -## Create a Variable -snippet v - ${1:String} ${2:var}${3: = null}${4}; -## -## Declaration for ArrayList -snippet d.al - List<${1:Object}> ${2:list} = new ArrayList<$1>();${0} -## Declaration for HashMap -snippet d.hm - Map<${1:Object}, ${2:Object}> ${3:map} = new HashMap<$1, $2>();${0} -## Declaration for HashSet -snippet d.hs - Set<${1:Object}> ${2:set} = new HashSet<$1>();${0} -## Declaration for Stack -snippet d.st - Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0} -## -## Singleton Pattern -snippet singlet - private static class Holder { - private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1(); - } - - private $1() { } - - public static $1 getInstance() { - return Holder.INSTANCE; - } -## -## Enhancements to Methods, variables, classes, etc. -snippet ab - abstract ${0} -snippet fi - final ${0} -snippet st - static ${0} -snippet sy - synchronized ${0} -## -## Error Methods -snippet err - System.err.print("${0:Message}"); -snippet errf - System.err.printf("${1:Message}", ${0:exception}); -snippet errln - System.err.println("${0:Message}"); -## -## Exception Handling -snippet as - assert ${1:test} : "${2:Failure message}"; -snippet ae - assertEquals("${1:Failure message}", ${2:expected}, ${3:actual}); -snippet aae - assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals}); -snippet af - assertFalse("${1:Failure message}", ${2:condition}); -snippet at - assertTrue("${1:Failure message}", ${2:condition}); -snippet an - assertNull("${1:Failure message}", ${2:object}); -snippet ann - assertNotNull("${1:Failure message}", ${2:object}); -snippet ass - assertSame("${1:Failure message}", ${2:expected}, ${3:actual}); -snippet asns - assertNotSame("${1:Failure message}", ${2:expected}, ${3:actual}); -snippet fa - fail("${1:Failure message}"); -snippet ca - catch(${1:Exception} ${2:e}) ${0} -snippet thr - throw ${0} -snippet ths - throws ${0} -snippet try - try { - ${0} - } catch(${1:Exception} ${2:e}) { - } -snippet tryf - try { - ${0} - } catch(${1:Exception} ${2:e}) { - } finally { - } -## -## Find Methods -snippet findall - List<${1:listName}> ${2:items} = ${1}.findAll(); -snippet findbyid - ${1:var} ${2:item} = ${1}.findById(${3}); -## -## Javadocs -snippet /** - /** - * ${0} - */ -snippet @au - @author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")` -snippet @br - @brief ${0:Description} -snippet @fi - @file ${0:`vim_snippets#Filename("$1")`}.java -snippet @pa - @param ${0:param} -snippet @re - @return ${0:param} -## -## Logger Methods -snippet debug - Logger.debug(${1:param}); -snippet error - Logger.error(${1:param}); -snippet info - Logger.info(${1:param}); -snippet warn - Logger.warn(${1:param}); -## -## Loops -snippet enfor - for (${1} : ${2}) ${0} -snippet for - for (${1}; ${2}; ${3}) ${0} -snippet wh - while (${1}) ${0} -## -## Main method -snippet main - public static void main (String[] args) { - ${0} - } -## -## Print Methods -snippet print - System.out.print("${0:Message}"); -snippet printf - System.out.printf("${1:Message}", ${0:args}); -snippet println - System.out.println(${0}); -snippet printlna - System.out.println(Arrays.toString(${0})); -## -## Render Methods -snippet ren - render(${1:param}); -snippet rena - renderArgs.put("${1}", ${2}); -snippet renb - renderBinary(${1:param}); -snippet renj - renderJSON(${1:param}); -snippet renx - renderXml(${1:param}); -## -## Setter and Getter Methods -snippet set - ${1:public} void set${3:}(${2:String} ${0:}){ - this.$4 = $4; - } -snippet get - ${1:public} ${2:String} get${3:}(){ - return this.${0:}; - } -## -## Terminate Methods or Loops -snippet re - return ${0} -snippet br - break; -## -## Test Methods -snippet t - public void test${1:Name}() throws Exception { - ${0} - } -snippet test - @Test - public void test${1:Name}() throws Exception { - ${0} - } -## -## Utils -snippet Sc - Scanner -## -## Miscellaneous -snippet action - public static void ${1:index}(${2:args}) { ${0} } -snippet rnf - notFound(${1:param}); -snippet rnfin - notFoundIfNull(${1:param}); -snippet rr - redirect(${1:param}); -snippet ru - unauthorized(${1:param}); -snippet unless - (unless=${1:param}); diff --git a/.config/micro/plug/snippets/snippets/javascript.snippets b/.config/micro/plug/snippets/snippets/javascript.snippets deleted file mode 100644 index db04e54..0000000 --- a/.config/micro/plug/snippets/snippets/javascript.snippets +++ /dev/null @@ -1,286 +0,0 @@ -# Functions - -# prototype -snippet proto - ${1:class_name}.prototype.${2:method_name} = function(${3}) { - ${0} - }; -# Function -snippet fun - function ${1:function_name}(${2}) { - ${0} - } -# Anonymous Function -snippet f "" w - function(${1}) { - ${0} - } -# Anonymous Function assigned to variable -snippet vaf - var ${1:function_name} = function(${2}) { - ${0} - }; -# Function assigned to variable -snippet vf - var ${1:function_name} = function $1(${2}) { - ${0} - }; -# Immediate function -snippet (f - (function(${1}) { - ${0} - }(${2})); -# Minify safe iife -snippet ;fe - ;(function(${1}) { - ${0} - }(${2})) -# self-defining function -snippet sdf - var ${1:function_name} = function (${2:argument}) { - ${3} - - $1 = function ($2) { - ${0} - }; - }; - -# Flow control - -# if -snippet if - if (${1:true}) { - ${0} - } -# if ... else -snippet ife - if (${1:true}) { - ${2} - } else { - ${0} - } -# tertiary conditional -snippet ter - ${1:/* condition */} ? ${2:/* if true */} : ${0:/* if false */} -# switch -snippet switch - switch (${1:expression}) { - case '${3:case}': - ${4} - break; - ${0} - default: - ${2} - } -# case -snippet case - case '${1:case}': - ${2} - break; - ${0} -# try -snippet try - try { - ${1} - } catch (${2:e}) { - ${0:/* handle error */} - } -# try finally -snippet tryf - try { - ${1} - } catch (${2:e}) { - ${0:/* handle error */} - } finally { - ${3:/* be executed regardless of the try / catch result*/} - } -# throw Error -snippet terr - throw new Error('${1:error message}') -# return -snippet ret - return ${0:result}; - -# Loops - -# for loop -snippet for - for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2++) { - var ${3:v} = $1[$2];${0:} - } -# Reversed for loop -snippet forr - for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2--) { - var ${3:v} = $1[$2];${0:} - } -# While loop -snippet wh - while (${1:/* condition */}) { - ${0} - } -# Do while loop -snippet do - do { - ${0} - } while (${1:/* condition */}); -# For in loop -snippet fori - for (var ${1:prop} in ${2:object}) { - ${0:$2[$1]} - } - -# Objects - -# Object Method -snippet :f - ${1:method_name}: function (${2:attribute}) { - ${3} - }, -# hasOwnProperty -snippet has - hasOwnProperty(${0}) -# singleton -snippet sing - function ${1:Singleton} (${2:argument}) { - // the cached instance - var instance; - - // rewrite the constructor - $1 = function $1($2) { - return instance; - }; - - // carry over the prototype properties - $1.prototype = this; - - // the instance - instance = new $1(); - - // reset the constructor pointer - instance.constructor = $1; - - ${0} - - return instance; - } -# Crockford's object function -snippet obj - function object(o) { - function F() {} - F.prototype = o; - return new F(); - } -# Define multiple properties -snippet props - var ${1:my_object} = Object.defineProperties( - ${2:new Object()}, - { - ${3:property} : { - get : function $1_$3_getter() { - // getter code - }, - set : function $1_$3_setter(value) { - // setter code - }, - value : ${4:value}, - writeable : ${5:boolean}, - enumerable : ${6:boolean}, - configurable : ${0:boolean} - } - } - ); -# Define single property -snippet prop - Object.defineProperty( - ${1:object}, - '${2:property}', - { - get : function $1_$2_getter() { - // getter code - }, - set : function $1_$2_setter(value) { - // setter code - }, - value : ${3:value}, - writeable : ${4:boolean}, - enumerable : ${5:boolean}, - configurable : ${0:boolean} - } - ); - -# Documentation - -# docstring -snippet /** - /** - * ${0:description} - * - */ -snippet @par - @param {${1:type}} ${2:name} ${0:description} -snippet @ret - @return {${1:type}} ${0:description} -# JSON - -# JSON.parse -snippet jsonp - JSON.parse(${0:jstr}); -# JSON.stringify -snippet jsons - JSON.stringify(${0:object}); - -# DOM selectors - -# Get elements -snippet get - getElementsBy${1:TagName}('${0}') -# Get element -snippet gett - getElementBy${1:Id}('${0}') -# Elements by class -snippet by. - ${1:document}.getElementsByClassName('${0:class}') -# Element by ID -snippet by# - ${1:document}.getElementById('${0:element ID}') -# Query selector -snippet qs - ${1:document}.querySelector('${0:CSS selector}') -# Query selector all -snippet qsa - ${1:document}.querySelectorAll('${0:CSS selector}') - -# Debugging -snippet de - debugger; -# console.log -snippet cl - console.log(${0}); -# console.debug -snippet cd - console.debug(${0}); -# console.error -snippet ce - console.error(${0}); -# console.trace -snippet ct - console.trace(${0:label}); -# console.time -snippet ctime - console.time(${0:label}); -# console.assert -snippet ca - console.assert(${1:expression}, ${0:obj}); -# console.dir -snippet cdir - console.dir(${0:obj}); - -# Misc - -# 'use strict'; -snippet us - 'use strict'; - -# setTimeout function -snippet timeout - setTimeout(function () {${0}}${2}, ${1:10}); diff --git a/.config/micro/plug/snippets/snippets/ledger.snippets b/.config/micro/plug/snippets/snippets/ledger.snippets deleted file mode 100644 index b401f61..0000000 --- a/.config/micro/plug/snippets/snippets/ledger.snippets +++ /dev/null @@ -1,5 +0,0 @@ -# Ledger <http://ledger-cli.org/> -snippet ent - `strftime("%Y/%m/%d")` ${1:transaction} - ${2:account} ${3:value} - ${0:account} diff --git a/.config/micro/plug/snippets/snippets/lfe.snippets b/.config/micro/plug/snippets/snippets/lfe.snippets deleted file mode 100644 index b716e6e..0000000 --- a/.config/micro/plug/snippets/snippets/lfe.snippets +++ /dev/null @@ -1,18 +0,0 @@ -snippet defmo - (defmodule ${1:`vim_snippets#Filename()`} - (export ${2:all})) - $0 -snippet def - (defun $1 ($2) - $0) -snippet ltest - (defmodule ${1:`vim_snippets#Filename()`} - (behaviour ltest-unit) - (export all)) - - (include-lib "ltest/include/ltest-macros.lfe") - - $0 -snippet test - (deftest $1 - $0) diff --git a/.config/micro/plug/snippets/snippets/lua.snippets b/.config/micro/plug/snippets/snippets/lua.snippets deleted file mode 100644 index b7de2de..0000000 --- a/.config/micro/plug/snippets/snippets/lua.snippets +++ /dev/null @@ -1,21 +0,0 @@ -snippet #! - #!/usr/bin/env lua - $1 -snippet local - local ${1:x} = ${0:1} -snippet fun - function ${1:fname}(${2:...}) - ${0:-- body} - end -snippet for - for ${1:i}=${2:1},${3:10} do - ${0:print(i)} - end -snippet forp - for ${1:i},${2:v} in pairs(${3:table_name}) do - ${0:-- body} - end -snippet fori - for ${1:i},${2:v} in ipairs(${3:table_name}) do - ${0:-- body} - end diff --git a/.config/micro/plug/snippets/snippets/makefile.snippets b/.config/micro/plug/snippets/snippets/makefile.snippets deleted file mode 100644 index 332d6fc..0000000 --- a/.config/micro/plug/snippets/snippets/makefile.snippets +++ /dev/null @@ -1,50 +0,0 @@ -# base -snippet base - .PHONY: clean, mrproper - CC = gcc - CFLAGS = -g -Wall - - all: $1 - - %.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< - - ${1:out}: $1.o - $(CC) $(CFLAGS) -o $@ $+ - - clean: - rm -f *.o core.* - - mrproper: clean - rm -f $1 -# add -snippet add - ${1:out}: $1.o - $(CC) $(CFLAGS) -o $@ $+ -# print -snippet print - print-%: ; @echo $*=$($*) -# ifeq -snippet if - ifeq (${1:cond0}, ${2:cond1}) - ${0} - endif -# ifeq ... else ... endif -snippet ife - ifeq (${1:cond0}, ${2:cond1}) - ${3} - else - ${0} - endif -# else ... -snippet el - else - ${0} -# .DEFAULT_GOAL := target -snippet default - .DEFAULT_GOAL := ${1} -# help target for self-documented Makefile -snippet help - help: ## Prints help for targets with comments - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}' - ${0} diff --git a/.config/micro/plug/snippets/snippets/markdown.snippets b/.config/micro/plug/snippets/snippets/markdown.snippets deleted file mode 100644 index d258aa8..0000000 --- a/.config/micro/plug/snippets/snippets/markdown.snippets +++ /dev/null @@ -1,139 +0,0 @@ -# Markdown - -# Includes octopress (http://octopress.org/) snippets - -# The suffix `c` stands for "Clipboard". - -snippet [ - [${1:text}](http://${2:address}) -snippet [* - [${1:link}](${2:`@*`}) -snippet [c - [${1:link}](${2:`@+`}) -snippet [" - [${1:text}](http://${2:address} "${3:title}") -snippet ["* - [${1:link}](${2:`@*`} "${3:title}") -snippet ["c - [${1:link}](${2:`@+`} "${3:title}") -snippet [: - [${1:id}]: http://${2:url} - -snippet [:* - [${1:id}]: ${2:`@*`} - -snippet [:c - [${1:id}]: ${2:`@+`} - -snippet [:" - [${1:id}]: http://${2:url} "${3:title}" - -snippet [:"* - [${1:id}]: ${2:`@*`} "${3:title}" - -snippet [:"c - [${1:id}]: ${2:`@+`} "${3:title}" - -snippet  -snippet  -snippet  -snippet  -snippet  -snippet  -snippet ![: - ![${1:id}]: ${2:url} - -snippet ![:* - ![${1:id}]: ${2:`@*`} - -snippet ![:" - ![${1:id}]: ${2:url} "${3:title}" - -snippet ![:"* - ![${1:id}]: ${2:`@*`} "${3:title}" - -snippet ![:"c - ![${1:id}]: ${2:`@+`} "${3:title}" - -snippet < - <http://${1:url}> -snippet <* - <`@*`> -snippet <c - <`@+`> -snippet ** - **${1:bold}** -snippet __ - __${1:bold}__ -snippet === - `repeat('=', strlen(getline(line(".") - 1)) - strlen(getline('.')))` - - ${0} -snippet - - - ${0} -snippet --- - `repeat('-', strlen(getline(line(".") - 1)) - strlen(getline('.')))` - - ${0} - -snippet blockquote - {% blockquote %} - ${0:quote} - {% endblockquote %} - -snippet blockquote-author - {% blockquote ${1:author}, ${2:title} %} - ${0:quote} - {% endblockquote %} - -snippet blockquote-link - {% blockquote ${1:author} ${2:URL} ${3:link_text} %} - ${0:quote} - {% endblockquote %} - -snippet ``` - \`\`\` - ${1:code} - \`\`\` - -# Language. -snippet ```l - \`\`\`${1:language} - ${2:code} - \`\`\` - -snippet codeblock-short - {% codeblock %} - ${0:code_snippet} - {% endcodeblock %} - -snippet codeblock-full - {% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %} - ${0:code_snippet} - {% endcodeblock %} - -snippet gist-full - {% gist ${1:gist_id} ${0:filename} %} - -snippet gist-short - {% gist ${0:gist_id} %} - -snippet img - {% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${0:alt_text} %} - -snippet youtube - {% youtube ${0:video_id} %} - -# The quote should appear only once in the text. It is inherently part of it. -# See http://octopress.org/docs/plugins/pullquote/ for more info. - -snippet pullquote - {% pullquote %} - ${1:text} {" ${2:quote} "} ${0:text} - {% endpullquote %} diff --git a/.config/micro/plug/snippets/snippets/perl.snippets b/.config/micro/plug/snippets/snippets/perl.snippets deleted file mode 100644 index 2ed2932..0000000 --- a/.config/micro/plug/snippets/snippets/perl.snippets +++ /dev/null @@ -1,363 +0,0 @@ -# #!/usr/bin/perl -snippet #! - #!/usr/bin/env perl - -# Hash Pointer -snippet . - => -# Function -snippet sub - sub ${1:function_name} { - ${0} - } -# Conditional -snippet if - if (${1}) { - ${0} - } -# Conditional if..else -snippet ife - if (${1}) { - ${2} - } - else { - ${0} - } -# Conditional if..elsif..else -snippet ifee - if (${1}) { - ${2} - } - elsif (${3}) { - ${4:# elsif...} - } - else { - ${0} - } -snippet eif - elsif (${1}) { - ${0} - } -# Conditional One-line -snippet xif - ${1:expression} if ${2:condition}; -# Unless conditional -snippet unless - unless (${1}) { - ${0} - } -# Unless conditional One-line -snippet xunless - ${1:expression} unless ${2:condition}; -# Try/Except -snippet eval - local $@; - eval { - ${1:# do something risky...} - }; - if (my $e = $@) { - ${0:# handle failure...} - } -# While Loop -snippet wh - while (${1}) { - ${0} - } -# While Loop One-line -snippet xwh - ${1:expression} while ${2:condition}; -# C-style For Loop -snippet cfor - for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${0} - } -# For loop one-line -snippet xfor - ${1:expression} for @${2:array}; -# Foreach Loop -snippet for - foreach my $${1:x} (@${2:array}) { - ${0} - } -# Foreach Loop One-line -snippet fore - ${1:expression} foreach @${2:array}; -# Package -snippet package - package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`}; - use strict; - use warnings; - - ${0} - - 1; - - __END__ -# Package syntax perl >= 5.14 -snippet packagev514 - package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`} ${2:0.99}; - use v5.14; - use warnings; - - ${0} - - 1; - - __END__ -#moose -snippet moose - use Moose; - use namespace::autoclean; - ${1:#}BEGIN {extends '${2:ParentClass}'}; - - ${0} -# parent -snippet parent - use parent qw(${0:Parent Class}); -# Read File -snippet slurp - my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> }; - ${0} -# strict warnings -snippet strwar - use strict; - use warnings; -# older versioning with perlcritic bypass -snippet vers - ## no critic - our $VERSION = '${0:version}'; - eval $VERSION; - ## use critic -# new 'switch' like feature -snippet switch - use feature 'switch'; - -# Anonymous subroutine -snippet asub - sub { - ${0} - } - - - -# Begin block -snippet begin - BEGIN { - ${0} - } - -# call package function with some parameter -snippet pkgmv - __PACKAGE__->${1:package_method}(${0:var}) - -# call package function without a parameter -snippet pkgm - __PACKAGE__->${0:package_method}() - -# call package "get_" function without a parameter -snippet pkget - __PACKAGE__->get_${0:package_method}() - -# call package function with a parameter -snippet pkgetv - __PACKAGE__->get_${1:package_method}(${0:var}) - -# complex regex -snippet qrx - qr/ - ${0:regex} - /xms - -#simpler regex -snippet qr/ - qr/${0:regex}/x - -#given -snippet given - given ($${1:var}) { - ${2:# cases} - ${0:# default} - } - -# switch-like case -snippet when - when (${1:case}) { - ${0} - } - -# hash slice -snippet hslice - @{ ${1:hash} }{ ${0:array} } - - -# map -snippet map - map { ${0: body } } ${1: @array } ; - - - -# Pod stub -snippet ppod - =head1 NAME - - ${1:ClassName} - ${2:ShortDesc} - - =head1 SYNOPSIS - - use $1; - - ${3:# synopsis...} - - =head1 DESCRIPTION - - ${0:# longer description...} - - - =head1 INTERFACE - - - =head1 DEPENDENCIES - - - =head1 SEE ALSO - - -# Heading for a subroutine stub -snippet psub - =head2 ${1:MethodName} - - ${0:Summary....} - -# Heading for inline subroutine pod -snippet psubi - =head2 ${1:MethodName} - - ${0:Summary...} - - - =cut -# inline documented subroutine -snippet subpod - =head2 $1 - - Summary of $1 - - =cut - - sub ${1:subroutine_name} { - ${0} - } -# Subroutine signature -snippet parg - =over 2 - - =item - Arguments - - - =over 3 - - =item - C<${1:DataStructure}> - - ${2:Sample} - - - =back - - - =item - Return - - =over 3 - - - =item - C<${0:...return data}> - - - =back - - - =back - - - -# Moose has -snippet has - has ${1:attribute} => ( - is => '${2:ro|rw}', - isa => '${3:Str|Int|HashRef|ArrayRef|etc}', - default => sub { - ${4:defaultvalue} - }, - ${0:# other attributes} - ); - - -# override -snippet override - override ${1:attribute} => sub { - ${2:# my $self = shift;}; - ${0:# my ($self, $args) = @_;}; - }; - - -# use test classes -snippet tuse - use Test::More; - use Test::Deep; # (); # uncomment to stop prototype errors - use Test::Exception; - -# local test lib -snippet tlib - use lib qw{ ./t/lib }; - -#test methods -snippet tmeths - $ENV{TEST_METHOD} = '${0:regex}'; - -# runtestclass -snippet trunner - use ${0:test_class}; - $1->runtests(); - -# Test::Class-style test -snippet tsub - sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) { - my $self = shift; - ${0} - - } - -# Test::Routine-style test -snippet trsub - test ${1:test_name} => { description => '${2:Description of test.}'} => sub { - my ($self) = @_; - ${0} - }; - -#prep test method -snippet tprep - sub prep${1:number}_${2:test_case} :Test(startup) { - my $self = shift; - ${0} - } - -# cause failures to print stack trace -snippet debug_trace - use Carp; # 'verbose'; - # cloak "die" - # warn "warning" - $SIG{'__DIE__'} = sub { - require Carp; Carp::confess - }; - -snippet dump - use Data::Dump qw(dump); - warn dump ${1:variable} - -snippet subtest - subtest '${1: test_name}' => sub { - ${2} - }; diff --git a/.config/micro/plug/snippets/snippets/perl6.snippets b/.config/micro/plug/snippets/snippets/perl6.snippets deleted file mode 100644 index 21ddf5b..0000000 --- a/.config/micro/plug/snippets/snippets/perl6.snippets +++ /dev/null @@ -1,116 +0,0 @@ -# shebang -snippet #! - #!/usr/bin/env perl6 - -# Hash Pointer -snippet . - => -# Function -snippet sub - sub ${1:function_name}(${2:Str $var}) { - ${3} - } -snippet mul - multi ${1:function_name}(${2:Str $var}) { - ${3} - } -# Conditional -snippet if - if ${1} { - ${2} - } -# Conditional if..else -snippet ife - if ${1} { - ${2} - } - else { - ${3} - } -snippet eif - elsif ${1) { - ${2} - } -# Conditional One-line -snippet xif - ${1:expression} if ${2:condition}; -# Unless conditional -snippet unless - unless ${1} { - ${2} - } -# Unless conditional One-line -snippet xunless - ${1:expression} unless ${2:condition}; -# Ternary conditional -snippet tc - ${1:condition} ?? ${2:value-if-true} !! ${3:value-if-false}; -# given - when (perl6 switch) -snippet switch - given ${1:$var} { - when ${2:condition} { - ${3:# code block ...} - } - ${4} - default { - ${5} - } - } -# 'loop' - C's for. -snippet loop - loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) { - ${3} - } -# for loop -snippet for - for ${1:@array} -> ${2:$variable} { - ${3} - } -# While Loop -snippet wh - while ${1} { - ${2} - } -# Repeat while and repean until -snippet rp - repeat { - ${1} - } ${2:while|until} ${3}; -# classes .. -snippet cl - ${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{ - ${4} - } -snippet has - has ${1:Type} ${2:$!identifier}; -snippet mth - method ${1:method_name}(${2:$attr}) { - ${3} - } -snippet pmth - method ${1:!}${2:method_name}(${3:$attr}) { - ${4} - } -snippet smth - submethod ${1:submethod_name}(${2:$attr}) { - ${3} - } -# Tests -snippet test - use v6; - use Test; - ${1:use lib 'lib';} - - plan ${2:$num-tests}; - -# IO -snippet slurp - my ${1:$var} = "${2:filename}".IO.slurp; -snippet rfile - for "${1:filename}".IO.lines -> $line { - ${2} - } -snippet open - my $fh = open "${1:filename}", ${2::r|:w|:a}; - ${3:# actions}; - $fh.close; diff --git a/.config/micro/plug/snippets/snippets/php.snippets b/.config/micro/plug/snippets/snippets/php.snippets deleted file mode 100644 index 0644859..0000000 --- a/.config/micro/plug/snippets/snippets/php.snippets +++ /dev/null @@ -1,663 +0,0 @@ -snippet <? - <?php - - ${0} -snippet dst "declare(strict_types=1)" - declare(strict_types=${1:1}); -snippet ec - echo ${0}; -snippet <?e - <?php echo ${0} ?> -# this one is for php5.4 -snippet <?= - <?=${0}?> -snippet ?= - <?= ${0} ?> -snippet ? - <?php ${0} ?> -snippet ?f - <?php foreach ($${1:vars} as $${2:$var}): ?> - ${0} - <?php endforeach ?> -snippet ?i - <?php if ($${1:var}): ?> - ${0} - <?php endif ?> -snippet ns - namespace ${1:Foo\Bar\Baz}; - ${0} -snippet c - class ${1:`vim_snippets#Filename()`} - { - ${0} - } -snippet i - interface ${1:`vim_snippets#Filename()`} - { - ${0} - } -snippet t. - $this-> -snippet f - function ${1}(${3}) - { - ${0} - } -# method -snippet m - ${1:protected} function ${2:foo}() - { - ${0} - } -snippet sm "PHP Class Setter" - /** - * Sets the value of ${1:foo} - * - * @param ${2:string} $$1 ${3:description} - * - * @return ${4:`vim_snippets#Filename()`} - */ - ${5:public} function set${6:$1}(${7:$2 }$$1) - { - $this->${8:$1} = $$1; - - return $this; - } -snippet gm "PHP Class Getter Setter" - /** - * Gets the value of ${1:foo} - * - * @return ${2:string} - */ - ${3:public} function get${4:$1}() - { - return $this->${5:$1}; - } -#setter -snippet $s - ${1:$foo}->set${2:Bar}(${0}); -#getter -snippet $g - ${1:$foo}->get${0:Bar}(); -# Tertiary conditional -snippet =?: - $${1:foo} = ${2:true} ? ${3:a} : ${0}; -snippet ?: - ${1:true} ? ${2:a} : ${0} -snippet t "$retVal = (condition) ? a : b" - $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b}; -# Predefined variables -snippet C - $_COOKIE['${1:variable}'] -snippet E - $_ENV['${1:variable}'] -snippet F - $_FILES['${1:variable}'] -snippet G - $_GET['${1:variable}'] -snippet P - $_POST['${1:variable}'] -snippet R - $_REQUEST['${1:variable}'] -snippet S - $_SERVER['${1:variable}'] -snippet SS - $_SESSION['${1:variable}'] -snippet get "get" - $_GET['${1}'] -snippet post "post" - $_POST['${1}'] -snippet session "session" - $_SESSION['${1}'] -# the following are old ones -snippet inc - include '${1:file}'; -snippet inc1 - include_once '${1:file}'; -snippet req - require '${1:file}'; -snippet req1 - require_once '${1:file}'; -# Start Docblock -snippet /* - /** - * ${0} - */ -# Class - post doc -snippet doc_cp - /** - * ${1:undocumented class} - * - * @package ${2:default} - * @subpackage ${3:default} - * @author ${4:`g:snips_author`} - */ -# Class Variable - post doc -snippet doc_vp - /** - * ${1:undocumented class variable} - * - * @var ${2:string} - */ -# Class Variable -snippet doc_v - /** - * ${3:undocumented class variable} - * - * @var ${4:string} - */ - ${1:var} $${2}; -# Class -snippet doc_c - /** - * ${3:undocumented class} - * - * @package ${4:default} - * @subpackage ${5:default} - * @author ${6:`g:snips_author`} - */ - ${1:}class ${2:} - { - ${0} - } // END $1class $2 -# Constant Definition - post doc -snippet doc_dp - /** - * ${1:undocumented constant} - */ -# Constant Definition -snippet doc_d - /** - * ${3:undocumented constant} - */ - define(${1}, ${2}); -# Function - post doc -snippet doc_fp - /** - * ${1:undocumented function} - * - * @return ${2:void} - * @author ${3:`g:snips_author`} - */ -# Function signature -snippet doc_s - /** - * ${4:undocumented function} - * - * @return ${5:void} - * @author ${6:`g:snips_author`} - */ - ${1}function ${2}(${3}); -# Function -snippet doc_f - /** - * ${4:undocumented function} - * - * @return ${5:void} - * @author ${6:`g:snips_author`} - */ - ${1}function ${2}(${3}) - {${0} - } -# Header -snippet doc_h - /** - * ${1} - * - * @author ${2:`g:snips_author`} - * @version ${3:$Id$} - * @copyright ${4:$2}, `strftime('%d %B, %Y')` - * @package ${0:default} - */ -snippet doc_i "interface someClass {}" - /** - * $1 - * @package ${2:default} - * @author ${3:`!v g:snips_author`} - **/ - interface ${1:someClass} - {${4} - } -snippet inheritdoc "@inheritdoc docblock" - /** - * {@inheritdoc} - */ -# Interface -snippet interface - /** - * ${2:undocumented class} - * - * @package ${3:default} - * @author ${4:`g:snips_author`} - */ - interface ${1:`vim_snippets#Filename()`} - { - ${0} - } -# Trait -snippet trait - /** - * ${2:undocumented class} - * - * @package ${3:default} - * @author ${4:`g:snips_author`} - */ - trait ${1:`vim_snippets#Filename()`} - { - ${0} - } -# class ... -snippet class - /** - * ${1} - */ - class ${2:`vim_snippets#Filename()`} - { - ${3} - /** - * ${4} - */ - ${5:public} function ${6:__construct}(${7:argument}) - { - ${0} - } - } -snippet nc - namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`}; - - ${2:abstract }class ${3:`vim_snippets#Filename()`} - { - ${0} - } -# define(...) -snippet def "define('VARIABLE_NAME', 'definition')" - define('${1:VARIABLE_NAME}', ${2:'definition'}); -# defined(...) -snippet def? - ${1}defined('${2}') -snippet wh "while (condition) { ... }" - while (${1:/* condition */}) { - ${0} - } -snippet do "do { ... } while (condition)" - do { - ${0} - } while (${1}); -snippet if "if (condition) { ... }" - if (${1}) { - ${0} - } -snippet ifn "if (!condition) { ... }" - if (!${1}) { - ${2} - } -snippet ifil "<?php if (condition): ?> ... <?php endif; ?>" - <?php if (${1}): ?> - ${0} - <?php endif; ?> -snippet ife "if (cond) { ... } else { ... }" - if (${1}) { - ${2} - } else { - ${3} - } - ${0} -snippet ifeil "<?php if (condition): ?> ... <?php else: ?> ... <?php endif; ?>" - <?php if (${1}): ?> - ${2} - <?php else: ?> - ${3} - <?php endif; ?> - ${0} -snippet el "else { ... }" - else { - ${0} - } -snippet eif "elseif(condition) { ... }" - elseif (${1}) { - ${0} - } -snippet switch "switch($var) { case 'xyz': ... default: .... }" - switch ($${1:variable}) { - case '${2:value}': - ${3} - break; - ${0} - default: - ${4} - break; - } -snippet case "case 'value': ... break" - case '${1:value}': - ${2} - break; -snippet for "for ($i = 0; $i < $count; $i++) { ... }" - for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) { - ${0} - } -snippet foreach "foreach ($var as $value) { .. }" - foreach ($${1:variable} as $${2:value}) { - ${0} - } -snippet foreachil "<?php foreach ($var as $value): ?> ... <?php endforeach; ?>" - <?php foreach ($${1:variable} as $${2:value}): ?> - ${0} - <?php endforeach; ?> -snippet foreachk "foreach ($var as $key => $value) { .. }" - foreach ($${1:variable} as $${2:key} => $${3:value}) { - ${0} - } -snippet foreachkil "<?php foreach ($var as $key => $value): ?> ... <?php endforeach; ?>" - <?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?> - ${0:<!-- html... -->} - <?php endforeach; ?> -snippet array "$... = array(...)" - $${1:arrayName} = array('${2}' => ${3}); -snippet try "try { ... } catch (Exception $e) { ... }" - try { - ${0} - } catch (${1:Exception} $e) { - } -# lambda with closure -snippet lambda - ${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) { - ${0} - }; -# pre_dump(); -snippet pd - echo '<pre>'; var_dump(${0}); echo '</pre>'; -# pre_dump(); die(); -snippet pdd - echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${0:}); -snippet vd - var_dump(${0}); -snippet vdd - var_dump(${1}); die(${0:}); -snippet pr - print_r(${0}); -snippet prs - print_r(${0}, 1); -snippet vdf - error_log(print_r($${1:foo}, true), 3, '${2:/tmp/debug.log}'); -snippet http_redirect - header ("HTTP/1.1 301 Moved Permanently"); - header ("Location: ".URL); - exit(); -snippet log "error_log(var_export($var, true));" - error_log(var_export(${1}, true)); -snippet var "var_export($var)" - var_export(${1}); -snippet ve "Dumb debug helper in HTML" - echo '<pre>' . var_export(${1}, 1) . '</pre>'; -snippet pc "Dumb debug helper in cli" - var_export($1);$0 -# Getters & Setters -snippet gs "PHP Class Getter Setter" - /** - * Gets the value of ${1:foo} - * - * @return ${2:string} - */ - public function get${3:$1}() - { - return $this->${4:$1}; - } - - /** - * Sets the value of $1 - * - * @param $2 $$1 ${5:description} - * - * @return ${6:`vim_snippets#Filename()`} - */ - public function set$3(${7:$2 }$$1) - { - $this->$4 = $$1; - return $this; - } -# anotation, get, and set, useful for doctrine -snippet ags - /** - * ${1:description} - * - * @${0} - */ - ${2:protected} $${3:foo}; - - public function get${4:$3}() - { - return $this->$3; - } - - public function set$4(${5:$4 }$${6:$3}) - { - $this->$3 = $$6; - return $this; - } -snippet rett - return true; -snippet retf - return false; -snippet am - $${1:foo} = array_map(function($${2:v}) { - ${0} - return $$2; - }, $$1); -snippet aw - array_walk($${1:foo}, function(&$${2:v}, $${3:k}) { - $$2 = ${0}; - }); -# static var assign once -snippet static_var - static $${1} = null; - if (is_null($$1)){ - $$1 = ${2}; - } -snippet CSVWriter - <?php - - class CSVWriter { - public function __construct($file_or_handle, $sep = "\t", $quot = '"'){ - $args = func_get_args(); - $mode = isset($opts['mode']) ? $opts['mode'] : 'w'; - - $this->f = - is_string($file_or_handle) - ? fopen($file_or_handle, $mode) - : $file_or_handle; - - $this->fputcsv_args = array($this->f, null, $sep, $quot); - - if (!$this->f) throw new Exception('bad file descriptor'); - } - - public function write($row){ - $this->fputcsv_args[1] =& $row; - call_user_func_array('fputcsv', $this->fputcsv_args); - } - - public function close(){ - if (!is_null($this->f)) - fclose($this->f); - $this->f = null; - } - - public function __destruct(){ - $this->close(); - } - - } -snippet CSVIterator - - // http://snipplr.com/view.php?codeview&id=1986 // modified - class CSVIterator implements Iterator - { - private $f; - private $curr; - private $rowCounter; - - /* opts keys: - * row_size - * escape - * enclosure - * delimiter - */ - public function __construct( $file_or_handle, $opts = array(4096, ',') ) - { - $d = function($n) use(&$opts){ return isset($opts[$n]) ? $opts[$n] : false; }; - - $this->combine = $d('combine'); - $this->headers = $d('headers'); - $this->headerCheckFunction = $d('header_check_function'); - - $this->f = - is_string($file_or_handle) - ? fopen( $file_or_handle, 'r' ) - : $file_or_handle; - if (!$this->f) throw new Exception('bad file descriptor'); - $this->fgetcsv_args = array( - $this->f, - isset($opts['row_size']) ? $opts['row_size'] : 4096, - isset($opts['delimiter']) ? $opts['delimiter'] : ',', - isset($opts['enclosure']) ? $opts['enclosure'] : '"', - isset($opts['escape']) ? $opts['escape'] : '\\', - ); - $this->start(); - } - - protected function readRow(){ - $this->curr = call_user_func_array('fgetcsv', $this->fgetcsv_args ); - $this->rowCounter++; - if ($this->rowCounter == 1){ - $this->processHeader(); - } elseif ($this->curr) { - $this->processRow(); - } - } - - public function processHeader(){ - if ($this->headers || $this->combine){ - $this->header = $this->curr; - if ($this->headerCheckFunction){ - $f = $this->headerCheckFunction; - $f($this->header); - } - $this->readRow(); - } - } - - public function processRow(){ - if ($this->combine) - $this->curr = array_combine($this->header, $this->curr); - } - - public function start(){ - $this->rowCounter = 0; - rewind( $this->f ); - $this->readRow(); - } - - public function rewind() - { - $this->start(); - } - - public function current() - { - $curr = $this->curr; - $this->readRow(); - return $curr; - } - - public function key() - { - return $this->rowCounter; - } - - public function next() - { - return $this->curr; - } - - public function valid(){ - if( !$this->next() ) - { - fclose( $this->f ); - return FALSE; - } - return TRUE; - } - - } // end class -# phpunit -snippet ase "$this->assertEquals()" - $this->assertEquals(${1:expected}, ${2:actual}); -snippet asne "$this->assertNotEquals()" - $this->assertNotEquals(${1:expected}, ${2:actual}); -snippet asf "$this->assertFalse()" - $this->assertFalse(${1}); -snippet ast "$this->assertTrue()" - $this->assertTrue(${1}); -snippet asfex "$this->assertFileExists()" - $this->assertFileExists(${1:'path/to/file'}); -snippet asfnex "$this->assertFileNotExists()" - $this->assertFileNotExists(${1:'path/to/file'}); -snippet ascon "$this->assertContains()" - $this->assertContains(${1:$needle}, ${2:$haystack}); -snippet ashk "$this->assertArrayHasKey()" - $this->assertArrayHasKey(${1:$key}, ${2:$array}); -snippet asnhk "$this->assertArrayNotHasKey()" - this->assertArrayNotHasKey(${1:$key}, ${2:$array}); -snippet ascha "$this->assertClassHasAttribute()" - $this->assertClassHasAttribute(${1:$attributeName}, '${2:$className}'); -snippet asi "$this->assertInstanceOf(...)" - $this->assertInstanceOf(${1:expected}, ${2:actual}); -snippet test "public function testXYZ() { ... }" - public function test${1}() - { - ${0} - } -snippet setup "protected function setUp() { ... }" - protected function setUp() - { - ${0} - } -snippet teardown "protected function tearDown() { ... }" - protected function tearDown() - { - ${0} - } -snippet exp "phpunit expects" - expects($this->${1:once}()) - ->method('${2}') - ->with($this->equalTo(${3})${4}) - ->will($this->returnValue(${5})); -snippet testcmt "phpunit comment with group" - /** - * @group ${1} - */ -snippet fail "$this->fail()" - $this->fail(${1}); -snippet marki "$this->markTestIncomplete()" - $this->markTestIncomplete(${1}); -snippet marks "$this->markTestSkipped()" - $this->markTestSkipped(${1}); -# end of phpunit snippets -snippet te "throw new Exception()" - throw new ${1:Exception}("${2:Error Processing Request}"); -snippet fpc "file_put_contents" b - file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0 -snippet sr "str_replace" - str_replace(${1:search}, ${2:replace}, ${3:subject})$0 -snippet ia "in_array" - in_array(${1:needle}, ${2:haystack})$0 -snippet is "isset" - isset(${1:var})$0 -snippet isa "isset array" - isset($${1:array}[${2:key}])$0 -snippet in "is_null" - is_null($${1:var})$0 -snippet fe "file_exists" - file_exists(${1:file})$0 -snippet id "is_dir" - is_dir(${1:path})$0 diff --git a/.config/micro/plug/snippets/snippets/po.snippets b/.config/micro/plug/snippets/snippets/po.snippets deleted file mode 100644 index 84916fa..0000000 --- a/.config/micro/plug/snippets/snippets/po.snippets +++ /dev/null @@ -1,5 +0,0 @@ -snippet msg - msgid "${1}" - msgstr "${2}" - - ${0} diff --git a/.config/micro/plug/snippets/snippets/puppet.snippets b/.config/micro/plug/snippets/snippets/puppet.snippets deleted file mode 100644 index 9e9ceeb..0000000 --- a/.config/micro/plug/snippets/snippets/puppet.snippets +++ /dev/null @@ -1,269 +0,0 @@ -# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540 -# -# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback, -# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php - -# Header to match http://docs.puppetlabs.com/guides/style_guide.html#puppet-doc -snippet classheader - # == Class: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'name')`} - # - # ${2:Full description of class $1 here} - # - # === Parameters - # - # Document parameters here. - # - # [*parameter1*] - # Explanation of what this parameter affects and what it defaults to. - # e.g. "Specify one or more upstream ntp servers as an array." - # - # === Variables - # - # Here you should define a list of variables that this module would require. - # - # [*variable1*] - # Explanation of how this variable affects the funtion of this class and - # if it has a default. e.g. "The parameter enc_ntp_servers must be set by the - # External Node Classifier as a comma separated list of hostnames." - # - # === Examples - # - # class { '$1': - # parameter1 => [ 'just', 'an', 'example', ] - # } - # - # === Authors - # - # `g:snips_author` <`g:snips_email`> - # - # === Copyright - # - # Copyright `strftime("%Y")` `g:snips_author` - # - class $1 (${3}){ - ${4} - } - -snippet defheader - # == Define: ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:r:s?/manifests/?::?'), 'name')`} - # - # ${2:Full description of defined resource type $1 here} - # - # === Parameters - # - # Document parameters here - # - # [*namevar*] - # If there is a parameter that defaults to the value of the title string - # when not explicitly set, you must always say so. This parameter can be - # referred to as a "namevar," since it's functionally equivalent to the - # namevar of a core resource type. - # - # [*basedir*] - # Description of this variable. For example, "This parameter sets the - # base directory for this resource type. It should not contain a trailing - # slash." - # - # === Examples - # - # Provide some examples on how to use this type: - # - # $1 { 'namevar': - # basedir => '/tmp/src', - # } - # - # === Authors - # - # `g:snips_author` <`g:snips_email`> - # - # === Copyright - # - # Copyright `strftime("%Y")` `g:snips_author` - # - define $1(${3}) { - ${4} - } - -# Language Constructs -snippet class - class ${1:`vim_snippets#Filename('', 'name')`} { - ${0} - } -snippet node - node "${1:`vim_snippets#Filename('', 'fqdn')`}" { - ${0} - } -snippet case - case $${1:variable} { - default: { ${0} } - } -snippet ife - if $${1:variable} { - ${2} - } else { - ${0} - } -snippet if - if $${1:variable} { - ${0} - } -snippet ifd - if defined(${1:Resource}["${2:name}"]) { - ${0} - } -snippet ifnd - if !defined(${1:Resource}["${2:name}"]) { - ${0} - } -snippet el - else { - ${0} - } -snippet ? - ? { - "${1}" => ${0} - } -# -# blocks etc and general syntax sugar -snippet [ - [ ${1} ] -snippet > - ${1} => ${0} -snippet p: - "puppet://puppet/${1:module name}/${0:file name}" -# -# Functions -snippet alert - alert("${1:message}") -snippet crit - crit("${1:message}") -snippet debug - debug("${1:message}") -snippet defined - defined(${1:Resource}["${2:name}"]) -snippet emerg - emerg("${1:message}") -snippet extlookup Simple extlookup - extlookup("${1:variable}") -snippet extlookup Extlookup with defaults - extlookup("${1:variable}", "${2:default}") -snippet extlookup Extlookup with defaults and custom data file - extlookup("${1:variable}", "${2:default}", "${3:data source}") -snippet fail - fail("${1:message}") -snippet info - info("${1:message}") -snippet inline_template - inline_template("<%= ${1} %>") -snippet notice - notice("${1:message}") -snippet realize - realize(${1:Resource}[${2:name}]) -snippet regsubst - regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}") -snippet inc - include ${1:classname} -snippet split - split(${1:hay stack}, "${2:patten}") -snippet versioncmp - versioncmp("${1:version}", "${2:version}") -snippet warning - warning("${1:message}") -# -# Types -snippet cron - cron { "${1:name}": - command => "${2}", - user => "${3:root}", - ${4} => ${0}, - } - -snippet exec - exec { "${1:name}": - command => "${2:$1}", - user => "${3:root}", - ${4} => ${0}, - } - -snippet user - user { "${1:user}": - ensure => present, - comment => "${2:$1}", - managehome => true, - home => "${0:/home/$1}", - } - -snippet group - group { "${1:group}": - ensure => ${0:present}, - } - -snippet host - host { "${1:hostname}": - ip => ${0:127.0.0.1}, - } - -snippet mailalias - mailalias { "${1:localpart}": - recipient => "${0:recipient}", - } - -snippet mount - mount { "${1:destination path}": - ensure => ${2:mounted}, - device => "${0:device name or path}", - } - -snippet package - package { "${1:package name}": - ensure => ${0:present}, - } - -snippet yumrepo - yumrepo { "${1:repo name}": - descr => "${2:$1}", - enabled => ${0:1}, - } - -snippet define - define ${1} (${2}) { - ${0} - } - -snippet service - service { "${1:service}" : - ensure => running, - enable => true, - require => [ Package["${2:package}"], File["${3:file}"], ], - subscribe => [ File["${4:configfile1}"], File["${5:configfile2}"], Package["${6:package}"], ], - } - -snippet file - file { "${1:filename}" : - ensure => ${2:present}, - owner => "${3:root}", - group => "${4:root}", - mode => "${5:0644}", - source => "puppet:///modules/${6:module}/${7:source}", - content => template("${8:module}/${9:template}"), - alias => "${10:alias}", - require => [ Package["${11:package}"], File["${12:file}"], ], - } - -snippet archive - archive { "${1:filename}" : - ensure => ${2:present}, - url => "http://${3:url}", - extension => "${4:tgz}", - target => "${5:target}", - checksum => ${6:false}, - src_target => "${7:/tmp}", - } - -snippet firewall - firewall { "${1:comment}" : - proto => ${2:tcp}, - action => ${3:accept}, - port => ${4}, - } - diff --git a/.config/micro/plug/snippets/snippets/python.snippets b/.config/micro/plug/snippets/snippets/python.snippets deleted file mode 100644 index 0f68acb..0000000 --- a/.config/micro/plug/snippets/snippets/python.snippets +++ /dev/null @@ -1,242 +0,0 @@ -snippet #! - #!/usr/bin/env python - # -*- coding: utf-8 -*- -snippet #!3 - #!/usr/bin/env python3 - # -*- coding: utf-8 -*- -snippet imp - import ${0:module} -snippet uni - def __unicode__(self): - ${0:representation} -snippet from - from ${1:package} import ${0:module} -# Module Docstring -snippet docs - """ - File: ${1:`vim_snippets#Filename('$1.py', 'foo.py')`} - Author: `g:snips_author` - Email: `g:snips_email` - Github: `g:snips_github` - Description: ${0} - """ - -snippet wh - while ${1:condition}: - ${0} -# dowh - does the same as do...while in other languages -snippet dowh - while True: - ${1} - if ${0:condition}: - break -snippet with - with ${1:expr} as ${2:var}: - ${0} -# New Class -snippet cl - class ${1:ClassName}(${2:object}): - """${3:docstring for $1}""" - def __init__(self, ${4:arg}): - ${5:super($1, self).__init__()} - self.$4 = $4 - ${0} -# New Function -snippet def - def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - """${3:docstring for $1}""" - ${0} -snippet deff - def ${1:fname}(${2:`indent('.') ? 'self' : ''`}): - ${0} -# New Method -snippet defm - def ${1:mname}(self, ${2:arg}): - ${0} -# New Property -snippet property - def ${1:foo}(): - doc = "${2:The $1 property.}" - def fget(self): - ${3:return self._$1} - def fset(self, value): - ${4:self._$1 = value} - def fdel(self): - ${0:del self._$1} - return locals() - $1 = property(**$1()) -# Ifs -snippet if - if ${1:condition}: - ${0} -snippet el - else: - ${0} -snippet ei - elif ${1:condition}: - ${0} -# For -snippet for - for ${1:item} in ${2:items}: - ${0} -# Encodes -snippet cutf8 - # -*- coding: utf-8 -*- -snippet clatin1 - # -*- coding: latin-1 -*- -snippet cascii - # -*- coding: ascii -*- -# Lambda -snippet ld - ${1:var} = lambda ${2:vars} : ${0:action} -snippet . - self. -snippet try Try/Except - try: - ${1} - except ${2:Exception}, ${3:e}: - ${0:raise $3} -snippet try Try/Except/Else - try: - ${1} - except ${2:Exception}, ${3:e}: - ${4:raise $3} - else: - ${0} -snippet try Try/Except/Finally - try: - ${1} - except ${2:Exception}, ${3:e}: - ${4:raise $3} - finally: - ${0} -snippet try Try/Except/Else/Finally - try: - ${1} - except ${2:Exception}, ${3:e}: - ${4:raise $3} - else: - ${5} - finally: - ${0} -# if __name__ == '__main__': -snippet ifmain - if __name__ == '__main__': - ${0:main()} -# __magic__ -snippet _ - __${1:init}__ -# python debugger (pdb) -snippet pdb - import pdb - pdb.set_trace() -# bpython debugger (bpdb) -snippet bpdb - import bpdb - bpdb.set_trace() -# ipython debugger (ipdb) -snippet ipdb - import ipdb - ipdb.set_trace() -# embed ipython itself -snippet iem - import IPython - IPython.embed() -# ipython debugger (pdbbb) -snippet pdbbb - import pdbpp - pdbpp.set_trace() -# remote python debugger (rpdb) -snippet rpdb - import rpdb - rpdb.set_trace() -# ptpython -snippet ptpython - from ptpython.repl import embed - embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None}) -# python console debugger (pudb) -snippet pudb - import pudb - pudb.set_trace() -# pdb in nosetests -snippet nosetrace - from nose.tools import set_trace - set_trace() -snippet pprint - import pprint - pprint.pprint(${1}) -snippet " - """${0:doc} - """ -# assertions -snippet a= - self.assertEqual(${0}, ${1}) -# test function/method -snippet test - def test_${1:description}(${2:`indent('.') ? 'self' : ''`}): - ${0} -# test case -snippet testcase - class ${1:ExampleCase}(unittest.TestCase): - - def test_${2:description}(self): - ${0} -snippet fut - from __future__ import ${0} -#getopt -snippet getopt - try: - # Short option syntax: "hv:" - # Long option syntax: "help" or "verbose=" - opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}]) - - except getopt.GetoptError, err: - # Print debug info - print str(err) - ${3:error_action} - - for option, argument in opts: - if option in ("-h", "--help"): - ${0} - elif option in ("-v", "--verbose"): - verbose = argument -# logging -# glog = get log -snippet glog - import logging - logger = logging.getLogger(${0:__name__}) -snippet le - logger.error(${0:msg}) -# conflict with lambda=ld, therefor we change into Logger.debuG -snippet lg - logger.debug(${0:msg}) -snippet lw - logger.warning(${0:msg}) -snippet lc - logger.critical(${0:msg}) -snippet li - logger.info(${0:msg}) -snippet epydoc - """${1:Description} - - @param ${2:param}: ${3: Description} - @type $2: ${4: Type} - - @return: ${5: Description} - @rtype : ${6: Type} - - @raise e: ${0: Description} - """ -snippet dol - def ${1:__init__}(self, *args, **kwargs): - super(${0:ClassName}, self).$1(*args, **kwargs) -snippet kwg - self.${1:var_name} = kwargs.get('$1', ${2:None}) -snippet lkwg - ${1:var_name} = kwargs.get('$1', ${2:None}) -snippet args - *args${1:,}${0} -snippet kwargs - **kwargs${1:,}${0} -snippet akw - *args, **kwargs${1:,}${0} diff --git a/.config/micro/plug/snippets/snippets/r.snippets b/.config/micro/plug/snippets/snippets/r.snippets deleted file mode 100644 index 7bdeeec..0000000 --- a/.config/micro/plug/snippets/snippets/r.snippets +++ /dev/null @@ -1,131 +0,0 @@ -snippet #! - #!/usr/bin/env Rscript - -# includes -snippet lib - library(${0:package}) -snippet req - require(${0:package}) -snippet source - source('${0:file}') - -# conditionals -snippet if - if (${1:condition}) { - ${0} - } -snippet el - else { - ${0} - } -snippet ei - else if (${1:condition}) { - ${0} - } - -# loops -snippet wh - while(${1}) { - ${2} - } -snippet for - for (${1:item} in ${2:list}) { - ${3} - } - -# functions -snippet fun - ${1:name} <- function (${2:variables}) { - ${0} - } -snippet ret - return(${0}) - -# dataframes, lists, etc -snippet df - ${1:name}[${2:rows}, ${0:cols}] -snippet c - c(${0:items}) -snippet li - list(${0:items}) -snippet mat - matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols}) - -# apply functions -snippet apply - apply(${1:array}, ${2:margin}, ${0:function}) -snippet lapply - lapply(${1:list}, ${0:function}) -snippet sapply - lapply(${1:list}, ${0:function}) -snippet vapply - vapply(${1:list}, ${2:function}, ${0:type}) -snippet mapply - mapply(${1:function}, ${0:...}) -snippet tapply - tapply(${1:vector}, ${2:index}, ${0:function}) -snippet rapply - rapply(${1:list}, ${0:function}) - -# plyr functions -snippet dd - ddply(${1:frame}, ${2:variables}, ${0:function}) -snippet dl - dlply(${1:frame}, ${2:variables}, ${0:function}) -snippet da - daply(${1:frame}, ${2:variables}, ${0:function}) -snippet d_ - d_ply(${1:frame}, ${2:variables}, ${0:function}) - -snippet ad - adply(${1:array}, ${2:margin}, ${0:function}) -snippet al - alply(${1:array}, ${2:margin}, ${0:function}) -snippet aa - aaply(${1:array}, ${2:margin}, ${0:function}) -snippet a_ - a_ply(${1:array}, ${2:margin}, ${0:function}) - -snippet ld - ldply(${1:list}, ${0:function}) -snippet ll - llply(${1:list}, ${0:function}) -snippet la - laply(${1:list}, ${0:function}) -snippet l_ - l_ply(${1:list}, ${0:function}) - -snippet md - mdply(${1:matrix}, ${0:function}) -snippet ml - mlply(${1:matrix}, ${0:function}) -snippet ma - maply(${1:matrix}, ${0:function}) -snippet m_ - m_ply(${1:matrix}, ${0:function}) - -# plot functions -snippet pl - plot(${1:x}, ${0:y}) -snippet ggp - ggplot(${1:data}, aes(${0:aesthetics})) -snippet img - ${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}') - ${0:plot} - dev.off() - -# statistical test functions -snippet fis - fisher.test(${1:x}, ${0:y}) -snippet chi - chisq.test(${1:x}, ${0:y}) -snippet tt - t.test(${1:x}, ${0:y}) -snippet wil - wilcox.test(${1:x}, ${0:y}) -snippet cor - cor.test(${1:x}, ${0:y}) -snippet fte - var.test(${1:x}, ${0:y}) -snippet kvt - kv.test(${1:x}, ${0:y}) diff --git a/.config/micro/plug/snippets/snippets/rst.snippets b/.config/micro/plug/snippets/snippets/rst.snippets deleted file mode 100644 index b185245..0000000 --- a/.config/micro/plug/snippets/snippets/rst.snippets +++ /dev/null @@ -1,98 +0,0 @@ -# rst - -snippet : - :${1:field name}: ${0:field body} -snippet * - *${1:Emphasis}* ${0} -snippet ** - **${1:Strong emphasis}** ${0} -snippet _ - \`${1:hyperlink-name}\`_ - .. _\`$1\`: ${0:link-block} -snippet = - ${1:Title} - =====${2:=} - ${0} -snippet - - ${1:Title} - -----${2:-} - ${0} -#some directive -snippet img: - .. |${0:alias}| image:: ${1:img} -snippet fig: - .. figure:: ${1:img} - :alt: ${0:alter text} - - $2 -snippet cont: - .. contents:: - ${0:content} -snippet code: - .. code:: ${1:type} - - ${0:write some code} -snippet tip: - .. tip:: - ${0:my tips} -snippet not: - .. note:: - ${0:my notes} -snippet war: - .. warning:: - ${0:attention!} -snippet imp: - .. important:: - ${0:this is importatnt} -snippet att: - .. attention:: - ${0:hey!} -snippet dan: - .. danger:: - ${0:ah!} -snippet err: - .. error:: - ${0:Error occur} -snippet cau: - .. caution:: - ${0:Watch out!} -#Sphinx only -snippet sid: - .. sidebar:: ${1:Title} - - ${0} -snippet tod: - .. todo:: - ${0} -snippet lis: - .. list-table:: ${0:Title} - :header-rows: 1 - :stub-columns: 1 - - * - x1,y1 - - x2,y1 - - x3,y1 - * - x1,y2 - - x2,y2 - - x3,y2 - * - x1,y3 - - x2,y3 - - x3,y3 - -snippet toc: - .. toctree:: - :maxdepth: 2 - - ${0} -snippet dow: - :download:`${0:text} <${1:path}>` -snippet ref: - :ref:`${0:text} <${1:path}>` -snippet doc: - :doc:`${0:text} <${1:path}>` -# CJK optimize, CJK has no space between charaters -snippet *c - \ *${1:Emphasis}*\ ${0} -snippet **c - \ **${1:Strong emphasis}**\ ${0} - diff --git a/.config/micro/plug/snippets/snippets/ruby.snippets b/.config/micro/plug/snippets/snippets/ruby.snippets deleted file mode 100644 index 772f464..0000000 --- a/.config/micro/plug/snippets/snippets/ruby.snippets +++ /dev/null @@ -1,731 +0,0 @@ -snippet enc - # encoding: utf-8 -snippet frozen - # frozen_string_literal: true -snippet #! - #!/usr/bin/env ruby -# New Block -snippet =b - =begin rdoc - ${0} - =end -snippet prot - protected - - ${0} -snippet priv - private - - ${0} -snippet y - :yields: ${0:arguments} -snippet rb - #!/usr/bin/env ruby -wKU -snippet beg - begin - ${0} - rescue ${1:Exception} => ${2:e} - end -snippet req require - require '${1}' -snippet reqr - require_relative '${1}' -snippet # - # => -snippet case - case ${1:object} - when ${2:condition} - ${0} - end -snippet when - when ${1:condition} - ${0} -snippet def - def ${1:method_name} - ${0} - end -snippet deft - def test_${1:case_name} - ${0} - end -snippet descendants - class Class - def descendants - ObjectSpace.each_object(::Class).select { |klass| klass < self } - end - end -snippet if - if ${1:condition} - ${0} - end -snippet ife - if ${1:condition} - ${2} - else - ${0} - end -snippet eif - elsif ${1:condition} - ${0} -snippet ifee - if ${1:condition} - $2 - elsif ${3:condition} - $4 - else - $0 - end -snippet unless - unless ${1:condition} - ${0} - end -snippet unlesse - unless ${1:condition} - $2 - else - $0 - end -snippet unlesee - unless ${1:condition} - $2 - elsif ${3:condition} - $4 - else - $0 - end -snippet wh - while ${1:condition} - ${0} - end -snippet for - for ${1:e} in ${2:c} - ${0} - end -snippet until - until ${1:condition} - ${0} - end -snippet cla class .. end - class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - ${0} - end -snippet clai class .. initialize .. end - class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - def initialize(${2:args}) - ${0} - end - end -snippet cla< class .. < ParentClass .. initialize .. end - class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass} - def initialize(${3:args}) - ${0} - end - end -snippet blankslate class BlankSlate .. initialize .. end - class ${0:BlankSlate} - instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ } - end -snippet claself class << self .. end - class << ${1:self} - ${0} - end -# class .. < DelegateClass .. initialize .. end -snippet cla- - class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass}) - def initialize(${3:args}) - super(${4:del_obj}) - - ${0} - end - end -snippet mod module .. end - module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - ${0} - end -snippet mod module .. ClassMethods .. end - module ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} - module ClassMethods - ${0} - end - - module InstanceMethods - - end - - def self.included(receiver) - receiver.extend ClassMethods - receiver.send :include, InstanceMethods - end - end -# attr_reader -snippet r - attr_reader :${0:attr_names} -# attr_writer -snippet w - attr_writer :${0:attr_names} -# attr_accessor -snippet rw - attr_accessor :${0:attr_names} -snippet atp - attr_protected :${0:attr_names} -snippet ata - attr_accessible :${0:attr_names} -snippet ana - accepts_nested_attributes_for :${0:association} -# ivc == instance variable cache -snippet ivc - @${1:variable_name} ||= ${0:cached_value} -# include Enumerable -snippet Enum - include Enumerable - - def each(&block) - ${0} - end -# include Comparable -snippet Comp - include Comparable - - def <=>(other) - ${0} - end -# extend Forwardable -snippet Forw- - extend Forwardable -# def self -snippet defs - def self.${1:class_method_name} - ${0} - end -# def initialize -snippet definit - def initialize(${1:args}) - ${0} - end -# def method_missing -snippet defmm - def method_missing(meth, *args, &blk) - ${0} - end -snippet defd - def_delegator :${1:@del_obj}, :${2:del_meth}, :${0:new_name} -snippet defds - def_delegators :${1:@del_obj}, :${0:del_methods} -snippet am - alias_method :${1:new_name}, :${0:old_name} -snippet app - if __FILE__ == $PROGRAM_NAME - ${0} - end -# usage_if() -snippet usai - if ARGV.${1} - abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0} - end -# usage_unless() -snippet usau - unless ARGV.${1} - abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${0} - end -snippet array - Array.new(${1:10}) { |${2:i}| ${0} } -snippet hash - Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${0} } -snippet file File.foreach() { |line| .. } - File.foreach(${1:'path/to/file'}) { |${2:line}| ${0} } -snippet file File.read() - File.read(${1:'path/to/file'}) -snippet Dir Dir.global() { |file| .. } - Dir.glob(${1:'dir/glob/*'}) { |${2:file}| ${0} } -snippet Dir Dir[".."] - Dir[${1:'glob/**/*.rb'}] -snippet dir - Filename.dirname(__FILE__) -snippet deli - delete_if { |${1:e}| ${0} } -snippet fil - fill(${1:range}) { |${2:i}| ${0} } -# flatten_once() -snippet flao - reduce(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2) } -snippet zip - zip(${1:enums}) { |${2:row}| ${0} } -# downto(0) { |n| .. } -snippet dow - downto(${1:0}) { |${2:n}| ${0} } -snippet ste - step(${1:2}) { |${2:n}| ${0} } -snippet tim - times { |${1:n}| ${0} } -snippet upt - upto(${1:1.0/0.0}) { |${2:n}| ${0} } -snippet loo - loop { ${0} } -snippet ea - each { |${1:e}| ${0} } -snippet ead - each do |${1:e}| - ${0} - end -snippet eab - each_byte { |${1:byte}| ${0} } -snippet eac- each_char { |chr| .. } - each_char { |${1:chr}| ${0} } -snippet eac- each_cons(..) { |group| .. } - each_cons(${1:2}) { |${2:group}| ${0} } -snippet eai - each_index { |${1:i}| ${0} } -snippet eaid - each_index do |${1:i}| - ${0} - end -snippet eak - each_key { |${1:key}| ${0} } -snippet eakd - each_key do |${1:key}| - ${0} - end -snippet eal - each_line { |${1:line}| ${0} } -snippet eald - each_line do |${1:line}| - ${0} - end -snippet eap - each_pair { |${1:name}, ${2:val}| ${0} } -snippet eapd - each_pair do |${1:name}, ${2:val}| - ${0} - end -snippet eas- - each_slice(${1:2}) { |${2:group}| ${0} } -snippet easd- - each_slice(${1:2}) do |${2:group}| - ${0} - end -snippet eav - each_value { |${1:val}| ${0} } -snippet eavd - each_value do |${1:val}| - ${0} - end -snippet eawi - each_with_index { |${1:e}, ${2:i}| ${0} } -snippet eawid - each_with_index do |${1:e}, ${2:i}| - ${0} - end -snippet eawo - each_with_object(${1:init}) { |${2:e}, ${3:var}| ${0} } -snippet eawod - each_with_object(${1:init}) do |${2:e}, ${3:var}| - ${0} - end -snippet reve - reverse_each { |${1:e}| ${0} } -snippet reved - reverse_each do |${1:e}| - ${0} - end -snippet inj - inject(${1:init}) { |${2:mem}, ${3:var}| ${0} } -snippet injd - inject(${1:init}) do |${2:mem}, ${3:var}| - ${0} - end -snippet red - reduce(${1:init}) { |${2:mem}, ${3:var}| ${0} } -snippet redd - reduce(${1:init}) do |${2:mem}, ${3:var}| - ${0} - end -snippet map - map { |${1:e}| ${0} } -snippet mapd - map do |${1:e}| - ${0} - end -snippet mapwi- - enum_with_index.map { |${1:e}, ${2:i}| ${0} } -snippet sor - sort { |a, b| ${0} } -snippet sorb - sort_by { |${1:e}| ${0} } -snippet ran - sort_by { rand } -snippet all - all? { |${1:e}| ${0} } -snippet any - any? { |${1:e}| ${0} } -snippet cl - classify { |${1:e}| ${0} } -snippet col - collect { |${1:e}| ${0} } -snippet cold - collect do |${1:e}| - ${0} - end -snippet det - detect { |${1:e}| ${0} } -snippet detd - detect do |${1:e}| - ${0} - end -snippet fet - fetch(${1:name}) { |${2:key}| ${0} } -snippet fin - find { |${1:e}| ${0} } -snippet find - find do |${1:e}| - ${0} - end -snippet fina - find_all { |${1:e}| ${0} } -snippet finad - find_all do |${1:e}| - ${0} - end -snippet gre - grep(${1:/pattern/}) { |${2:match}| ${0} } -snippet sub - ${1:g}sub(${2:/pattern/}) { |${3:match}| ${0} } -snippet sca - scan(${1:/pattern/}) { |${2:match}| ${0} } -snippet scad - scan(${1:/pattern/}) do |${2:match}| - ${0} - end -snippet max - max { |a, b| ${0} } -snippet min - min { |a, b| ${0} } -snippet par - partition { |${1:e}| ${0} } -snippet pard - partition do |${1:e}| - ${0} - end -snippet rej - reject { |${1:e}| ${0} } -snippet rejd - reject do |${1:e}| - ${0} - end -snippet sel - select { |${1:e}| ${0} } -snippet seld - select do |${1:e}| - ${0} - end -snippet lam - lambda { |${1:args}| ${0} } -snippet -> - -> { ${0} } -snippet ->a - ->(${1:args}) { ${0} } -# I'm pretty sure that ruby users expect do to expand to do .. end -snippet do - do - ${0} - end -# this is for one or more variables. typing a ", " is that cheap that it may -# not be worth adding another snippet. should 0/1 placeholders change order? -# its a good idea to think about the var name, so use it first -snippet dov - do |${1:v}| - ${2} - end -snippet : - ${1:key}: ${2:'value'} -snippet ope - open('${1:path/or/url/or/pipe}', '${2:w}') { |${3:io}| ${0} } -# path_from_here() -snippet fpath - File.join(File.dirname(__FILE__), *['${1:rel path here}']) -# unix_filter {} -snippet unif - ARGF.each_line${1} do |${2:line}| - ${0} - end -# option_parse {} -snippet optp - require 'optparse' - - options = { ${0:default: 'args'} } - - ARGV.options do |opts| - opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}" - end -snippet opt - opts.on('-${1:o}', '--${2:long-option-name}', ${3:String}, '${4:Option description.}') do |${5:opt}| - ${0} - end -snippet tc - require 'test/unit' - - require '${1:library_file_name}' - - class Test${2:$1} < Test::Unit::TestCase - def test_${3:case_name} - ${0} - end - end -snippet ts - require 'test/unit' - - require 'tc_${1:test_case_file}' - require 'tc_${2:test_case_file}' -snippet as - assert ${1:test}, '${2:Failure message.}' -snippet ase - assert_equal ${1:expected}, ${2:actual} -snippet asne - assert_not_equal ${1:unexpected}, ${2:actual} -snippet asid - assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2**-20} -snippet asi - assert_includes ${1:collection}, ${2:object} -snippet asio - assert_instance_of ${1:ExpectedClass}, ${2:actual_instance} -snippet asko - assert_kind_of ${1:ExpectedKind}, ${2:actual_instance} -snippet asn - assert_nil ${1:instance} -snippet asnn - assert_not_nil ${1:instance} -snippet asm - assert_match(/${1:expected_pattern}/, ${2:actual_string}) -snippet asnm - assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string}) -snippet aso - assert_operator ${1:left}, :${2:operator}, ${3:right} -snippet asr - assert_raise ${1:Exception} { ${0} } -snippet asrd - assert_raise ${1:Exception} do - ${0} - end -snippet asnr - assert_nothing_raised ${1:Exception} { ${0} } -snippet asnrd - assert_nothing_raised ${1:Exception} do - ${0} - end -snippet asrt - assert_respond_to ${1:object}, :${2:method} -snippet ass assert_same(..) - assert_same ${1:expected}, ${2:actual} -snippet ass assert_send(..) - assert_send [${1:object}, :${2:message}, ${3:args}] -snippet asns - assert_not_same ${1:unexpected}, ${2:actual} -snippet ast - assert_throws :${1:expected}, -> { ${0} } -snippet astd - assert_throws :${1:expected} do - ${0} - end -snippet asnt - assert_nothing_thrown { ${0} } -snippet asntd - assert_nothing_thrown do - ${0} - end -snippet fl - flunk '${1:Failure message.}' -# Benchmark.bmbm do .. end -snippet bm- - TESTS = ${1:10_000} - Benchmark.bmbm do |results| - ${0} - end -snippet rep - results.report('${1:name}:') { TESTS.times { ${0} } } -# Marshal.dump(.., file) -snippet Md - File.open('${1:path/to/file.dump}', 'wb') { |${2:file}| Marshal.dump(${3:obj}, $2) } -# Mashal.load(obj) -snippet Ml - File.open('${1:path/to/file.dump}', 'rb') { |${2:file}| Marshal.load($2) } -# deep_copy(..) -snippet deec - Marshal.load(Marshal.dump(${1:obj_to_copy})) -snippet Pn- - PStore.new('${1:file_name.pstore}') -snippet tra - transaction(${1:true}) { ${0} } -# xmlread(..) -snippet xml- - REXML::Document.new(File.read('${1:path/to/file}')) -# xpath(..) { .. } -snippet xpa - elements.each('${1://Xpath}') do |${2:node}| - ${0} - end -# class_from_name() -snippet clafn - split('::').inject(Object) { |par, const| par.const_get(const) } -# singleton_class() -snippet sinc - class << self; self end -snippet nam - namespace :${1:`vim_snippets#Filename()`} do - ${0} - end -snippet tas - desc '${1:Task description}' - task ${2:task_name: [:dependent, :tasks]} do - ${0} - end -# block -snippet b - { |${1:var}| ${0} } -snippet begin - begin - fail 'A test exception.' - rescue Exception => e - puts e.message - puts e.backtrace.inspect - else - # other exception - ensure - # always executed - end - -#debugging -snippet debug - require 'byebug'; byebug -snippet debug19 - require 'debugger'; debugger -snippet debug18 - require 'ruby-debug'; debugger -snippet pry - require 'pry'; binding.pry -snippet strf - strftime('${1:%Y-%m-%d %H:%M:%S %z}')${0} -# -# Minitest snippets -# -snippet mb - must_be ${0} -snippet wb - wont_be ${0} -snippet mbe - must_be_empty -snippet wbe - wont_be_empty -snippet mbio - must_be_instance_of ${0:Class} -snippet wbio - wont_be_instance_of ${0:Class} -snippet mbko - must_be_kind_of ${0:Class} -snippet wbko - wont_be_kind_of ${0:Class} -snippet mbn - must_be_nil -snippet wbn - wont_be_nil -snippet mbsa - must_be_same_as ${0:other} -snippet wbsa - wont_be_same_as ${0:other} -snippet mbsi - -> { ${0} }.must_be_silent -snippet mbwd - must_be_within_delta ${1:0.1}, ${2:0.1} -snippet wbwd - wont_be_within_delta ${1:0.1}, ${2:0.1} -snippet mbwe - must_be_within_epsilon ${1:0.1}, ${2:0.1} -snippet wbwe - wont_be_within_epsilon ${1:0.1}, ${2:0.1} -snippet me - must_equal ${0:other} -snippet we - wont_equal ${0:other} -snippet mi - must_include ${0:what} -snippet wi - wont_include ${0:what} -snippet mm - must_match /${0:regex}/ -snippet wm - wont_match /${0:regex}/ -snippet mout - -> { ${1} }.must_output '${0}' -snippet mra - -> { ${1} }.must_raise ${0:Exception} -snippet mrt - must_respond_to :${0:method} -snippet wrt - wont_respond_to :${0:method} -snippet msend - must_send [ ${1:what}, :${2:method}, ${3:args} ] -snippet mthrow - -> { throw :${1:error} }.must_throw :${2:error} -########################## -# Rspec snippets # -########################## -snippet desc - describe ${1:`substitute(substitute(vim_snippets#Filename(), '_spec$', '', ''), '\(_\|^\)\(.\)', '\u\2', 'g')`} do - ${0} - end -snippet descm - describe '${1:#method}' do - ${0:pending 'Not implemented'} - end -snippet cont - context '${1:message}' do - ${0} - end -snippet bef - before :${1:each} do - ${0} - end -snippet aft - after :${1:each} do - ${0} - end -snippet let - let(:${1:object}) { ${0} } -snippet let! - let!(:${1:object}) { ${0} } -snippet subj - subject { ${0} } -snippet s. - subject.${0:method} -snippet spec - specify { subject.${0} } -snippet exp - expect(${1:object}).to ${0} -snippet expb - expect { ${1:object} }.to ${0} -snippet experr - expect { ${1:object} }.to raise_error ${2:StandardError}, /${0:message_regex}/ -snippet shared - shared_examples ${0:'shared examples name'} -snippet ibl - it_behaves_like ${0:'shared examples name'} -snippet it - it '${1:spec_name}' do - ${0} - end -snippet its - its(:${1:method}) { should ${0} } -snippet is - it { should ${0} } -snippet isn - it { should_not ${0} } -snippet iexp - it { expect(${1:object}).${1} ${0} } -snippet iexpb - it { expect { ${1:object} }.${1} ${0} } -snippet iiexp - it { is_expected.to ${0} } -snippet iiexpn - it { is_expected.not_to ${0} } -snippet agg - aggregate_failures '${1:message}' do - ${0} - end diff --git a/.config/micro/plug/snippets/snippets/rust.snippets b/.config/micro/plug/snippets/snippets/rust.snippets deleted file mode 100644 index 11f6859..0000000 --- a/.config/micro/plug/snippets/snippets/rust.snippets +++ /dev/null @@ -1,190 +0,0 @@ -################# -# Rust Snippets # -################# - -# Functions -snippet fn "Function definition" - fn ${1:function_name}(${2})${3} { - ${0} - } -snippet pfn "Function definition" - pub fn ${1:function_name}(${2})${3} { - ${0} - } -snippet test "Unit test function" - #[test] - fn ${1:test_function_name}() { - ${0} - } -snippet bench "Bench function" b - #[bench] - fn ${1:bench_function_name}(b: &mut test::Bencher) { - b.iter(|| { - ${0} - }) - } -snippet new "Constructor function" - pub fn new(${2}) -> ${1:Name} { - $1 { ${3} } - } -snippet main "Main function" - pub fn main() { - ${0} - } -snippet let "let variable declaration with type inference" - let ${1} = ${2}; -snippet lett "let variable declaration with explicit type annotation" - let ${1}: ${2} = ${3}; -snippet letm "let mut variable declaration with type inference" - let mut ${1} = ${2}; -snippet lettm "let mut variable declaration with explicit type annotation" - let mut ${1}: ${2} = ${3}; -snippet pln "println!" - println!("${1}"); -snippet pln, "println! with format param" - println!("${1}", ${2}); -# Modules -snippet ec "extern crate" - extern crate ${1:sync}; -snippet ecl "extern crate log" - #[macro_use] - extern crate log; -snippet mod - mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { - ${0} - } /* $1 */ -snippet testmod "Test module" b - #[cfg(test)] - mod tests { - use super::${1:*}; - - test${0} - } -# Attributes -snippet allow "allow lint attribute" b - #[allow(${1:unused_variable})] -snippet cfg "cfg attribute" b - #[cfg(${1:target_os = "linux"})] -snippet feat "feature attribute" b - #![feature(${1:plugin})] -snippet der "#[derive(..)]" b - #[derive(${1:Debug})] -snippet attr "#[..]" b - #[${1:inline}] -snippet crate "Define create meta attributes" - // Crate name - #![crate_name = "${1:crate_name}"] - // Additional metadata attributes - #![desc = "${2:Descrption.}"] - #![license = "${3:BSD}"] - #![comment = "${4:Comment.}"] - // Specify the output type - #![crate_type = "${5:lib}"] -# Common types -snippet opt "Option<T>" - Option<${1:i32}> -snippet res "Result<T, E>" - Result<${1:~str}, ${2:()}> -# Control structures -snippet if - if ${1} { - ${0} - } -snippet ife "if / else" - if ${1} { - ${2} - } else { - ${0} - } -snippet ifl "if let expression" - if let ${1} = ${2} { - ${0} - } -snippet el "else" - else { - ${0} - } -snippet eli "else if" - else if ${1} { - ${0} - } -snippet mat "match pattern" - match ${1} { - ${2} => ${3} - } -snippet case "Case clause of pattern match" - ${1:_} => ${2:expression} -snippet loop "loop {}" b - loop { - ${0} - } -snippet wh "while loop" - while ${1:condition} { - ${0} - } -snippet for "for ... in ... loop" - for ${1:i} in ${2} { - ${0} - } -# TODO commenting -snippet todo "TODO comment" - // [TODO]: ${0:Description} -snippet fixme "FIXME comment" - // FIXME: $0 -# Struct -snippet st "Struct definition" - struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { - ${0} - } -snippet impl "Struct/Trait implementation" - impl ${1:Type/Trait}${2: for ${3:Type}} { - ${0} - } -snippet stn "Struct with new constructor" - pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} { - ${0} - } - - impl $1 { - pub fn new(${2}) -> $1 { - $1 { ${3} } - } - } -snippet type "Type alias" - type ${1:NewName} = $2; -snippet enum "enum definition" - enum ${1:Name} { - ${2}, - } -# Traits -snippet trait "Trait definition" - trait ${1:Name} { - ${0} - } -snippet drop "Drop trait implementation (destructor)" - impl Drop for ${1:Name} { - fn drop(&mut self) { - ${0} - } - } -# Statics -snippet ss "static string declaration" - static ${1}: &'static str = "${0}"; -snippet stat "static item declaration" - static ${1}: ${2:usize} = ${0}; -# Concurrency -snippet scoped "spawn a scoped thread" - thread::scoped(${1:move }|| { - ${0} - }); -snippet spawn "spawn a thread" - thread::spawn(${1:move }|| { - ${0} - }); -snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()" - let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel(); -# Testing -snippet as "assert!" - assert!(${1:predicate}) -snippet ase "assert_eq!" - assert_eq!(${1:expected}, ${2:actual}) diff --git a/.config/micro/plug/snippets/snippets/scala.snippets b/.config/micro/plug/snippets/snippets/scala.snippets deleted file mode 100644 index 003081e..0000000 --- a/.config/micro/plug/snippets/snippets/scala.snippets +++ /dev/null @@ -1,360 +0,0 @@ -################################################################ -# © Copyright 2011 Konstantin Gorodinskiy. All Rights Reserved.# -# Do What The Fuck You Want To Public License, Version 2. # -# See http://sam.zoy.org/wtfpl/COPYING for more details. # -################################################################ -# Scala lang -#if -snippet if - if (${1}) - ${0} -#if not -snippet ifn - if (!${1}) - ${0} -#if-else -snippet ife - if (${1}) - ${2} - else - ${0} -#if-else-if -snippet ifelif - if (${1}) - ${2} - else if (${3}) - ${0} -snippet eif - else if (${3}) - ${0} -#while loop -snippet wh - while (${1:obj}) { - ${0} - } -#for loop(classic) -snippet for - for (${1:item} <- ${2:obj}) { - ${0} - } -#for loop(indexed) -snippet fori - for (${1:i} <- ${2:0} to ${3:obj}.length) { - ${0} - } -#for comprehension -snippet fory - for { - ${1:item} <- ${2:obj} - } yield ${0} -#exceptions -snippet try - try { - ${1} - } catch { - case e: FileNotFoundException => ${2} - case e: IOException => ${3} - } finally { - ${0} - } -#match -snippet match - ${1: obj} match { - case ${2:e} => ${3} - case _ => ${0} - } -#case -snippet case - case ${1:value} => ${0} -############################ -# methods and arguments -# -#arg -snippet arg - ${1:a}: ${2:T}${0:, arg} -#args -snippet args - ${1:args}: ${0:T}* -#def -snippet def - def ${1:name}(${2:arg}) = ${0:} -#private def -snippet prdef - private def ${1:name}(${2:arg}) = ${0:} -#override def -snippet ovdef - override def ${1:name}(${2:arg}) = ${0:} -#first class function(see scalabook p 188) -snippet fcf - (${1:a}: ${2:T}) => $1 ${0} -snippet => - ${1:name} => ${0} -#recursion -snippet rec - def ${1:name}(${0:arg}) = - if($2) $2 - else $1($2) -#curried method -snippet crdef - def ${1:name}(${2:arg})(${3:arg}) = ${0:} -#main method -#check validity of T -snippet main - def main(args: Array[String]):${1:T} = ${0:} -############################ -# basic types(general purpose) -# you might want to use basic types snippets - -#1 -snippet T Double - dbl -#2 -snippet T Int - int -#3 -snippet T Long - lng -#4 -snippet T Char - chr -#5 -snippet T String - str -#6 -snippet T Array - arr -#7 -snippet T Buffer - buf -#8 -snippet T List - list -#9 -snippet T Tuple - tpl -#10 -snippet T Set - set -#11 -snippet T Map - map -#12 -snippet T HashSet - hset -#13 -snippet T HashMap - hmap -#14 -snippet T Boolean - bool -#end - -#named snippets for types -snippet bool - Boolean -snippet anyr - AnyRef -snippet dbl - Double -snippet int - Int -snippet str - String -snippet chr - Char -snippet lng - Long -snippet arr - Array${1:[T]}${0:()} -snippet buf - Buffer${1:[T]}${0:()} -snippet list - List${1:[T]}${0:()} -snippet tpl - Tuple${1:2}[${2:T},${0:T}] -snippet set - Set${1:[T]}${0:()} -snippet hset - HashSet${1:[T]}${0:()} -snippet mhset - mutable.HashSet${1:[T]}${0:()} -#for maps -snippet keyval - ${1:key}->${2:val}${0:, keyval} -snippet map - Map[${1:T},${2:T}]${0:(keyval)} -snippet hmap - HashMap[${1:T},${2:T}]${0:(keyval)} -snippet mmap - mutable.Map[${1:T},${2:T}]${0:(keyval)} -snippet mhmap - mutable.HashMap[${1:T},${2:T}]${0:(keyval)} -#TODO add TreeMap and TreeSet -#asInstanceOf[] -snippet as - ${1:name}.asInstanceOf[${2:T}] -#isInstanceOf[] -snippet is - ${1:name}.isInstanceOf[${2:T}] - -#collections methods - -#scope() with one arg -snippet (a - (${1:a} => ${0}) -#scope() with two args -snippet {( - {(${1:a},${2:b}) => - ${0} - } -#filter -snippet filter - ${0:name}.filter (a -#map function -snippet mapf - ${0:name}.map (a -#flatmap -snippet flatmap - ${1:name}.flatMap${0:[T]}(a -#fold left -snippet fldl - ${1:name}.foldLeft(${0:first}) {( -#fold right -snippet fldr - ${1:name}.foldRight(${0:first}) {( -#fold left operator(if u wanna reduce readability of ur code) -#use wildcard symbols -snippet /: - (${1:first}/:${2:name})(${0}) -#fold right operator -snippet :\ - (${1:first}:\${2:name})(${0}) -#reduce left -snippet redl - ${1:name}.reduceLeft[${0:T}] {( -#reduce right -snippet redr - ${1:name}.reduceRight[${0:T}] {( -#zipWithIndex(safe way). -#see http://daily-scala.blogspot.com/2010/05/zipwithindex.html -snippet zipwi - ${0:name}.view.zipWithIndex -#split -snippet spl - ${1:name}.split("${0:,}") -#end -snippet val - val ${1:name}${2:: T} = ${0:value} -snippet var - var ${1:name}${2:: T} = ${0:value} -############################ -# classes -# -#extends -snippet extends - extends ${0:what} -#with -snippet with - with ${1:what}${0: with} -#auxiliary constructor(a. this) -snippet athis - def this(arg) = this(arg) -#abstract class -snippet abstract - abstract class ${1:name}${2:(arg)}${3: extends }${4: with} { - ${5:override def toString = "$1"} - ${0} - } -#class -snippet class - class ${1:name}${2:(arg)}${3: extends }${4: with} { - ${5:override def toString = "$1"} - ${0} - } -#object -snippet object - object ${1:name}${2:(arg)}${3: extends }${4: with} ${0:} -#trait -snippet trait - trait ${1:name}${2: extends }${3: with} { - ${0:} - } -#class with trait Ordered(page 265) -snippet ordered - class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} { - ${4:override def toString = "$1"} - def compare(that: $1) = ${5:this - that} - ${0} - } -#case class -snippet casecl - case class ${1:name}${2:(arg)}${3: extends }${4: with} ${0:} -############################ -# testing -# -#scalatest imports -snippet scalatest - ${1:import org.scalatest.Suite} - ${0:import org.scalatest.FunSuite} -#assert -snippet assert - assert(${1:a} === ${0:b}) -#ensuring(p 296) -snippet ensuring - ifel ensuring(${1:a}==${0:b}) -#expect -snippet expect - expect(${1:what}) { - ${0} - } -#intercept -snippet intercept - intercept[${1:IllegalArgumentException}] { - ${0} - } -#test -snippet test - test("${1:description}") { - ${0} - } -#suite -snippet suite - class ${0:name} extends Suite { - def test() { - } -#funsuite -snippet fsuite - class ${1:name} extends FunSuite { - test("${0:description}") { - } -############################ -# SBT -# -snippet webproject - import sbt._ - - class ${1:Name}(info: ProjectInfo) extends DefaultWebProject(info) { - val liftVersion = "${0:2.3}" - - override def libraryDependencies = Set( - - ) ++ super.libraryDependencies - - val snapshots = ScalaToolsSnapshots - } -#depencies -snippet liftjar - "net.liftweb" %% "${0:lib}" % liftVersion % "compile->default", -snippet jettyjar - "org.mortbay.jetty" % "jetty" % "${0:version}" % "test->default", -############################ -# Lift -# -#lift imports -snippet liftimports - import _root_.net.liftweb.http._ - import S._ - import _root_.net.liftweb.util._ - import Helpers._ - import _root_.scala.xml._ -#TODO LIFT,SBT,WEB.XML,HTML snippets diff --git a/.config/micro/plug/snippets/snippets/shell.snippets b/.config/micro/plug/snippets/snippets/shell.snippets deleted file mode 100644 index e470a2a..0000000 --- a/.config/micro/plug/snippets/snippets/shell.snippets +++ /dev/null @@ -1,99 +0,0 @@ -# Shebang. Executing bash via /usr/bin/env makes scripts more portable. -snippet #! - #!/usr/bin/env sh - -snippet bash - #!/usr/bin/env bash - -snippet sbash - #!/usr/bin/env bash - set -euo pipefail - IFS=$'\n\t' - -snippet if - if [[ ${1:condition} ]]; then - ${0:#statements} - fi -snippet elif - elif [[ ${1:condition} ]]; then - ${0:#statements} -snippet for - for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${0:#statements} - done -snippet fori - for ${1:needle} in ${2:haystack} ; do - ${0:#statements} - done -snippet wh - while [[ ${1:condition} ]]; do - ${0:#statements} - done -snippet until - until [[ ${1:condition} ]]; do - ${0:#statements} - done -snippet case - case ${1:word} in - ${2:pattern}) - ${0};; - esac -snippet go - while getopts '${1:o}' ${2:opts} - do - case $$2 in - ${3:o0}) - ${0:#staments};; - esac - done -# Set SCRIPT_DIR variable to directory script is located. -snippet sdir - SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -# getopt -snippet getopt - __ScriptVersion="${1:version}" - - #=== FUNCTION ================================================================ - # NAME: usage - # DESCRIPTION: Display usage information. - #=============================================================================== - function usage () - { - echo "Usage : $${0:0} [options] [--] - - Options: - -h|help Display this message - -v|version Display script version" - - } # ---------- end of function usage ---------- - - #----------------------------------------------------------------------- - # Handle command line arguments - #----------------------------------------------------------------------- - - while getopts ":hv" opt - do - case $opt in - - h|help ) usage; exit 0 ;; - - v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;; - - * ) echo -e "\n Option does not exist : $OPTARG\n" - usage; exit 1 ;; - - esac # --- end of case --- - done - shift $(($OPTIND-1)) -snippet root - if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi - -snippet fun-sh - ${1:function_name}() { - ${0:#function_body} - } - -snippet fun - function ${1:function_name}() { - ${0:#function_body} - } diff --git a/.config/micro/plug/snippets/snippets/sql.snippets b/.config/micro/plug/snippets/snippets/sql.snippets deleted file mode 100644 index 556fae0..0000000 --- a/.config/micro/plug/snippets/snippets/sql.snippets +++ /dev/null @@ -1,26 +0,0 @@ -snippet tbl - create table ${1:table} ( - ${0:columns} - ); -snippet col - ${1:name} ${2:type} ${3:default ''} ${0:not null} -snippet ccol - ${1:name} varchar2(${2:size}) ${3:default ''} ${0:not null} -snippet ncol - ${1:name} number ${3:default 0} ${0:not null} -snippet dcol - ${1:name} date ${3:default sysdate} ${0:not null} -snippet ind - create index ${0:$1_$2} on ${1:table}(${2:column}); -snippet uind - create unique index ${1:name} on ${2:table}(${0:column}); -snippet tblcom - comment on table ${1:table} is '${0:comment}'; -snippet colcom - comment on column ${1:table}.${2:column} is '${0:comment}'; -snippet addcol - alter table ${1:table} add (${2:column} ${0:type}); -snippet seq - create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${0:1}; -snippet s* - select * from ${0:table} diff --git a/.config/micro/plug/snippets/snippets/tcl.snippets b/.config/micro/plug/snippets/snippets/tcl.snippets deleted file mode 100644 index 9da703c..0000000 --- a/.config/micro/plug/snippets/snippets/tcl.snippets +++ /dev/null @@ -1,96 +0,0 @@ -# #!/usr/bin/env tclsh -snippet #! - #!/usr/bin/env tclsh - -# Process -snippet pro - proc ${1:function_name} {${2:args}} { - ${0} - } -#xif -snippet xif - ${1:expr}? ${2:true} : ${0:false} -# Conditional -snippet if - if {${1}} { - ${0} - } -# Conditional if..else -snippet ife - if {${1}} { - ${2} - } else { - ${0:# else...} - } -snippet eif - elseif {${1}} { - ${0} - } -# Conditional if..elsif..else -snippet ifee - if {${1}} { - ${2} - } elseif {${3}} { - ${4:# elsif...} - } else { - ${0:# else...} - } -# If catch then -snippet ifc - if { [catch {${1:#do something...}} ${2:err}] } { - ${0:# handle failure...} - } -# Catch -snippet catch - catch {${1}} ${2:err} ${0:options} -# While Loop -snippet wh - while {${1}} { - ${0} - } -# For Loop -snippet for - for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} { - ${0} - } -# Foreach Loop -snippet fore - foreach ${1:x} {${2:#list}} { - ${0} - } -# after ms script... -snippet af - after ${1:ms} ${0:#do something} -# after cancel id -snippet afc - after cancel ${0:id or script} -# after idle -snippet afi - after idle ${0:script} -# after info id -snippet afin - after info ${0:id} -# Expr -snippet exp - expr {${0:#expression here}} -# Switch -snippet sw - switch ${1:var} { - ${3:pattern 1} { - ${0:#do something} - } - default { - ${2:#do something} - } - } -# Case -snippet ca - ${1:pattern} { - ${2:#do something} - } -# Namespace eval -snippet ns - namespace eval ${1:path} {${0:#script...}} -# Namespace current -snippet nsc - namespace current diff --git a/.config/micro/plug/snippets/snippets/tex.snippets b/.config/micro/plug/snippets/snippets/tex.snippets deleted file mode 100644 index 68ac5d0..0000000 --- a/.config/micro/plug/snippets/snippets/tex.snippets +++ /dev/null @@ -1,317 +0,0 @@ -#PREAMBLE -#newcommand -snippet nc \newcommand - \newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0} -#usepackage -snippet up \usepackage - \usepackage[${1:options}]{${2:package}} ${0} -#newunicodechar -snippet nuc \newunicodechar - \newunicodechar{${1}}{${2:\ensuremath}${3:tex-substitute}}} ${0} -#DeclareMathOperator -snippet dmo \DeclareMathOperator - \DeclareMathOperator{${1}}{${2}} ${0} - -#DOCUMENT -# \begin{}...\end{} -snippet begin \begin{} ... \end{} block - \begin{${1:env}} - ${0:${VISUAL}} - \end{$1} -# Tabular -snippet tab tabular (or arbitrary) environment - \begin{${1:tabular}}{${2:c}} - ${0:${VISUAL}} - \end{$1} -snippet thm thm (or arbitrary) environment with optional argument - \begin[${1:author}]{${2:thm}} - ${0:${VISUAL}} - \end{$2} -snippet center center environment - \begin{center} - ${0:${VISUAL}} - \end{center} -# Align(ed) -snippet ali align(ed) environment - \begin{align${1:ed}} - \label{eq:${2}} - ${0:${VISUAL}} - \end{align$1} -# Gather(ed) -snippet gat gather(ed) environment - \begin{gather${1:ed}} - ${0:${VISUAL}} - \end{gather$1} -# Equation -snippet eq equation environment - \begin{equation} - ${0:${VISUAL}} - \end{equation} -# Equation -snippet eql Labeled equation environment - \begin{equation} - \label{eq:${2}} - ${0:${VISUAL}} - \end{equation} -# Equation -snippet eq* unnumbered equation environment - \begin{equation*} - ${0:${VISUAL}} - \end{equation*} -# Unnumbered Equation -snippet \ unnumbered equation: \[ ... \] - \[ - ${0:${VISUAL}} - \] -# Equation array -snippet eqnarray eqnarray environment - \begin{eqnarray} - ${0:${VISUAL}} - \end{eqnarray} -# Label -snippet lab \label - \label{${1:eq:}${2:fig:}${3:tab:}${0}} -# Enumerate -snippet enum enumerate environment - \begin{enumerate} - \item ${0} - \end{enumerate} -snippet enuma enumerate environment - \begin{enumerate}[(a)] - \item ${0} - \end{enumerate} -snippet enumi enumerate environment - \begin{enumerate}[(i)] - \item ${0} - \end{enumerate} -# Itemize -snippet itemize itemize environment - \begin{itemize} - \item ${0} - \end{itemize} -snippet item \item - \item ${1:${VISUAL}} -# Description -snippet desc description environment - \begin{description} - \item[${1}] ${0} - \end{description} -# Endless new item -snippet ]i \item (recursive) - \item ${1} - ${0:]i} -# Matrix -snippet mat smart matrix environment - \begin{${1:p/b/v/V/B/small}matrix} - ${0:${VISUAL}} - \end{$1matrix} -# Cases -snippet cas cases environment - \begin{cases} - ${1:equation}, &\text{ if }${2:case}\\ - ${0:${VISUAL}} - \end{cases} -# Split -snippet spl split environment - \begin{split} - ${0:${VISUAL}} - \end{split} -# Part -snippet part document \part - \part{${1:part name}} % (fold) - \label{prt:${2:$1}} - ${0} - % part $2 (end) -# Chapter -snippet cha \chapter - \chapter{${1:chapter name}} - \label{cha:${2:$1}} - ${0} -# Section -snippet sec \section - \section{${1:section name}} - \label{sec:${2:$1}} - ${0} -# Section without number -snippet sec* \section* - \section*{${1:section name}} - \label{sec:${2:$1}} - ${0} -# Sub Section -snippet sub \subsection - \subsection{${1:subsection name}} - \label{sub:${2:$1}} - ${0} -# Sub Section without number -snippet sub* \subsection* - \subsection*{${1:subsection name}} - \label{sub:${2:$1}} - ${0} -# Sub Sub Section -snippet subs \subsubsection - \subsubsection{${1:subsubsection name}} - \label{ssub:${2:$1}} - ${0} -# Sub Sub Section without number -snippet subs* \subsubsection* - \subsubsection*{${1:subsubsection name}} - \label{ssub:${2:$1}} - ${0} -# Paragraph -snippet par \paragraph - \paragraph{${1:paragraph name}} - \label{par:${2:$1}} - ${0} -# Sub Paragraph -snippet subp \subparagraph - \subparagraph{${1:subparagraph name}} - \label{subp:${2:$1}} - ${0} -snippet ni \noindent - \noindent - ${0} -#References -snippet itd description \item - \item[${1:description}] ${0:item} -snippet figure reference to a figure - ${1:Figure}~\ref{${2:fig:}} -snippet table reference to a table - ${1:Table}~\ref{${2:tab:}} -snippet listing reference to a listing - ${1:Listing}~\ref{${2:list}} -snippet section reference to a section - ${1:Section}~\ref{sec:${2}} ${0} -snippet page reference to a page - ${1:page}~\pageref{${2}} ${0} -snippet index \index - \index{${1:index}} ${0} -#Citations -snippet citen \citen - \citen{${1}} ${0} -# natbib citations -snippet citep \citep - \citep{${1}} ${0} -snippet citet \citet - \citet{${1}} ${0} -snippet cite \cite[]{} - \cite[${1}]{${2}} ${0} -snippet citea \citeauthor - \citeauthor{${1}} ${0} -snippet citey \citeyear - \citeyear{${1}} ${0} -snippet fcite \footcite[]{} - \footcite[${1}]{${2}}${0} -#Formating text: italic, bold, underline, small capital, emphase .. -snippet it italic text - \textit{${0:${VISUAL:text}}} -snippet bf bold face text - \textbf{${0:${VISUAL:text}}} -snippet under underline text - \underline{${0:${VISUAL:text}}} -snippet emp emphasize text - \emph{${0:${VISUAL:text}}} -snippet sc small caps text - \textsc{${0:${VISUAL:text}}} -#Choosing font -snippet sf sans serife text - \textsf{${0:${VISUAL:text}}} -snippet rm roman font text - \textrm{${0:${VISUAL:text}}} -snippet tt typewriter (monospace) text - \texttt{${0:${VISUAL:text}}} -#Math font -snippet mf mathfrak - \mathfrak{${0:${VISUAL:text}}} -snippet mc mathcal - \mathcal{${0:${VISUAL:text}}} -snippet ms mathscr - \mathscr{${0:${VISUAL:text}}} -#misc -snippet ft \footnote - \footnote{${0:${VISUAL:text}}} -snippet fig figure environment (includegraphics) - \begin{figure} - \begin{center} - \includegraphics[scale=${1}]{Figures/${2}} - \end{center} - \caption{${3}} - \label{fig:${4}} - \end{figure} - ${0} -snippet tikz figure environment (tikzpicture) - \begin{figure} - \begin{center} - \begin{tikzpicture}[scale=${1:1}] - ${2} - \end{tikzpicture} - \end{center} - \caption{${3}} - \label{fig:${4}} - \end{figure} - ${0} -#math -snippet stackrel \stackrel{}{} - \stackrel{${1:above}}{${2:below}} ${0} -snippet frac \frac{}{} - \frac{${1:num}}{${2:denom}} ${0} -snippet sum \sum^{}_{} - \sum^{${1:n}}_{${2:i=1}} ${0} -snippet lim \lim_{} - \lim_{${1:n \to \infty}} ${0} -snippet frame frame environment - \begin{frame}[${1:t}]{${2:title}} - ${0:${VISUAL}} - \end{frame} -snippet block block environment - \begin{block}{${1:title}} - ${0:${VISUAL}} - \end{block} -snippet alert alertblock environment - \begin{alertblock}{${1:title}} - ${0:${VISUAL}} - \end{alertblock} -snippet example exampleblock environment - \begin{exampleblock}{${1:title}} - ${0:${VISUAL}} - \end{exampleblock} -snippet col2 two-column environment - \begin{columns} - \begin{column}{0.5\textwidth} - ${1} - \end{column} - \begin{column}{0.5\textwidth} - ${0} - \end{column} - \end{columns} -snippet \{ \{ \} - \\{ ${0} \\} -#delimiter -snippet lr left right - \left${1} ${0} \right$1 -snippet lr( left( right) - \left( ${0} \right) -snippet lr| left| right| - \left| ${0} \right| -snippet lr{ left\{ right\} - \left\\{ ${0} \right\\} -snippet lr[ left[ right] - \left[ ${0} \right] -snippet lra langle rangle - \langle ${0} \rangle -# Code listings -snippet lst - \begin{listing}[language=${1:language}] - ${0:${VISUAL}} - \end{listing} -snippet lsi - \lstinline|${1}| ${0} -# Hyperlinks -snippet url - \url{${1}} ${0} -snippet href - \href{${1}}{${2}} ${0} -# URL from Clipboard. -snippet urlc - \url{`@+`} ${0} -snippet hrefc - \href{`@+`}{${1}} ${0} diff --git a/.config/micro/plug/snippets/snippets/vi.snippets b/.config/micro/plug/snippets/snippets/vi.snippets deleted file mode 100644 index b299f51..0000000 --- a/.config/micro/plug/snippets/snippets/vi.snippets +++ /dev/null @@ -1,52 +0,0 @@ -snippet header standard Vim script file header - " File: ${1:`expand('%:t')`} - " Author: ${2:`g:snips_author`} - " Description: ${3} - ${0:" Last Modified: `strftime("%B %d, %Y")`} -snippet guard script reload guard - if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700} - finish - endif - let $1 = 1${0} -snippet f function - fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3}) - ${0} - endf -snippet t try ... catch statement - try - ${1} - catch ${2} - ${0} - endtry -snippet for for ... in loop - for ${1} in ${2} - ${0} - endfor -snippet forkv for [key, value] in loop - for [${1},${2}] in items(${3}) - ${0} - unlet $1 $2 - endfor -snippet wh while loop - while ${1} - ${0} - endw -snippet if if statement - if ${1} - ${0} - endif -snippet ife if ... else statement - if ${1} - ${2} - else - ${0} - endif -snippet au augroup ... autocmd block - augroup ${1:AU_NAME} - " this one is which you're most likely to use? - autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|<buffer[=N]>} ${0} - augroup end -snippet bun Vundle.vim Plugin definition - Plugin '${0}' -snippet plug Vundle.vim Plugin definition - Plugin '${0}' diff --git a/.config/micro/plug/snippets/snippets/xml.snippets b/.config/micro/plug/snippets/snippets/xml.snippets deleted file mode 100644 index 0ab346b..0000000 --- a/.config/micro/plug/snippets/snippets/xml.snippets +++ /dev/null @@ -1,12 +0,0 @@ -# xml declaration -snippet xml - <?xml version="1.0" encoding="UTF-8"?> -# tag -snippet t - <${1:}> - ${2} - </$1> -# inline tag -snippet ti - <${1:}>${2}</$1> - diff --git a/.config/micro/plug/snippets/snippets/zsh.snippets b/.config/micro/plug/snippets/snippets/zsh.snippets deleted file mode 100644 index fc1c837..0000000 --- a/.config/micro/plug/snippets/snippets/zsh.snippets +++ /dev/null @@ -1,66 +0,0 @@ -# #!/bin/zsh -snippet #! - #!/bin/zsh - -snippet if - if ${1:condition}; then - ${0:# statements} - fi -snippet ife - if ${1:condition}; then - ${2:# statements} - else - ${0:# statements} - fi -snippet eif - elif ${1:condition}; then - ${0:# statements} -snippet for - for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do - ${0:# statements} - done -snippet fori - for ${1:needle} in ${2:haystack}; do - ${0:#statements} - done -snippet fore - for ${1:item} in ${2:list}; do - ${0:# statements} - done -snippet wh - while ${1:condition}; do - ${0:# statements} - done -snippet until - until ${1:condition}; do - ${0:# statements} - done -snippet repeat - repeat ${1:integer}; do - ${0:# statements} - done -snippet case - case ${1:word} in - ${2:pattern}) - ${0};; - esac -snippet select - select ${1:answer} in ${2:choices}; do - ${0:# statements} - done -snippet ( - ( ${0:#statements} ) -snippet { - { ${0:#statements} } -snippet [ - [[ ${0:test} ]] -snippet always - { ${1:try} } always { ${0:always} } -snippet fun - ${1:function_name}() { - ${0:# function_body} - } -snippet ffun - function ${1:function_name}() { - ${0:# function_body} - } diff --git a/.config/micro/plug/wc/CHANGELOG.md b/.config/micro/plug/wc/CHANGELOG.md deleted file mode 100644 index b36e4df..0000000 --- a/.config/micro/plug/wc/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -Version 1.2.1 -* Fixed utf8 character count - -Version 1.2.0 -+ Now counts lines -+ Added Support for counting lines, words and characters in selection diff --git a/.config/micro/plug/wc/LICENSE b/.config/micro/plug/wc/LICENSE deleted file mode 100644 index 8c58ad0..0000000 --- a/.config/micro/plug/wc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 bananaapple - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/.config/micro/plug/wc/README.md b/.config/micro/plug/wc/README.md deleted file mode 100644 index 78ff3c6..0000000 --- a/.config/micro/plug/wc/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Micro Word Count Plugin - -Word, character and line counter for micro editor. -(forked from https://github.com/adamnpeace/micro-wc-plugin)
\ No newline at end of file diff --git a/.config/micro/plug/wc/help/wc.md b/.config/micro/plug/wc/help/wc.md deleted file mode 100644 index ad36643..0000000 --- a/.config/micro/plug/wc/help/wc.md +++ /dev/null @@ -1,25 +0,0 @@ -# WordCount (wc) Plugin # - -The wc plugin provides the user with the ability to count either -characters or strings in any text being edited with micro. - -A word is defined as a string of characters delimited by white -space characters. White space characters are the set of characters -for which the iswspace(3) function returns true. - -A line is defined as a string of characters delimited by \n -characters, or by the beginning or end of the file. \r\n line -endings will be counted correctly as well, since there is only -one \n per \r\n. - -Character count includes white space and newline characters. - -To initiate the function, you can either: - -Press "F5" - -Or run: - -``` -> wc -``` diff --git a/.config/micro/plug/wc/info.json b/.config/micro/plug/wc/info.json deleted file mode 100644 index b5b8886..0000000 --- a/.config/micro/plug/wc/info.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "wc", - "description": "Word count plugin", - "website": "", - "install": "", - "version": "1.2.1", - "require": [ - "micro >= 2.0.0" - ] -} diff --git a/.config/micro/plug/wc/repo.json b/.config/micro/plug/wc/repo.json deleted file mode 100644 index 3f6a05d..0000000 --- a/.config/micro/plug/wc/repo.json +++ /dev/null @@ -1,22 +0,0 @@ -[{ - "Name": "wc", - "Description": "Plugin to count words/characters in micro", - "Tags": ["wc", "word", "character", "count"], - "Website": "https://github.com/adamnpeace/micro-wc-plugin", - "Versions": [ - { - "Version": "1.1.0", - "Url": "https://github.com/adamnpeace/micro-wc-plugin/archive/v1.1.0.zip", - "Require": { - "micro": ">=2.0.0-1" - } - }, - { - "Version": "1.0.1", - "Url": "https://github.com/adamnpeace/micro-wc-plugin/archive/v1.0.1.zip", - "Require": { - "micro": ">=1.1.0" - } - } - ] -}] diff --git a/.config/micro/plug/wc/wc.lua b/.config/micro/plug/wc/wc.lua deleted file mode 100644 index 0e13677..0000000 --- a/.config/micro/plug/wc/wc.lua +++ /dev/null @@ -1,37 +0,0 @@ -VERSION = "1.2.1" - -local micro = import("micro") -local config = import("micro/config") -local util = import("micro/util") -local utf8 = import("unicode/utf8") - -function init() - config.MakeCommand("wc", wordCount, config.NoComplete) - config.AddRuntimeFile("wc", config.RTHelp, "help/wc.md") - config.TryBindKey("F5", "lua:wc.wordCount", false) -end - -function wordCount(bp) - -- Buffer of selection/whole document - local buffer - --Get active cursor (to get selection) - local cursor = bp.Buf:GetActiveCursor() - --If cursor exists and there is selection, convert selection byte[] to string - if cursor and cursor:HasSelection() then - buffer = util.String(cursor:GetSelection()) - else - --no selection, convert whole buffer byte[] to string - buffer = util.String(bp.Buf:Bytes()) - end - --length of the buffer/selection (string), utf8 friendly - charCount = utf8.RuneCountInString(buffer) - --Get word/line count using gsub's number of substitutions - -- number of substitutions, pattern: %S+ (more than one non-whitespace characters) - local _ , wordCount = buffer:gsub("%S+","") - -- number of substitutions, pattern: \n (number of newline characters) - local _, lineCount = buffer:gsub("\n", "") - --add one to line count (since we're counting separators not lines above) - lineCount = lineCount + 1 - --display the message - micro.InfoBar():Message("Lines:" .. lineCount .. " Words:"..wordCount.." Characters:"..charCount) -end |
