├── .gitattributes ├── .gitignore ├── ReadMe.md ├── UltiSnips ├── cpp.snippets ├── oblxml.snippets ├── obse.snippets ├── rst.snippets ├── sh.snippets └── tex.snippets ├── after └── ftplugin │ ├── NeogitPopup.fnl │ ├── calendar.fnl │ ├── cpp.fnl │ ├── fennel.fnl │ ├── html.fnl │ ├── javascript.fnl │ ├── lua.fnl │ ├── markdown.fnl │ ├── norg.fnl │ ├── nu.fnl │ ├── obl.fnl │ ├── openscad.fnl │ ├── python.fnl │ ├── rst.fnl │ ├── scss.fnl │ ├── sh.fnl │ ├── tex.fnl │ ├── text.fnl │ ├── vim.fnl │ ├── vimwiki.fnl │ ├── xml.fnl │ └── zig.fnl ├── before.vim ├── colors └── wal.lua ├── docs ├── init.norg └── main.norg ├── fnl ├── au.fnl ├── config.fnl ├── init.fnl ├── maps.fnl ├── plugins │ ├── bufferline │ │ └── config.fnl │ ├── cmp │ │ └── config.fnl │ ├── colors │ │ ├── scheme.fnl │ │ └── time.fnl │ ├── conjure │ │ └── config.fnl │ ├── cursorhold │ │ └── config.fnl │ ├── dirbuf │ │ └── config.fnl │ ├── file │ │ └── jump.fnl │ ├── fnlfmt │ │ ├── curl.fnl │ │ └── format.fnl │ ├── fugitive │ │ ├── config.fnl │ │ └── maps.fnl │ ├── fzf │ │ ├── commands.fnl │ │ ├── config.fnl │ │ ├── directory │ │ │ └── preview.fnl │ │ ├── git │ │ │ ├── init.fnl │ │ │ └── preview.fnl │ │ ├── launchers.fnl │ │ ├── maps.fnl │ │ ├── neorg │ │ │ └── preview.fnl │ │ ├── preview.fnl │ │ └── session │ │ │ └── preview.fnl │ ├── git │ │ ├── commands.fnl │ │ └── repos.fnl │ ├── gitsigns │ │ └── config.fnl │ ├── goyo │ │ ├── config.fnl │ │ └── maps.fnl │ ├── indent-blankline │ │ └── config.fnl │ ├── insert │ │ ├── autoclose.fnl │ │ └── indent.fnl │ ├── latex │ │ └── config.fnl │ ├── lazy │ │ ├── config.fnl │ │ └── maps.fnl │ ├── lsp │ │ ├── config.fnl │ │ └── maps.fnl │ ├── lualine │ │ └── config.fnl │ ├── markid │ │ └── config.fnl │ ├── neogit │ │ ├── config.fnl │ │ └── maps.fnl │ ├── neorg │ │ ├── config.fnl │ │ ├── gtd.fnl │ │ └── maps.fnl │ ├── nvim-gps │ │ └── config.fnl │ ├── nvim-tree │ │ └── config.fnl │ ├── oblivim │ │ └── config.fnl │ ├── session │ │ ├── au.fnl │ │ ├── commands.fnl │ │ ├── init.fnl │ │ ├── json.fnl │ │ ├── maps.fnl │ │ ├── save.fnl │ │ ├── store │ │ │ └── init.fnl │ │ ├── stored.json │ │ └── utils.fnl │ ├── startify │ │ ├── commands.fnl │ │ ├── config.fnl │ │ ├── maps.fnl │ │ └── runners.fnl │ ├── tabby │ │ └── config.fnl │ ├── todo-comments │ │ └── config.fnl │ ├── traveller │ │ ├── config.fnl │ │ └── maps.fnl │ ├── treesitter │ │ ├── config.fnl │ │ ├── context │ │ │ └── config.fnl │ │ ├── docs │ │ │ └── config.fnl │ │ ├── playground │ │ │ ├── config.fnl │ │ │ └── maps.fnl │ │ └── rainbow │ │ │ └── config.fnl │ ├── ultisnips │ │ └── config.fnl │ ├── vimwiki │ │ ├── config.fnl │ │ └── maps.fnl │ ├── wilder │ │ └── config.fnl │ └── zenmode │ │ ├── config.fnl │ │ └── maps.fnl └── system.fnl ├── indent └── oblxml.vim ├── init.lua ├── lazy-lock.json ├── md └── init.md ├── queries ├── fennel │ ├── folds.scm │ ├── highlights.scm │ ├── indents.scm │ └── rainbow-parens.scm └── obl │ ├── folds.scm │ ├── highlights.scm │ ├── indents.scm │ └── locals.scm ├── spell ├── en.utf-8.add └── en.utf-8.add.spl └── syntax └── oblxml.vim /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.fnl linguist-language=Clojure 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lua/ 2 | .netrwhist 3 | plugin/packer_compiled.lua 4 | *.lua 5 | fnl/plugins/fnlfmt/fnlfmt.fnl 6 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | # Neovim Configs 2 | 3 | These are my Neovim configs, written literally in Neorg. 4 | 5 | [Initialization](md/init.md) 6 | -------------------------------------------------------------------------------- /UltiSnips/cpp.snippets: -------------------------------------------------------------------------------- 1 | snippet incl "#include" 2 | #include <$1> 3 | endsnippet 4 | 5 | snippet usestd "using std::operator;" 6 | using std::$1; 7 | endsnippet 8 | 9 | snippet vec "vector" 10 | vector<$1> 11 | endsnippet 12 | -------------------------------------------------------------------------------- /UltiSnips/oblxml.snippets: -------------------------------------------------------------------------------- 1 | snippet et "True entity" A 2 | &true; 3 | endsnippet 4 | 5 | snippet en "Entity Form" A 6 | &${1:${VISUAL:entity}};$0 7 | endsnippet 8 | 9 | snippet ef "False entity" A 10 | &false; 11 | endsnippet 12 | 13 | snippet ci "Comment inline" i 14 | $0 15 | endsnippet 16 | 17 | snippet ml "Modeline addition to set ft to oblxml" b 18 | 19 | endsnippet 20 | 21 | snippet cm "Comment multiline" b 22 | 25 | endsnippet 26 | 27 | snippet tin "Tag inline named" i 28 | <${1:${VISUAL:Tile}} ${2:${VISUAL:Attribute}}="${3:${VISUAL:Value}}"> $4 $0 29 | endsnippet 30 | 31 | snippet tis "Tag inline selector" i 32 | <${1:${VISUAL:Tile}} src="${2:${VISUAL:Selector}}()" trait="${3:${VISUAL:Trait}}"/>$0 33 | endsnippet 34 | 35 | snippet copy "Copy tag" wi 36 | $0 37 | endsnippet 38 | 39 | snippet incl "include tag" i 40 | $0 41 | endsnippet 42 | 43 | snippet tn "Tag block named" b 44 | <$1 $2="$3"> 45 | $0 46 | 47 | endsnippet 48 | 49 | snippet t "Tag block" b 50 | <$1> 51 | $0 52 | 53 | endsnippet 54 | 55 | snippet ti "Tag inline" i 56 | <$1> $2 $0 57 | endsnippet 58 | -------------------------------------------------------------------------------- /UltiSnips/obse.snippets: -------------------------------------------------------------------------------- 1 | snippet beg "Begin block" 2 | Begin $1 3 | $0 4 | End 5 | endsnippet 6 | 7 | snippet let "let thing" 8 | let $1 := $0 9 | endsnippet 10 | 11 | snippet set "set thing" 12 | set $1 to $0 13 | endsnippet 14 | 15 | snippet play "PlayerREF" 16 | PlayerREF 17 | endsnippet 18 | 19 | snippet arr "array var" 20 | array_var a$1 21 | endsnippet 22 | 23 | snippet ref "ref var" 24 | ref r$1 25 | endsnippet 26 | 27 | snippet float "float var" 28 | float f$1 29 | endsnippet 30 | 31 | snippet str "string var" 32 | string_var s$1 33 | endsnippet 34 | 35 | snippet int "int var" 36 | int i$1 37 | endsnippet 38 | 39 | snippet while "while loop" b 40 | While $1 41 | $0 42 | Loop 43 | endsnippet 44 | 45 | snippet if "if block" b 46 | if $1 47 | $0 48 | endif 49 | endsnippet 50 | 51 | snippet for "foreach block" b 52 | ForEach $1 <- $2 53 | $0 54 | Loop 55 | endsnippet 56 | -------------------------------------------------------------------------------- /UltiSnips/rst.snippets: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | priority -50 4 | 5 | ########################################################################### 6 | # General Stuff # 7 | ########################################################################### 8 | global !p 9 | from collections import Counter 10 | from vimsnippets import complete, has_cjk, display_width 11 | 12 | # http://docutils.sourceforge.net/docs/ref/rst/roles.html 13 | TEXT_ROLES = ['emphasis', 'literal', 'code', 'math', 14 | 'pep-reference', 'rfc-reference', 15 | 'strong', 'subscript', 'superscript', 16 | 'title-reference', 'raw'] 17 | TEXT_ROLES_REGEX = r'\.\.\srole::?\s(w+)' 18 | 19 | # http://docutils.sourceforge.net/docs/ref/rst/directives.html#specific-admonitions 20 | SPECIFIC_ADMONITIONS = ["attention", "caution", "danger", 21 | "error", "hint", "important", "note", 22 | "tip", "warning"] 23 | # http://docutils.sourceforge.net/docs/ref/rst/directives.html 24 | DIRECTIVES = ['code', 'contents', 'admonition', 'table', 'csv-table', 'list-table', 25 | 'class', 'container', 'sidebar', 'topic', 'title', 26 | 'role', 'default-role', 'raw'] 27 | 28 | # DIRECTIVES_WITHOUT_TITLE means directive arguments equal None 29 | DIRECTIVES_WITHOUT_TITLE = ['math', 'meta', 'parsed-literal', 'line-block', 30 | 'header', 'compound', 'highlights', 'pull-quote', 31 | 'footer', 'epigraph', 'rubric', 'sectnum'] 32 | 33 | INCLUDABLE_DIRECTIVES = ['image', 'figure', 'include'] 34 | 35 | # Directives for Subsubsection Definition 36 | DIRECTIVES_FOR_SUBSTITUTION = ['replace', 'unicode', 'date'] 37 | 38 | # http://www.pygal.org/en/stable/documentation/types/index.html 39 | CHART_TYPES = ["Line", "StackedLine", "HorizontalLine", "Bar", "StackedBar", "HorizontalBar", "Histogram", "XY", "DateLine", "TimeLine", "TimeDeltaLine", "DateTimeLine", "Pie", "Radar", "Box", "Dot", "Funnel", "Gauge", "SolidGauge", "Pyramid", "Treemap"] 40 | 41 | def real_filename(filename): 42 | """pealeextension name off if possible 43 | # i.e. "foo.bar.png will return "foo.bar" 44 | """ 45 | return os.path.splitext(filename)[0] 46 | 47 | def check_file_exist(rst_path, relative_path): 48 | """ 49 | For RST file, it can just include files as relative path. 50 | 51 | :param rst_path: absolute path to rst file 52 | :param relative_path: path related to rst file 53 | :return: relative file's absolute path if file exist 54 | """ 55 | abs_path = os.path.join(os.path.dirname(rst_path), relative_path) 56 | if os.path.isfile(abs_path): 57 | return abs_path 58 | 59 | def make_items(times, leading='+'): 60 | """ 61 | make lines with leading char multitimes 62 | 63 | :param: times, how many times you need 64 | :param: leading, leading character 65 | """ 66 | times = int(times) 67 | if leading == 1: 68 | msg = "" 69 | for x in range(1, times+1): 70 | msg += "%s. Item\n" % x 71 | return msg 72 | else: 73 | return ("%s Item\n" % leading) * times 74 | 75 | 76 | def look_up_directives(regex, fpath): 77 | """ 78 | find all directive args in given file 79 | :param: regex, the regex that needs to match 80 | :param: path, to path to rst file 81 | 82 | :return: list, empty list if nothing match 83 | """ 84 | try: 85 | with open(fpath) as source: 86 | match = re.findall(regex, source.read()) 87 | except IOError: 88 | match = [] 89 | return match 90 | 91 | 92 | def get_popular_code_type(): 93 | """ 94 | find most popular code type in the given rst 95 | 96 | :param path: file to detect 97 | 98 | :return: string, most popular code type in file 99 | """ 100 | buf = "".join(vim.current.buffer) 101 | types = re.findall(r'[:|\.\.\s]code::?\s(\w+)', buf) 102 | try: 103 | popular_type = Counter(types).most_common()[0][0] 104 | except IndexError: 105 | popular_type = "lua" # Don't break default 106 | return popular_type 107 | endglobal 108 | 109 | snippet in "Inline literal" i 110 | `!p 111 | # dirty but works with CJK character detection 112 | if has_cjk(vim.current.line): 113 | snip.rv ="\ "`\`\`${1:${VISUAL:Inline}}\`\``!p 114 | if has_cjk(vim.current.line): 115 | snip.rv ="\ " 116 | else: 117 | snip.rv = " " 118 | `$0 119 | endsnippet 120 | 121 | snippet rc 122 | .. _${1:Name}: 123 | $0 124 | endsnippet 125 | 126 | snippet rf 127 | :ref:\`${1:text} <${2:path}>\`$0 128 | endsnippet 129 | -------------------------------------------------------------------------------- /UltiSnips/sh.snippets: -------------------------------------------------------------------------------- 1 | snippet if "if statement" 2 | if [[ $1 ]]; then 3 | $0 4 | fi 5 | endsnippet 6 | -------------------------------------------------------------------------------- /UltiSnips/tex.snippets: -------------------------------------------------------------------------------- 1 | snippet table "Table Center" 2 | \begin{center} 3 | \begin{tabular}{ $1 } 4 | \hline 5 | $0 6 | \end{tabular} 7 | \end{center} 8 | endsnippet 9 | 10 | snippet c++ "C++ Code Block" 11 | \begin{lstlisting}[language=C++] 12 | $1 13 | \end{lstlisting} 14 | endsnippet 15 | 16 | snippet verb "Create verb" 17 | \verb|$1| 18 | endsnippet 19 | 20 | snippet beg "Create begin block" 21 | \begin{$1} 22 | $0 23 | \end{$1} 24 | endsnippet 25 | 26 | snippet emph "Emphasis" 27 | \emph{$1} 28 | endsnippet 29 | 30 | snippet bold "Bold" 31 | \textbf{$1} 32 | endsnippet 33 | 34 | snippet sec "Section" 35 | \section{$1} 36 | endsnippet 37 | 38 | snippet ssec "Sub-Section" 39 | \subsection{$1} 40 | endsnippet 41 | 42 | snippet sssec "Sub-Sub-Section" 43 | \subsubsection{$1} 44 | endsnippet 45 | 46 | snippet cjk "Chinese Character Support" 47 | \begin{CJK}{UTF8}{bsmi} 48 | $1 49 | \end{CJK} 50 | endsnippet 51 | 52 | snippet hyper "Hyperlink" 53 | \href{$1}{$2} 54 | endsnippet 55 | 56 | snippet url "URL Hyperlink" 57 | \url{$1} 58 | endsnippet 59 | 60 | snippet ilist "Itemize list" 61 | \begin{itemize} 62 | \item $0 63 | \end{itemize} 64 | endsnippet 65 | 66 | snippet lst "lstlisting" 67 | \begin{lstlisting}[language=$1] 68 | $0 69 | \end{lstlisting} 70 | endsnippet 71 | -------------------------------------------------------------------------------- /after/ftplugin/NeogitPopup.fnl: -------------------------------------------------------------------------------- 1 | (module NeogitPopup {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | (set-opts-auto {listchars {:trail " "}}) 5 | -------------------------------------------------------------------------------- /after/ftplugin/calendar.fnl: -------------------------------------------------------------------------------- 1 | (module calendar {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opts-auto {number false relativenumber false}) 4 | -------------------------------------------------------------------------------- /after/ftplugin/cpp.fnl: -------------------------------------------------------------------------------- 1 | (module cpp {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {autoclose plugins.insert.autoclose 4 | indent plugins.insert.indent}}) 5 | 6 | (set-opts-auto {tabstop 2 shiftwidth 2}) 7 | 8 | ; enclose word 9 | (ino- "(" "()" {:buffer true}) 10 | (ino- "[" "[]" {:buffer true}) 11 | (ino- "{" "{}" {:buffer true}) 12 | 13 | (ino- ")" (fn [] 14 | (autoclose.parenthesis)) {:buffer true :expr true}) 15 | 16 | (ino- "]" (fn [] 17 | (autoclose.bracket)) {:buffer true :expr true}) 18 | 19 | (ino- "}" (fn [] 20 | (autoclose.brace)) {:buffer true :expr true}) 21 | 22 | (ino- : (fn [] 23 | (indent.curly)) {:buffer true :expr true}) 24 | 25 | ; make button 26 | (nno- : ":make! -C ./build" "Run make") 27 | -------------------------------------------------------------------------------- /after/ftplugin/fennel.fnl: -------------------------------------------------------------------------------- 1 | (module fennel-con {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {jump plugins.file.jump}}) 4 | 5 | ; make button 6 | (nno- : ":make!" "Run make") 7 | 8 | ;; jtt 9 | (nno- jump.test-edit (fn [] 10 | (jump.->test :edit :-test.fnl)) 11 | "Jump to aniseed test") 12 | 13 | ;; jtv 14 | (nno- jump.test-vsplit 15 | (fn [] 16 | (jump.->test :vsplit :-test.fnl)) 17 | "Jump to aniseed test in a vsplit") 18 | 19 | ;; jts 20 | (nno- jump.test-split (fn [] 21 | (jump.->test :split :-test.fnl)) 22 | "Jump to aniseed test in a split") 23 | 24 | ;; jcc 25 | (nno- jump.compile-edit 26 | (fn [] 27 | (jump.->compiled :edit :fnl :lua :lua)) 28 | "Jump to compiled fennel file in directory") 29 | 30 | ;; jcv 31 | (nno- jump.compile-vsplit 32 | (fn [] 33 | (jump.->compiled :vsplit :fnl :lua :lua)) 34 | "Jump to compiled fennel file directory in vsplit") 35 | 36 | ;; jcs 37 | (nno- jump.compile-split 38 | (fn [] 39 | (jump.->compiled :split :fnl :lua :lua)) 40 | "Jump to compiled fennel file in directory in split") 41 | 42 | (set-opts-auto {foldexpr "nvim_treesitter#foldexpr()" foldmethod :expr}) 43 | -------------------------------------------------------------------------------- /after/ftplugin/html.fnl: -------------------------------------------------------------------------------- 1 | (module html {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opts-auto {tabstop 2 shiftwidth 2}) 4 | -------------------------------------------------------------------------------- /after/ftplugin/javascript.fnl: -------------------------------------------------------------------------------- 1 | (module javascript {require-macros [katcros-fnl.macros.nvim.api.maps.macros] 2 | autoload {autoclose plugins.insert.autoclose 3 | indent plugins.insert.indent}}) 4 | 5 | ; enclose word 6 | (ino- "(" "()" {:buffer true}) 7 | (ino- "[" "[]" {:buffer true}) 8 | (ino- "{" "{}" {:buffer true}) 9 | 10 | (ino- ")" (fn [] 11 | (autoclose.parenthesis)) {:buffer true :expr true}) 12 | 13 | (ino- "]" (fn [] 14 | (autoclose.bracket)) {:buffer true :expr true}) 15 | 16 | (ino- "}" (fn [] 17 | (autoclose.brace)) {:buffer true :expr true}) 18 | 19 | (ino- : (fn [] 20 | (indent.curly)) {:buffer true :expr true}) 21 | -------------------------------------------------------------------------------- /after/ftplugin/lua.fnl: -------------------------------------------------------------------------------- 1 | (module lua {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {autoclose plugins.insert.autoclose 4 | indent plugins.insert.indent 5 | jump plugins.file.jump}}) 6 | 7 | ; ; enclose word 8 | (ino- "(" "()" {:buffer true}) 9 | (ino- "[" "[]" {:buffer true}) 10 | (ino- "{" "{}" {:buffer true}) 11 | 12 | (ino- ")" (fn [] 13 | (autoclose.parenthesis)) {:buffer true :expr true}) 14 | 15 | (ino- "]" (fn [] 16 | (autoclose.bracket)) {:buffer true :expr true}) 17 | 18 | (ino- "}" (fn [] 19 | (autoclose.brace)) {:buffer true :expr true}) 20 | 21 | (ino- : (fn [] 22 | (indent.curly)) {:buffer true :expr true}) 23 | 24 | (set-opts-auto {foldexpr "nvim_treesitter#foldexpr()" 25 | foldmethod :expr 26 | tabstop 4 27 | shiftwidth 4 28 | expandtab true}) 29 | 30 | ;; jcc 31 | (nno- jump.compile-edit 32 | (fn [] 33 | (jump.<-compiled :lua :fnl :fnl)) "Jump back to a source file") 34 | -------------------------------------------------------------------------------- /after/ftplugin/markdown.fnl: -------------------------------------------------------------------------------- 1 | (module markdown {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opts-auto {conceallevel 0 spell true}) 4 | -------------------------------------------------------------------------------- /after/ftplugin/norg.fnl: -------------------------------------------------------------------------------- 1 | (module neorg 2 | {autoload {neorg plugins.neorg.gtd} 3 | require-macros [katcros-fnl.macros.nvim.api.options.macros 4 | katcros-fnl.macros.nvim.api.utils.macros 5 | katcros-fnl.macros.nvim.api.maps.macros]}) 6 | 7 | (set-opts-auto {tabstop 2 8 | shiftwidth 2 9 | expandtab true 10 | textwidth 100 11 | spell true 12 | listchars {:tab " " :extends ">" :precedes "<"} 13 | wrap false 14 | concealcursor :nvc}) 15 | 16 | (nno- :to :NvimTreeFocus "Focus nvim tree" {:buffer true}) 17 | (nno- :tc :NvimTreeClose "Close nvim tree" {:buffer true}) 18 | (nno- :tt :NvimTreeToggle "Toggle nvim tree" {:buffer true}) 19 | -------------------------------------------------------------------------------- /after/ftplugin/nu.fnl: -------------------------------------------------------------------------------- 1 | (module nu {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {autoclose plugins.insert.autoclose 4 | indent plugins.insert.indent}}) 5 | 6 | ; ; enclose word 7 | (ino- "(" "()" {:buffer true}) 8 | (ino- "[" "[]" {:buffer true}) 9 | (ino- "{" "{}" {:buffer true}) 10 | 11 | (ino- ")" (fn [] 12 | (autoclose.parenthesis)) {:buffer true :expr true}) 13 | 14 | (ino- "]" (fn [] 15 | (autoclose.bracket)) {:buffer true :expr true}) 16 | 17 | (ino- "}" (fn [] 18 | (autoclose.brace)) {:buffer true :expr true}) 19 | 20 | (ino- : (fn [] 21 | (indent.curly)) {:buffer true :expr true}) 22 | -------------------------------------------------------------------------------- /after/ftplugin/obl.fnl: -------------------------------------------------------------------------------- 1 | (module obl {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {autoclose plugins.insert.autoclose}}) 4 | 5 | (set-opts-auto {tabstop 4 shiftwidth 4}) 6 | 7 | (set-opts-auto {:foldmethod :expr 8 | :foldexpr "nvim_treesitter#foldexpr()" 9 | :foldenable false 10 | :commentstring "; %s"}) 11 | 12 | ; enclose word 13 | (ino- "(" "()" {:buffer true}) 14 | (ino- "[" "[]" {:buffer true}) 15 | (ino- "{" "{}" {:buffer true}) 16 | 17 | (ino- ")" (fn [] 18 | (autoclose.parenthesis)) {:buffer true :expr true}) 19 | 20 | (ino- "]" (fn [] 21 | (autoclose.bracket)) {:buffer true :expr true}) 22 | 23 | (ino- "}" (fn [] 24 | (autoclose.brace)) {:buffer true :expr true}) 25 | -------------------------------------------------------------------------------- /after/ftplugin/openscad.fnl: -------------------------------------------------------------------------------- 1 | (module openscad {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opts-auto {expandtab true shiftwidth 2}) 4 | -------------------------------------------------------------------------------- /after/ftplugin/python.fnl: -------------------------------------------------------------------------------- 1 | (module python {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {autoclose plugins.insert.autoclose 4 | indent plugins.insert.indent 5 | jump plugins.file.jump}}) 6 | 7 | ; ; enclose word 8 | (ino- "(" "()" {:buffer true}) 9 | (ino- "[" "[]" {:buffer true}) 10 | (ino- "{" "{}" {:buffer true}) 11 | 12 | (ino- ")" (fn [] 13 | (autoclose.parenthesis)) {:buffer true :expr true}) 14 | 15 | (ino- "]" (fn [] 16 | (autoclose.bracket)) {:buffer true :expr true}) 17 | 18 | (ino- "}" (fn [] 19 | (autoclose.brace)) {:buffer true :expr true}) 20 | 21 | (ino- : (fn [] 22 | (indent.curly)) {:buffer true :expr true}) 23 | 24 | -------------------------------------------------------------------------------- /after/ftplugin/rst.fnl: -------------------------------------------------------------------------------- 1 | (module rst {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opts-auto {expandtab false tabstop 4 shiftwidth 3 textwidth 100}) 4 | -------------------------------------------------------------------------------- /after/ftplugin/scss.fnl: -------------------------------------------------------------------------------- 1 | (module scss {require-macros [katcros-fnl.macros.nvim.api.maps.macros] 2 | autoload {autoclose plugins.insert.autoclose 3 | indent plugins.insert.indent}}) 4 | 5 | ; enclose word 6 | (ino- "(" "()" {:buffer true}) 7 | (ino- "[" "[]" {:buffer true}) 8 | (ino- "{" "{}" {:buffer true}) 9 | 10 | (ino- ")" (fn [] 11 | (autoclose.parenthesis)) {:buffer true :expr true}) 12 | 13 | (ino- "]" (fn [] 14 | (autoclose.bracket)) {:buffer true :expr true}) 15 | 16 | (ino- "}" (fn [] 17 | (autoclose.brace)) {:buffer true :expr true}) 18 | 19 | (ino- : (fn [] 20 | (indent.curly)) {:buffer true :expr true}) 21 | -------------------------------------------------------------------------------- /after/ftplugin/sh.fnl: -------------------------------------------------------------------------------- 1 | (module sh {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {autoclose plugins.insert.autoclose 4 | indent plugins.insert.indent}}) 5 | 6 | (set-opts-auto {tabstop 2 shiftwidth 2}) 7 | 8 | ; ; enclose word 9 | (ino- "(" "()" {:buffer true}) 10 | (ino- "[" "[]" {:buffer true}) 11 | (ino- "{" "{}" {:buffer true}) 12 | 13 | (ino- ")" (fn [] 14 | (autoclose.parenthesis)) {:buffer true :expr true}) 15 | 16 | (ino- "]" (fn [] 17 | (autoclose.bracket)) {:buffer true :expr true}) 18 | 19 | (ino- "}" (fn [] 20 | (autoclose.brace)) {:buffer true :expr true}) 21 | 22 | (ino- : (fn [] 23 | (indent.curly)) {:buffer true :expr true}) 24 | -------------------------------------------------------------------------------- /after/ftplugin/tex.fnl: -------------------------------------------------------------------------------- 1 | (module tex {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {git-command plugins.git.commands}}) 4 | 5 | (set-opts-auto {spell true updatetime 500}) 6 | 7 | (nno- :O ":VimtexCompileOutput" "Compile and output TeX file" 8 | {:buffer true :silent true}) 9 | 10 | (nno- :C ":VimtexCompile" "Compile TeX file" 11 | {:buffer true :silent true}) 12 | 13 | (nno- :V ":VimtexView" "View current TeX file if compiled" 14 | {:buffer true :silent true}) 15 | 16 | (nno- :O (fn [] 17 | (git-command.lazy-update)) 18 | "Update git repo" {:buffer true :silent true}) 19 | -------------------------------------------------------------------------------- /after/ftplugin/text.fnl: -------------------------------------------------------------------------------- 1 | (module text {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opt-auto spell true) 4 | -------------------------------------------------------------------------------- /after/ftplugin/vim.fnl: -------------------------------------------------------------------------------- 1 | (module vim {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opt-auto foldmethod :marker) 4 | -------------------------------------------------------------------------------- /after/ftplugin/vimwiki.fnl: -------------------------------------------------------------------------------- 1 | (module vimwiki {require-macros [katcros-fnl.macros.nvim.api.options.macros 2 | katcros-fnl.macros.nvim.api.maps.macros] 3 | autoload {git-command plugins.git.commands}}) 4 | 5 | (set-opts-auto {shiftwidth 2 tabstop 2 listchars {:tab " "} concealcursor :nc}) 6 | 7 | (nno- :U (fn [] 8 | (git-command.lazy-update)) 9 | "Update git repo" {:buffer true}) 10 | -------------------------------------------------------------------------------- /after/ftplugin/xml.fnl: -------------------------------------------------------------------------------- 1 | (module xml {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 2 | 3 | (set-opts-auto {tabstop 4 shiftwidth 4}) 4 | -------------------------------------------------------------------------------- /after/ftplugin/zig.fnl: -------------------------------------------------------------------------------- 1 | (module zig 2 | {autoload {autoclose plugins.insert.autoclose 3 | indent plugins.insert.indent} 4 | require-macros [katcros-fnl.macros.nvim.api.maps.macros 5 | katcros-fnl.macros.nvim.api.options.macros]}) 6 | 7 | (set-local-opts {shiftwidth 4 tabstop 4}) 8 | 9 | (ino- "(" "()" {:buffer true}) 10 | (ino- "[" "[]" {:buffer true}) 11 | (ino- "{" "{}" {:buffer true}) 12 | 13 | (ino- ")" (fn [] 14 | (autoclose.parenthesis)) {:buffer true :expr true}) 15 | 16 | (ino- "]" (fn [] 17 | (autoclose.bracket)) {:buffer true :expr true}) 18 | 19 | (ino- "}" (fn [] 20 | (autoclose.brace)) {:buffer true :expr true}) 21 | 22 | (ino- "|" (fn [] 23 | (autoclose.bar)) {:buffer true :expr true}) 24 | 25 | (ino- : (fn [] 26 | (indent.curly)) {:buffer true :expr true}) 27 | 28 | (nno- : :make "Run make") 29 | -------------------------------------------------------------------------------- /before.vim: -------------------------------------------------------------------------------- 1 | " this is whatever needs to be loaded first 2 | let g:vimwiki_list = [{'path': '~/Documents/VimWikiHTML/VimWiki', 3 | \ 'path_html': '~/Documents/VimWikiHTML', 4 | \ 'auto_generate_links': 1, 5 | \ 'auto_export': 1}] 6 | let g:vimiwiki_folding = 'list' 7 | let g:vimwiki_nested_syntaxes = {'python': 'python', 8 | \'c++': 'cpp', 9 | \'xml': 'xml', 10 | \'obse': 'obse', 11 | \'make': 'make', 12 | \'scala': 'scala', 13 | \} 14 | let g:vimwiki_listsyms = '◯◔◐◕●✓' 15 | let g:vimwiki_global_ext = 0 16 | let g:vimwiki_conceallevel = 2 17 | let g:vimwiki_use_calendar = 1 18 | -------------------------------------------------------------------------------- /colors/wal.lua: -------------------------------------------------------------------------------- 1 | 2 | local colors = { 3 | color_0 = "#21140C", 4 | color_1 = "#BE4F3F", 5 | color_2 = "#768705", 6 | color_3 = "#929A0E", 7 | color_4 = "#B59863", 8 | color_5 = "#D1738A", 9 | color_6 = "#7B854D", 10 | color_7 = "#FFE1E1", 11 | } 12 | 13 | local opts = { 14 | contrast = "hard", 15 | colors_name = "wal", 16 | render = true, 17 | } 18 | 19 | require("kreative.color")["init-colors"](colors) 20 | require("kreative.main").init(opts) 21 | -------------------------------------------------------------------------------- /docs/main.norg: -------------------------------------------------------------------------------- 1 | @document.meta 2 | title: main 3 | description: 4 | authors: kat 5 | categories: config docs 6 | created: 2022-10-11 7 | updated: 2022-10-14 8 | version: 0.0.15 9 | @end 10 | 11 | * Neovim Configs 12 | These are my Neovim configs, written literally in Neorg. 13 | 14 | - {:init:}[Initialization] -------------------------------------------------------------------------------- /fnl/au.fnl: -------------------------------------------------------------------------------- 1 | (module au 2 | {autoload {format plugins.fnlfmt.format} 3 | require-macros [katcros-fnl.macros.nvim.api.autocommands.macros 4 | katcros-fnl.macros.nvim.api.utils.macros 5 | katcros-fnl.macros.nvim.api.options.macros]}) 6 | 7 | ;; AUG -- highlight yank settings 8 | ;; 1. highlight text yank 9 | (let [highlight (def-aug- :highlightOnYank)] 10 | (aug- highlight (auc- :TextYankPost "*" 11 | (fn [] 12 | ((. (require :vim.highlight) :on_yank))) 13 | "Highlight yank region"))) 14 | 15 | ;; AUG -- terminal 16 | ;; 1. set no number, relative number and spell. Also set buffer hidden 17 | (let [terminal (def-aug- :terminalSettings)] 18 | (aug- terminal 19 | (auc- :TermOpen "*" 20 | (fn [] 21 | (set-opts-auto {number false 22 | relativenumber false 23 | spell false 24 | bufhidden :hide})) 25 | "No number, relativenumber, & spell. Bufhidden"))) 26 | 27 | ;; AUG -- suffix addition 28 | ;; 1. add appropriate suffixes to each filetype 29 | (let [suffix (def-aug- :suffixAdd)] 30 | (fn suffix-add-run [] 31 | (let [ext (vim.fn.expand "%:e")] 32 | (aug- suffix (auc- :FileType ext 33 | (fn [] 34 | (set-local-opt suffixesadd (.. "." ext))) 35 | "Add suffixes to all files")))) 36 | 37 | (aug- suffix (auc- :BufEnter "*" suffix-add-run 38 | "Run suffixAdd for each buffer"))) 39 | 40 | ;; FN -- see if we are in a config directory 41 | (defn in-config-dir? [] "Get configuration directory" 42 | (let [config-root (.. vim.env.HOME :/.config/nvim) 43 | current-file (vim.loop.cwd)] 44 | (if (current-file:find config-root) true false))) 45 | 46 | ;; AUG -- config directory specific 47 | ;; 1. Config local user command for formatting config files 48 | (let [config-group (def-aug- :configsOnly)] 49 | (aug- config-group 50 | (auc- :BufEnter "*" 51 | (fn [] 52 | (if (in-config-dir?) 53 | (command- :KatFormatConfigs 54 | (fn [] 55 | (format.configs!)) 56 | "Config local formatting user command" 57 | {:buffer true})))))) 58 | -------------------------------------------------------------------------------- /fnl/config.fnl: -------------------------------------------------------------------------------- 1 | (module config 2 | {autoload {sys system} 3 | require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 4 | 5 | ;; System 6 | (set-opts {mouse :nvi 7 | number true 8 | relativenumber true 9 | modeline true 10 | undofile true 11 | hidden false 12 | updatetime 100 13 | cmdheight 2 14 | title true}) 15 | 16 | (set-opt clipboard :unnamedplus :append) 17 | 18 | ;; Fold 19 | (set-opts {foldenable false 20 | foldmethod :syntax 21 | foldtext "substitute(getline(v:foldstart),'\t',repeat(' ',&tabstop),'g').'  '.trim(getline(v:foldend))" 22 | foldcolumn :3}) 23 | 24 | ;; List 25 | (set-opts {list true 26 | listchars {:tab " " :trail "■" :extends ">" :precedes "<"}}) 27 | 28 | ;; Tab 29 | (set-opts {tabstop 2 shiftwidth 2 expandtab true}) 30 | 31 | ;; Conceal 32 | (set-opt conceallevel 2) 33 | 34 | ;; Break 35 | (set-opts {breakindent true linebreak true showbreak "=>"}) 36 | 37 | (set-opt inccommand :nosplit) 38 | 39 | (set-opt nrformats :octal :remove) 40 | 41 | (vim.diagnostic.config {:virtual_text false}) 42 | 43 | (set-opt guifont "FiraCode Nerd Font Mono:h11,MesloLGS NF:h11,DejavuSans:h11") 44 | (if vim.g.neovide 45 | (set-vars g {:neovide_cursor_animation_length 0.02 46 | :neovide_cursor_trail_length 2 47 | :neovide_cursor_vfx_mode :railgun 48 | :neovide_cursor_vfx_opacity 100 49 | :neovide_cursor_vfx_particle_density 20 50 | :neovide_cursor_vfx_particle_speed 10 51 | :neovide_remember_window_size false 52 | :neovide_remember_window_position false})) 53 | 54 | (match sys.name 55 | :Kat-Arch (set-var g :neovide_transparency 0.9) 56 | :kat (set-opt guifont "FiraCode Nerd Font Mono:h14,MesloLGS NF:h14,DejavuSans:h14")) 57 | -------------------------------------------------------------------------------- /fnl/init.fnl: -------------------------------------------------------------------------------- 1 | (module init {require-macros [katcros-fnl.macros.nvim.api.utils.macros 2 | katcros-fnl.macros.nvim.api.autocommands.macros 3 | katcros-fnl.macros.nvim.api.options.macros] 4 | autoload {c aniseed.compile 5 | s aniseed.string 6 | render katdotnvim.utils.export.render} 7 | require {: au 8 | : config 9 | : maps 10 | sys system}}) 11 | 12 | (def plugins []) 13 | 14 | (table.insert plugins :folke/lazy.nvim) 15 | (table.insert plugins :Olical/aniseed) 16 | (table.insert plugins {:dir "~/Repos/NEOVIM/katcros-fnl/"}) 17 | 18 | (table.insert plugins {1 :nvim-treesitter/nvim-treesitter 19 | :build ":TSUpdate" 20 | :config (fn [] (require :plugins.treesitter.config))}) 21 | 22 | (table.insert plugins {1 :nvim-treesitter/playground 23 | :config (fn [] (require :plugins.treesitter.playground.config))}) 24 | 25 | (table.insert plugins {:url :https://gitlab.com/HiPhish/nvim-ts-rainbow2 26 | :config (fn [] (require :plugins.treesitter.rainbow.config))}) 27 | 28 | (table.insert plugins {1 :romgrk/nvim-treesitter-context 29 | :config (fn [] (require :plugins.treesitter.context.config))}) 30 | 31 | (table.insert plugins {1 :folke/todo-comments.nvim 32 | :config (fn [] (require :plugins.todo-comments.config))}) 33 | 34 | (table.insert plugins {1 :luckasRanarison/tree-sitter-hypr}) 35 | 36 | (table.insert plugins {1 :rcarriga/nvim-notify 37 | :config (fn [] (set vim.notify (require :notify)) 38 | (vim.notify.setup {:stages :slide}))}) 39 | 40 | (table.insert plugins :katawful/kat.vim) 41 | (table.insert plugins {:dir "~/Repos/NEOVIM/katdotnvim/" 42 | :config (fn [] 43 | (if (= sys.name :builder) 44 | (do 45 | (set-opts {:background :light 46 | :termguicolors true}) 47 | (vim.cmd.colorscheme "kat.nvim")) 48 | (do 49 | (set-opt :termguicolors true) 50 | ((. (require :plugins.colors.time) :set-colors)) 51 | ((. (require :plugins.colors.scheme) :set*)))))}) 52 | 53 | (table.insert plugins {1 :nvim-lualine/lualine.nvim 54 | :config (fn [] (require :plugins.lualine.config))}) 55 | 56 | (table.insert plugins {1 :folke/zen-mode.nvim 57 | :config (fn [] (require :plugins.zenmode.config))}) 58 | 59 | (table.insert plugins :kyazdani42/nvim-web-devicons) 60 | 61 | (table.insert plugins {1 :lukas-reineke/indent-blankline.nvim 62 | :config (fn [] (require :plugins.indent-blankline.config))}) 63 | 64 | (table.insert plugins {:dir "~/Repos/NEOVIM/nvim-startify/"}) 65 | 66 | (table.insert plugins {1 :gelguy/wilder.nvim 67 | :build ":UpdateRemotePlugins" 68 | :config (fn [] (require :plugins.wilder.config))}) 69 | 70 | (table.insert plugins {:dir "~/Repos/NEOVIM/syntax-test"}) 71 | 72 | (table.insert plugins {:dir "~/Repos/NEOVIM/kreative"}) 73 | 74 | (table.insert plugins :nanozuki/tabby.nvim) 75 | 76 | (table.insert plugins {1 :lewis6991/gitsigns.nvim 77 | :config (fn [] (require :plugins.gitsigns.config))}) 78 | 79 | (table.insert plugins {1 :NeogitOrg/neogit 80 | :config (fn [] (require :plugins.neogit.config)) 81 | :dependencies [:nvim-lua/plenary.nvim 82 | :nvim-telescope/telescope.nvim]}) 83 | 84 | (table.insert plugins {1 :tpope/vim-fugitive 85 | :config (fn [] (require :plugins.fugitive.config))}) 86 | 87 | (table.insert plugins {1 :Olical/conjure 88 | :branch :develop 89 | :config (fn [] (require :plugins.conjure.config))}) 90 | 91 | (table.insert plugins {1 :eraserhd/parinfer-rust 92 | :build (let [path (.. (do-viml stdpath :data) :/lazy/parinfer-rust)] 93 | (string.format "(cd %s; cargo build --release)" 94 | path))}) 95 | 96 | (table.insert plugins {1 :lervag/vimtex 97 | :config (fn [] (require :plugins.latex.config))}) 98 | 99 | (table.insert plugins {:dir "~/Repos/OBLIVION/obl.vim"}) 100 | 101 | (table.insert plugins {:dir "~/Repos/OBLIVION/obluavim"}) 102 | 103 | (table.insert plugins {1 :katawful/Obli-Vim-Docs 104 | :ft :obl}) 105 | 106 | (table.insert plugins :vim-scripts/bnf.vim) 107 | 108 | (table.insert plugins :killphi/vim-ebnf) 109 | 110 | (table.insert plugins {1 :SirVer/ultisnips 111 | :config (fn [] (require :plugins.ultisnips.config))}) 112 | 113 | (table.insert plugins {1 :honza/vim-snippets}) 114 | 115 | (table.insert plugins :tpope/vim-commentary) 116 | 117 | (table.insert plugins {1 :IndianBoy42/fuzzy.nvim 118 | :dependencies [{1 :nvim-telescope/telescope-fzf-native.nvim 119 | :build "make"}]}) 120 | (table.insert plugins {1 :IndianBoy42/fuzzy_slash.nvim 121 | :opts {:Fz :Fuz 122 | :FzNext :FuzNext 123 | :FzPrev :FuzPrev 124 | :FzPattern :FuzPattern 125 | :FzClear :FuzClear}}) 126 | 127 | (table.insert plugins {1 :Stormherz/tablify}) 128 | 129 | (table.insert plugins {1 :sukima/xmledit}) 130 | 131 | (table.insert plugins {1 :LhKipp/nvim-nu}) 132 | 133 | (table.insert plugins {1 :neovim/nvim-lspconfig}) 134 | 135 | (table.insert plugins :williamboman/mason-lspconfig.nvim) 136 | 137 | (table.insert plugins {1 :williamboman/mason.nvim 138 | :config (fn [] (require :plugins.lsp.config))}) 139 | 140 | (table.insert plugins {1 :junegunn/fzf 141 | :build (fn [] (let [path (.. (do-viml stdpath :data) :/lazy/fzf) 142 | install (.. path "/install")] 143 | (do-viml system [install "--all"])))}) 144 | 145 | (table.insert plugins {1 :Norlock/nvim-traveller 146 | :config (fn [] (require :plugins.traveller.config))}) 147 | 148 | (table.insert plugins {1 :ibhagwan/fzf-lua 149 | :config (fn [] (require :plugins/fzf/config))}) 150 | 151 | (table.insert plugins :airblade/vim-rooter) 152 | 153 | (table.insert plugins :andweeb/presence.nvim) 154 | 155 | (table.insert plugins {1 :nvim-neorg/neorg 156 | :build ":Neorg sync-parsers" 157 | :config (fn [] (require :plugins.neorg.config)) 158 | :dependencies [:nvim-lua/plenary.nvim]}) 159 | 160 | ((. (require :lazy) :setup) [plugins]) 161 | (require :plugins.lazy.config) 162 | 163 | ;;; after/ftplugin 164 | (c.glob :*.fnl :/home/kat/.config/nvim/after/ftplugin 165 | :/home/kat/.config/nvim/after/ftplugin) 166 | ;;; plugin 167 | (c.glob :*.fnl :/home/kat/.config/nvim/plugin :/home/kat/.config/nvim/plugin) 168 | ;;; autoload 169 | (c.glob :*.fnl :/home/kat/.config/nvim/autoload 170 | :/home/kat/.config/nvim/autoload) 171 | ;;; ftplugin 172 | (c.glob :*.fnl :/home/kat/.config/nvim/ftplugin 173 | :/home/kat/.config/nvim/ftplugin) 174 | 175 | (require :plugins.tabby.config) -------------------------------------------------------------------------------- /fnl/maps.fnl: -------------------------------------------------------------------------------- 1 | (module maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros 3 | katcros-fnl.macros.nvim.api.options.macros]}) 4 | 5 | (nm- : : "Set space to no operation") 6 | (nomap- [:n :v] "\\" "," "Remap , so we don't lose it" {:nowait true}) 7 | (set-vars g {:mapleader " " :maplocalleader ","}) 8 | 9 | ; i didn't like \ as local leader 10 | 11 | ; allow gf to open non-existent files 12 | ; currently not working, no idea why 13 | ; (map- :gf ":edit ") 14 | 15 | (nomap- [:n :v] ";" ":" "Swap char search and command-line enter") 16 | (nomap- [:n :v] ":" ";" "Swap command-line enter and char search") 17 | 18 | (nomap- [:n :v] :H :g^ "Move to beginning of virtual line") 19 | (nomap- [:n :v] :J "}" "Jump to bottom of paragraph") 20 | (nomap- [:n :v] :K "{" "Jump to top of paragraph") 21 | (nomap- [:n :v] :L :g_ "Move to end of virtual line") 22 | 23 | (ino- : : "Enter user complete easier") 24 | 25 | (nno- : :< "Shrink window horizontally") 26 | (nno- : :+ "Grow window vertically") 27 | (nno- : :- "Shrin window vertically") 28 | (nno- : :> "Grow window horizontally") 29 | (nno- :r "nohlsearch|diffupdate|normal! " 30 | "Return functionality") 31 | 32 | (nno- : :h "Go to window to the left") 33 | (nno- : :j "Go to window below") 34 | (nno- : :k "Go to window above") 35 | (nno- : :l "Go to window to the right") 36 | 37 | (tno- : "" "Easier terminal mode escape") 38 | 39 | (vno- "<" :" :>gv "Maintain visual mode when indenting") 41 | 42 | (vno- :y "myy`y" "Maintain visual mode when yanking") 43 | (vno- :Y "myY`y" "Maintain visual mode when yanking") 44 | -------------------------------------------------------------------------------- /fnl/plugins/bufferline/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.bufferline.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for bufferline.nvim 5 | ;;; https://github.com/akinsho/bufferline.nvim 6 | 7 | (opt- :bufferline :setup) 8 | (fn runBufferline [] 9 | (opt- :bufferline :setup 10 | {:options {:numbers (fn function [opts] 11 | (string.format "%s.%s" opts.id 12 | (opts.raise opts.ordinal))) 13 | :separator_style :slant 14 | :indicator_icon "▎" 15 | :buffer_close_icon "" 16 | :modified_icon "" 17 | :close_icon "" 18 | :left_trunc_marker "" 19 | :right_trunc_marker ""} 20 | :highlights {:fill {:guifg {:attribute :bg :highlight :Normal} 21 | :guibg {:attribute :fg :highlight :Conditional}} 22 | :tab {:guifg {:attribute :bg :highlight :Normal} 23 | :guibg {:attribute :fg :highlight :Exception}} 24 | :tab_selected {:guifg {:attribute :bg :highlight :Normal} 25 | :guibg {:attribute :fg 26 | :highlight :SpecialChar}} 27 | :tab_close {:guifg {:attribute :bg :highlight :Normal} 28 | :guibg {:attribute :fg :highlight :Define}} 29 | :info {:guifg {:attribute :bg :highlight :Normal} 30 | :guibg {:attribute :bg :highlight :SpecialComment}} 31 | :buffer_visible {:guifg {:attribute :bg 32 | :highlight :Normal} 33 | :guibg {:attribute :fg 34 | :highlight :SpecialComment}} 35 | :buffer_selected {:guifg {:attribute :bg 36 | :highlight :Normal} 37 | :guibg {:attribute :fg 38 | :highlight :SpecialChar} 39 | :gui "bold,italic"} 40 | :close_button {:guifg {:attribute :bg :highlight :Normal} 41 | :guibg {:attribute :fg 42 | :highlight :Exception} 43 | :gui :bold} 44 | :close_button_visible {:guifg {:attribute :bg 45 | :highlight :Normal} 46 | :guibg {:attribute :fg 47 | :highlight :SpecialComment} 48 | :gui :bold} 49 | :close_button_selected {:guifg {:attribute :bg 50 | :highlight :Normal} 51 | :guibg {:attribute :fg 52 | :highlight :SpecialChar} 53 | :gui :bold} 54 | :modified {:guifg {:attribute :fg :highlight :Tag} 55 | :guibg {:attribute :fg :highlight :Exception}} 56 | :modified_visible {:guifg {:attribute :fg 57 | :highlight :Tag} 58 | :guibg {:attribute :fg 59 | :highlight :SpecialComment}} 60 | :modified_selected {:guifg {:attribute :fg 61 | :highlight :Tag} 62 | :guibg {:attribute :fg 63 | :highlight :SpecialChar}} 64 | :duplicate_selected {:guifg {:attribute :fg 65 | :highlight :Normal} 66 | :guibg {:attribute :fg 67 | :highlight :SpecialChar}} 68 | :duplicate_visible {:guifg {:attribute :bg 69 | :highlight :Normal} 70 | :guibg {:attribute :fg 71 | :highlight :SpecialComment}} 72 | :duplicate {:guifg {:attribute :bg :highlight :Normal} 73 | :guibg {:attribute :fg :highlight :Exception}} 74 | :separator_selected {:guifg {:attribute :fg 75 | :highlight :Conditional} 76 | :guibg {:attribute :fg 77 | :highlight :SpecialChar}} 78 | :separator_visible {:guifg {:attribute :fg 79 | :highlight :Conditional} 80 | :guibg {:attribute :fg 81 | :highlight :SpecialComment}} 82 | :separator {:guifg {:attribute :fg 83 | :highlight :Conditional} 84 | :guibg {:attribute :fg :highlight :Exception}} 85 | :indicator_selected {:guifg {:attribute :bg 86 | :highlight :Normal} 87 | :guibg {:attribute :fg 88 | :highlight :SpecialChar}} 89 | :pick_selected {:guifg {:attribute :fg 90 | :highlight :Normal} 91 | :guibg {:attribute :fg 92 | :highlight :SpecialChar}} 93 | :pick_visible {:guifg {:attribute :fg :highlight :Normal} 94 | :guibg {:attribute :fg 95 | :highlight :SpecialChar}} 96 | :pick {:guifg {:attribute :fg :highlight :Normal} 97 | :guibg {:attribute :fg :highlight :SpecialChar}} 98 | :background {:guifg {:attribute :bg :highlight :Normal} 99 | :guibg {:attribute :fg 100 | :highlight :Exception}}}})) 101 | 102 | (runBufferline) 103 | -------------------------------------------------------------------------------- /fnl/plugins/cmp/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.cmp.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | ;;; Configs for nvim-cmp 5 | ;;; https://github.com/hrsh7th/nvim-cmp 6 | 7 | (def- cmp (require :cmp)) 8 | (set-opt completeopt "menu,menuone,noselect") 9 | (cmp.setup {:sources (cmp.config.sources {1 {:name :neorg}} {1 {:name :buffer}})}) 10 | -------------------------------------------------------------------------------- /fnl/plugins/colors/scheme.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.colors.scheme 2 | {autoload {sys system} 3 | require-macros [katcros-fnl.macros.nvim.api.options.macros 4 | katcros-fnl.macros.nvim.api.colors.macros]}) 5 | 6 | (defn change-kitty [back color] "Change out kitty scheme" 7 | (let [name (string.format "Kitty-%s-%s" color back)] 8 | (vim.fn.system (string.format "kitty +kitten themes --reload-in all %s" 9 | name)))) 10 | 11 | (defn grep-kitty [back color] 12 | (let [name (string.format "# Kitty-%s-%s" color back)] 13 | (vim.fn.system (string.format "grep -qx \"%s\" ~/.config/kitty/kitty.conf" name)) 14 | (if (> vim.v.shell_error 0) 15 | false 16 | true))) 17 | 18 | (defn set* [] (let [timeLocal (tonumber (vim.fn.strftime "%H")) 19 | background vim.o.background 20 | color vim.g.colors_name] 21 | (if (and (>= timeLocal 18) (< timeLocal 8)) 22 | (do 23 | (when (or (not= background :dark) (not= color :kat.nvim)) 24 | (do 25 | (set vim.o.background :dark) 26 | (col- :kat.nvim) 27 | (when (not (grep-kitty :dark :kat.nvim)) 28 | (change-kitty :dark :kat.nwim))))) 29 | (and (>= timeLocal 8) (< timeLocal 11)) 30 | (do 31 | (when (or (not= background :light) (not= color :kat.nwim)) 32 | (do 33 | (set vim.o.background :light) 34 | (col- :kat.nwim) 35 | (when (not (grep-kitty :light :kat.nwim)) 36 | (change-kitty :light :kat.nwim))))) 37 | (and (>= timeLocal 11) (< timeLocal 15)) 38 | (do 39 | (when (or (not= background :light) (not= color :kat.nvim)) 40 | (do 41 | (set vim.o.background :light) 42 | (col- :kat.nvim) 43 | (when (not (grep-kitty :light :kat.nvim)) 44 | (change-kitty :light :kat.nvim))))) 45 | (and (>= timeLocal 15) (< timeLocal 18)) 46 | (do 47 | (when (or (not= background :dark) (not= color :kat.nwim)) 48 | (do 49 | (set vim.o.background :dark) 50 | (col- :kat.nwim) 51 | (when (not (grep-kitty :dark :kat.nwim)) 52 | (change-kitty :dark :kat.nwim))))) 53 | (do 54 | (when (or (not= background :dark) (not= color :kat.nvim)) 55 | (do 56 | (set vim.o.background :dark) 57 | (col- :kat.nvim) 58 | (when (not (grep-kitty :dark :kat.nvim)) 59 | (change-kitty :dark :kat.nvim)))))))) 60 | -------------------------------------------------------------------------------- /fnl/plugins/colors/time.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.colors.time {autoload {scheme plugins.colors.scheme}}) 2 | 3 | ;;; Handles autosetting of colors based on time of day 4 | 5 | (defonce color (vim.loop.new_timer)) 6 | 7 | (defonce check (* 300 1000)) 8 | 9 | (defn set-colors [] 10 | (color:start check check 11 | (vim.schedule_wrap (fn [] 12 | (scheme.set*))))) 13 | -------------------------------------------------------------------------------- /fnl/plugins/conjure/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.conjure.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | (set-var g "conjure#client#fennel#aniseed#aniseed_module_prefix" :aniseed.) 5 | -------------------------------------------------------------------------------- /fnl/plugins/cursorhold/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.cursorhold.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | (set-var g :cursorhold_updatetime 500) 5 | -------------------------------------------------------------------------------- /fnl/plugins/dirbuf/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.dirbuf.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for dirbuf 5 | ;;; https://github.com/elihunter173/dirbuf.nvim 6 | 7 | (opt- :dirbuf :setup {:show_hidden true :devicons false}) 8 | -------------------------------------------------------------------------------- /fnl/plugins/file/jump.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.file.jump) 2 | 3 | ;;; Module for handling file specific runners 4 | ;;; Things like: jump to test, jump to compile, reverse jump, etc... 5 | 6 | ;; String -- jump leader subkey 7 | (defonce leader-jump :j) 8 | 9 | ;; define leader keys for test jumping 10 | 11 | ;; fnlfmt: skip 12 | (def test-edit (.. leader-jump "tt")) 13 | (def test-split (.. leader-jump :ts)) 14 | (def test-vsplit (.. leader-jump :tv)) 15 | 16 | ;; define leader keys for compiled file jumping 17 | 18 | ;; fnlfmt: skip 19 | (def compile-edit (.. leader-jump "cc")) 20 | (def compile-split (.. leader-jump :cs)) 21 | (def compile-vsplit (.. leader-jump :cv)) 22 | 23 | ;; FN -- open things based on each split type 24 | ;; Might be useful to add tab support 25 | (defn vsplit [file] "Open new window in a vertical split and edit it" 26 | (vim.cmd (.. "vsplit " file))) 27 | 28 | (defn split [file] "Open new window in a horizontal split and edit it" 29 | (vim.cmd (.. "split " file))) 30 | 31 | (defn edit [file] "Edit in window" (vim.cmd (.. "edit " file))) 32 | 33 | ;; FN -- Root finder function 34 | ;; Put here in case I switch it 35 | (defn ->root [] "Go to root directory if possible" (vim.cmd :Rooter)) 36 | 37 | ;; FN -- jump to a test 38 | ;; @split-type -- how to split the file 39 | ;; @test-ext -- extension desired for the test 40 | (defn ->test [split-type test-ext] 41 | "Jump to a test from a desired file 42 | It notifies the user if a test is empty, but still goes to the empty file anyways" 43 | (->root) ; creating a test assumes I'm in a project anyways 44 | (let [dir-root (let [dir (vim.fn.expand "%:h")] 45 | (if (= dir ".") "" (.. dir "/"))) 46 | file-name (vim.fn.expand "%:t:r") 47 | current-dir (vim.fn.getcwd) 48 | test-file (.. current-dir :/test/ dir-root file-name test-ext) 49 | truncated-test-file (.. :/test/ dir-root file-name test-ext)] 50 | ;; I want to know if I'm making a new test 51 | ;; Good thing to add skeleton/template support here if needed 52 | (if (= (vim.fn.filewritable test-file) 0) 53 | (vim.notify (.. "No test found for '" file-name 54 | "',creating a new test in:" truncated-test-file))) 55 | (match split-type 56 | :vsplit (vsplit test-file) 57 | :split (split test-file) 58 | :edit (edit test-file)))) 59 | 60 | ;; FN -- jump to the compiled file if it exists based on split type 61 | ;; @from-dir -- extension we are compiling from 62 | ;; @split-type -- how we want to open the file 63 | ;; @ext -- file extension for compiled file 64 | ;; @compile-dir -- directory for compiled file 65 | ;; -- compile-dir is for when a dir is specified 66 | ;; -- if nil, then assumed that compiled file is in same dir 67 | (defn ->compiled [split-type from-dir ext compile-dir] 68 | "Jump to the compiled file based on directory path. 69 | If path is nil, it is assumed that the compiled file should be in the same dir as the source. 70 | If no file was found, simply warn the user as it is unneeded to go to an empty file." 71 | (->root) ; jumping to a compiled file assumes I'm in a project 72 | (let [file-name (let [name (vim.fn.fnamemodify (vim.fn.expand "%") ":.:r")] 73 | (if (not= (name:gsub "(.-)(/)(.*)" "%1") from-dir) 74 | name 75 | (name:gsub "(.-)(/)(.*)" "%3"))) 76 | full-file-name (vim.fn.expand "%:t") 77 | current-dir (vim.fn.getcwd) 78 | compiled-file (if compile-dir 79 | (string.format "%s/%s/%s.%s" current-dir 80 | compile-dir file-name ext) 81 | (string.format "%s/%s.%s" current-dir file-name 82 | ext))] 83 | ;; I want to know if no compiled file exists and only jump if it does 84 | ;; Good thing to add skeleton/template support here if needed 85 | (if (= (vim.fn.filewritable compiled-file) 0) 86 | (vim.notify (.. "No compiled file found for '" full-file-name "' at: 87 | " 88 | compiled-file) 89 | vim.log.levels.WARN) 90 | (match split-type 91 | :vsplit (vsplit compiled-file) 92 | :split (split compiled-file) 93 | :edit (edit compiled-file))))) 94 | 95 | ;; FN -- jump to the sourced file if it exists based on split type 96 | ;; @from-dir -- extension we are sourcing from 97 | ;; @split-type -- how we want to open the file 98 | ;; @ext -- file extension for sourced file 99 | ;; @source-dir -- directory for sourced file 100 | ;; -- source-dir is for when a dir is specified 101 | ;; -- if nil, then assumed that sourced file is in same dir 102 | (defn <-compiled [from-dir ext source-dir] "Jump from a compiled file" (->root) 103 | ; jumping from a compiled file assumes I'm in a project 104 | (let [file-name (let [name (vim.fn.fnamemodify (vim.fn.expand "%") ":.:r")] 105 | (if (not= (name:gsub "(.-)(/)(.*)" "%1") from-dir) 106 | name 107 | (name:gsub "(.-)(/)(.*)" "%3"))) 108 | full-file-name (vim.fn.expand "%:t") 109 | current-dir (vim.fn.getcwd) 110 | sourced-file (if source-dir 111 | (string.format "%s/%s/%s.%s" current-dir 112 | source-dir file-name ext) 113 | (string.format "%s/%s.%s" current-dir file-name 114 | ext))] 115 | ;; I want to know if no sourced file exists and only jump if it does 116 | ;; Good thing to add skeleton/template support here if needed 117 | (if (= (vim.fn.filewritable sourced-file) 0) 118 | (vim.notify (.. "No source file found for '" full-file-name 119 | "' at:\n" sourced-file "\nIs this a Fennel project?") 120 | vim.log.levels.WARN) 121 | (edit sourced-file)))) 122 | -------------------------------------------------------------------------------- /fnl/plugins/fnlfmt/curl.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fnlfmt.curl 2 | {autoload {c aniseed.compile format plugins.fnlfmt.format} 3 | require-macros [katcros-fnl.macros.nvim.api.utils.macros]}) 4 | 5 | ;; String -- String of home directory root, i.e. /home/kat 6 | ;; vim.env calls vim.fn internally, which is incompatible with Lua callbacks without a defer 7 | (def- home-root vim.env.HOME) 8 | 9 | ;; FN -- Compile fnlfmt.fnl to fnlfmt.lua 10 | ;; Deferred 11 | (defn- compile! [] "Compiles fnlfmt" 12 | (vim.schedule_wrap (fn [] 13 | (c.file (.. home-root 14 | :/.config/nvim/fnl/plugins/fnlfmt/fnlfmt.fnl) 15 | (.. home-root 16 | :/.config/nvim/lua/plugins/fnlfmt/fnlfmt.lua))))) 17 | 18 | ;; FN -- Copy fnl/fennel.lua to lua/fennel.lua 19 | (defn- copy! [] "Copies fennel.lua to the lua directory" 20 | (vim.loop.fs_copyfile (.. home-root :/.config/nvim/fnl/fennel.lua) 21 | (.. home-root :/.config/nvim/lua/fennel.lua))) 22 | 23 | ;; FN -- Error message if curl failed 24 | (defn- error-message$ [file] "Error message for curling" 25 | (vim.notify (.. "Something went wrong with curling " file) 26 | vim.log.levels.ERROR)) 27 | 28 | ;; FN -- Asynchronously curl fennel.lua for runtime usage 29 | (defn fennel-lua! [] "Download fennel.lua into 'fnl/' with curl. 30 | Copies fnl/fennel.lua to lua/fennel.lua. 31 | Runs format.configs on completion. 32 | Callback has a nested function so we can vim.schedule_wrap important pieces. 33 | Otherwise we couldn't run vim.fn functions." 34 | (let [fennel-dir (.. home-root :/.config/nvim/fnl/fennel.lua) 35 | fennel-url "https://git.sr.ht/~technomancy/fnlfmt/blob/main/fennel.lua"] 36 | (local handle 37 | (vim.loop.spawn :curl {:args [:-o fennel-dir fennel-url]} 38 | (fn [code signal] 39 | (fn nest [signal] 40 | (if (> signal 0) 41 | (error-message$ :fennel.lua) 42 | (do 43 | (copy!) 44 | (handle:close) 45 | (format.compile!)))) 46 | 47 | (vim.schedule_wrap (nest code))))))) 48 | 49 | ;; FN -- Asynchronously curl fnlfmt for formatting fennel files 50 | (defn fnlfmt! [] "Download fnlfmt into 'fnl/plugins/fnlfmt' with curl. 51 | Compiles fnlfmt.fnl to fnlfmt.lua. 52 | Runs function fennel-lua on completion. 53 | Callback has a nested function so we can vim.schedule_wrap important pieces. 54 | Otherwise we couldn't run vim.fn functions." 55 | (let [fnlfmt-dir (.. home-root 56 | :/.config/nvim/fnl/plugins/fnlfmt/fnlfmt.fnl) 57 | fnlfmt-url "https://git.sr.ht/~technomancy/fnlfmt/blob/main/fnlfmt.fnl"] 58 | (local handle 59 | (vim.loop.spawn :curl {:args [:-o fnlfmt-dir fnlfmt-url]} 60 | (fn [code signal] 61 | (fn nest [signal] 62 | (if (> signal 0) 63 | (error-message$ :fnlfmt.fnl) 64 | (do 65 | (compile!) 66 | (handle:close) 67 | (fennel-lua!)))) 68 | 69 | (vim.schedule_wrap (nest code))))))) 70 | -------------------------------------------------------------------------------- /fnl/plugins/fnlfmt/format.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fnlfmt.format {autoload {curl plugins.fnlfmt.curl}}) 2 | 3 | ;;; Formatting 4 | 5 | ;; String -- String of home directory root, i.e. /home/kat 6 | ;; vim.env calls vim.fn internally, which is incompatible with Lua callbacks without a defer 7 | (def home-root vim.env.HOME) 8 | 9 | ;; Seq -- Sequential table of all fennel files within our runtime 10 | (def fnl-runtime-files (vim.api.nvim_get_runtime_file :**/*.fnl true)) 11 | 12 | ;; FN -- Get fennel configuration files only 13 | (defn config-files [] "Get only the fennel configuration files" 14 | (let [files fnl-runtime-files 15 | config-dir (.. home-root :/.config/nvim/) 16 | fmt-table []] 17 | (each [_ v (pairs files)] 18 | (if (and (v:find config-dir) 19 | (not (v:find (.. home-root 20 | :/.config/nvim/plugins/fnlfmt/fnlfmt.fnl)))) 21 | (table.insert fmt-table v))) 22 | fmt-table)) 23 | 24 | ;; Async Tree FN -- Starts the tree to format fennel configuration files 25 | (defn configs! [] "Compile Neovim configs when inside Neovim directory 26 | Runs plugins.fnlfmt.curl.fnlfmt!" 27 | (let [config-root (.. vim.env.HOME :/.config/nvim) 28 | current-dir (vim.loop.cwd)] 29 | (if (current-dir:find config-root) 30 | (curl.fnlfmt!) 31 | (vim.notify "Not in Neovim configuration directory, fnlfmt won't start" 32 | vim.log.levels.ERROR)))) 33 | 34 | ;; FN -- Formats configuration files 35 | (defn compile! [] "Format Neovim configuration files" 36 | (let [fnlfmt (require :plugins.fnlfmt.fnlfmt)] 37 | (each [_ v (pairs (config-files))] 38 | (let [out-file (assert (vim.loop.fs_open v :r+ 438) 39 | "something went wrong with fs_open") 40 | temp-file (vim.loop.fs_open (.. v :-bak) :w+ 438)] 41 | (vim.loop.fs_write temp-file (fnlfmt.format-file v {}) 0) ; write to temp file with formated source file 42 | (vim.loop.fs_unlink v) ; get rid of source file 43 | (vim.loop.fs_close out-file) 44 | (vim.loop.fs_rename (.. v :-bak) v) ; make temp file the source file and delete the temp file 45 | (vim.loop.fs_unlink (.. v :-bak)) 46 | (vim.loop.fs_close temp-file))))) 47 | 48 | (defn file! [file] "Formats a specific file" 49 | (if (= (vim.fn.filereadable (.. vim.env.HOME 50 | :/.config/nvim/fnl/plugins/fnlfmt/fnlfmt.fnl)) 51 | 1) 52 | (let [fnlfmt (require :plugins.fnlfmt.fnlfmt) 53 | old-file (vim.loop.fs_open file :r+ 438) 54 | temp-file (vim.loop.fs_open (.. file :-bak) :w+ 438)] 55 | (vim.loop.fs_write temp-file (fnlfmt.format-file file {}) 0) 56 | (vim.loop.fs_unlink file) 57 | (vim.loop.fs_close old-file) 58 | (vim.loop.fs_rename (.. file :-bak) file) 59 | (vim.loop.fs_unlink (.. file :-bak)) 60 | (vim.loop.fs_close temp-file)) 61 | (vim.notify "fnlfmt not found, no fixing implemented atm" 62 | vim.log.levels.ERROR))) 63 | -------------------------------------------------------------------------------- /fnl/plugins/fugitive/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fugitive.config 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | ;;; Configs for vim-fugitive 5 | ;;; https://github.com/tpope/vim-fugitive 6 | 7 | ;; Call maps 8 | (require :plugins.fugitive.maps) 9 | -------------------------------------------------------------------------------- /fnl/plugins/fugitive/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fugitive.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | ;;; Maps for vim-fugitive 5 | 6 | ;; String -- fugitive leader subkey 7 | (defonce- gitLeader :g) 8 | 9 | ;; FN -- create a single mode map using the fugitive leader key 10 | ;; @mode -- mode to use 11 | ;; @lhs -- left hand side 12 | ;; @rhs -- right hand side 13 | ;; @description -- description for mapping 14 | (defn fugMap [mode lhs rhs description] 15 | (match mode 16 | :n (do 17 | (nno- (.. : gitLeader lhs) rhs 18 | {:desc description :silent true :nowait true})))) 19 | 20 | (fugMap :n :p "Git push" "Push commits of current repo") 21 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/commands.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.commands 2 | {autoload {fzf fzf 3 | fzf-lua fzf-lua.init 4 | configs plugins.fzf.config 5 | launcher plugins.fzf.launchers 6 | preview plugins.fzf.git.preview 7 | git plugins.fzf.git.init 8 | repos plugins.git.repos} 9 | require-macros [katcros-fnl.macros.nvim.api.maps.macros 10 | katcros-fnl.macros.lispism.macros 11 | katcros-fnl.macros.nvim.api.utils.macros]}) 12 | 13 | ;;; User commands for fzf 14 | 15 | (command- :KatFZFSearchDir (fn [] 16 | (launcher.search-dirs)) 17 | "Search for directories") 18 | 19 | (command- :KatFZFOpenFile (fn [] 20 | (launcher.files)) 21 | "Open files") 22 | 23 | (command- :KatFZFOpenBuffers (fn [] 24 | (launcher.buffers)) 25 | "Open buffers") 26 | 27 | (command- :KatFZFOpenMarks (fn [] 28 | (launcher.marks)) 29 | "Open marks") 30 | 31 | (command- :KatFZFOpenGrep (fn [] 32 | (launcher.live-grep)) 33 | "Open live grep") 34 | 35 | (command- :KatFZFOpenHelpTags 36 | (fn [] 37 | (launcher.help-tags)) "Open help files") 38 | 39 | (command- :KatFZFGetDotfiles 40 | (fn [] 41 | (launcher.open-preview repos.dotfiles)) "Get dotfiles") 42 | 43 | (command- :KatFZFGetNeovimPlugins 44 | (fn [] 45 | (launcher.open-preview repos.neovim-plugins)) 46 | "Get neovim plugin directories") 47 | 48 | (command- :KatFZFGetGitRepos 49 | (fn [] 50 | (launcher.open-preview repos.git-repos)) 51 | "Get other git repositories") 52 | 53 | (command- :KatFZFSearchDirectory 54 | (fn [] 55 | (launcher.search-dirs)) "Search through current directory") 56 | 57 | (command- :KatFZFGetSessions 58 | (fn [] 59 | (launcher.search-sessions)) "Search through sessions") 60 | 61 | (command- :KatFZFSearchNeorgWorkspaces 62 | (fn [] 63 | (vim.cmd "silent! NeorgStart silent=true") 64 | (launcher.search-neorg-workspaces)) 65 | "Search through Neorg workspaces") 66 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.config 2 | {autoload {fzf fzf 3 | fzf-lua fzf-lua.init 4 | preview plugins.fzf.git.preview 5 | git plugins.fzf.git.init 6 | repos plugins.git.repos} 7 | require-macros [katcros-fnl.macros.nvim.api.maps.macros 8 | katcros-fnl.macros.lispism.macros 9 | katcros-fnl.macros.nvim.api.utils.macros]}) 10 | 11 | ;;; FZF plugin configuration 12 | 13 | (def- actions (require :fzf-lua.actions)) 14 | 15 | ;; Setup -- setup table for fzf.lua 16 | ;; https://github.com/ibhagwan/fzf-lua 17 | (opt- :fzf-lua :setup 18 | {:winopts {:border [" " " " " " " " " " " " " " " "] 19 | :hl {:normal :MsgArea 20 | :border :ModeMsg 21 | :cursor :Visual 22 | :cursorline :Visual 23 | :title :Title 24 | :scrollbar_f :PmenuThumb 25 | :scrollbar_e :PmenuSbar} 26 | :preview {:scrollbar :float}} 27 | :fzf_colors {:prompt {1 :fg 2 :Title} 28 | :hl+ {1 :bg 2 :Error} 29 | :hl {1 :bg 2 :WarningMsg} 30 | :pointer {1 :bg 2 :Visual} 31 | :fg+ {1 :fg 2 :Normal} 32 | :bg+ {1 :bg 2 :Visual} 33 | :fg {1 :bg 2 :Visual}} 34 | :files {:actions {:ctrl-x actions.file_split 35 | :ctrl-y actions.file_sel_to_qf}} 36 | :grep {:actions {:ctrl-x actions.file_split 37 | :ctrl-y actions.file_edit_or_qf}} 38 | :buffers {:actions {:ctrl-x actions.buf_split :ctrl-d actions.buf_del}}}) 39 | 40 | ;; String -- fzf executable path 41 | ;; For some reason the fzf path is just broken on my laptop 42 | ;; Search for it and and use it directly 43 | (defonce fzf-path (. (vim.api.nvim_get_runtime_file :bin/fzf true) 1)) 44 | 45 | ;; Key -- options for nvim-fzf plugin 46 | (defonce fzf-nvim-opts {:border :rounded}) 47 | 48 | ;; Setup -- register fzf-lua for vim.ui.select 49 | (opt- :fzf-lua :register_ui_select) 50 | 51 | ;; Call maps and user commands 52 | (require :plugins.fzf.commands) 53 | (require :plugins.fzf.maps) 54 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/directory/preview.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.directory.preview 2 | {autoload {preview plugins.fzf.preview 3 | configs plugins.fzf.configs 4 | s aniseed.string}}) 5 | 6 | ;;; Previewer for directories 7 | 8 | (def base (. (require :fzf-lua.previewer.builtin) :base)) 9 | (def buffer_or_file (. (require :fzf-lua.previewer.builtin) :buffer_or_file)) 10 | 11 | (def contents-type {}) 12 | 13 | ;; output the module table explicitly 14 | ;; This is needed to get the preview window working 15 | (def module-tab *module*) 16 | 17 | (defn get-index [item] "Get index for current item" (preview.get-index* item)) 18 | 19 | (defn new [self o opts fzf-win] (preview.new* self o opts fzf-win)) 20 | 21 | (defn contents [] "Show working directories" 22 | (let [output []] 23 | (if contents-type.current-dir 24 | (let [fd (vim.loop.fs_opendir "." nil 500) 25 | cwd (vim.loop.cwd)] 26 | (each [_ file (pairs (vim.loop.fs_readdir fd))] 27 | (when (= file.type :directory) 28 | (table.insert output 29 | {:text file.name 30 | :data "data\n" 31 | :desc :desc 32 | :dir (.. cwd "/" file.name)}))) 33 | (vim.loop.fs_closedir fd))) 34 | output)) 35 | 36 | (defn parse_entry [self entry-str] "Get content at specified index" 37 | (let [index (get-index entry-str)] 38 | (. (contents) index))) 39 | 40 | (defn parse-data [data] "Get rid of newlines so it can be output" 41 | (if data 42 | (s.split data "\n") 43 | [""])) 44 | 45 | (defn data-length [data] "Find the length of the data" 46 | (local (_ output) (string.gsub data "\n" "")) output) 47 | 48 | (defn populate_preview_buf [self entry-str] 49 | "Populate the preview window with dirbuf" 50 | (let [entry (self:parse_entry entry-str) 51 | ;; Set the buffer to a var 52 | ;; fzf-lua sometimes breaks this 53 | buffer (vim.api.nvim_win_get_buf self.win.preview_winid)] 54 | (vim.api.nvim_buf_call buffer 55 | (fn [] 56 | ((. (require :dirbuf) :open) entry.dir))) 57 | (self.win:update_scrollbar))) 58 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/git/init.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.git.init 2 | {require-macros [katcros-fnl.macros.nvim.api.autocommands.macros 3 | katcros-fnl.macros.nvim.api.maps.macros]}) 4 | 5 | ;;; Handles manipulation of git stuff from fzf directly 6 | 7 | ;; FN -- open up a fugitive window in a floating window for quick checking 8 | ;; @dir -- the directory 9 | (defn open$ [dir] "Opens a fugitive window of the directory desired" 10 | ; open up fugitive at the right di 11 | (vim.fn.chdir dir) (vim.cmd :Git) 12 | (let [timer (vim.loop.new_timer) 13 | fug-win (vim.api.nvim_get_current_win) 14 | fug-buf (vim.api.nvim_win_get_buf fug-win) 15 | ui (. (vim.api.nvim_list_uis) 1) 16 | width-pad (math.floor (/ ui.width 3.14)) 17 | win-width (-> ui.width 18 | (- width-pad)) 19 | height-pad (math.floor (/ ui.height 3.14)) 20 | win-height (-> ui.height 21 | (- height-pad)) 22 | win-opts {:relative :editor 23 | :height win-height 24 | :width win-width 25 | :row (/ (- ui.height win-height) 2) 26 | :col (/ (- ui.width win-width) 2) 27 | :border :rounded 28 | :style :minimal}] ; use a very small timer so things aren't poorly blocked 29 | (timer:start 1 0 30 | (vim.schedule_wrap (fn [] 31 | (nno- :q 32 | (fn [] 33 | (vim.api.nvim_win_close fug-win 34 | true)) 35 | "Close fugitive window with just q" 36 | {:buffer fug-buf}) 37 | (nno- : 38 | (fn [] 39 | (vim.api.nvim_win_close fug-win 40 | true)) 41 | "Close fugitive window with just " 42 | {:buffer fug-buf}) 43 | (let [fug-floatwin (def-aug- :fugitiveFloatwin)] 44 | (aug- fug-floatwin 45 | (auc- :BufLeave nil 46 | (fn [] 47 | (vim.api.nvim_win_close fug-win 48 | true) 49 | (vim.api.nvim_del_augroup_by_id fug-floatwin)) 50 | "Close fugitive floating window after we leave it" 51 | {:buffer fug-buf}))) 52 | (vim.api.nvim_win_set_config fug-win 53 | win-opts)))))) 54 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/git/preview.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.git.preview 2 | {autoload {repos plugins.git.repos 3 | preview plugins.fzf.preview 4 | s aniseed.string}}) 5 | 6 | ;;; preview module specific to git operations 7 | 8 | (def base (. (require :fzf-lua.previewer.builtin) :base)) 9 | (def buffer_or_file (. (require :fzf-lua.previewer.builtin) :buffer_or_file)) 10 | 11 | ;; A mutable table to determine what dir we are working on 12 | (def repo-type {}) 13 | 14 | ;; output the module table explicitly 15 | ;; This is needed to get the preview window working 16 | (def module-tab *module*) 17 | 18 | (defn get-index [item] "Get index for current item" (preview.get-index* item)) 19 | 20 | (defn new [self o opts fzf-win] (preview.new* self o opts fzf-win)) 21 | 22 | ;; FN -- output a table of contents appropriately 23 | ;; This is needed to minimize how much work is needed to change things 24 | (defn contents [] "Contents to parse" 25 | (let [dirs repo-type.current ; look at current repo type for dirs 26 | output []] 27 | (each [k v (pairs dirs)] 28 | (table.insert output {:text v.name 29 | :data (repos.status v.dir) 30 | :dir v.dir 31 | :desc v.desc})) 32 | output)) 33 | 34 | (defn parse_entry [self entry-str] "Get content at specified index" 35 | (let [index (get-index entry-str)] 36 | (. (contents) index))) 37 | 38 | (defn parse-data [data] "Get rid of newlines so it can be output" 39 | (if data 40 | (s.split data "\n") 41 | [""])) 42 | 43 | (defn data-length [data] "Find the length of the data" 44 | (local (_ output) (string.gsub data "\n" "")) output) 45 | 46 | (defn populate_preview_buf [self entry-str] "Populate the preview window" 47 | (let [entry (self:parse_entry entry-str) 48 | data (parse-data entry.data) 49 | ;; Set the buffer to a var 50 | ;; fzf-lua sometimes breaks this 51 | buffer (vim.api.nvim_win_get_buf self.win.preview_winid) 52 | line-count (data-length entry.data)] 53 | (set self.preview_bufloaded true) 54 | (vim.api.nvim_buf_set_lines buffer 0 -1 false data) 55 | ;; TODO: new syntax type for git status? 56 | (local filetype :fugitive) 57 | (vim.api.nvim_buf_set_option buffer :filetype filetype) 58 | (self.win:update_scrollbar))) 59 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/launchers.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.launchers 2 | {autoload {fzf fzf 3 | fzf-lua fzf-lua.init 4 | configs plugins.fzf.config 5 | git-preview plugins.fzf.git.preview 6 | dir-preview plugins.fzf.directory.preview 7 | session-preview plugins.fzf.session.preview 8 | neorg-preview plugins.fzf.neorg.preview 9 | session plugins.session.init 10 | git plugins.fzf.git.init 11 | repos plugins.git.repos} 12 | require-macros [katcros-fnl.macros.nvim.api.maps.macros 13 | katcros-fnl.macros.lispism.macros 14 | katcros-fnl.macros.nvim.api.utils.macros]}) 15 | 16 | (defn- dirbuf-open [dir] "Open dir with dirbuf" 17 | ((. (require :dirbuf) :open) dir)) 18 | 19 | ;; FN -- launchers built into fzf.lua 20 | (defn files [opts] ((. (require :fzf-lua) :files) opts)) 21 | 22 | (defn resume [opts] (fzf-lua.resume opts)) 23 | 24 | (defn buffers [opts] ((. (require :fzf-lua) :buffers) opts)) 25 | 26 | (defn marks [opts] ((. (require :fzf-lua) :marks) opts)) 27 | 28 | (defn live-grep [opts] ((. (require :fzf-lua) :live_grep) opts)) 29 | 30 | (defn spell-suggest [opts] ((. (require :fzf-lua) :spell_suggest) opts)) 31 | 32 | (defn help-tags [opts] ((. (require :fzf-lua) :help_tags) opts)) 33 | 34 | ;; FN -- open a preview of git repos 35 | ;; @repo -- repo table to preview 36 | (defn open-preview [repo] ; make sure we have the correct repo type in mind 37 | (set git-preview.repo-type.current repo) ; feed entries into fzf 38 | (fn func [fzf-cb] 39 | (var i 1) 40 | ;; format entry so that it has an index 41 | ;; item -> 1. item 42 | ;; this is then what you see in fzf 43 | (each [_ e (ipairs (git-preview.contents))] 44 | (fzf-cb (: "%d. %s" :format i e.text)) 45 | (set i (+ i 1))) 46 | (fzf-cb nil)) 47 | (local actions 48 | {:default (fn [selected _] 49 | (print (vim.inspect selected)) 50 | (let [index (git-preview.get-index (. selected 2)) 51 | contents (. (git-preview.contents) index)] 52 | (vim.notify (.. "cwd: " contents.dir) 53 | vim.log.levels.INFO) 54 | (git.open$ contents.dir)))}) 55 | ((coroutine.wrap (fn [] 56 | (let [selected ((. (require :fzf-lua) :fzf) func 57 | {:prompt "Repos❯ " 58 | :previewer git-preview.module-tab 59 | : actions 60 | :fzf_opts {:--delimiter "." 61 | :--nth :3..}})] 62 | ((. (. (require :fzf-lua) :actions) :act) actions 63 | selected {})))))) 64 | 65 | (defn search-neorg-workspaces [] "Search Neorg workspaces" 66 | (fn func [fzf-cb] 67 | (var i 1) 68 | ;; format entry so that it has an index 69 | ;; item -> 1. item 70 | ;; this is then what you see in fzf 71 | (each [_ e (ipairs (neorg-preview.contents))] 72 | (fzf-cb (: "%d. %s" :format i e.text)) 73 | (set i (+ i 1))) 74 | (fzf-cb nil)) 75 | (local actions 76 | {:default (fn [selected _] 77 | (let [index (neorg-preview.get-index (. selected 2)) 78 | contents (. (neorg-preview.contents) index)] 79 | (vim.cmd (.. "Neorg workspace " contents.name))))}) 80 | ((coroutine.wrap (fn [] 81 | (let [selected ((. (require :fzf-lua) :fzf) func 82 | {:prompt "Workspaces❯ " 83 | :previewer neorg-preview.module-tab 84 | : actions 85 | :fzf_opts {:--delimiter "." 86 | :--nth :3..}})] 87 | ((. (. (require :fzf-lua) :actions) :act) actions 88 | selected {})))))) 89 | 90 | (defn search-sessions [] "Search sessions stored" 91 | (fn func [fzf-cb] 92 | (var i 1) 93 | ;; format entry so that it has an index 94 | ;; item -> 1. item 95 | ;; this is then what you see in fzf 96 | (each [_ e (ipairs (session-preview.contents))] 97 | (fzf-cb (: "%d. %s" :format i e.text)) 98 | (set i (+ i 1))) 99 | (fzf-cb nil)) 100 | (local actions {:default (fn [selected _] 101 | (let [index (session-preview.get-index 102 | (. selected 2)) 103 | contents (. (session-preview.contents) 104 | index)] 105 | (session.load! contents))) 106 | :ctrl-d (fn [selected _] 107 | (let [index (session-preview.get-index 108 | (. selected 2)) 109 | contents (. (session-preview.contents) 110 | index)] 111 | (session.delete! contents) 112 | (search-sessions)))}) 113 | ((coroutine.wrap (fn [] 114 | (let [selected ((. (require :fzf-lua) :fzf) func 115 | {:prompt "Sessions❯ " 116 | :previewer session-preview.module-tab 117 | : actions 118 | :fzf_opts {:--delimiter "." 119 | :--nth :3..}})] 120 | ((. (. (require :fzf-lua) :actions) :act) actions 121 | selected {})))))) 122 | 123 | (defn search-dirs [] "Search directories found in cwd\nPreviews with dirbuf" 124 | (set dir-preview.contents-type.current-dir true) 125 | ; make sure we have the correct repo type in mind 126 | (fn func [fzf-cb] ; feed entries into fzf 127 | (var i 1) 128 | ;; format entry so that it has an index 129 | ;; item -> 1. item 130 | ;; this is then what you see in fzf 131 | (each [_ e (ipairs (dir-preview.contents))] 132 | (fzf-cb (: "%d. %s" :format i e.text)) 133 | (set i (+ i 1))) 134 | (fzf-cb nil)) (fn open-notify [dir] 135 | (vim.notify (.. "cwd: " dir) vim.log.levels.INFO) 136 | (vim.loop.chdir dir)) 137 | (local actions 138 | {:default (fn [selected _] 139 | "cd to directory" 140 | (let [index (dir-preview.get-index (. selected 2)) 141 | contents (. (dir-preview.contents) index)] 142 | (open-notify contents.dir))) 143 | :ctrl-s (fn [selected _] 144 | "cd and open up fzf of new directory" 145 | (let [index (dir-preview.get-index (. selected 2)) 146 | contents (. (dir-preview.contents) index)] 147 | (open-notify contents.dir) 148 | (search-dirs))) 149 | :ctrl-e (fn [selected _] 150 | "cd and open up fzf of new directory" 151 | (let [index (dir-preview.get-index (. selected 2)) 152 | contents (. (dir-preview.contents) index)] 153 | (open-notify contents.dir) 154 | (dirbuf-open contents.dir))) 155 | :ctrl-x (fn [selected _] 156 | "cd and open up fzf of new directory" 157 | (let [index (dir-preview.get-index (. selected 2)) 158 | contents (. (dir-preview.contents) index)] 159 | (open-notify contents.dir) 160 | (vim.cmd :split) 161 | (dirbuf-open contents.dir))) 162 | :ctrl-v (fn [selected _] 163 | "cd and open up fzf of new directory" 164 | (let [index (dir-preview.get-index (. selected 2)) 165 | contents (. (dir-preview.contents) index)] 166 | (open-notify contents.dir) 167 | (vim.cmd :vsplit) 168 | (dirbuf-open contents.dir)))}) 169 | ((coroutine.wrap (fn [] 170 | (let [selected ((. (require :fzf-lua) :fzf) func 171 | {:prompt "Directories❯ " 172 | :previewer dir-preview.module-tab 173 | : actions 174 | :fzf_opts {:--delimiter "." 175 | :--nth :3..}})] 176 | ((. (. (require :fzf-lua) :actions) :act) actions 177 | selected {})))))) 178 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.maps 2 | {autoload {fzf fzf 3 | fzf-lua fzf-lua.init 4 | configs plugins.fzf.config 5 | launcher plugins.fzf.launchers 6 | preview plugins.fzf.git.preview 7 | git plugins.fzf.git.init 8 | repos plugins.git.repos} 9 | require-macros [katcros-fnl.macros.nvim.api.maps.macros 10 | katcros-fnl.macros.lispism.macros 11 | katcros-fnl.macros.nvim.api.utils.macros]}) 12 | 13 | ;;; Maps for fzf 14 | 15 | ;; String -- fzf leader subkey 16 | (def- fzf-leader :f) 17 | 18 | (nno- (.. fzf-leader :f) (fn [] 19 | (launcher.files)) 20 | "Open FZF file window" {:silent true}) 21 | 22 | (nno- (.. fzf-leader :F) (fn [] 23 | (launcher.resume)) 24 | "Open FZF file window with last search string" {:silent true}) 25 | 26 | (nno- (.. fzf-leader :b) (fn [] 27 | (launcher.buffers)) 28 | "Open FZF buffer window" {:silent true}) 29 | 30 | (nno- (.. fzf-leader "'") (fn [] 31 | (launcher.marks)) 32 | "Open FZF marks window" {:silent true}) 33 | 34 | (nno- (.. fzf-leader :g) (fn [] 35 | (launcher.live-grep)) 36 | "Open FZF live grep window" {:silent true}) 37 | 38 | (nno- (.. fzf-leader :G) 39 | (fn [] 40 | (launcher.live-grep {:continue_last_search true})) 41 | "Open FZF live grep window with last search string" {:silent true}) 42 | 43 | (nno- :z= (fn [] 44 | (launcher.spell-suggest)) "Open FZF spell suggest window" 45 | {:silent true}) 46 | 47 | (nno- (.. fzf-leader :h) (fn [] 48 | (launcher.help-tags)) 49 | "Open FZF help tags window" {:silent true}) 50 | 51 | (nno- (.. fzf-leader :H) (fn [] 52 | (launcher.resume)) 53 | "Open FZF help tags window" {:silent true}) 54 | 55 | (nno- (.. fzf-leader :o) 56 | (fn [] 57 | (launcher.files {:cwd :/home/kat/Documents/neorg})) 58 | "Open FZF window of neorg files" {:silent true}) 59 | 60 | (nno- (.. fzf-leader :O) 61 | (fn [] 62 | (launcher.resume {:cwd :/home/kat/Documents/neorg})) 63 | "Open FZF window of neorg files with last search string" {:silent true}) 64 | 65 | (nno- (.. fzf-leader :c) 66 | (fn [] 67 | (launcher.files {:cwd :/home/kat/.config/nvim})) 68 | "Open FZF window of Neovim config directory" {:silent true}) 69 | 70 | (nno- (.. fzf-leader :d) 71 | (fn [] 72 | (launcher.open-preview repos.dotfiles)) 73 | "Open a FZF window of dotfiles, going to a floating fugitive window" 74 | {:silent true}) 75 | 76 | (nno- (.. fzf-leader :n) 77 | (fn [] 78 | (launcher.open-preview repos.neovim-plugins)) 79 | "Open a FZF window of Neovim plugins, going to a floating fugitive window" 80 | {:silent true}) 81 | 82 | (nno- (.. fzf-leader :r) 83 | (fn [] 84 | (launcher.open-preview repos.git-repos)) 85 | "Open a FZF window of git repos, going to a floating fugitive window" 86 | {:silent true}) 87 | 88 | (nno- (.. fzf-leader :s) 89 | (fn [] 90 | (launcher.search-sessions repos.git-repos)) 91 | "Open a FZF window of sessions" {:silent true}) 92 | 93 | (nno- (.. fzf-leader :w) 94 | (fn [] 95 | (launcher.search-neorg-workspaces))) 96 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/neorg/preview.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.neorg.previewer 2 | {autoload {preview plugins.fzf.preview 3 | neorg-config plugins.neorg.config 4 | configs plugins.fzf.configs 5 | a aniseed.core 6 | s aniseed.string}}) 7 | 8 | ;;; Previewer for neorg 9 | 10 | (defonce main-file :main.norg) 11 | 12 | (def base (. (require :fzf-lua.previewer.builtin) :base)) 13 | (def buffer_or_file (. (require :fzf-lua.previewer.builtin) :buffer_or_file)) 14 | 15 | (def contents-type {}) 16 | 17 | ;; output the module table explicitly 18 | ;; This is needed to get the preview window working 19 | (def module-tab *module*) 20 | 21 | (defn get-index [item] "Get index for current item" (preview.get-index* item)) 22 | 23 | (defn new [self o opts fzf-win] (preview.new* self o opts fzf-win)) 24 | 25 | (defn contents [] "Get Neorg workspaces" 26 | (let [output []] 27 | (each [name dir (pairs neorg-config.workspaces)] 28 | (table.insert output {:text name : name : dir})) 29 | output)) 30 | 31 | (defn parse_entry [self entry-str] "Get content at specified index" 32 | (let [index (get-index entry-str)] 33 | (. (contents) index))) 34 | 35 | (defn slurp [path] "Slurp a file" (a.slurp (.. path :/main.norg))) 36 | 37 | (defn parse-data [path] "Get rid of newlines so it can be output" 38 | (s.split (slurp path) "\n")) 39 | 40 | (defn data-length [data] "Find the length of the data" 41 | (local (_ output) (string.gsub data "\n" "")) output) 42 | 43 | (defn populate_preview_buf [self entry-str] 44 | "Populate preview window with session information 45 | Seems to be broken in kitty for some reason." 46 | (let [entry (self:parse_entry entry-str) 47 | ;; Set the buffer to a var 48 | ;; fzf-lua sometimes breaks this 49 | buffer (vim.api.nvim_win_get_buf self.win.preview_winid)] 50 | (vim.api.nvim_buf_call buffer 51 | (fn [] 52 | (vim.cmd.edit (.. entry.dir :/main.norg)))) 53 | (self.win:update_scrollbar))) 54 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/preview.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.preview) 2 | 3 | ;;; Generic preview interface 4 | ;;; This is not for direct use, but interfacing with other preview modules 5 | 6 | (def base (. (require :fzf-lua.previewer.builtin) :base)) 7 | (def buffer_or_file (. (require :fzf-lua.previewer.builtin) :buffer_or_file)) 8 | 9 | (defn get-index* [item] "Get index for current item" 10 | (tonumber (item:match "^(%d+)"))) 11 | 12 | (defn new* [self o opts fzf-win] 13 | (set-forcibly! self 14 | (setmetatable (base o opts fzf-win) 15 | {:__index (vim.tbl_deep_extend :keep self 16 | base)})) 17 | self) 18 | 19 | (defn parse_entry [self entry-str] "Get content at specified index" 20 | (let [index (get-index entry-str)] 21 | (. (contents) index))) 22 | 23 | (defn parse-data [data] "Parse data" data) 24 | 25 | (defn populate_preview_buf [self entry-str] "Populate the preview window" 26 | (values self entry-str)) 27 | -------------------------------------------------------------------------------- /fnl/plugins/fzf/session/preview.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.fzf.session.preview 2 | {autoload {preview plugins.fzf.preview 3 | configs plugins.fzf.configs 4 | store plugins.session.store 5 | json plugins.session.json 6 | s aniseed.string}}) 7 | 8 | ;;; Previewer for sessions 9 | 10 | (def base (. (require :fzf-lua.previewer.builtin) :base)) 11 | (def buffer_or_file (. (require :fzf-lua.previewer.builtin) :buffer_or_file)) 12 | 13 | (def contents-type {}) 14 | 15 | ;; output the module table explicitly 16 | ;; This is needed to get the preview window working 17 | (def module-tab *module*) 18 | 19 | (defn get-index [item] "Get index for current item" (preview.get-index* item)) 20 | 21 | (defn new [self o opts fzf-win] (preview.new* self o opts fzf-win)) 22 | 23 | (defn contents [] "Get the sessions" 24 | (let [output []] 25 | (each [_ session (pairs (-> (json.<-file) 26 | (json.decode)))] 27 | (table.insert output 28 | {:text session.name 29 | :name session.name 30 | :last session.last 31 | :dir session.dir})) 32 | output)) 33 | 34 | (defn parse_entry [self entry-str] "Get content at specified index" 35 | (let [index (get-index entry-str)] 36 | (. (contents) index))) 37 | 38 | (defn parse-data [data] "Get rid of newlines so it can be output" 39 | (if data 40 | (s.split data "\n") 41 | [""])) 42 | 43 | (defn data-length [data] "Find the length of the data" 44 | (local (_ output) (string.gsub data "\n" "")) output) 45 | 46 | (defn populate_preview_buf [self entry-str] 47 | "Populate preview window with session information" 48 | (let [entry (self:parse_entry entry-str) 49 | data (parse-data entry.last) 50 | ;; Set the buffer to a var 51 | ;; fzf-lua sometimes breaks this 52 | buffer (vim.api.nvim_win_get_buf self.win.preview_winid) 53 | line-count 1] 54 | (vim.api.nvim_buf_set_lines buffer 0 line-count false data) 55 | (self.win:update_scrollbar))) 56 | -------------------------------------------------------------------------------- /fnl/plugins/git/commands.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.git.commands 2 | {require-macros [katcros-fnl.macros.nvim.api.utils.macros]}) 3 | 4 | ;;; Commands for git 5 | 6 | (defn lazy-update [] (do-command Git "add -u") 7 | (do-command Git "commit -m 'update'") (do-command Git :push)) 8 | -------------------------------------------------------------------------------- /fnl/plugins/git/repos.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.git.repos {autoload {sys system}}) 2 | 3 | ;;; Module that deals with git repos 4 | 5 | ;; Key -- Key value table of repo directories 6 | ;; structure: 7 | ;; name {:dir directory 8 | ;; :desc descrpition 9 | ;; :name name} 10 | 11 | ;; fnlfmt: skip 12 | (defonce dotfiles {:neovim {:dir (.. sys.home-path "/.config/nvim") 13 | :desc "Personal Neovim configs" 14 | :name " Neovim Configs"} 15 | :i3 {:dir (.. sys.home-path "/.config/i3") 16 | :desc "Scripts and config file for i3 window manager" 17 | :name "i3 Configs"} 18 | :rofi {:dir (.. sys.home-path "/.config/rofi") 19 | :desc "Configuration for the rofi menu" 20 | :name "rofi Configs"} 21 | :polybar {:dir (.. sys.home-path "/.config/polybar") 22 | :desc "Configs for the polybar WM bar" 23 | :name "Polybar Configs"}}) 24 | 25 | ;; fnlfmt: skip 26 | (defonce neovim-plugins {:katdotnvim {:dir (.. sys.git-path "katdotnvim/") 27 | :desc "My colorscheme, built with Aniseed" 28 | :name :kat.nvim} 29 | :kreative {:dir (.. sys.git-path "kreative/") 30 | :desc "Colorscheme backend, analagous to pywal" 31 | :name :Kreative} 32 | :obluavim {:dir (.. sys.git-path "obluavim/") 33 | :desc "Filetype plugin for Oblivion" 34 | :name :Obluavim} 35 | :katcros-fnl {:dir (.. sys.git-path "katcros-fnl/") 36 | :desc "Fennel macros primarily for Neovim" 37 | :name :katcros-fnl} 38 | :obse.vim {:dir (.. sys.git-path "obse.vim/") 39 | :desc "Syntax files for Oblivion" 40 | :name :obse.vim} 41 | :nvim-startify {:dir (.. sys.git-path "nvim-startify/") 42 | :desc "Fennel recreation of vim-startify" 43 | :name :nvim-startify} 44 | :vim-startify {:dir (.. sys.git-path "vim-startify/") 45 | :desc "Startup page" 46 | :name :Startify}}) 47 | 48 | ;; fnlfmt: skip 49 | (defonce git-repos 50 | {:oblivion-lang-ref {:dir (.. sys.git-path "oblivion-lang-ref/") 51 | :desc "Language reference for Oblivion" 52 | :name "Oblivon Language Reference"} 53 | :tree-sitter-obl {:dir (.. sys.git-path "tree-sitter-obl") 54 | :desc "Tree-sitter grammar for Oblivion" 55 | :name "Tree-sitter obl"} 56 | :oblivion-git {:dir (.. sys.git-path "oblivion-git/") 57 | :desc "Plugin files" 58 | :name "Oblivion Plugins"} 59 | :katawful.github.io {:dir (.. sys.git-path "katawful.github.io/") 60 | :desc "Website hosted by GitHub" 61 | :name "katawful.github.io"}}) 62 | 63 | ;; FN -- get status of a repo 64 | ;; @repo -- indexed repo from a specified table 65 | (defn status [repo] "Get the status of a repo" 66 | (let [status (vim.fn.system (string.format "git -C \"%s\" status" repo))] 67 | status)) 68 | 69 | ;; FN -- get a directories for repos 70 | ;; @repo-type -- the main repo to use 71 | (defn directories [repo-type] "Get a list of directories for output to FZF" 72 | (let [dir-table []] 73 | (each [k v (pairs repo-type)] 74 | (let [current-repo (. repo-type k)] 75 | (table.insert dir-table current-repo.dir))) 76 | dir-table)) 77 | -------------------------------------------------------------------------------- /fnl/plugins/gitsigns/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.gitsigns.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | (opt- :gitsigns :setup) 5 | -------------------------------------------------------------------------------- /fnl/plugins/goyo/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.goyo.config 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros 3 | katcros-fnl.macros.nvim.api.options.macros]}) 4 | 5 | ;;; Configs for Goyo 6 | ;;; https://github.com/junegunn/goyo.vim 7 | 8 | (set-var g :goyo_width 120) 9 | 10 | ;; Call maps 11 | (require :plugins.goyo.maps) 12 | -------------------------------------------------------------------------------- /fnl/plugins/goyo/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.goyo.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros 3 | katcros-fnl.macros.nvim.api.options.macros]}) 4 | 5 | ;;; Maps for Goyo 6 | 7 | (nno- :Gy ":Goyo" "Activate Goyo") 8 | -------------------------------------------------------------------------------- /fnl/plugins/indent-blankline/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.indent-blankline.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | ;;; Configs for indent_blankline 5 | ;;; https://github.com/lukas-reineke/indent-blankline.nvim 6 | 7 | (set-vars g {:indent_blankline_use_treesitter true 8 | :indent_blankline_show_current_context true 9 | :indent_blankline_buftype_exclude [:terminal] 10 | :indent_blankline_filetype_exclude [:text 11 | :terminal 12 | :man 13 | :NeogitPopup 14 | :startify 15 | :help 16 | :calendar 17 | :startup 18 | :norg]}) 19 | -------------------------------------------------------------------------------- /fnl/plugins/insert/autoclose.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.insert.autoclose {autoload {a aniseed.core}}) 2 | 3 | ;;; Autoclosing functions 4 | 5 | ;;; Private 6 | ;; FN -- determine if we are at a bracket character and act appropriately 7 | (defn- closer [bracket] ; get the character under the cursor 8 | (def getCursor (vim.api.nvim_win_get_cursor 0)) (var row 0) (var col 0) 9 | (var result :empty) ; this is stored as {1 r, 2 c} 10 | (each [k v (pairs getCursor)] 11 | (match k ; store column and row to vars 12 | 1 13 | (set row v) 14 | 2 15 | (set col v))) (def currLine (vim.api.nvim_get_current_line)) 16 | ; get current line 17 | (def currCharacter (currLine:sub (+ col 1) (+ col 1))) 18 | ; get current character 19 | (if (= (tostring bracket) (tostring currCharacter)) 20 | ;; if current character is the bracket then return 21 | (do 22 | ; we need to use the termcode directly, else prints literally 23 | (set result :)) 24 | (do 25 | (set result (tostring bracket)))) result) 26 | 27 | (defn- opener-closer [bracket] "Open and close a bracket" 28 | (let [cursor (vim.api.nvim_win_get_cursor 0) 29 | position {:row "" :col ""} 30 | line (vim.api.nvim_get_current_line) 31 | result [""]] 32 | (each [k v (pairs cursor)] 33 | (match k 34 | 1 (set position.row (+ 1 v)) 35 | 2 (set position.col (+ 1 v)))) 36 | (let [char (line:sub position.col position.col)] 37 | (if (= bracket char) 38 | (do 39 | (tset result 1 :)) 40 | (do 41 | (tset result 1 (.. bracket bracket :)))) 42 | (. result 1)))) 43 | 44 | ;;; Public 45 | ;; FN -- self named, called for the ending bracket needed 46 | (defn parenthesis [] (closer ")")) 47 | 48 | (defn bracket [] (closer "]")) 49 | 50 | (defn brace [] (closer "}")) 51 | 52 | (defn bar [] (opener-closer "|")) 53 | -------------------------------------------------------------------------------- /fnl/plugins/insert/indent.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.insert.indent {autoload {a aniseed.core}}) 2 | 3 | (defn curly [] ; get the character under the cursor 4 | (def getCursor (vim.api.nvim_win_get_cursor 0)) (var row 0) (var col 0) 5 | (var result :empty) ; this is stored as {1 r, 2 c} 6 | (each [k v (pairs getCursor)] 7 | (match k ; store column and row to vars 8 | 1 9 | (set row v) 10 | 2 11 | (set col v))) ; get current line 12 | (def currLine (vim.api.nvim_get_current_line)) ; get current character 13 | (def currCharacter (currLine:sub (+ col 1) (+ col 1))) 14 | (if (= "}" (tostring currCharacter)) ; print term codes 15 | (do 16 | (set result :)) 17 | (do 18 | (set result :))) result) 19 | 20 | (defn parenthesis [] ; get the character under the cursor 21 | (def getCursor (vim.api.nvim_win_get_cursor 0)) (var row 0) (var col 0) 22 | (var result :empty) ; this is stored as {1 r, 2 c} 23 | (each [k v (pairs getCursor)] 24 | (match k ; store column and row to vars 25 | 1 26 | (set row v) 27 | 2 28 | (set col v))) ; get current line 29 | (def currLine (vim.api.nvim_get_current_line)) ; get current character 30 | (def currCharacter (currLine:sub (+ col 1) (+ col 1))) 31 | (if (= ")" (tostring currCharacter)) ; print term codes 32 | (do 33 | (set result :)) 34 | (do 35 | (set result :))) result) 36 | -------------------------------------------------------------------------------- /fnl/plugins/latex/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.latex.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | ;;; Configs for latex 5 | 6 | ; set for neovim-remote 7 | (set-vars g 8 | {:vimtex_compiler_progname :nvr 9 | :vimtex_compiler_method :latexmk 10 | :vimtex_enabled 1 11 | :vimtex_quickfix_mode 0 12 | :tex_flavor :latex 13 | :vimtex_view_general_viewer :zathura 14 | :vimtex_complete_close_braces 1 15 | :vimtex_quickfix-mode 1 16 | :tex_conceal :abdmg 17 | :vimtex_compiler_latexmk {:executable :latexmk 18 | :options [:-xelatex 19 | :-file-line-error 20 | :-synctex=1 21 | :-interaction=nonstopmode]}}) 22 | -------------------------------------------------------------------------------- /fnl/plugins/lazy/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.lazy.config) 2 | 3 | (require :plugins.lazy.maps) 4 | -------------------------------------------------------------------------------- /fnl/plugins/lazy/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.lazy.maps 2 | {autoload {s aniseed.string} 3 | require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 4 | 5 | ;;; Module: Lazy.nvim maps 6 | 7 | ;;; Module: Lazy.nvim 8 | ;; Non-Aniseed modules seem to fail when loaded through Aniseed 9 | (def- lazy (require :lazy)) 10 | 11 | ;;; Seq: A seq of all lazy functions so I don't have to write them all 12 | (def- lazy-functions 13 | [ 14 | :build 15 | :check 16 | :clean 17 | :clear 18 | :debug 19 | :health 20 | :help 21 | :home 22 | :install 23 | :load 24 | :log 25 | :profile 26 | :restore 27 | :sync 28 | :update]) 29 | 30 | ;;; String: Lazy.nvim leader header 31 | (def lazy-leader "l") 32 | 33 | ;;; FN: Maps a key to a normal mode map with the lazy leader header 34 | ;;; @key: String -- key to map 35 | ;;; @rhs: The thing to map to 36 | ;;; @func: String -- The lazy function used 37 | (defn- map [key rhs func] "Maps a key to a normal mode map wit the lazy leader header 38 | @key: String -- key to map 39 | @rhs: The thing to map to 40 | @func: String -- The lazy function used" 41 | (let [description (string.format "Run :Lazy %s" func)] 42 | (nno- (.. lazy-leader key) rhs 43 | {:nowait true 44 | :desc (string.format "Run :Lazy %s" func) 45 | :silent true}))) 46 | 47 | (fn _G.lazy_command_completion [_ cmd-line _] "Completion for input" 48 | (let [output [] 49 | plugins (let [out# []] 50 | (each [_ v (ipairs (lazy.plugins))] 51 | (table.insert out# v.name)) 52 | out#)] 53 | ;; If the cmdline is occupied we wanna narrow the search 54 | (if (string.match (cmd-line:sub 1 1) "%w") 55 | ;; Add matching completions to output 56 | (let [completion (cmd-line:sub 1 -1)] 57 | (each [_ plugin (ipairs plugins)] 58 | (if (string.match plugin (.. "^" completion)) 59 | (table.insert output plugin)))) 60 | ;; Else output all completions available 61 | (do 62 | (each [_ plugin (ipairs plugins)] 63 | (table.insert output plugin)))) 64 | output)) 65 | 66 | ;;; FN: Ask for input and return it 67 | ;;; @prompt: String -- User prompt 68 | (defn- input? [prompt] "Ask for input and return it) 69 | @prompt: String -- User prompt" 70 | (var output "") 71 | (let [plugins (do (let [out# []] 72 | (each [_ v (ipairs (lazy.plugins))] 73 | (table.insert out# v.name)) 74 | out#))] 75 | (vim.ui.input {:prompt prompt 76 | :completion "customlist,v:lua.lazy_command_completion"} 77 | (fn [in] (set output in))) 78 | (if output 79 | {:plugins [output]} 80 | nil))) 81 | 82 | ;;; FN: Ask for select and return it 83 | ;;; @prompt: String -- User prompt 84 | (defn- select? [items prompt] "Ask for selection and return it) 85 | @prompt: String -- User prompt" 86 | (var output "") 87 | (let [string-items (do (let [out []] 88 | (each [_ v (ipairs items)] 89 | (table.insert out v.name)) 90 | out))] 91 | (vim.ui.select string-items {:prompt prompt} 92 | (fn [in] (set output in))) 93 | {:plugins output})) 94 | 95 | ;;; FN: Run through all Lazy functions and map them to a neat mapping 96 | (defn all [] "Run through all Lazy functions and map them to a neat mapping" 97 | (map :b (fn [] (let [result (input? "Select a plugin to build: ")] 98 | (if result 99 | (lazy.build result) 100 | (vim.notify "No result given" vim.log.levels.INFO)))) 101 | :build) 102 | (map :c (fn [] (lazy.check)) :check) 103 | (map :D (fn [] (lazy.debug)) :debug) 104 | (map :H (fn [] (lazy.health)) :health) 105 | (map :? (fn [] (lazy.help)) :help) 106 | (map :h (fn [] (lazy.home)) :home) 107 | (map :l (fn [] (lazy.log)) :log) 108 | (map :P (fn [] (lazy.profile)) :profile) 109 | (map :s (fn [] (lazy.sync)) :sync) 110 | (map :u (fn [] (lazy.update)) :update)) 111 | 112 | (all) 113 | -------------------------------------------------------------------------------- /fnl/plugins/lsp/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.lsp.config 2 | {autoload {maps plugins.lsp.maps sys system} 3 | require-macros [katcros-fnl.macros.nvim.api.maps.macros 4 | katcros-fnl.macros.nvim.api.options.macros 5 | katcros-fnl.macros.lispism.macros]}) 6 | 7 | ;;; Configs for lsp 8 | 9 | ;; Seq -- sequential table of servers 10 | (def servers [:clangd :zls]) 11 | 12 | (local runtime-path (vim.split package.path ";")) 13 | (table.insert runtime-path :lua/?.lua) 14 | (table.insert runtime-path :lua/?/init.lua) 15 | (defn _G.install_servers [] 16 | (each [_ lsp (pairs servers)] 17 | (local (server_is_found server) (lsp_installer.get_server lsp)) 18 | (when (not (server:is_installed)) 19 | (do 20 | (vim.notify (.. "Installing " lsp) vim.log.levels.INFO) 21 | (server:install))) 22 | (when server_is_found 23 | (server:on_ready (fn [] 24 | (let [opts {:on_attach on-attach 25 | :flags {:debounce_text_changes 150}}] 26 | (when (= server.name :sumneko_lua) 27 | (set opts.settings 28 | {:Lua {:runtime {:version :LuaJIT 29 | :path runtime-path} 30 | :workspace {:library (vim.api.nvim_get_runtime_file "" 31 | true)} 32 | :diagnostics {:globals {1 :vim}}}})) 33 | (server:setup opts))))))) 34 | 35 | (opt- :mason :setup) 36 | 37 | (when (not= sys.name :builder) 38 | (opt- :mason-lspconfig :setup {:ensure_installed servers}) 39 | 40 | ((. (. (require :lspconfig) :zls) :setup) {:on_attach maps.on-attach 41 | :settings {:zls {:enable_unused_variable_warnings true 42 | :enable_inlay_hints true 43 | :zig_lib_path (.. sys.home-path 44 | :/.local/bin/ziglang/zig/lib) 45 | :zig_exe_path (.. sys.home-path 46 | :/.local/bin/ziglang/zig)}}}) 47 | 48 | ;; Call maps 49 | (require :plugins.lsp.maps)) 50 | -------------------------------------------------------------------------------- /fnl/plugins/lsp/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.lsp.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros 3 | katcros-fnl.macros.nvim.api.options.macros]}) 4 | 5 | ;;; Maps for lsp 6 | 7 | (def nvim-lsp (require :lspconfig)) 8 | (defn on-attach [client bufnr] (set- omnifunc "v:lua.vim.lsp.omnifunc") 9 | (nno- :gD vim.lsp.buf.declaration {:silent true}) 10 | (nno- :gd vim.lsp.buf.definition {:silent true}) 11 | (nno- :K vim.lsp.buf.hover {:silent true}) 12 | (nno- :gi vim.lsp.buf.implementation {:silent true}) 13 | (nno- : vim.lsp.buf.signature_help {:silent true}) 14 | (nno- :wa vim.lsp.buf.add_workspace_folder {:silent true}) 15 | (nno- :wr vim.lsp.buf.remove_workspace_folder {:silent true}) 16 | (nno- :wl 17 | (fn [] 18 | (print (vim.inspect (vim.lsp.buf.list_workspace_folders)))) 19 | {:silent true}) 20 | (nno- :D vim.lsp.buf.type_definition {:silent true}) 21 | (nno- :rn vim.lsp.buf.rename {:silent true}) 22 | (nno- :ca vim.lsp.buf.code_action {:silent true}) 23 | (nno- :gr vim.lsp.buf.references {:silent true}) 24 | (nno- :E (fn [] 25 | (vim.diagnostic.open_float 0)) 26 | {:silent true}) 27 | (nno- "[d" vim.diagnostic.goto_prev {:silent true}) 28 | (nno- "]d" vim.diagnostic.goto_next {:silent true}) 29 | (nno- :Q vim.diagnostic.setloclist {:silent true}) 30 | (nno- :F vim.lsp.buf.formatting {:silent true})) 31 | -------------------------------------------------------------------------------- /fnl/plugins/lualine/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.lualine.configs 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for nvim-lualine 5 | ;;; https://github.com/nvim-lualine/lualine.nvim 6 | 7 | ;; Setup -- setup table for lualine 8 | (opt- :lualine :setup {:options {:icons_enabled 1 9 | :theme :kat 10 | :component_separators {:left "" 11 | :right ""} 12 | :section_separators {:left "" :right ""} 13 | :disabled_filetypes {} 14 | :always_divide_middle true} 15 | :sections {:lualine_a {1 :mode} 16 | :lualine_b {1 :branch} 17 | :lualine_c {1 {1 :filename 18 | :file_status true 19 | :path 1}} 20 | :lualine_x {1 {1 :filetype :colored true}} 21 | ; 2 {1 gps.get_location 22 | ; :cond gps.is_available}} 23 | :lualine_y {1 :progress 2 :fileformat} 24 | :lualine_z {1 :location}} 25 | :inactive_sections {:lualine_a {} 26 | :lualine_b {} 27 | :lualine_c {1 :filename} 28 | :lualine_x {1 :location} 29 | :lualine_y {} 30 | :lualine_z {}} 31 | :tabline {}}) 32 | -------------------------------------------------------------------------------- /fnl/plugins/markid/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.markid.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | (local m (require :markid)) 5 | 6 | (opt- :nvim-treesitter.configs :setup 7 | {:markid {:enable true 8 | :colors m.colors.medium 9 | :queries m.queries}}) 10 | 11 | (tset m.queries :fennel 12 | "(symbol) @markid") 13 | -------------------------------------------------------------------------------- /fnl/plugins/neogit/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.neogit.config 2 | {autoload {colors katdotnvim.color 3 | render katdotnvim.utils.export.render} 4 | require-macros [katcros-fnl.macros.nvim.api.utils.macros]}) 5 | 6 | ;;; Configs for Neogit 7 | ;;; https://github.com/NeogitOrg/neogit 8 | 9 | ((. (require :neogit) :setup) {}) 10 | 11 | (def- color colors.kat) 12 | (def- red color.red) 13 | (def- pink color.pink) 14 | (def- blue color.blue) 15 | (def- green color.green) 16 | (def- purple color.purple) 17 | (def- orange color.orange) 18 | (def- teal color.teal) 19 | (def- plum color.plum) 20 | (def- fg color.fg) 21 | (def- bg color.bg) 22 | 23 | (defn overrides [] 24 | (render.override {:source "neogit" 25 | :light_hard [{:group :NeogitGraphRed :fg red.base.color} 26 | {:group :NeogitGraphBoldRed :fg red.base.color :bold true} 27 | {:group :NeogitGraphWhite :fg fg.base.color} 28 | {:group :NeogitGraphBoldWhite :fg fg.base.color :bold true} 29 | {:group :NeogitGraphOrange :fg orange.base.color} 30 | {:group :NeogitGraphBoldOrange :fg orange.base.color :bold true} 31 | {:group :NeogitGraphYellow :fg orange.match_fg.color} 32 | {:group :NeogitGraphBoldYellow :fg orange.match_fg.color :bold true} 33 | {:group :NeogitGraphGreen :fg green.auto.color} 34 | {:group :NeogitGraphBoldGreen :fg green.auto.color :bold true} 35 | {:group :NeogitGraphCyan :fg blue.match_fg.color} 36 | {:group :NeogitGraphBoldCyan :fg blue.match_fg.color :bold true} 37 | {:group :NeogitGraphBlue :fg blue.base.color} 38 | {:group :NeogitGraphBoldBlue :fg blue.base.color :bold true} 39 | {:group :NeogitGraphPurple :fg purple.base.color} 40 | {:group :NeogitGraphBoldPurple :fg purple.base.color :bold true} 41 | {:group :NeogitGraphGray :fg fg.meld.color} 42 | {:group :NeogitGraphBoldGray :fg fg.meld.color :bold true} 43 | {:group :NeogitDiffAdd :link :DiffAdd} 44 | {:group :NeogitDiffDelete :link :DiffDelete} 45 | {:group :NeogitDiffContext :link :DiffText} 46 | {:group :NeogitDiffAddHighlight :link :diffAdded} 47 | {:group :NeogitDiffDeleteHighlight :link :diffRemoved} 48 | {:group :NeogitDiffContextHighlight :link :diffText} 49 | {:group :NeogitHunkHeader :fg fg.base.color :bg bg.shadow.color} 50 | {:group :NeogitHunkHeaderHighlight :fg fg.base.color :bg bg.umbra.color}]}) 51 | (render.override {:source "neogit" 52 | :light_soft [{:group :NeogitGraphRed :fg red.base.color} 53 | {:group :NeogitGraphBoldRed :fg red.base.color :bold true} 54 | {:group :NeogitGraphWhite :fg fg.base.color} 55 | {:group :NeogitGraphBoldWhite :fg fg.base.color :bold true} 56 | {:group :NeogitGraphOrange :fg orange.base.color} 57 | {:group :NeogitGraphBoldOrange :fg orange.base.color :bold true} 58 | {:group :NeogitGraphYellow :fg orange.match_fg.color} 59 | {:group :NeogitGraphBoldYellow :fg orange.match_fg.color :bold true} 60 | {:group :NeogitGraphGreen :fg green.auto.color} 61 | {:group :NeogitGraphBoldGreen :fg green.auto.color :bold true} 62 | {:group :NeogitGraphCyan :fg blue.match_fg.color} 63 | {:group :NeogitGraphBoldCyan :fg blue.match_fg.color :bold true} 64 | {:group :NeogitGraphBlue :fg blue.base.color} 65 | {:group :NeogitGraphBoldBlue :fg blue.base.color :bold true} 66 | {:group :NeogitGraphPurple :fg purple.base.color} 67 | {:group :NeogitGraphBoldPurple :fg purple.base.color :bold true} 68 | {:group :NeogitGraphGray :fg fg.meld.color} 69 | {:group :NeogitGraphBoldGray :fg fg.meld.color :bold true} 70 | {:group :NeogitDiffAdd :link :DiffAdd} 71 | {:group :NeogitDiffDelete :link :DiffDelete} 72 | {:group :NeogitDiffContext :link :DiffText} 73 | {:group :NeogitDiffAddHighlight :link :diffAdded} 74 | {:group :NeogitDiffDeleteHighlight :link :diffRemoved} 75 | {:group :NeogitDiffContextHighlight :link :diffText} 76 | {:group :NeogitHunkHeader :fg fg.base.color :bg bg.shadow.color} 77 | {:group :NeogitHunkHeaderHighlight :fg fg.base.color :bg bg.umbra.color}]}) 78 | (render.override {:source "neogit" 79 | :dark_hard [{:group :NeogitGraphRed :fg red.base.color} 80 | {:group :NeogitGraphBoldRed :fg red.base.color :bold true} 81 | {:group :NeogitGraphWhite :fg fg.base.color} 82 | {:group :NeogitGraphBoldWhite :fg fg.base.color :bold true} 83 | {:group :NeogitGraphOrange :fg orange.base.color} 84 | {:group :NeogitGraphBoldOrange :fg orange.base.color :bold true} 85 | {:group :NeogitGraphYellow :fg orange.match_fg.color} 86 | {:group :NeogitGraphBoldYellow :fg orange.match_fg.color :bold true} 87 | {:group :NeogitGraphGreen :fg green.auto.color} 88 | {:group :NeogitGraphBoldGreen :fg green.auto.color :bold true} 89 | {:group :NeogitGraphCyan :fg blue.match_fg.color} 90 | {:group :NeogitGraphBoldCyan :fg blue.match_fg.color :bold true} 91 | {:group :NeogitGraphBlue :fg blue.base.color} 92 | {:group :NeogitGraphBoldBlue :fg blue.base.color :bold true} 93 | {:group :NeogitGraphPurple :fg purple.base.color} 94 | {:group :NeogitGraphBoldPurple :fg purple.base.color :bold true} 95 | {:group :NeogitGraphGray :fg fg.meld.color} 96 | {:group :NeogitGraphBoldGray :fg fg.meld.color :bold true} 97 | {:group :NeogitDiffAdd :link :DiffAdd} 98 | {:group :NeogitDiffDelete :link :DiffDelete} 99 | {:group :NeogitDiffContext :link :DiffText} 100 | {:group :NeogitDiffAddHighlight :link :diffAdded} 101 | {:group :NeogitDiffDeleteHighlight :link :diffRemoved} 102 | {:group :NeogitDiffContextHighlight :link :diffText} 103 | {:group :NeogitHunkHeader :fg fg.base.color :bg bg.shadow.color} 104 | {:group :NeogitHunkHeaderHighlight :fg fg.base.color :bg bg.umbra.color}]}) 105 | (render.override {:source "neogit" 106 | :dark_soft [{:group :NeogitGraphRed :fg red.base.color} 107 | {:group :NeogitGraphBoldRed :fg red.base.color :bold true} 108 | {:group :NeogitGraphWhite :fg fg.base.color} 109 | {:group :NeogitGraphBoldWhite :fg fg.base.color :bold true} 110 | {:group :NeogitGraphOrange :fg orange.base.color} 111 | {:group :NeogitGraphBoldOrange :fg orange.base.color :bold true} 112 | {:group :NeogitGraphYellow :fg orange.match_fg.color} 113 | {:group :NeogitGraphBoldYellow :fg orange.match_fg.color :bold true} 114 | {:group :NeogitGraphGreen :fg green.auto.color} 115 | {:group :NeogitGraphBoldGreen :fg green.auto.color :bold true} 116 | {:group :NeogitGraphCyan :fg blue.match_fg.color} 117 | {:group :NeogitGraphBoldCyan :fg blue.match_fg.color :bold true} 118 | {:group :NeogitGraphBlue :fg blue.base.color} 119 | {:group :NeogitGraphBoldBlue :fg blue.base.color :bold true} 120 | {:group :NeogitGraphPurple :fg purple.base.color} 121 | {:group :NeogitGraphBoldPurple :fg purple.base.color :bold true} 122 | {:group :NeogitGraphGray :fg fg.meld.color} 123 | {:group :NeogitGraphBoldGray :fg fg.meld.color :bold true} 124 | {:group :NeogitDiffAdd :link :DiffAdd} 125 | {:group :NeogitDiffDelete :link :DiffDelete} 126 | {:group :NeogitDiffContext :link :DiffText} 127 | {:group :NeogitDiffAddHighlight :link :diffAdded} 128 | {:group :NeogitDiffDeleteHighlight :link :diffRemoved} 129 | {:group :NeogitDiffContextHighlight :link :diffText} 130 | {:group :NeogitHunkHeader :fg fg.base.color :bg bg.shadow.color} 131 | {:group :NeogitHunkHeaderHighlight :fg fg.base.color :bg bg.umbra.color}]})) 132 | 133 | (cre-command "KatNeogitOverride" overrides "Add color overrides") 134 | 135 | ;; Call maps 136 | (require :plugins.neogit.maps) 137 | -------------------------------------------------------------------------------- /fnl/plugins/neogit/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.neogit.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | ;;; Maps for Neogit 5 | 6 | ;; String -- neogit leader subkey 7 | (defonce- gitLeader :g) 8 | 9 | ;; Module -- neogit module 10 | (defonce- neogit (require :neogit)) 11 | 12 | ;; FN -- create a single mode map using the Neogit leader key 13 | ;; @mode -- mode to use 14 | ;; @lhs -- left hand side 15 | ;; @rhs -- right hand side 16 | ;; @description -- description for mapping 17 | (defn map [mode lhs rhs description] 18 | (match mode 19 | :n (do 20 | (nno- (.. : gitLeader lhs) rhs 21 | {:desc description :silent true :nowait true})))) 22 | 23 | (map :n :g (fn [] (neogit.open {:kind :split_above})) "Open Neogit window") 24 | -------------------------------------------------------------------------------- /fnl/plugins/neorg/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.neorg.config 2 | {autoload {sys system} 3 | require-macros [katcros-fnl.macros.lispism.macros]}) 4 | 5 | ;;; Configs for Neorg 6 | ;;; https://github.com/nvim-neorg/neorg 7 | 8 | ;; String -- Leader for neorg 9 | (def neorg_leader :n) 10 | 11 | ;; Key -- Workspaces for neorg 12 | (defonce workspaces 13 | {:blog (.. sys.home-path :/Documents/neorg/Blog) 14 | :fennel (.. sys.home-path :/Documents/neorg/Fennel) 15 | :oblivion (.. sys.home-path :/Documents/neorg/Oblivion) 16 | :personal (.. sys.home-path :/Documents/neorg/Personal) 17 | :programming (.. sys.home-path :/Documents/neorg/Programming) 18 | :obl-ref (.. sys.home-path "/Repos/OBLIVION/oblivion-lang-ref") 19 | :wood (.. sys.home-path :/Documents/neorg/Woodworking) 20 | :academics (.. sys.home-path :/Documents/neorg/Academics) 21 | :config (.. sys.home-path :/.config/nvim/docs)}) 22 | 23 | (defonce norg-map {:n [[:gtd :core.qol.todo_items.todo.task_done] 24 | [:gtu :core.qol.todo_items.todo.task_undone] 25 | [:gtp :core.qol.todo_items.todo.task_pending] 26 | [: :core.qol.todo_items.todo.task_cycle] 27 | [: :core.esupports.hop.hop-link] 28 | ["{" :core.integrations.treesitter.next.heading] 29 | ["}" :core.integrations.treesitter.previous.heading] 30 | ["" :core.integrations.treesitter.next.link] 31 | ["" :core.integrations.treesitter.previous.link] 32 | [(.. neorg_leader :n) :core.dirman.new.note]] 33 | :o [[:ah :core.manoeuvre.textobject.around-heading] 34 | [:ih :core.manoeuvre.textobject.inner-heading] 35 | [:at :core.manoeuvre.textobject.around-tag] 36 | [:it :core.manoeuvre.textobject.inner-tag] 37 | [:al :core.manoeuvre.textobject.around-heading]]}) 38 | 39 | (defonce gtd-map {:n [[: :core.gtd.ui.goto_task] 40 | [:q :core.gtd.ui.close] 41 | [: :core.gtd.ui.close] 42 | [:e :core.gtd.ui.edit_task] 43 | [: :core.gtd.ui.details]]}) 44 | 45 | (defonce all-map {:n [[(.. neorg_leader :mn) "Neorg mode norg"] 46 | [(.. neorg_leader :mh) 47 | "Neorg mode traverse-heading"]]}) 48 | 49 | ; require('neorg').setup { 50 | ; load = { 51 | ; ['core.defaults'] = {}, 52 | ; ['core.completion'] = { config = { engine = 'nvim-cmp' } }, 53 | ; ['core.dirman'] = { config = { workspaces = { journal = '~/journal', rrc = '~/RRC' } } }, 54 | ; ['core.esupports.metagen'] = { 55 | ; config = { 56 | ; tab = ' ', 57 | ; template = { 58 | ; { 'title', function() return vim.fn.expand '%:t:r' end }, 59 | ; { 'description', '' }, 60 | ; { 'author', 'dasu pradyumna' }, 61 | ; { 'categories', '' }, 62 | ; { 'created', function() return os.date '%d %b %Y %H:%M' end }, 63 | ; { 'updated', function() return os.date '%d %b %Y %H:%M' end }, 64 | ; -- { 'version', require('neorg.config').norg_version }, -- error here, why? 65 | ; , 66 | ;update_date = false, -- BUG: "update-metadata" uses default datetime format (not config)} 67 | ; ,} 68 | ; ,} 69 | ; ,} 70 | 71 | (def- template {:updated (fn [] (os.date "%d %b %Y %H:%M")) 72 | :created (fn [] (os.date "%b %Y %H:%M")) 73 | :title (fn [] (vim.fn.expand "%:t:r")) 74 | :description "" 75 | :author "Kat" 76 | :categories "" 77 | :update_data true}) 78 | 79 | ;; Setup -- setup table for neorg 80 | (opt- :neorg :setup 81 | {:load {:core.defaults {} 82 | :core.concealer {:config {:dim_code_blocks {:conceal false 83 | :width :content 84 | :content_only true 85 | :adaptive true}}} 86 | ; :core.esupports.metagen {:config {: template}} 87 | :core.export {} 88 | :core.syntax {} 89 | :core.export.markdown {} 90 | ; :core.tempus {} 91 | ; :core.ui {} 92 | :core.summary {} 93 | ; :core.ui.calendar {} 94 | :core.keybinds {:config {:neorg_leader :n}} 95 | :core.dirman {:config {: workspaces 96 | :index :main.norg 97 | :autodetect true 98 | :autochdir true}} 99 | :core.qol.toc {} 100 | :core.journal {:config {:workspace :personal 101 | :journal_folder :journal 102 | :use_folders false}}}}) 103 | ; :hook (fn [] 104 | ; (let [neorg_callbacks (require :neorg.callbacks)] 105 | ; (neorg_callbacks.on_event :core.keybinds.events.enable_keybinds 106 | ; (fn [_ content] 107 | ; (content.map_event_to_mode :norg norg-map 108 | ; {:silent true 109 | ; :noremap true}) 110 | ; (content.map_event_to_mode :gtd-displays gtd-map 111 | ; {:silent true 112 | ; :noremap true 113 | ; :nowait true}) 114 | ; (content.map_to_mode :all all-map 115 | ; {:silent true 116 | ; :noremap true})))))}) 117 | 118 | (require :plugins.neorg.maps) 119 | -------------------------------------------------------------------------------- /fnl/plugins/neorg/gtd.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.neorg.gtd 2 | {require-macros [katcros-fnl.macros.nvim.api.utils.macros]}) 3 | 4 | ;;; Handles switching GTD workspaces until it is fixed 5 | 6 | (local dirman (require :neorg.modules.core.norg.dirman.module)) 7 | (local gtd (require :neorg.modules.core.gtd.base.module)) 8 | 9 | (defn physical-workspace [] "Get the current physical Neorg workspace" 10 | (. (dirman.public.get_current_workspace) 1)) 11 | 12 | (defn change-gtd-workspace [] "Changes the gtd workspace" 13 | (tset gtd.config.public :workspace (physical-workspace))) 14 | 15 | (defn reload-gtd [] "Reloads GTD" (neorg.modules.load_module :core.gtd.base)) 16 | -------------------------------------------------------------------------------- /fnl/plugins/neorg/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.neorg.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | (nno- :njn "Neorg journal today") 5 | -------------------------------------------------------------------------------- /fnl/plugins/nvim-gps/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.nvim-gps.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for nvim-gps 5 | ;;; https://github.com/SmiteshP/nvim-gps 6 | 7 | (opt- :nvim-gps :setup {:icons {:class-name " " 8 | :function-name " " 9 | :method-name " " 10 | :container-name "⛶ " 11 | :tag-name "炙 "} 12 | :separator "  "}) 13 | -------------------------------------------------------------------------------- /fnl/plugins/nvim-tree/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.nvim-tree.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | (opt- :nvim-tree :setup) 5 | -------------------------------------------------------------------------------- /fnl/plugins/oblivim/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.oblivim.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | ;;; Configs for Obli-Vim 5 | ;;; https://github.com/katawful/Obli-Vim 6 | 7 | (set-vars g {:ov_window_style :double :ov_sync_time 1}) 8 | -------------------------------------------------------------------------------- /fnl/plugins/session/au.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.au 2 | {autoload {save plugins.session.save session plugins.session.init} 3 | require-macros [katcros-fnl.macros.nvim.api.autocommands.macros]}) 4 | 5 | ;;; Autocommands for session 6 | 7 | (defn cursor-hold [] 8 | "Run cursorhold autocommand 9 | If we want to stop autosaving, this makes sure to interrupt the timer 10 | and set it to nil before doing so. Deletes augroup by name doing so." 11 | (if save.handles.save-on-hold 12 | (let [session-group (def-aug- :katSession)] 13 | (aug- session-group 14 | (auc- :CursorHold "*" 15 | (fn [] 16 | (save.cursor-hold)) 17 | "Session autosave process on cursor hold"))) 18 | (do 19 | (when save.handles.init-save-timer 20 | (vim.fn.timer_stop save.handles.init-save-timer)) 21 | (set save.handles.init-save-timer nil) 22 | (let [augroup (pcall vim.api.nvim_get_autocmds {:group :katSession})] 23 | (when augroup 24 | (vim.api.nvim_del_augroup_by_name :katSession)))))) 25 | -------------------------------------------------------------------------------- /fnl/plugins/session/commands.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.commands 2 | {autoload {session plugins.session.init 3 | save plugins.session.save 4 | au plugins.session.au 5 | util plugins.session.utils 6 | fzf plugins.fzf.launchers} 7 | require-macros [katcros-fnl.macros.nvim.api.utils.macros]}) 8 | 9 | (command- :KatSessionCreate 10 | (fn [] 11 | (session.create! (util.generate$))) "Create a session") 12 | 13 | (command- :KatSessionSearch 14 | (fn [] 15 | (fzf.search-sessions)) "Search through sessions") 16 | 17 | (command- :KatSessionLoad 18 | (fn [args] 19 | (session.load<-name args.args)) {:nargs 1}) 20 | 21 | (command- :KatSessionSave (fn [args] 22 | (match args.args 23 | :autosave (do 24 | (set save.handles.save? true) 25 | (set save.handles.save-on-hold true)) 26 | _ (do 27 | (set save.handles.save-on-hold false) 28 | (set save.handles.save? true))) 29 | (au.cursor-hold) 30 | (save.save! true)) 31 | "Save a session, create if not found. Arg option 'autosave'" 32 | {:nargs "?"}) 33 | -------------------------------------------------------------------------------- /fnl/plugins/session/init.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.init 2 | {autoload {store plugins.session.store.init 3 | repos plugins.git.repos 4 | util plugins.session.utils 5 | json plugins.session.json 6 | au plugins.session.au 7 | sys system 8 | a aniseed.core} 9 | require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 10 | 11 | ;;; Primary session management 12 | 13 | ;; String -- actual session file name 14 | (defonce session-file (.. "." (string.lower sys.name) :.katsession.vim)) 15 | 16 | (defn write! [session] 17 | (let [file (.. session.dir "/" session-file)] 18 | (vim.schedule (fn [] 19 | (vim.cmd (.. "mksession! " file)))))) 20 | 21 | (defn delete! [session] (let [new-session session 22 | file (.. session.dir "/" session-file)] 23 | (set new-session.mark :delete) 24 | (store.file! (store.update new-session)) 25 | (os.remove file))) 26 | 27 | (defn modify! [session-dir] "Modify a session to match to whatever path needed" 28 | (let [file (.. session-dir "/" session-file) 29 | git-root sys.git-path] 30 | (with-open [handle (io.open file :r)] 31 | (print (vim.inspect (handle:read))) 32 | (let [data (handle:read :*a)] 33 | (print (string.gsub data (.. "~" (git-root:gsub " " "\\ ")) :test)))))) 34 | 35 | (defn load! [session] "Load a session file" 36 | (let [fixed-session-dir (if (= (session.dir:sub -1 -1) "/") 37 | (session.dir:sub 1 -2) 38 | session.dir) 39 | session-dir (if (fixed-session-dir:find sys.git-path) 40 | fixed-session-dir 41 | (do 42 | (let [tail (vim.fn.fnamemodify fixed-session-dir 43 | ":t") 44 | git-path (if (= (sys.git-path -1 -1) "/") 45 | (sys.git-path 1 -2) 46 | sys.git-path)] 47 | (.. git-path "/" tail)))) 48 | file (.. session-dir "/" session-file)] 49 | (if (= (vim.fn.filereadable file) 1) 50 | (do 51 | (vim.cmd (.. "silent! source " file)) 52 | (set-opt cmdheight 2) 53 | (vim.notify (.. "Loading session: '" session.name "' in cwd: " 54 | session-dir))) 55 | (vim.notify (.. "Session file for '" session.name "' not found") 56 | vim.log.levels.ERROR)))) 57 | 58 | (defn load<-name [name] "Loads a session from a name" 59 | (let [sessions (-> (json.<-file) 60 | (json.decode))] 61 | (each [_ session# (pairs sessions)] 62 | (if (= session#.name name) 63 | (load! session#) 64 | (vim.notify (.. "Session " name " not found") 65 | vim.log.levels.ERROR))))) 66 | 67 | (defn create! [session] 68 | "Creates a new session, stores it and writes the session file" 69 | (store.file! (store.update session)) (write! session)) 70 | 71 | (require :plugins.session.commands) 72 | (require :plugins.session.au) 73 | (require :plugins.session.maps) 74 | (au.cursor-hold) 75 | -------------------------------------------------------------------------------- /fnl/plugins/session/json.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.json {autoload {store plugins.session.store.init}}) 2 | 3 | ;;; JSON management for sessions 4 | ;;; We need to store sessions to a JSON file for easy management 5 | 6 | ;; String -- relative config path 7 | (defonce config-path (.. (os.getenv :HOME) :/.config/nvim/)) 8 | 9 | ;; String -- relative stored file path 10 | (defonce stored-file (.. config-path :fnl/plugins/session/stored.json)) 11 | 12 | (defn encode [session] "Encode lua table as a json" (vim.json.encode session)) 13 | 14 | (defn decode [json] "Decode json into a lua table" (vim.json.decode json)) 15 | 16 | (defn ->file! [json] "Store json to file" (os.execute (.. "rm " stored-file)) 17 | (with-open [file (io.open stored-file :w)] 18 | (file:write json))) 19 | 20 | (defn <-file [] "Read stored json" 21 | (with-open [file (io.open stored-file :r)] 22 | (if file 23 | (file:read :*a) 24 | "{}"))) 25 | -------------------------------------------------------------------------------- /fnl/plugins/session/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.maps 2 | {autoload {sessions plugins.session.init 3 | save plugins.session.save 4 | fzf plugins.fzf.launchers 5 | au plugins.session.au} 6 | require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 7 | 8 | ;;; Maps for sessions 9 | 10 | ;; String -- session leader subkey 11 | (defonce session-leader :k) 12 | 13 | (nno- (.. session-leader :s) (fn [] 14 | (set save.handles.save-on-hold false) 15 | (set save.handles.save? true) 16 | (au.cursor-hold) 17 | (save.save! true)) 18 | "Save a session, getting rid of autosave") 19 | 20 | (nno- (.. session-leader :a) (fn [] 21 | (set save.handles.save-on-hold true) 22 | (set save.handles.save? true) 23 | (au.cursor-hold) 24 | (save.save!)) 25 | "Save a session, starting autosave") 26 | 27 | (nno- (.. session-leader :f) 28 | (fn [] 29 | (fzf.search-sessions)) "Search sessions with fzf") 30 | -------------------------------------------------------------------------------- /fnl/plugins/session/save.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.save 2 | {autoload {session plugins.session.init 3 | store plugins.session.store.init 4 | json plugins.session.json 5 | jump plugins.file.jump 6 | util plugins.session.utils} 7 | require-macros [katcros-fnl.macros.nvim.api.autocommands.macros]}) 8 | 9 | ;;; Save management 10 | 11 | ;; Key -- table to hold various save stuff 12 | ;; save-on-hold -- enable save on cursor hold? 13 | ;; save? -- do we want to save at all? 14 | ;; autosave-interval -- time, in seconds that autosaves should update 15 | (def handles {:autosave-interval 180 :save-on-hold true :save? true}) 16 | 17 | (defn find [input] "Get session from loaded save, or make a new one 18 | If a session with the current name is found, also check if there's a session 19 | file. If so, just continue saving as is. If one isn't found, go through the 20 | normal creation process" (jump.->root) 21 | (let [cur-dir (vim.loop.cwd) 22 | stored (-> (json.<-file) 23 | (json.decode)) 24 | stored-session []] 25 | (each [name tbl (pairs stored)] 26 | ;; gotta make sure that we are getting the right directory 27 | (let [dir (if (= (tbl.dir:sub -1) "/") 28 | (tbl.dir:sub 1 -2) 29 | tbl.dir) 30 | dir-tail (vim.fn.fnamemodify dir ":t") 31 | cur-dir-tail (vim.fn.fnamemodify cur-dir ":t")] 32 | (if (and (= dir cur-dir) (= dir-tail cur-dir-tail)) 33 | (do 34 | (tset stored-session 1 tbl))))) 35 | (if (?. stored-session 1) 36 | (if input 37 | (do 38 | (vim.ui.input {:prompt "Describe the last thing you were doing: "} 39 | (fn [input] 40 | (tset (. stored-session 1) :last input))) 41 | (. stored-session 1)) 42 | (. stored-session 1)) 43 | (do 44 | (vim.ui.input {:prompt "Create a session to save? (y/N)"} 45 | (fn [input] 46 | (match input 47 | :y (do 48 | (set handles.save? true) 49 | (set handles.save-on-hold true) 50 | (let [new-session (util.generate$)] 51 | (session.create! new-session) 52 | (tset stored-session 1 new-session))) 53 | :n (do 54 | (set handles.save? false) 55 | (set handles.save-on-hold false) 56 | (tset stored-session 1 nil)) 57 | _ (do 58 | (set handles.save? false) 59 | (set handles.save-on-hold false) 60 | (tset stored-session 1 nil))))) 61 | (?. stored-session 1))))) 62 | 63 | (defn save! [input] "Save a session, creating a new one if desired. 64 | Important to note that this is dependent upon handles.save-on-hold. 65 | This will usually only be set to false if I decline to create a new session during 66 | the autosave process." 67 | (if (not (util.empty?)) 68 | (let [session# (find input)] 69 | (when handles.save? 70 | (do 71 | (if input (session.create! session#) (session.write! session#)) 72 | ;; the window from vim.notify was getting saved 73 | ;; simply run it later, it's not that important 74 | (vim.fn.timer_start 500 75 | (fn [] 76 | (vim.notify (.. "Saving session '" 77 | session#.name "'"))) 78 | {:repeat 0})))) 79 | (vim.notify "Neovim is empty, not saving"))) 80 | 81 | (defn cursor-hold [] 82 | "Process for how cursor hold should be run. 83 | We need to check if we even have a session to save, creating one if no. 84 | Use a predefined timer so we don't go through this with each hold. 85 | Only start cursorhold process if we absolutely want to create a session save. 86 | If we say no in this process, then we don't care about autosaving." 87 | ;; we do need save-on-hold to be *something* 88 | (if (= handles.save-on-hold nil) 89 | (set handles.save-on-hold true) 90 | ;; if save-on-hold true and init-save-timer is nil 91 | ;; basically we *do* want to save, but the timer is still going 92 | ;; just in case cursor-hold runs again 93 | (and handles.save-on-hold (not (?. handles :init-save-timer))) 94 | (do 95 | ;; only run this if we don't have a timer running for autosaves already 96 | (when handles.save-on-hold 97 | (do 98 | (set handles.init-save-timer 99 | (vim.fn.timer_start (* handles.autosave-interval 1000) 100 | (fn [] 101 | (save!) 102 | (vim.fn.timer_stop handles.init-save-timer) 103 | (set handles.init-save-timer nil)) 104 | {:repeat 0}))))))) 105 | -------------------------------------------------------------------------------- /fnl/plugins/session/store/init.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.store.init 2 | {autoload {a aniseed.core 3 | c aniseed.compile 4 | util plugins.session.utils 5 | json plugins.session.json 6 | format plugins.fnlfmt.format}}) 7 | 8 | ;;; Handles storing session information to a file 9 | ;;; Stored file fnl/plugins.session.stored.fnl: 10 | ;;; (module plugins.session.stored) 11 | ;;; (def sessions 12 | ;;; {session-1.name {} 13 | ;;; session-2.name {}}) 14 | 15 | ;; String -- module header for the session file 16 | (defonce header "(module plugins.session.stored)\n") 17 | 18 | ;; String -- table definition with string format 19 | (defonce tbl "(defn sessions []\n%s\n )") 20 | 21 | ;; String -- relative config path 22 | (defonce config-path (.. (vim.loop.os_getenv :HOME) :/.config/nvim/)) 23 | 24 | ;; String -- relative stored file path 25 | (defonce stored-file (.. config-path :fnl/plugins/session/stored.fnl)) 26 | 27 | ;; String -- relative stored file path 28 | (defonce stored-file-lua (.. config-path :lua/plugins/session/stored.lua)) 29 | 30 | (defn last [] "Get the last stored sessions table 31 | Because I am using a Fennel file to store all of this information, 32 | as opposed to a data file like JSON, I have to both compile the Fennel file 33 | with Aniseed and source the compiled Lua file with an Ex command" 34 | (vim.schedule_wrap (fn [] 35 | (c.file stored-file stored-file-lua))) 36 | (vim.schedule_wrap (fn [] 37 | (vim.cmd (.. "source " stored-file-lua)))) 38 | ((. (require :plugins.session.stored) :sessions))) 39 | 40 | (defn update [session] "Update sessions table with session provided 41 | Checks if session already exists and updates it" 42 | (let [stored (-> (json.<-file) 43 | (json.decode)) 44 | new {}] 45 | (when stored 46 | (each [k v (pairs stored)] 47 | (if (= session.name v.name) 48 | (tset new k session) ; update with new name value if exist 49 | (and (= session.dir v.dir) (not= session.name v.name)) 50 | (tset new session.name session) ; update with different name value, but same dir 51 | (tset new k v)))) ; add non-matching values unadulterated 52 | ;; check through output sessions table to see if we didn't add new session 53 | (if (not= (a.get new.name session.name) session.name) 54 | (tset new session.name session)) 55 | ;; make sure to remove a deleted session 56 | (if (= session.mark :delete) 57 | (tset new session.name nil)) 58 | new)) 59 | 60 | (defn file! [sessions] "Stores session table as a fnl file to a specified location 61 | Is a literal file, reconstructed upon each store 62 | Checks if file exists first before starting" 63 | (json.->file! (json.encode sessions))) 64 | 65 | ; (file! (update (util.generate$))) 66 | -------------------------------------------------------------------------------- /fnl/plugins/session/stored.json: -------------------------------------------------------------------------------- 1 | {"katcros-fnl":{"dir":"\/home\/kat\/Git Repos\/katcros-fnl\/","name":"katcros-fnl","last":"del command stuff"},"neovim-configs":{"dir":"\/home\/kat\/.config\/nvim\/","name":"neovim-configs","last":"neio"},"python":{"dir":"\/home\/kat\/Git Repos\/python-scripting\/","name":"python","last":"python"},"oblivion-plugins":{"dir":"\/home\/kat\/Git Repos\/oblivion-git\/","name":"oblivion-plugins","last":"menu-testing: getting scrolling working"},"kreative":{"dir":"\/home\/kat\/Git Repos\/kreative\/","name":"kreative"},"zigthings":{"dir":"\/home\/kat\/Git Repos\/ziglings\/","name":"zigthings","last":"83"},"kat.nvim":{"dir":"\/home\/kat\/Git Repos\/katdotnvim\/","name":"kat.nvim","last":"working on json"},"tree-sitter-obl":{"dir":"\/home\/kat\/Git Repos\/tree-sitter-obl\/","name":"tree-sitter-obl","last":"array substringing"},"analytical-chemistry":{"dir":"\/home\/kat\/","name":"analytical-chemistry","last":"Chapter 4"},"oblivion-language-reference":{"dir":"\/home\/kat\/Git Repos\/oblivion-lang-ref\/","name":"oblivion-language-reference","last":"test"},"dirbuf.nvim":{"dir":"\/home\/kat\/Git Repos\/dirbuf.nvim\/","name":"dirbuf.nvim","last":"getting parsing to work"},"katawful.github.io":{"dir":"\/home\/kat\/Git Repos\/katawful.github.io\/","name":"katawful.github.io","last":"regretting writing this post"},"init-norg":{"dir":"\/home\/kat\/.config\/nvim\/docs\/","name":"init-norg","last":"porting to lazy"},"nvim-startify":{"dir":"\/home\/kat\/Git Repos\/nvim-startify\/","name":"nvim-startify","last":"file"}} -------------------------------------------------------------------------------- /fnl/plugins/session/utils.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.session.utils 2 | {autoload {repos plugins.git.repos a aniseed.core s aniseed.string}}) 3 | 4 | ;;; Utilities for sessions 5 | 6 | ;; FN -- fix session name 7 | ;; @name -- name to fix 8 | (defn fix-name [name] "Fixes session name that comes from a different source 9 | Removes all multibyte strings, at the cost of English only characters 10 | Makes sure to remove leading hypen 11 | Converts spaces to hyphens" 12 | (let [tbl []] 13 | (for [i 1 (name:len)] 14 | (let [char (name:sub i i)] 15 | (when (string.match char "[%z\001-\127][\128-\191]*$") 16 | (tset tbl i (: char :lower))) 17 | (if (= (name:sub i i) " ") 18 | (tset tbl i "-")))) 19 | (let [name-tbl (a.vals tbl)] 20 | (if (= (. name-tbl 1) "-") 21 | (table.remove name-tbl 1)) 22 | (s.join name-tbl)))) 23 | 24 | ;; FN -- generates a table of needed information for sessions 25 | (defn generate$ [] "Generate the needed information for the user for a session 26 | Parses tables from plugins.git.repos for names I use, making sure to fix them 27 | Asks for input if a matched directory was not found 28 | Asks for input for last thing done for this session" 29 | (let [cur-dir (.. (vim.loop.cwd) "/") 30 | ; added a / to the end so we could always find cur-dir 31 | session {}] 32 | (each [_ v (pairs repos.dotfiles)] 33 | (if (= cur-dir v.dir) 34 | (do 35 | (tset session :dir v.dir) 36 | (tset session :name (fix-name v.name))))) 37 | (each [_ v (pairs repos.neovim-plugins)] 38 | (if (= cur-dir v.dir) 39 | (do 40 | (tset session :dir v.dir) 41 | (tset session :name (fix-name v.name))))) 42 | (each [_ v (pairs repos.git-repos)] 43 | (if (= cur-dir v.dir) 44 | (do 45 | (tset session :dir v.dir) 46 | (tset session :name (fix-name v.name))))) 47 | (if (not session.dir) 48 | (do 49 | (tset session :dir cur-dir) 50 | (vim.ui.input {:prompt "Enter a session name: "} 51 | (fn [input] 52 | (tset session :name (fix-name input)))))) 53 | (vim.ui.input {:prompt "Describe the last thing you were doing: "} 54 | (fn [input] 55 | (tset session :last input))) 56 | session)) 57 | 58 | (defn empty? [] 59 | "Is the current Neovim session empty? 60 | We don't want to deal with sessions when we just booted up Neovim" 61 | (let [buffers (vim.api.nvim_exec :buffers true)] 62 | (if (= (length buffers) 0) true false))) 63 | 64 | (defn except [dir] "Don't make a session in any directory contained in dir") 65 | -------------------------------------------------------------------------------- /fnl/plugins/startify/commands.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.startify.commands 2 | {autoload {configs plugins.startify.config} 3 | require-macros [katcros-fnl.macros.nvim.api.utils.macros]}) 4 | 5 | ;;; User commands for startify 6 | 7 | (command- :KatStart 8 | (fn [] 9 | (configs.update-variables) 10 | ((. vim.fn "startify#insane_in_the_membrane") 0 1)) 11 | "Open a Startify window with fresh vars") 12 | -------------------------------------------------------------------------------- /fnl/plugins/startify/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.startify.config 2 | {autoload {runners plugins.startify.runners} 3 | require-macros [katcros-fnl.macros.nvim.api.options.macros 4 | katcros-fnl.macros.nvim.api.autocommands.macros]}) 5 | 6 | ;;; Configs for vim-startify 7 | ;;; https://github.com/mhinz/vim-startify 8 | 9 | ;; FN -- gets padding size needed 10 | (defn padding-size [] (let [width (vim.api.nvim_win_get_width 0) 11 | padding (if (> width 100) 12 | (math.floor (/ (- width 80) 2)) 13 | 4)] 14 | padding)) 15 | 16 | ;; Key -- key/value table for storing the last padding 17 | (def padding {:last 0}) 18 | 19 | ;; FN -- amount of whitespace needed 20 | ;; @amount -- amount of whitespace 21 | (defn whitespace-size [amount] (var output "") 22 | (for [i 0 (- amount 9)] 23 | (set output (string.format "%s " output))) output) 24 | 25 | ; (set vim.g.ascii 26 | ; [ 27 | ; " /( ,,,,, )\\ " 28 | ; " _\\,;;;;;;;,/_ " 29 | ; " .-'; ;;;;;;;;; ;'-. " 30 | ; " '.__/`_ / \\ _`\\__.' " 31 | ; " | (')| |(') | " 32 | ; " | .--' '--. | " 33 | ; " |/ o o \\| " 34 | ; " | | " 35 | ; " / \\ _..=.._ / \\ " 36 | ; " /:. '._____.' \\ " 37 | ; " ;::' / \\ .; " 38 | ; " | _|_ _|_ ::| " 39 | ; " .-| '==o==' '|-. " 40 | ; " / | . / \\ | \\ " 41 | ; " | | ::| | | .| " 42 | ; " | ( ') (. )::| " 43 | ; " |: | |; U U U ;|:: | `| " 44 | ; " |' | | \\ U U / |' | | " 45 | ; " ##V| |_/`\"\"\"`\\_| |V## " 46 | ; " ##V## ##V## "]) 47 | (set vim.g.ascii 48 | [" ░░ ░░ " 49 | " ░░ ░░ " 50 | " ░░░░ ░░░░ " 51 | " ▒▒▒▒▒▒░░ ░░▒▒▒▒▒▒ " 52 | " ▒▒░░ ░░▒▒ " 53 | " ████████████░░░░░░░░ " 54 | " ░░░░░░ ▓▓▓▓▓▓▓▓▓▓ ░░ ░░░░░░ " 55 | " ░░ ░░ ████▓▓▓▓▓▓▓▓▓▓ ░░░░ ░░ ░░ " 56 | " ░░ ░░░░ ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░ ░░░░░░ ░░ " 57 | " ░░░░░░░░░░██▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░░░░░░░░░░░ ██ " 58 | " ░░░░░░ ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░ ░░░░░░██████▓▓██ " 59 | " ██▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ░░ ▓▓▓▓▓▓▓▓▓▓██ " 60 | " ░░▓▓▓▓▓▓▓▓▓▓██▓▓ ██ ░░ ██▓▓▓▓▓▓▓▓▓▓██ " 61 | " ░░ ▓▓▓▓▓▓██▓▓██ ██ ██ ░░ ██▓▓▓▓▓▓████ " 62 | " ░░ ▓▓▓▓▓▓░░ ░░ ██▓▓▓▓▓▓ " 63 | " ░░ ▒▒▒▒▒▒▒▒ ░░ ██▓▓██ " 64 | " ░░░░ ░░ ░░▒▒░░░░░░░░▒▒▒▒ ░░ ▒▒░░░░ " 65 | " ░░ ▒▒░░░░ ▒▒░░░░░░░░░░░░░░░░▒▒ ░░░░ ░░ ░░ " 66 | " ░░▒▒░░░░▒▒░░░░░░░░▒▒░░░░▒▒░░ ░░ ░░ " 67 | " ██▓▓▓▓▒▒░░░░░░░░░░░░░░░░▒▒░░░░░░ ░░ ░░ " 68 | " ██▓▓▓▓▓▓▓▓▒▒░░░░░░░░░░░░▒▒░░░░ ░░ ░░ ░░ " 69 | " ██▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒░░░░ ░░ ░░ ░░ " 70 | " ░░ ▓▓▓▓ ░░░░░░░░░░░░░░░░ ░░ ░░ " 71 | " ░░ ▓▓▓▓░░ " 72 | " ░░ ░░░░░░░░░░░░ ██▓▓██ " 73 | " ░░ ░░░░░░░░░░░░░░░░░░░░░░░░▓▓▓▓▓▓██ " 74 | " ░░ ░░░░░░░░ ░░░░░░░░ ░░░░░░▓▓▓▓████ " 75 | " ░░ ░░░░░░░░ ░░░░░░▓▓██████ " 76 | " ░░░░░░░░░░ ░░░░░░░░▒▒ " 77 | " ▓▓▒▒▒▒▒▒▒▒██ ▓▓▒▒▒▒▒▒▒▒▓▓ " 78 | " ▓▓▒▒▓▓▒▒▓▓▓▓ ▓▓▒▒▓▓▒▒▓▓▓▓ " 79 | " ░░▓▓▓▓▓▓▓▓ ▒▒▓▓▓▓▓▓░░ "]) 80 | 81 | (defn update-variables [] (set padding.last (padding-size)) 82 | (set-vars g 83 | {:startify_lists [{:type :commands 84 | :header [(.. (whitespace-size (padding-size)) 85 | :Commands)]} 86 | {:type :files 87 | :header [(.. (whitespace-size (padding-size)) 88 | "Recent Global Files")]} 89 | {:type :dir 90 | :header [(.. (whitespace-size (padding-size)) 91 | "Recent Files in: " 92 | (vim.fn.getcwd))]} 93 | {:type startShowCurrRepo 94 | :header [(.. (whitespace-size (padding-size)) 95 | "Commits in: " (vim.fn.getcwd))]} 96 | {:type :sessions 97 | :header [(.. (whitespace-size (padding-size)) 98 | :Sessions)]} 99 | {:type :bookmarks 100 | :header [(.. (whitespace-size (padding-size)) 101 | :Bookmarks)]}] 102 | :startify_padding_left (padding-size) 103 | :startify_files_number 5 104 | :startify_bookmarks [{:i "~/.config/nvim/fnl/init.fnl"} 105 | {:z "~/.zshrc"} 106 | {:c "~/.config/i3/config"}] 107 | :startify_fortune_use_unicode 1 108 | :startify_commands [{:s [" Search for directory" 109 | :KatFZFSearchDir]} 110 | {:f [" Search for file" 111 | :KatFZFOpenFile]} 112 | {:b [" Search for buffer" 113 | :KatFZFOpenBuffer]} 114 | {:m [" Search for marks" 115 | :KatFZFOpenMarks]} 116 | {:h [" Search help tags" 117 | :KatFZFOpenHelpTags]} 118 | {:d [" Search dotfile repos" 119 | :KatFZFGetDotfiles]} 120 | {:n [" Search Neovim repos" 121 | :KatFZFGetNeovimPlugins]} 122 | {:g [" Search git repos" 123 | :KatFZFGetGitRepos]} 124 | {:S [" Open sessions" 125 | :KatSessionSearch]} 126 | {:N [" Open Neorg Workspace" 127 | :KatFZFSearchNeorgWorkspaces]}] 128 | :startify_custom_header ((. vim.fn "startify#center") vim.g.ascii)})) 129 | 130 | (update-variables) 131 | (update-variables) 132 | 133 | (let [startify (def-aug- :startifyResize)] 134 | (aug- startify (auc- [:VimResized :WinEnter :VimEnter :WinNew :WinLeave] "*" 135 | (fn [args] 136 | (runners.kat-start-delay 0 args.buf)) 137 | "Update startify on window changes"))) 138 | 139 | ;; Call maps and user commands 140 | (require :plugins.startify.maps) 141 | (require :plugins.startify.commands) 142 | -------------------------------------------------------------------------------- /fnl/plugins/startify/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.startify.maps 2 | {autoload {runners plugins.startify.runners} 3 | require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 4 | 5 | ;;; Maps for startify 6 | 7 | (nno- :sn (fn [] 8 | (runners.kat-start :none)) 9 | "Open Startify in window") 10 | 11 | (nno- :ss (fn [] 12 | (runners.kat-start :hor)) 13 | "Open Startify in split") 14 | 15 | (nno- :sv (fn [] 16 | (runners.kat-start :ver)) 17 | "Open Startify in vsplit") 18 | 19 | (nno- :st (fn [] 20 | (runners.kat-start :tab)) 21 | "Open Startify in tab") 22 | -------------------------------------------------------------------------------- /fnl/plugins/startify/runners.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.startify.runners 2 | {autoload {configs plugins.startify.config} 3 | require-macros [katcros-fnl.macros.nvim.api.options.macros 4 | katcros-fnl.macros.nvim.api.utils.macros 5 | katcros-fnl.macros.nvim.api.maps.macros 6 | katcros-fnl.macros.nvim.api.autocommands.macros]}) 7 | 8 | (defn startShowCurrRepo [] ; make sure we are in a git repo 9 | (vim.cmd "silent! !git rev-parse --is-inside-work-tree") 10 | (when (= vim.v.shell_error 0) ; create the table of git commits 11 | (let [commits (vim.fn.systemlist "git log --oneline | head -n5") 12 | output []] ; this gets the info we need 13 | (local lineRegex (vim.regex "\\s\\zs.*")) ; this is so we can use fugitive on it 14 | (local showRegex (vim.regex "^\\x\\+")) 15 | (local iter 1) ; iterate over the initial table to construct things 16 | (each [_ v (ipairs commits)] ; create the 'line': strings 17 | (local index (lineRegex:match_str v)) 18 | (local line (v:sub (+ index 1))) ; create the 'cmd': strings 19 | (local show (v:sub 0 (- index 1))) ; create the table 20 | (table.insert output {: line :cmd (.. "Git show " show)}) 21 | (+ iter 1)) 22 | output))) 23 | 24 | (defn callback [buf] 25 | (if (= vim.b.current_syntax :startify) 26 | (do 27 | (configs.update-variables) 28 | ((. vim.fn "startify#insane_in_the_membrane") 0)))) 29 | 30 | (defn kat-start-delay [time# buf] 31 | (if (= vim.b.current_syntax :startify) 32 | (do 33 | (if (or (> configs.padding.last 0) 34 | (= configs.padding.last (configs.padding-size))) 35 | (let [timer (vim.loop.new_timer)] 36 | (timer:start time# 0 37 | (vim.schedule_wrap (fn [] 38 | (callback buf))))))))) 39 | 40 | (defn kat-start [split] 41 | (match split 42 | :none (do 43 | (configs.update-variables) 44 | ((. vim.fn "startify#insane_in_the_membrane") 0 1)) 45 | :hor (do 46 | (vim.cmd :split) 47 | (configs.update-variables) 48 | ((. vim.fn "startify#insane_in_the_membrane") 0 1)) 49 | :ver (do 50 | (vim.cmd :vsplit) 51 | (configs.update-variables) 52 | ((. vim.fn "startify#insane_in_the_membrane") 0 1)) 53 | :tab (do 54 | (vim.cmd :tabnew) 55 | (configs.update-variables) 56 | ((. vim.fn "startify#insane_in_the_membrane") 0 1)))) 57 | -------------------------------------------------------------------------------- /fnl/plugins/tabby/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.tabby.config) 2 | 3 | ;;; Configs for tabby.nvim 4 | ;;; https://github.com/nanozuki/tabby.nvim 5 | 6 | ;; Setup -- setup table for tabby 7 | ((. (require :tabby) :setup) {:tabline (. (require :tabby.presets) 8 | :active_wins_at_tail)}) 9 | 10 | ; ((. (require :tabby) :setup) {}) 11 | -------------------------------------------------------------------------------- /fnl/plugins/todo-comments/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.todo-comments.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | (opt- :todo-comments :setup {}) 5 | -------------------------------------------------------------------------------- /fnl/plugins/traveller/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.traveller.config) 2 | 3 | ; ((. (require :nvim-traveller) :setup) {:replace_netrw false 4 | ; :sync_cwd false 5 | ; :show_hidden true}) 6 | 7 | ; (require :plugins.traveller.maps) 8 | -------------------------------------------------------------------------------- /fnl/plugins/traveller/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.traveller.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | (def- traveller (require :nvim-traveller)) 5 | 6 | (nno- "-" traveller.open_navigation "Open Traveller window") 7 | -------------------------------------------------------------------------------- /fnl/plugins/treesitter/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.treesitter.config 2 | {autoload {sys system} 3 | require-macros [katcros-fnl.macros.lispism.macros 4 | katcros-fnl.macros.nvim.api.maps.macros]}) 5 | 6 | ;;; Configs for tree-sitter 7 | 8 | ;; Install norg parsers 9 | (var parser-configs (opt- :nvim-treesitter.parsers :get_parser_configs)) 10 | 11 | (set parser-configs.obl 12 | {:install_info {:url "/home/kat/Repos/TREESITTER/tree-sitter-obl/" 13 | :files [:src/parser.c :src/scanner.cc] 14 | :branch :main 15 | :require_generate_from_grammar true} 16 | :filetype :obl}) 17 | 18 | (set parser-configs.hypr 19 | {:install_info {:url "https://github.com/luckasRanarison/tree-sitter-hypr" 20 | :files [:src/parser.c] 21 | :branch :master} 22 | :filetype :hypr}) 23 | 24 | (vim.filetype.add 25 | {:extension {:obl :obl} 26 | :pattern {".*.obl" :obl 27 | ".*.obse" :obl 28 | ".*.obscript" :obl}}) 29 | 30 | ;; Seq -- sequential table of languages 31 | (def- languages [:query 32 | :rst 33 | :clojure 34 | :vimdoc 35 | :gitattributes 36 | :gitcommit 37 | :zig 38 | :python 39 | :regex 40 | :fennel 41 | :lua 42 | :html 43 | :css 44 | :obl 45 | :hypr 46 | :cpp 47 | :c 48 | :latex 49 | :vim 50 | :bash 51 | :javascript 52 | :markdown 53 | :markdown_inline]) 54 | 55 | (if (not= sys.name :builder) 56 | (table.insert languages :obl)) 57 | 58 | ;; Setup -- setup table for nvim-treesitter 59 | ;; https://github.com/nvim-treesitter/nvim-treesitter 60 | (opt- :nvim-treesitter.configs :setup 61 | {:ensure_installed languages 62 | :highlight {:enable true} 63 | :indent {:enable true} 64 | :incremental_selection {:enable true 65 | :keymaps {:init_selection :gnn 66 | :node_decremental :grm 67 | :node_incremental :grn 68 | :scope_incremental :grc}}}) 69 | -------------------------------------------------------------------------------- /fnl/plugins/treesitter/context/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.treesitter.context.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for treesitter context 5 | ;;; https://github.com/nvim-treesitter/nvim-treesitter-context 6 | 7 | ;; Setup -- setup table for treesitter-context 8 | (opt- :treesitter-context :setup {:enable true}) 9 | -------------------------------------------------------------------------------- /fnl/plugins/treesitter/docs/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.treesitter.docs.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for nvim-tree-docs 5 | ;;; https://github.com/nvim-treesitter/nvim-tree-docs 6 | 7 | ;; Setup -- setup table for tree-docs 8 | (opt- :nvim-treesitter.configs :setup {:tree_docs {:enable false}}) 9 | -------------------------------------------------------------------------------- /fnl/plugins/treesitter/playground/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.treesitter.playground.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ;;; Configs for treesitter playground 5 | ;;; https://github.com/nvim-treesitter/playground 6 | 7 | ;; Setup -- setup table for playground 8 | (opt- :nvim-treesitter.configs :setup 9 | {:playground {:enable true 10 | :updatetime 205 11 | :persist_queries false 12 | :keybindings {:toggle_query_editor :o 13 | :toggle_hl_groups :i 14 | :toggle_injected_languages :t 15 | :toggle_anonymous_nodes :a 16 | :toggle_language_display :I 17 | :focus_language :f 18 | :unfocus_language :F 19 | :update :R 20 | :goto_node : 21 | :show_help "?"}}}) 22 | 23 | ;; Call maps 24 | (require :plugins.treesitter.playground.maps) 25 | -------------------------------------------------------------------------------- /fnl/plugins/treesitter/playground/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.treesitter.playground.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | ;;; Maps for playground 5 | 6 | ; show highlight 7 | (nno- :h :TSHighlightCapturesUnderCursor 8 | "Show highlight under cursor") 9 | -------------------------------------------------------------------------------- /fnl/plugins/treesitter/rainbow/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.treesitter.rainbow.config 2 | {autoload {rainbow ts-rainbow} 3 | require-macros [katcros-fnl.macros.lispism.macros]}) 4 | 5 | ;;; Configs for TS-rainbow 6 | ;;; https://github.com/p00f/nvim-ts-rainbow 7 | 8 | ;; Setup -- setup table for rainbow 9 | (opt- :nvim-treesitter.configs :setup 10 | {:rainbow {:enable true :strategy rainbow.strategy.global 11 | :queries {1 :rainbow-parens 12 | :fennel :rainbow-parens 13 | :html :rainbow-tags 14 | :latex :rainbow-blocks}}}) 15 | -------------------------------------------------------------------------------- /fnl/plugins/ultisnips/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.ultisnips.config 2 | {require-macros [katcros-fnl.macros.nvim.api.options.macros]}) 3 | 4 | ;;; Configs for Ultisnips 5 | ;;; https://github.com/SirVer/ultisnips 6 | 7 | (set-vars g {:UltiSnipsExpandTrigger : 8 | :UltiSnipsJumpForwardTrigger : 9 | :UltiSnipsEditSplit :context 10 | :UltiSnipsJumpBackwardsTrigger :}) 11 | -------------------------------------------------------------------------------- /fnl/plugins/vimwiki/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.vimwiki.config 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | ;;; Configs for vimwiki 5 | ;;; https://github.com/vimwiki/vimwiki 6 | 7 | (require :plugins.vimwiki.maps) 8 | 9 | (nno- :WW ":VimwikiDiaryIndex" "Open Vimwiki diary") 10 | (nno- :ww ":VimwikiIndex" "Open Vimwiki index") 11 | 12 | ; ALL VIMWIKI CONFIGS IS IN BEFORE.VIM 13 | ; IT MUST LOAD VERY EARLY TO WORK 14 | -------------------------------------------------------------------------------- /fnl/plugins/vimwiki/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.vimwiki.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | ;;; Maps for vimwiki 5 | 6 | (nno- :WW ":VimwikiDiaryIndex" "Open Vimwiki diary") 7 | (nno- :ww ":VimwikiIndex" "Open Vimwiki index") 8 | -------------------------------------------------------------------------------- /fnl/plugins/wilder/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.wilder.config) 2 | 3 | ;;; Configs for wilder.nvim 4 | ;;; https://github.com/gelguy/wilder.nvim 5 | 6 | ((. vim.fn "wilder#setup") {:modes {1 ":" 2 "/" 3 "?"}}) 7 | 8 | ; ((. vim.fn :wilder#set_option) :renderer ((. vim.fn :wilder#popupmenu_renderer) ((. vim.fn :wilder#popupment_border_theme) {:highlights {:border :Normal} :border :rounded}))) 9 | 10 | (vim.cmd " 11 | call wilder#set_option('renderer', wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ 'highlights': { 'border': 'Normal', }, 'border': 'rounded', }))) 12 | ") 13 | -------------------------------------------------------------------------------- /fnl/plugins/zenmode/config.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.zenmode.config 2 | {require-macros [katcros-fnl.macros.lispism.macros]}) 3 | 4 | ((. (require :zen-mode) :setup) {:window {:width 140} 5 | :plugins {:options {:ruler true}}}) 6 | 7 | (require :plugins.zenmode.maps) 8 | -------------------------------------------------------------------------------- /fnl/plugins/zenmode/maps.fnl: -------------------------------------------------------------------------------- 1 | (module plugins.zenmode.maps 2 | {require-macros [katcros-fnl.macros.nvim.api.maps.macros]}) 3 | 4 | 5 | (nno- :Gy (fn [] ((. (require :zen-mode) :toggle))) "Activate zen mode") 6 | -------------------------------------------------------------------------------- /fnl/system.fnl: -------------------------------------------------------------------------------- 1 | (module system) 2 | 3 | ;;; System specific information 4 | 5 | ;; String -- home path acquired from environment 6 | (defonce home-path vim.env.HOME) 7 | 8 | ;; String -- trimmed system name 9 | (defonce name (string.sub (vim.fn.system "uname -n") 1 -2)) 10 | 11 | ;; String -- path for git repo based on machine 12 | (defonce git-path (.. home-path "/Repos/")) 13 | 14 | ;; String -- current colorscheme background 15 | (defonce background vim.o.background) 16 | 17 | ;; String -- raw git root 18 | (defonce git-root "/Repos/") 19 | -------------------------------------------------------------------------------- /indent/oblxml.vim: -------------------------------------------------------------------------------- 1 | " Language: XML 2 | " Maintainer: Christian Brabandt 3 | " Oblivion Schema XML Maintainer: Kat 4 | " Repository: https://github.com/chrisbra/vim-xml-ftplugin 5 | " Previous Maintainer: Johannes Zellner 6 | " Last Changed: 2020 Nov 4th 7 | " Last Change: 8 | " 20200529 - Handle empty closing tags correctly 9 | " 20191202 - Handle docbk filetype 10 | " 20190726 - Correctly handle non-tagged data 11 | " 20190204 - correctly handle wrap tags 12 | " https://github.com/chrisbra/vim-xml-ftplugin/issues/5 13 | " 20190128 - Make sure to find previous tag 14 | " https://github.com/chrisbra/vim-xml-ftplugin/issues/4 15 | " 20181116 - Fix indentation when tags start with a colon or an underscore 16 | " https://github.com/vim/vim/pull/926 17 | " 20181022 - Do not overwrite indentkeys setting 18 | " https://github.com/chrisbra/vim-xml-ftplugin/issues/1 19 | " 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 20 | 21 | " NOTES FOR OBLIVION SCHEMA XML: 22 | " This syntax file is directly copied from the maintree XML syntax file. 23 | " This is purely meant to improve coloring specifically for Oblivion's XML 24 | " Schema. The filetype, thus, must be set to "oblxml" to use this. 25 | 26 | " 27 | " Notes: 28 | " 1) does not indent pure non-xml code (e.g. embedded scripts) 29 | " 2) will be confused by unbalanced tags in comments 30 | " or CDATA sections. 31 | " 2009-05-26 patch by Nikolai Weibull 32 | " TODO: implement pre-like tags, see xml_indent_open / xml_indent_close 33 | 34 | " Only load this indent file when no other was loaded. 35 | if exists("b:did_indent") 36 | finish 37 | endif 38 | let b:did_indent = 1 39 | let s:keepcpo= &cpo 40 | set cpo&vim 41 | 42 | " [-- local settings (must come before aborting the script) --] 43 | " Attention: Parameter use_syntax_check is used by the docbk.vim indent script 44 | setlocal indentexpr=XmlIndentGet(v:lnum,1) 45 | setlocal indentkeys=o,O,*,<>>,<<>,/,{,},!^F 46 | " autoindent: used when the indentexpr returns -1 47 | setlocal autoindent 48 | 49 | let b:undo_indent = "setl ai< inde< indk<" 50 | 51 | if !exists('b:xml_indent_open') 52 | let b:xml_indent_open = '.\{-}<[:A-Z_a-z]' 53 | " pre tag, e.g.
54 | " let b:xml_indent_open = '.\{-}<[/]\@!\(address\)\@!' 55 | endif 56 | 57 | if !exists('b:xml_indent_close') 58 | let b:xml_indent_close = '.\{-}.\{-}' 59 | " end pre tag, e.g.
60 | " let b:xml_indent_close = '.\{-}XmlIndentWithPattern(line, pat) 79 | let s = substitute('x'.a:line, a:pat, "\1", 'g') 80 | return strlen(substitute(s, "[^\1].*$", '', '')) 81 | endfun 82 | 83 | " [-- check if it's xml --] 84 | fun! XmlIndentSynCheck(lnum) 85 | if &syntax != '' 86 | let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name') 87 | let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') 88 | if syn1 != '' && syn1 !~ 'xml' && syn2 != '' && syn2 !~ 'xml' 89 | " don't indent pure non-xml code 90 | return 0 91 | endif 92 | endif 93 | return 1 94 | endfun 95 | 96 | " [-- return the sum of indents of a:lnum --] 97 | fun! XmlIndentSum(line, style, add) 98 | if IsXMLContinuation(a:line) && a:style == 0 && !IsXMLEmptyClosingTag(a:line) 99 | " no complete tag, add one additional indent level 100 | " but only for the current line 101 | return a:add + shiftwidth() 102 | elseif HasNoTagEnd(a:line) 103 | " no complete tag, return initial indent 104 | return a:add 105 | endif 106 | if a:style == match(a:line, '^\s*XmlIndentWithPattern(a:line, b:xml_indent_open) 109 | \ - XmlIndentWithPattern(a:line, b:xml_indent_close) 110 | \ - XmlIndentWithPattern(a:line, '.\{-}/>'))) + a:add 111 | else 112 | return a:add 113 | endif 114 | endfun 115 | 116 | " Main indent function 117 | fun! XmlIndentGet(lnum, use_syntax_check) 118 | " Find a non-empty line above the current line. 119 | if prevnonblank(a:lnum - 1) == 0 120 | " Hit the start of the file, use zero indent. 121 | return 0 122 | endif 123 | " Find previous line with a tag (regardless whether open or closed, 124 | " but always restrict the match to a line before the current one 125 | " Note: xml declaration: 126 | " won't be found, as it is not a legal tag name 127 | let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. a:lnum .'l\)' 128 | let ptag = search(ptag_pattern, 'bnW') 129 | " no previous tag 130 | if ptag == 0 131 | return 0 132 | endif 133 | 134 | let pline = getline(ptag) 135 | let pind = indent(ptag) 136 | 137 | let syn_name_start = '' " Syntax element at start of line (excluding whitespace) 138 | let syn_name_end = '' " Syntax element at end of line 139 | let curline = getline(a:lnum) 140 | if a:use_syntax_check 141 | let check_lnum = XmlIndentSynCheck(ptag) 142 | let check_alnum = XmlIndentSynCheck(a:lnum) 143 | if check_lnum == 0 || check_alnum == 0 144 | return indent(a:lnum) 145 | endif 146 | let syn_name_end = synIDattr(synID(a:lnum, strlen(curline) - 1, 1), 'name') 147 | let syn_name_start = synIDattr(synID(a:lnum, match(curline, '\S') + 1, 1), 'name') 148 | let prev_syn_name_end = synIDattr(synID(ptag, strlen(pline) - 1, 1), 'name') 149 | " not needed (yet?) 150 | " let prev_syn_name_start = synIDattr(synID(ptag, match(pline, '\S') + 1, 1), 'name') 151 | endif 152 | 153 | if syn_name_end =~ 'Comment' && syn_name_start =~ 'Comment' 154 | return XmlIndentComment(a:lnum) 155 | elseif empty(syn_name_start) && empty(syn_name_end) && a:use_syntax_check 156 | " non-xml tag content: use indent from 'autoindent' 157 | if pline =~ b:xml_indent_close 158 | return pind 159 | elseif !empty(prev_syn_name_end) 160 | " only indent by an extra shiftwidth, if the previous line ends 161 | " with an XML like tag 162 | return pind + shiftwidth() 163 | else 164 | " no extra indent, looks like a text continuation line 165 | return pind 166 | endif 167 | endif 168 | 169 | " Get indent from previous tag line 170 | let ind = XmlIndentSum(pline, -1, pind) 171 | " Determine indent from current line 172 | let ind = XmlIndentSum(curline, 0, ind) 173 | return ind 174 | endfun 175 | 176 | func! IsXMLContinuation(line) 177 | " Checks, whether or not the line matches a start-of-tag 178 | return a:line !~ '^\s*<' && &ft =~# b:xml_indent_continuation_filetype 179 | endfunc 180 | 181 | func! HasNoTagEnd(line) 182 | " Checks whether or not the line matches '>' (so finishes a tag) 183 | return a:line !~ '>\s*$' 184 | endfunc 185 | 186 | func! IsXMLEmptyClosingTag(line) 187 | " Checks whether the line ends with an empty closing tag such as 188 | return a:line =~? '<[^>]*/>\s*$' 189 | endfunc 190 | 191 | " return indent for a commented line, 192 | " the middle part might be indented one additional level 193 | func! XmlIndentComment(lnum) 194 | let ptagopen = search('.\{-}<[:A-Z_a-z]\_[^/]\{-}>.\{-}', 'bnW') 195 | let ptagclose = search(b:xml_indent_close, 'bnW') 196 | if getline(a:lnum) =~ '' 214 | " end of comment, same as start of comment 215 | return indent(search('+ 368 | \ end=++ 369 | \ end=+/>+ 370 | \ fold 371 | \ contains=oblXmlTag,oblXmlEndTag,oblXmlRegion,oblXmlComment,oblXmlEntity,oblXmlProcessing,@oblXmlRegionHook,@Spell,oblXmlNumber,oblXmlString 372 | \ keepend 373 | \ extend 374 | 375 | 376 | " Processing instructions 377 | " This allows "?>" inside strings -- good idea? 378 | syn region oblXmlProcessing matchgroup=oblXmlProcessingDelim start="" contains=oblXmlAttrib,oblXmlEqual,oblXmlValue 379 | 380 | 381 | " synchronizing 382 | 383 | syn sync match oblXmlSyncComment grouphere oblXmlComment ++ 385 | 386 | " The following is slow on large documents (and the doctype is optional 387 | " syn sync match oblXmlSyncDT grouphere oblXmlDocType +\_.\(+ 389 | 390 | if exists('g:xml_syntax_folding') 391 | syn sync match oblXmlSync grouphere oblXmlRegion +\_.\(<[^ /!?<>"']\+\)\@=+ 392 | " syn sync match oblXmlSync grouphere oblXmlRegion "<[^ /!?<>"']*>" 393 | syn sync match oblXmlSync groupthere oblXmlRegion +"']\+>+ 394 | endif 395 | 396 | syn sync minlines=100 maxlines=200 397 | 398 | 399 | " The default highlighting. 400 | hi def link oblXmlTodo @text.todo 401 | hi def link oblXmlNote @text.note 402 | hi def link oblXmlWarn @text.warning 403 | hi def link oblXmlError @error 404 | hi def link oblXmlTag @tag 405 | hi def link oblXmlTagName @tag 406 | hi def link oblXmlTagNameTile @function.builtin 407 | hi def link oblXmlTagNameInclude @include 408 | hi def link oblXmlTagNameCustom @function 409 | hi def link oblXmlTagNameTrait @field 410 | hi def link oblXmlTagNameOperator @operator 411 | hi def link oblXmlEndTag Identifier 412 | hi def link oblXmlEntity @define 413 | hi def link oblXmlEntityPunct @punctuation 414 | hi def link oblXmlNumber @number 415 | hi def link oblXmlSelector @method 416 | hi def link oblXmlSelectorArgument @parameter 417 | hi def link oblXmlSelectedTrait @parameter 418 | hi def link oblXmlSelectorStart @punctuation.delimiter 419 | hi def link oblXmlSelectorEnd @punctuation.delimiter 420 | 421 | hi def link oblXmlAttribPunct Comment 422 | hi def link oblXmlAttrib @attribute 423 | 424 | hi def link oblXmlValue @string.special 425 | hi def link oblXmlString @string 426 | hi def link oblXmlComment Comment 427 | hi def link oblXmlCommentStart oblXmlComment 428 | hi def link oblXmlCommentPart Comment 429 | hi def link oblXmlCommentError Error 430 | hi def link oblXmlCommentContent @text.literal 431 | hi def link oblXmlError Error 432 | 433 | hi def link oblXmlProcessingDelim Comment 434 | hi def link oblXmlProcessing Type 435 | 436 | hi def link oblXmlDocTypeDecl Function 437 | hi def link oblXmlDocTypeKeyword Statement 438 | hi def link oblXmlInlineDTD Function 439 | 440 | let b:current_syntax = "xml" 441 | 442 | let &cpo = s:xml_cpo_save 443 | unlet s:xml_cpo_save 444 | 445 | " vim: ts=4 446 | --------------------------------------------------------------------------------