From c2813116579ce7ef37a8272b9a7d561209648342 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sun, 12 Jun 2022 20:25:17 +0100 Subject: [PATCH] feat(vim): start moving back --- .../core/files/oh-my-zsh/custom/fzf.zsh | 3 +- .../core/files/vim/UltiSnips/all.snippets | 24 -- .../files/vim/UltiSnips/gitcommit.snippets | 45 --- .../core/files/vim/UltiSnips/go.snippets | 77 ---- .../core/files/vim/UltiSnips/html.snippets | 172 --------- .../files/vim/UltiSnips/html_php.snippets | 47 --- .../files/vim/UltiSnips/javascript.snippets | 93 ----- .../files/vim/UltiSnips/markdown.snippets | 42 --- .../vim/UltiSnips/pdv_templates/attribute.tpl | 5 - .../vim/UltiSnips/pdv_templates/class.tpl | 11 - .../vim/UltiSnips/pdv_templates/const.tpl | 3 - .../vim/UltiSnips/pdv_templates/function.tpl | 5 - .../vim/UltiSnips/pdv_templates/interface.tpl | 5 - .../vim/UltiSnips/pdv_templates/trait.tpl | 3 - .../core/files/vim/UltiSnips/php.snippets | 200 ---------- .../vim/UltiSnips/php_codeception.snippets | 35 -- .../files/vim/UltiSnips/php_html.snippets | 65 ---- .../core/files/vim/UltiSnips/php_yii.snippets | 18 - .../core/files/vim/UltiSnips/puppet.snippets | 66 ---- .../core/files/vim/UltiSnips/sh.snippets | 35 -- .../files/vim/UltiSnips/snippets.snippets | 18 - .../files/vim/UltiSnips/typescript.snippets | 31 -- .../core/files/vim/after/ftplugin/json.vim | 1 + .../core/files/vim/after/plugin/vim-jsx.vim | 4 - .../core/files/vim/autoload/aa/buffer.vim | 58 --- .../core/files/vim/autoload/aa/emmet.vim | 21 -- .../core/files/vim/autoload/aa/fold.vim | 94 ----- .../core/files/vim/autoload/aa/functions.vim | 75 ---- .../files/vim/autoload/aa/languagetool.vim | 6 - .../core/files/vim/autoload/aa/supertab.vim | 36 -- .../core/files/vim/autoload/pathogen.vim | 353 ------------------ site-modules/core/files/vim/coc-settings.json | 63 ---- .../core/files/vim/colors/my_default.vim | 28 -- .../core/files/vim/ftdetect/javascript.vim | 29 -- .../core/files/vim/ftdetect/php.class.vim | 28 -- .../core/files/vim/ftdetect/typescript.vim | 6 - site-modules/core/files/vim/ftplugin/diff.vim | 4 - .../core/files/vim/ftplugin/gitcommit.vim | 15 - site-modules/core/files/vim/ftplugin/json.vim | 1 + site-modules/core/files/vim/ftplugin/mail.vim | 6 - .../core/files/vim/ftplugin/markdown.vim | 7 - site-modules/core/files/vim/ftplugin/org.vim | 4 + site-modules/core/files/vim/ftplugin/php.vim | 8 - site-modules/core/files/vim/init.vim | 246 +++--------- .../core/files/vim/pack/bundle/opt/.gitignore | 2 - .../files/vim/pack/bundle/start/.gitignore | 2 - .../files/vim/plugin/active-highlight.vim | 13 - site-modules/core/files/vim/plugin/colors.vim | 31 +- .../core/files/vim/plugin/comments.lua | 2 + .../core/files/vim/plugin/completion.lua | 55 +++ site-modules/core/files/vim/plugin/defer.vim | 40 -- .../core/files/vim/plugin/deoplete.vim | 13 - site-modules/core/files/vim/plugin/emmet.vim | 12 - .../core/files/vim/plugin/file-ops.vim | 46 +++ site-modules/core/files/vim/plugin/format.vim | 183 --------- .../core/files/vim/plugin/functions.vim | 77 ---- site-modules/core/files/vim/plugin/js.vim | 4 - site-modules/core/files/vim/plugin/lint.lua | 47 +++ site-modules/core/files/vim/plugin/lsp.lua | 51 +++ site-modules/core/files/vim/plugin/lsv.vim | 38 -- .../core/files/vim/plugin/nerdtree.vim | 34 -- site-modules/core/files/vim/plugin/org.lua | 11 + .../core/files/vim/plugin/snippets.lua | 100 +++++ .../core/files/vim/plugin/status-line.vim | 10 + site-modules/core/files/vim/plugin/term.vim | 78 ---- .../core/files/vim/plugin/treesitter.lua | 12 + .../core/files/vim/plugin/ultisnips.vim | 16 - site-modules/core/files/zshrc | 2 +- site-modules/core/manifests/vim.pp | 95 +++-- site-modules/core/templates/git/gitconfig.erb | 2 +- 70 files changed, 462 insertions(+), 2610 deletions(-) delete mode 100644 site-modules/core/files/vim/UltiSnips/all.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/gitcommit.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/go.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/html.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/html_php.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/javascript.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/markdown.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/pdv_templates/attribute.tpl delete mode 100644 site-modules/core/files/vim/UltiSnips/pdv_templates/class.tpl delete mode 100644 site-modules/core/files/vim/UltiSnips/pdv_templates/const.tpl delete mode 100644 site-modules/core/files/vim/UltiSnips/pdv_templates/function.tpl delete mode 100644 site-modules/core/files/vim/UltiSnips/pdv_templates/interface.tpl delete mode 100644 site-modules/core/files/vim/UltiSnips/pdv_templates/trait.tpl delete mode 100644 site-modules/core/files/vim/UltiSnips/php.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/php_codeception.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/php_html.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/php_yii.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/puppet.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/sh.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/snippets.snippets delete mode 100644 site-modules/core/files/vim/UltiSnips/typescript.snippets create mode 100644 site-modules/core/files/vim/after/ftplugin/json.vim delete mode 100644 site-modules/core/files/vim/after/plugin/vim-jsx.vim delete mode 100644 site-modules/core/files/vim/autoload/aa/buffer.vim delete mode 100644 site-modules/core/files/vim/autoload/aa/emmet.vim delete mode 100644 site-modules/core/files/vim/autoload/aa/fold.vim delete mode 100644 site-modules/core/files/vim/autoload/aa/functions.vim delete mode 100644 site-modules/core/files/vim/autoload/aa/languagetool.vim delete mode 100644 site-modules/core/files/vim/autoload/aa/supertab.vim delete mode 100644 site-modules/core/files/vim/autoload/pathogen.vim delete mode 100644 site-modules/core/files/vim/coc-settings.json delete mode 100644 site-modules/core/files/vim/colors/my_default.vim delete mode 100644 site-modules/core/files/vim/ftdetect/javascript.vim delete mode 100644 site-modules/core/files/vim/ftdetect/php.class.vim delete mode 100644 site-modules/core/files/vim/ftdetect/typescript.vim delete mode 100644 site-modules/core/files/vim/ftplugin/diff.vim delete mode 100644 site-modules/core/files/vim/ftplugin/gitcommit.vim create mode 100644 site-modules/core/files/vim/ftplugin/json.vim delete mode 100644 site-modules/core/files/vim/ftplugin/mail.vim delete mode 100644 site-modules/core/files/vim/ftplugin/markdown.vim create mode 100644 site-modules/core/files/vim/ftplugin/org.vim delete mode 100644 site-modules/core/files/vim/ftplugin/php.vim delete mode 100644 site-modules/core/files/vim/pack/bundle/opt/.gitignore delete mode 100644 site-modules/core/files/vim/pack/bundle/start/.gitignore delete mode 100644 site-modules/core/files/vim/plugin/active-highlight.vim create mode 100644 site-modules/core/files/vim/plugin/comments.lua create mode 100644 site-modules/core/files/vim/plugin/completion.lua delete mode 100644 site-modules/core/files/vim/plugin/defer.vim delete mode 100644 site-modules/core/files/vim/plugin/deoplete.vim delete mode 100644 site-modules/core/files/vim/plugin/emmet.vim create mode 100644 site-modules/core/files/vim/plugin/file-ops.vim delete mode 100644 site-modules/core/files/vim/plugin/format.vim delete mode 100644 site-modules/core/files/vim/plugin/functions.vim delete mode 100644 site-modules/core/files/vim/plugin/js.vim create mode 100644 site-modules/core/files/vim/plugin/lint.lua create mode 100644 site-modules/core/files/vim/plugin/lsp.lua delete mode 100644 site-modules/core/files/vim/plugin/lsv.vim delete mode 100644 site-modules/core/files/vim/plugin/nerdtree.vim create mode 100644 site-modules/core/files/vim/plugin/org.lua create mode 100644 site-modules/core/files/vim/plugin/snippets.lua create mode 100644 site-modules/core/files/vim/plugin/status-line.vim delete mode 100644 site-modules/core/files/vim/plugin/term.vim create mode 100644 site-modules/core/files/vim/plugin/treesitter.lua delete mode 100644 site-modules/core/files/vim/plugin/ultisnips.vim diff --git a/site-modules/core/files/oh-my-zsh/custom/fzf.zsh b/site-modules/core/files/oh-my-zsh/custom/fzf.zsh index a7d01b2..4148e42 100644 --- a/site-modules/core/files/oh-my-zsh/custom/fzf.zsh +++ b/site-modules/core/files/oh-my-zsh/custom/fzf.zsh @@ -10,8 +10,7 @@ # Edit commands with file previews using `fd` to search files to exclude files # to improve performance # -alias fe="e \"\$(FZF_DEFAULT_COMMAND=\"fd -t f\" fzf --layout=reverse --preview 'bat --style=numbers ---color=always {}')\"" -alias fte="te \"\$(FZF_DEFAULT_COMMAND=\"fd -t f\" fzf --layout=reverse --preview 'bat --style=numbers ---color=always {}')\"" +alias fe="vim \"\$(FZF_DEFAULT_COMMAND=\"fd -t f\" fzf --layout=reverse --preview 'bat --style=numbers ---color=always {}')\"" # # cd in to a porject directory diff --git a/site-modules/core/files/vim/UltiSnips/all.snippets b/site-modules/core/files/vim/UltiSnips/all.snippets deleted file mode 100644 index 4f79d40..0000000 --- a/site-modules/core/files/vim/UltiSnips/all.snippets +++ /dev/null @@ -1,24 +0,0 @@ -snippet date "YYYY-MM-DD" w -`!v strftime("%Y-%m-%d")` -endsnippet - -snippet ddate "Month DD, YYYY" w -`!v strftime("%b %d, %Y")` -endsnippet - -snippet diso "ISO format datetime" w -`!v strftime("%Y-%m-%d %H:%M:%S%z")` -endsnippet - -snippet time "hh:mm" w -`!v strftime("%H:%M")` -endsnippet - -snippet datetime "YYYY-MM-DD hh:mm" w -`!v strftime("%Y-%m-%d %H:%M")` -endsnippet - -snippet uuid "Random UUID" w -`!p if not snip.c: import uuid; snip.rv = uuid.uuid4()` -endsnippet - diff --git a/site-modules/core/files/vim/UltiSnips/gitcommit.snippets b/site-modules/core/files/vim/UltiSnips/gitcommit.snippets deleted file mode 100644 index 1a9b80c..0000000 --- a/site-modules/core/files/vim/UltiSnips/gitcommit.snippets +++ /dev/null @@ -1,45 +0,0 @@ -snippet fix "Bug fix commit message" b -fix(${1:category}): ${2:title} - -${3:description} - -fixes issue ${4:issue number} -endsnippet - -snippet feat "Feature commit message" b -feat(${1:category}): ${2:title} -endsnippet - -snippet chore "Chore commit message" b -chore(${1:category}): ${2:title} -endsnippet - -snippet ci "Continuous intergration commit message" b -ci(${1:category}): ${2:title} -endsnippet - -snippet docs "Documentation commit message" b -docs(${1:category}): ${2:title} -endsnippet - -snippet test "Test commit message" b -test(${1:category}): ${2:title} -endsnippet - -snippet style "Code styling commit message" b -style(${1:category}): ${2:title} -endsnippet - -snippet perf "Performance commit message" b -perf(${1:category}): ${2:title} -endsnippet - -snippet refactor "Refactor commit message" b -refactor(${1:category}): ${2:title} -endsnippet - -snippet bc "Breaking change" b -BREAKING CHANGE: ${0:Description} -endsnippet - - diff --git a/site-modules/core/files/vim/UltiSnips/go.snippets b/site-modules/core/files/vim/UltiSnips/go.snippets deleted file mode 100644 index e7fa0b3..0000000 --- a/site-modules/core/files/vim/UltiSnips/go.snippets +++ /dev/null @@ -1,77 +0,0 @@ - -snippet /^import/ "Import declaration" r -import ( - "${1:package}" -) -endsnippet - -snippet struct "Struct declaration" b -type ${1:Struct} struct { - ${0:${VISUAL}} -} -endsnippet - -snippet interface "Interface declaration" b -type ${1:Interface} interface { - ${0:${VISUAL}} -} -endsnippet - -snippet if "If statement" b -if ${1:condition}${1/(.+)/ /}{ - ${0:${VISUAL}} -} -endsnippet - -snippet switch "Switch statement" b -switch ${1:expression}${1/(.+)/ /}{ -case$0 -} -endsnippet - -snippet /^main/ "Main function" r -func main() { - ${0:${VISUAL}} -} -endsnippet - -snippet /^meth/ "Method" r -func (${1:receiver} ${2:type}) ${3:name}(${4:params})${5/(.+)/ /}${5:type} { - ${0:${VISUAL}} -} -endsnippet - -snippet func "Function" b -func ${1:name}(${2:params})${3/(.+)/ /}${3:type} { - ${0:${VISUAL}} -} -endsnippet - -snippet map "Map type" b -map[${1:keytype}]${2:valtype} -endsnippet - -snippet : "Variable declaration :=" b -${1:name} := ${0:value} -endsnippet - -snippet var "Variable declaration" b -var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}} -endsnippet - -snippet vars "Variables declaration" b -var ( - ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} } -) -endsnippet - -snippet json "JSON field" -\`json:"${1:displayName}"\` -endsnippet - -snippet err "Basic error handling" b -if err != nil { - log.${1:Fatal}(err) -} -endsnippet - diff --git a/site-modules/core/files/vim/UltiSnips/html.snippets b/site-modules/core/files/vim/UltiSnips/html.snippets deleted file mode 100644 index 9546ef0..0000000 --- a/site-modules/core/files/vim/UltiSnips/html.snippets +++ /dev/null @@ -1,172 +0,0 @@ -snippet input "Input with Label" w - -endsnippet - -snippet input "XHTML " w - -endsnippet - - -snippet opt "Option" w -${3:$2} -endsnippet - -snippet select "Select Box" w - -endsnippet - - -snippet textarea "XHTML -endsnippet - -snippet mailto "XHTML " w -${3:email me} -endsnippet - -snippet base "XHTML " w - -endsnippet - -snippet body "" - - ${0:${VISUAL}} - -endsnippet - -snippet div "
" w -
- ${0:${VISUAL}} -
-endsnippet - -snippet div. "
with class" w - - ${0:${VISUAL}} -
-endsnippet - -snippet div# "
with ID & class" w - - ${0:${VISUAL}} -
-endsnippet - -snippet form "XHTML
" w - - ${0:${VISUAL}} -
-endsnippet - -snippet h1 "XHTML

" w -

${0:${VISUAL}}

-endsnippet - -snippet h2 "XHTML

" w -

${0:${VISUAL}}

-endsnippet - -snippet h3 "XHTML

" w -

${0:${VISUAL}}

-endsnippet - -snippet h4 "XHTML

" w -

${0:${VISUAL}}

-endsnippet - -snippet h5 "XHTML
" w -
${0:${VISUAL}}
-endsnippet - -snippet h6 "XHTML
" w -
${0:${VISUAL}}
-endsnippet - -snippet link "XHTML " w - -endsnippet - -snippet meta "XHTML " w - -endsnippet - -snippet scriptsrc "XHTML -endsnippet - -snippet script "XHTML -endsnippet - -snippet span "" w - ${0:${VISUAL}} -endsnippet - -snippet span. " with class" w - ${0:${VISUAL}} -endsnippet - -snippet span# " with ID & class" w - ${0:${VISUAL}} -endsnippet - -snippet style "XHTML -endsnippet - -snippet table "XHTML " w -
- ${0:${VISUAL}} -
-endsnippet - -snippet a "Link" w -${4:Anchor Text} -endsnippet - -snippet p "paragraph" w -

${0:${VISUAL}}

-endsnippet - -snippet li "list item" w -
  • ${0:${VISUAL}}
  • -endsnippet - -snippet ul "unordered list" w -
      - ${0:${VISUAL}} -
    -endsnippet - -snippet td "table cell" w -${0:${VISUAL}} -endsnippet - -snippet th "table header" w -${0:${VISUAL}} -endsnippet - -snippet tr "table row" w -${0:${VISUAL}} -endsnippet - -snippet title "XHTML " w -<title>${1:`!p snip.rv = snip.basename or "Page Title"`} -endsnippet - -snippet fieldset "Fieldset" w -
    - $1 - ${0:${VISUAL}} -
    -endsnippet - - diff --git a/site-modules/core/files/vim/UltiSnips/html_php.snippets b/site-modules/core/files/vim/UltiSnips/html_php.snippets deleted file mode 100644 index 74fc4e5..0000000 --- a/site-modules/core/files/vim/UltiSnips/html_php.snippets +++ /dev/null @@ -1,47 +0,0 @@ -snippet php "php tag" i - -endsnippet - -snippet phpe "php echo tag" i - -endsnippet - -snippet phpif "php if statment" b - - $0 - -endsnippet - -snippet phpife "php if else statment" b - - $2 - - $0 - -endsnippet - -snippet phpifeif "php if else if statment" b - - $2 - - $4 - - $0 - -endsnippet - -snippet phpfe "php foreach" b -${3:$value}): ?> - $0 - -endsnippet - -snippet phpf "php for loop" b - - $0 - -endsnippet - -snippet prdd "vardump in php tags" b - -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/javascript.snippets b/site-modules/core/files/vim/UltiSnips/javascript.snippets deleted file mode 100644 index f569382..0000000 --- a/site-modules/core/files/vim/UltiSnips/javascript.snippets +++ /dev/null @@ -1,93 +0,0 @@ -snippet #! "shebang" -#!/usr/bin/env node -endsnippet - -snippet vreq "assign a CommonJS-style module to a var" -const ${0:${1/(.+\/)*(\w+)(-|\b|$)(\..+$)?/\u$2/g}} = require('$1'); -endsnippet - -snippet import "ES6 import" b -import {$0} from '$1'; -endsnippet - -snippet ex "module.exports" -module.exports = $0; -endsnippet - -snippet default "export default" b -export default $0 -endsnippet - -snippet cl "Console LOG" b -console.log($0); -endsnippet - -snippet cw "Console Warn" b -console.warn($0); -endsnippet - -snippet ce "Console Error" b -console.error($0); -endsnippet - -snippet rfc "React functional component" b -export const ${1:Name} = (${2:props})=> { - return ( - ${0:
    Component
    } - ); -}; - -$1.propTypes = {}; -endsnippet - -snippet rc "React component" b -export class ${1:Name} extends React.Component { - static propTypes = {}; - - state = {}; - - render() { - return ( - ${0:
    Component
    } - ); - } -} -endsnippet - -snippet raect "Adds react import statements" b -import React from 'react'; -import PropTypes from 'prop-types'; -endsnippet - -snippet useState "React.useState" w -const [$1, set${1/\w+\s*/\u$0/g}] = React.useState(${3:''});${0} -endsnippet - -snippet useEffect "useEffect" w -React.useEffect(() => { - $0 -}); -endsnippet - -snippet useContext "useContext" w -const $1 = React.useContext($2);${0} -endsnippet - -snippet useCallback "useCallback" w -React.useCallback( - () => { - $0 - }, - [$1], -); -endsnippet - -snippet useMemo "useMemo" w -const $1 = React.useMemo(() => { - ${0} -}, [$2]); -endsnippet - -snippet useRef "useRef" w -const $1 = React.useRef($2);${0} -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/markdown.snippets b/site-modules/core/files/vim/UltiSnips/markdown.snippets deleted file mode 100644 index 001e87f..0000000 --- a/site-modules/core/files/vim/UltiSnips/markdown.snippets +++ /dev/null @@ -1,42 +0,0 @@ -snippet link "Link to something" -[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0 -endsnippet - -snippet img "Image" -![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0 -endsnippet - -snippet icode "Inline Code" i -\`$1\`$0 -endsnippet - -snippet code "Codeblock" b -\`\`\`${1:lang} -$2 -\`\`\` -$0 -endsnippet - -snippet table "A base table layout" b -|${0} | | | | | -|---|---|---|---|---| -| | | | | | -endsnippet - -snippet frontmatter "A basic frontmatter block" b ---- -title: ${1:Title} -comments: false -date: ${2:date} -tags: - - ${3:tags} -categories: - - ${4:categories} ---- - -${0} -endsnippet - -snippet more "A more comment tag for blogs" b - -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/pdv_templates/attribute.tpl b/site-modules/core/files/vim/UltiSnips/pdv_templates/attribute.tpl deleted file mode 100644 index 5556a10..0000000 --- a/site-modules/core/files/vim/UltiSnips/pdv_templates/attribute.tpl +++ /dev/null @@ -1,5 +0,0 @@ -/** - * ${1:{{name}}} - * - * @var ${2:{{type}}{{^type}}mixed{{/type}}} - */ diff --git a/site-modules/core/files/vim/UltiSnips/pdv_templates/class.tpl b/site-modules/core/files/vim/UltiSnips/pdv_templates/class.tpl deleted file mode 100644 index 78431c6..0000000 --- a/site-modules/core/files/vim/UltiSnips/pdv_templates/class.tpl +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ${1:{{name}}} - * - * @category Project - * @package \{\{package\}\} - * @author Ade Attwood - * @copyright `!v strftime('%Y')` Practically.io{{#interfaces}} - * @see {{name}}{{/interfaces}}{{#parent}} - * @see {{name}}{{/parent}}{{#abstract}} - * @abstract {{/abstract}} - */ diff --git a/site-modules/core/files/vim/UltiSnips/pdv_templates/const.tpl b/site-modules/core/files/vim/UltiSnips/pdv_templates/const.tpl deleted file mode 100644 index df89103..0000000 --- a/site-modules/core/files/vim/UltiSnips/pdv_templates/const.tpl +++ /dev/null @@ -1,3 +0,0 @@ -/** - * ${1:{{name}}} - */ diff --git a/site-modules/core/files/vim/UltiSnips/pdv_templates/function.tpl b/site-modules/core/files/vim/UltiSnips/pdv_templates/function.tpl deleted file mode 100644 index 1eea796..0000000 --- a/site-modules/core/files/vim/UltiSnips/pdv_templates/function.tpl +++ /dev/null @@ -1,5 +0,0 @@ -/** - * ${1:{{name}}}{{?func: vmustache#InitCounter("params", 1)}} - *{{#parameters}} - * @param ${{{?func: vmustache#IncrementCounter("params")}}:{{type}}{{^type}}mixed{{/type}}} ${{name}}${{{?func: vmustache#IncrementCounter("params")}}}{{/parameters}} - */ diff --git a/site-modules/core/files/vim/UltiSnips/pdv_templates/interface.tpl b/site-modules/core/files/vim/UltiSnips/pdv_templates/interface.tpl deleted file mode 100644 index dc7aee1..0000000 --- a/site-modules/core/files/vim/UltiSnips/pdv_templates/interface.tpl +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Interface: ${1:{{name}}} - *{{#parents}} - * @see {{name}}{{/parents}} - */ diff --git a/site-modules/core/files/vim/UltiSnips/pdv_templates/trait.tpl b/site-modules/core/files/vim/UltiSnips/pdv_templates/trait.tpl deleted file mode 100644 index 7c8e8f2..0000000 --- a/site-modules/core/files/vim/UltiSnips/pdv_templates/trait.tpl +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Trait: ${1:{{name}}} - */ diff --git a/site-modules/core/files/vim/UltiSnips/php.snippets b/site-modules/core/files/vim/UltiSnips/php.snippets deleted file mode 100644 index 84c6fba..0000000 --- a/site-modules/core/files/vim/UltiSnips/php.snippets +++ /dev/null @@ -1,200 +0,0 @@ -snippet - "" i -->$0 -endsnippet - -snippet = "" i -=>$0 -endsnippet - -snippet this "Description" i -$this->$0 -endsnippet - -snippet dd "Dumb debug helper in HTML" -echo '
    ' . var_dump($1, 1) . '
    ';$0 -endsnippet - -snippet dump "Symfony Dump" i -dump(${1:var}); -endsnippet - -snippet dumpd "Symfony Dump Die" i -dump(${1:var}); -die; -endsnippet - -snippet rdd "Revo die var" i -\revo\Revo::dieVar(${1:var}); -endsnippet - -snippet ai "Array item" i -'${1:key}' => ${0:value} -endsnippet - -snippet try "Try and catch block" b -try { - $0 -} catch (\Exception $e) {} -endsnippet - -snippet pub "Public function" b -/** - * ${3:undocumented function} - * - * @return $4 - */ -public function ${1:name}(${2:$param})${3:: ${4:void}} -{ - ${VISUAL}$0 -} -endsnippet - -snippet pro "Protected function" b -/** - * ${3:undocumented function} - * - * @return $4 - */ -protected function ${1:name}(${2:$param})${3:: ${4:void}} -{ - ${VISUAL}$0 -} -endsnippet - -snippet pri "Private function" b -/** - * ${3:undocumented function} - * - * @return $4 - */ -private function ${1:name}(${2:$param})${3:: ${4:void}} -{ - ${VISUAL}$0 -} -endsnippet - -snippet pubs "Public static function" b -/** - * ${3:undocumented function} - * - * @return $4 - */ -public static function ${1:name}(${2:$param})${3:: ${4:void}} -{ - ${VISUAL}$0 -} -endsnippet - -snippet pros "Protected static function" b -/** - * ${3:undocumented function} - * - * @return $4 - */ -protected static function ${1:name}(${2:$param})${3:: ${4:void}} -{ - ${VISUAL}$0 -} -endsnippet - -snippet pris "Private static function" b -/** - * ${3:undocumented function} - * - * @return $4 - */ -private static function ${1:name}(${2:$param})${3:: ${4:void}} -{ - ${VISUAL}$0 -} -endsnippet - -snippet new "New class instance" b -$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3); -$0 -endsnippet - -snippet ns "namespace declaration" b -namespace ${1:`!p -relpath = os.path.relpath(path) -m = re.search(r'[A-Z].+(?=/)', relpath) -if m: - snip.rv = m.group().replace('/', '\\') -`}; -endsnippet - -snippet class "Class declaration template" b -$1 = $$1;/g} -} -$0 -endsnippet - -# PHPUnit snippets -snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }" -wantToTest('${2:dis}'); - ${3://test} -} -endsnippet - -snippet utest "Unit test" b -public function ${1:name}(UnitTester $I): void -{ - $I->wantToTest('${2:dis}'); - ${3://test} -} -endsnippet - - -snippet atest "Acceptance test" b -public function ${1:name}(AcceptanceTester $I): void -{ - $I->wantToTest('${2:dis}'); - ${3://test} -} -endsnippet - -snippet _b+a "Before and After class" b -public function _before(${1:inject}) -{ -} - -public function _after($1) -{ -} -endsnippet - diff --git a/site-modules/core/files/vim/UltiSnips/php_html.snippets b/site-modules/core/files/vim/UltiSnips/php_html.snippets deleted file mode 100644 index 56b0f9d..0000000 --- a/site-modules/core/files/vim/UltiSnips/php_html.snippets +++ /dev/null @@ -1,65 +0,0 @@ -snippet php "php tag" i - -endsnippet - -snippet phpe "php echo tag" i - -endsnippet - -snippet phpif "php if statment" b - - $0 - -endsnippet - -snippet phpife "php if else statment" b - - $2 - - $0 - -endsnippet - -snippet phpifeif "php if else if statment" b - - $2 - - $4 - - $0 - -endsnippet - -snippet phpfe "php foreach" b -${3:$value}): ?> - $0 - -endsnippet - -snippet phpf "php for loop" b - - $0 - -endsnippet - -snippet var-doc "Code for createing a vardoc" b -echo '
    ';
    -echo '/**'.PHP_EOL;
    -echo ' *'.PHP_EOL;
    -$_type = gettype($this) == 'object' ? get_class($this) : gettype($this);
    -echo " * @var $_type \\$this\n";
    -foreach(get_defined_vars() as $name => $var) {
    -    if (substr($name, 0, strlen('_')) !== '_' && $name !== 'this') {
    -        if (is_array($var) && isset($var[0]) && gettype($var[0]) == 'object') {
    -            $type = get_class($var[0]);
    -            echo " * @var {$type}[] \$$name\n";
    -            continue;
    -        }
    -        $type = gettype($var) == 'object' ? get_class($var) : gettype($var);
    -        echo " * @var $type \$$name\n";
    -    }
    -}
    -echo ' */'.PHP_EOL;
    -echo "
    "; -die; -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/php_yii.snippets b/site-modules/core/files/vim/UltiSnips/php_yii.snippets deleted file mode 100644 index bf0c79b..0000000 --- a/site-modules/core/files/vim/UltiSnips/php_yii.snippets +++ /dev/null @@ -1,18 +0,0 @@ -snippet yiifk "migration foreign key" b -/* - * FOREIGN KEY : ${1:Table}.${2:Field} - * REFERENCES : ${3:Reference Table}.${4:Reference Field} - */ -$this->addForeignKey( - 'fk-$1-$2', - '$1', - '$2', - '$3', - '$4', - 'CASCADE' -); -endsnippet - -snippet yapp "Yii App" i -Yii::$app->${1:Command} -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/puppet.snippets b/site-modules/core/files/vim/UltiSnips/puppet.snippets deleted file mode 100644 index fc7fb52..0000000 --- a/site-modules/core/files/vim/UltiSnips/puppet.snippets +++ /dev/null @@ -1,66 +0,0 @@ -# -# Python helper code for generating namespaces -# -# See: https://github.com/honza/vim-snippets/blob/master/UltiSnips/puppet.snippets -# - -global !p -import vim -import os.path -def get_module_namespace_and_basename(): - """This function will try to guess the current class or define name you are - trying to create. Note that for this to work you should be using the module - structure as per the style guide. Examples inputs and it's output - * /home/nikolavp/puppet/modules/collectd/manifests/init.pp -> collectd - * /home/nikolavp/puppet/modules/collectd/manfistes/mysql.pp -> collectd::mysql - """ - first_time = True - current_file_path_without_ext = vim.eval('expand("%:p:r")') or "" - if not current_file_path_without_ext: - return "name" - parts = os.path.split(current_file_path_without_ext) - namespace = '' - while parts[0] and parts[0] != '/': - if parts[1] == 'init' and first_time and not namespace: - first_time = False - parts = os.path.split(parts[0]) - continue - if parts[1] == 'manifests': - return os.path.split(parts[0])[1] + ('::' + namespace).rstrip(':') - else: - namespace = parts[1] + '::' + namespace - parts = os.path.split(parts[0]) - return "name" -endglobal - -# -# Snippets -# - -snippet class "Class declaration" b -class ${1:`!p snip.rv = get_module_namespace_and_basename()`} { - ${0:# Puppet code} -} -endsnippet - -snippet define "Definition" b -define ${1:`!p snip.rv = get_module_namespace_and_basename()`} { - ${0:# Puppet Code} -} -endsnippet - -snippet = "" i -=>$0 -endsnippet - -snippet ai "Array item" i -'${1:key}' => ${0:value} -endsnippet - -snippet alert "Alert Function" b -alert("${1:message}")$0 -endsnippet - -snippet info "Info Function" b -info("${1:message}")$0 -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/sh.snippets b/site-modules/core/files/vim/UltiSnips/sh.snippets deleted file mode 100644 index d4e4856..0000000 --- a/site-modules/core/files/vim/UltiSnips/sh.snippets +++ /dev/null @@ -1,35 +0,0 @@ -global !p -import vim - -# Tests for the existence of a variable declared by Vim's filetype detection -# suggesting the type of shell script of the current file -def testShell(scope, shell): - return vim.eval("exists('" + scope + ":is_" + shell + "')") - -# Loops over the possible variables, checking for global variables -# first since they indicate an override by the user. -def getShell(): - for scope in ["g", "b"]: - for shell in ["bash", "posix", "sh", "kornshell"]: - if testShell(scope, shell) == "1": - if shell == "kornshell": - return "ksh" - if shell == "posix": - return "sh" - return shell - return "sh" -endglobal - -snippet #! -`!p snip.rv = '#!/bin/' + getShell() + "\n\n" ` -endsnippet - -snippet !env "#!/usr/bin/env (!env)" -`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" ` -endsnippet - -snippet if "If Condition" b -if [ $1 ]; then - $0 -fi -endsnippet diff --git a/site-modules/core/files/vim/UltiSnips/snippets.snippets b/site-modules/core/files/vim/UltiSnips/snippets.snippets deleted file mode 100644 index 0543cdd..0000000 --- a/site-modules/core/files/vim/UltiSnips/snippets.snippets +++ /dev/null @@ -1,18 +0,0 @@ -# We use a little hack so that the snippet is expanded -# and parsed correctly -snippet snip "Snippet definition" b -`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b} -$0 -`!p snip.rv = "endsnippet"` -endsnippet - -snippet global "Global snippet" b -`!p snip.rv = "global"` !p -$0 -`!p snip.rv = "endglobal"` -endsnippet - -snippet vis "${VISUAL}" i -\$\{VISUAL${1:${2:default}${3:/transform/}}\} -endsnippet - diff --git a/site-modules/core/files/vim/UltiSnips/typescript.snippets b/site-modules/core/files/vim/UltiSnips/typescript.snippets deleted file mode 100644 index 4e2a0eb..0000000 --- a/site-modules/core/files/vim/UltiSnips/typescript.snippets +++ /dev/null @@ -1,31 +0,0 @@ -extends javascript -priority 1 - -snippet rfc "React functional component" b -export interface $1Props {}; - -export const ${1:Name}:React.FC<$1Props> = (${2:props}) => { - return ( - ${0:
    Component
    } - ); -}; -endsnippet - -snippet rc "React component" b -export interface $1State {}; -export interface $1Props {}; - -export class ${1:Name} extends React.Component<$1Props, $1State> { - public state: $1State = {} - - public render(): JSX.Element { - return ( - ${0:
    Component
    } - ); - } -} -endsnippet - -snippet react "Adds react import statements" b -import * as React from 'react'; -endsnippet diff --git a/site-modules/core/files/vim/after/ftplugin/json.vim b/site-modules/core/files/vim/after/ftplugin/json.vim new file mode 100644 index 0000000..3af3aaf --- /dev/null +++ b/site-modules/core/files/vim/after/ftplugin/json.vim @@ -0,0 +1 @@ +set conceallevel=0 diff --git a/site-modules/core/files/vim/after/plugin/vim-jsx.vim b/site-modules/core/files/vim/after/plugin/vim-jsx.vim deleted file mode 100644 index 2c63207..0000000 --- a/site-modules/core/files/vim/after/plugin/vim-jsx.vim +++ /dev/null @@ -1,4 +0,0 @@ -" -" Sort vim-jsx settting js files to javascript.jsx -" -let g:jsx_ext_required=1 diff --git a/site-modules/core/files/vim/autoload/aa/buffer.vim b/site-modules/core/files/vim/autoload/aa/buffer.vim deleted file mode 100644 index d988184..0000000 --- a/site-modules/core/files/vim/autoload/aa/buffer.vim +++ /dev/null @@ -1,58 +0,0 @@ -" -" Orignaly from google maktaba -" https://github.com/google/vim-maktaba/blob/master/autoload/maktaba/buffer.vim#L15 -" -" Gets the text of the current or last visual selection. -" Useful for visual mode mappings. -function! aa#buffer#GetVisualSelection() abort - let [l:lnum1, l:col1] = getpos("'<")[1:2] - let [l:lnum2, l:col2] = getpos("'>")[1:2] - " 'selection' is a rarely-used option for overriding whether the last - " character is included in the selection. Bizarrely, it always affects the - " last character even when selecting from the end backwards. - if &selection !=# 'inclusive' - let l:col2 -= 1 - endif - let l:lines = getline(l:lnum1, l:lnum2) - if !empty(l:lines) - " If there is only 1 line, the part after the selection must be removed - " first because `col2` is relative to the start of the line. - let l:lines[-1] = l:lines[-1][: l:col2 - 1] - let l:lines[0] = l:lines[0][l:col1 - 1 : ] - endif - return join(l:lines, "\n") -endfunction - -" -" Mainly taken form maktab. This just uses the pure vim implemetaion to -" replace lines -" -function! aa#buffer#Overwrite(startline, endline, lines) abort - " If lines already match, don't modify buffer. - if getline(a:startline, a:endline) == a:lines - return - endif - - " Lines being replaced minus lines being inserted. - let l:line_delta = len(a:lines) - (a:endline + 1 - a:startline) - " If there's a surplus (more to replace than insert), delete the last n lines. - if l:line_delta < 0 - let l:winview = winsaveview() - let l:keep_end = a:endline - (-l:line_delta) - execute string(l:keep_end + 1) . ',' . string(a:endline) . 'delete' - " Special case: Move the cursor up to track buffer changes if necessary. - " If we delete lines above the cursor, the cursor should NOT remain on the - " same line number. - if l:winview.lnum > a:endline - let l:winview.lnum += l:line_delta - endif - call winrestview(l:winview) - endif - " If there's a deficit (more to insert than replace), append the last n lines. - let l:lines = a:lines - if l:line_delta > 0 - call append(a:endline, a:lines[-l:line_delta : ]) - let l:lines = l:lines[ : -l:line_delta - 1] - endif - call setline(a:startline, l:lines) -endfunction diff --git a/site-modules/core/files/vim/autoload/aa/emmet.vim b/site-modules/core/files/vim/autoload/aa/emmet.vim deleted file mode 100644 index 1a2c2d4..0000000 --- a/site-modules/core/files/vim/autoload/aa/emmet.vim +++ /dev/null @@ -1,21 +0,0 @@ -function aa#emmet#init() - " - " Don't install emmet globally we want to only use it on selected languages - " - let g:user_emmet_install_global = 0 - - " - " Set Ctrl-E emmet trigger - " - "let g:user_emmet_leader_key='' - - " - " Add the emmet package - " - packadd emmet-vim - - " - " Install the package - " - EmmetInstall -endfunction diff --git a/site-modules/core/files/vim/autoload/aa/fold.vim b/site-modules/core/files/vim/autoload/aa/fold.vim deleted file mode 100644 index 58a150e..0000000 --- a/site-modules/core/files/vim/autoload/aa/fold.vim +++ /dev/null @@ -1,94 +0,0 @@ -" -" Sets all the settings for different fold types -" -" a:type -" The type of fold you want to set. -" Valid options are 'marker', 'indent', 'diff', hunk and 'off' -" -function! aa#fold#set_fold(type) - if a:type == "marker" - setlocal foldenable - setlocal foldmethod=marker - setlocal foldlevel=0 - setlocal foldnestmax=99 - elseif a:type == "indent" - setlocal foldenable - setlocal foldmethod=indent - setlocal foldlevel=1 - setlocal foldnestmax=2 - elseif a:type == "diff" - setlocal foldenable - setlocal nomodeline formatoptions-=croq formatoptions+=tl - setlocal foldmethod=expr - setlocal foldexpr=aa#fold#diff_fold() - setlocal foldcolumn=3 - elseif a:type == "hunk" - setlocal foldenable - setlocal nomodeline formatoptions-=croq formatoptions+=tl - setlocal foldmethod=expr - setlocal foldexpr=aa#fold#diff_hunk_fold() - setlocal foldcolumn=3 - elseif a:type == 'off' - set nofoldenable - else - echoerr a:type . " is not a valid fold use 'off', 'marker' or 'indent'" - endif -endfunction - -" -" Get the competition list for `set_fold()` -" -function! aa#fold#command_complete(a, cm, cu) - return ['off', 'marker', 'indent', 'diff', 'hunk'] -endfunction - -" -" Get the fold text for displaying neat folds -" See: https://dhruvasagar.com/2013/03/28/vim-better-foldtext -" -function! aa#fold#fold_text() - let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' - let lines_count = v:foldend - v:foldstart + 1 - let lines_count_text = '| ' . printf("%10s", lines_count . ' linesss') . ' |' - let foldchar = '-' - let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) - let foldtextend = lines_count_text . repeat(foldchar, 8) - let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn - return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend -endfunction - -" -" function for the `foldexpr` to fold git diffs -" -" Inspired from https://github.com/sgeb/vim-diff-fold -" -function! aa#fold#diff_fold() - let l:line=getline(v:lnum) - - if l:line =~# '^\(diff\|Index\)' - return '>1' - else - return '=' - endif -endfunction - -" -" function for the `foldexpr` to fold git diffs and hunks -" -" Inspired from https://github.com/sgeb/vim-diff-fold -" -function! aa#fold#diff_hunk_fold() - let l:line=getline(v:lnum) - - if l:line =~# '^\(diff\|Index\)' - return '>1' - elseif l:line =~# '^\(@@\|\d\)' - return '>2' - elseif l:line =~# '^\*\*\* \d\+,\d\+ \*\*\*\*$' - return '>2' - elseif l:line =~# '^--- \d\+,\d\+ ----$' - return '>2' - else - return '=' - endif -endfunction diff --git a/site-modules/core/files/vim/autoload/aa/functions.vim b/site-modules/core/files/vim/autoload/aa/functions.vim deleted file mode 100644 index 8c26eb4..0000000 --- a/site-modules/core/files/vim/autoload/aa/functions.vim +++ /dev/null @@ -1,75 +0,0 @@ -" -" Turn line numbers on -" -" This set all settings for relative number and enables git gutter -" -function! aa#functions#number_on(local) - if a:local == 1 - setlocal relativenumber - setlocal number - setlocal signcolumn=yes - else - set relativenumber - set number - set signcolumn=yes - endif - - if exists(':GitGutterEnable') - GitGutterEnable - endif - - let g:linenumber=1 -endfunction - -" -" Turn line numbers off -" -" Disables line numbers and git gutter -" -function! aa#functions#number_off(local) - if a:local == 1 - setlocal norelativenumber - setlocal nonumber - setlocal signcolumn=no - else - set norelativenumber - set nonumber - set signcolumn=no - endif - - - if exists(':GitGutterDisable') - GitGutterDisable - endif - - let g:linenumber=0 -endfunction - -" -" Toggles line numbers and all of the relevant settings -" -function! aa#functions#toggle_numbers() - if g:linenumber - call aa#functions#number_off(0) - else - call aa#functions#number_on(0) - end -endfunction - -" -" Display ruler if text is over a specified char length -" -" a:lengthLimit -" The char length when to show the column ruler -" -function! aa#functions#show_column_if_line_too_long(lengthLimit) - " See https://stackoverflow.com/questions/2075276/longest-line-in-vim#2982789 - let maxLineLength = max(map(getline(1,'$'), 'len(v:val)')) - - if maxLineLength > a:lengthLimit - highlight ColorColumn ctermbg=18 guibg=18 - execute "set colorcolumn=" . join(range((a:lengthLimit + 1),999), ",") - else - set colorcolumn="" - endif -endfunction diff --git a/site-modules/core/files/vim/autoload/aa/languagetool.vim b/site-modules/core/files/vim/autoload/aa/languagetool.vim deleted file mode 100644 index 8610e98..0000000 --- a/site-modules/core/files/vim/autoload/aa/languagetool.vim +++ /dev/null @@ -1,6 +0,0 @@ -function! aa#languagetool#init() - let g:languagetool_jar = "~/.local/share/LanguageTool-4.6/languagetool-commandline.jar" - let g:languagetool_lang = 'en-GB' - - packadd vim-LanguageTool -endfunction diff --git a/site-modules/core/files/vim/autoload/aa/supertab.vim b/site-modules/core/files/vim/autoload/aa/supertab.vim deleted file mode 100644 index ecb75d8..0000000 --- a/site-modules/core/files/vim/autoload/aa/supertab.vim +++ /dev/null @@ -1,36 +0,0 @@ -function aa#supertab#expand() - if exists('g:UltiSnipsEnableSnipMate') - " - " Try to expand snippet or go to the next tab stop - " - call UltiSnips#ExpandSnippetOrJump() - if g:ulti_expand_or_jump_res != 0 - let g:ulti_expand_or_jump_res = 0 - return "" - endif - endif - - " - " If popup is open cycle through the items this will most likely be - " deoplete completion - " - if pumvisible() - return "\" - endif - - if exists('g:loaded_emmet_vim') - - " - " If there is an emmet expression expand it - " - if emmet#isExpandable() - call emmet#expandAbbr(0,"") - return "\" - endif - endif - - " - " If all else fails just tab along - " - return "\" -endfunction diff --git a/site-modules/core/files/vim/autoload/pathogen.vim b/site-modules/core/files/vim/autoload/pathogen.vim deleted file mode 100644 index 59a75c1..0000000 --- a/site-modules/core/files/vim/autoload/pathogen.vim +++ /dev/null @@ -1,353 +0,0 @@ -" pathogen.vim - path option manipulation -" Maintainer: Tim Pope -" Version: 2.4 - -" Install in ~/.vim/autoload (or ~\vimfiles\autoload). -" -" For management of individually installed plugins in ~/.vim/bundle (or -" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your -" .vimrc is the only other setup necessary. -" -" The API is documented inline below. - -if exists("g:loaded_pathogen") || &cp - finish -endif -let g:loaded_pathogen = 1 - -" Point of entry for basic default usage. Give a relative path to invoke -" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke -" pathogen#surround(). Curly braces are expanded with pathogen#expand(): -" "bundle/{}" finds all subdirectories inside "bundle" inside all directories -" in the runtime path. -function! pathogen#infect(...) abort - for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}'] - if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]' - call pathogen#surround(path) - elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)' - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#surround(path . '/{}') - elseif path =~# '[{}*]' - call pathogen#interpose(path) - else - call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')') - call pathogen#interpose(path . '/{}') - endif - endfor - call pathogen#cycle_filetype() - if pathogen#is_disabled($MYVIMRC) - return 'finish' - endif - return '' -endfunction - -" Split a path into a list. -function! pathogen#split(path) abort - if type(a:path) == type([]) | return a:path | endif - if empty(a:path) | return [] | endif - let split = split(a:path,'\\\@]','\\&','') - endif -endfunction - -" Like findfile(), but hardcoded to use the runtimepath. -function! pathogen#runtime_findfile(file,count) abort - let rtp = pathogen#join(1,pathogen#split(&rtp)) - let file = findfile(a:file,rtp,a:count) - if file ==# '' - return '' - else - return fnamemodify(file,':p') - endif -endfunction - -" Section: Deprecated - -function! s:warn(msg) abort - echohl WarningMsg - echomsg a:msg - echohl NONE -endfunction - -" Prepend all subdirectories of path to the rtp, and append all 'after' -" directories in those subdirectories. Deprecated. -function! pathogen#runtime_prepend_subdirectories(path) abort - call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')') - return pathogen#surround(a:path . pathogen#slash() . '{}') -endfunction - -function! pathogen#incubate(...) abort - let name = a:0 ? a:1 : 'bundle/{}' - call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')') - return pathogen#interpose(name) -endfunction - -" Deprecated alias for pathogen#interpose(). -function! pathogen#runtime_append_all_bundles(...) abort - if a:0 - call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')') - else - call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()') - endif - return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}') -endfunction - -if exists(':Vedit') - finish -endif - -let s:vopen_warning = 0 - -function! s:find(count,cmd,file,lcd) - let rtp = pathogen#join(1,pathogen#split(&runtimepath)) - let file = pathogen#runtime_findfile(a:file,a:count) - if file ==# '' - return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'" - endif - if !s:vopen_warning - let s:vopen_warning = 1 - let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE' - else - let warning = '' - endif - if a:lcd - let path = file[0:-strlen(a:file)-2] - execute 'lcd `=path`' - return a:cmd.' '.pathogen#fnameescape(a:file) . warning - else - return a:cmd.' '.pathogen#fnameescape(file) . warning - endif -endfunction - -function! s:Findcomplete(A,L,P) - let sep = pathogen#slash() - let cheats = { - \'a': 'autoload', - \'d': 'doc', - \'f': 'ftplugin', - \'i': 'indent', - \'p': 'plugin', - \'s': 'syntax'} - if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0]) - let request = cheats[a:A[0]].a:A[1:-1] - else - let request = a:A - endif - let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*' - let found = {} - for path in pathogen#split(&runtimepath) - let path = expand(path, ':p') - let matches = split(glob(path.sep.pattern),"\n") - call map(matches,'isdirectory(v:val) ? v:val.sep : v:val') - call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]') - for match in matches - let found[match] = 1 - endfor - endfor - return sort(keys(found)) -endfunction - -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1) -command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1) - -" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=': diff --git a/site-modules/core/files/vim/coc-settings.json b/site-modules/core/files/vim/coc-settings.json deleted file mode 100644 index 0ed75b5..0000000 --- a/site-modules/core/files/vim/coc-settings.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "diagnostic.virtualText": true, - "diagnostic.enableHighlightLineNumber": false, - "diagnostic.errorSign": "❌", - "diagnostic.warningSign": "⚠", - "diagnostic.infoSign": "ℹ", - "diagnostic.hintSign": "ℹ", - "coc.preferences.hoverTarget": "preview", - "suggest.floatEnable": false, - "diagnostic.messageTarget": "echo", - "json.schemas": [ - { - "url": "https://git.baln.co.uk/general/conventional-tools/blob/master/src/config.schema.json" - } - ], - "yaml.schemas": { - "https://git.baln.co.uk/general/conventional-tools/raw/master/src/config.schema.json": "/.ctrc.yml" - }, - "cSpell.language": "en-GB", - "cSpell.dictionaryDefinitions": [ - {"name": "ade", "path": "/home/ade/.vim/spell/en.utf-8.add"} - ], - "cSpell.dictionaries": ["ade"], - "cSpell.enabledLanguageIds": [ - "asciidoc", - "c", - "cpp", - "csharp", - "css", - "git-commit", - "gitcommit", - "go", - "handlebars", - "haskell", - "html", - "jade", - "java", - "javascript", - "javascript.jsx", - "javascriptreact", - "json", - "jsonc", - "latex", - "less", - "markdown", - "php", - "plaintext", - "pug", - "python", - "restructuredtext", - "rust", - "scala", - "scss", - "text", - "typescript", - "typescript.jsx", - "typescriptreact", - "vim", - "yaml", - "yml" - ], - "cSpell.userWords": ["enviopemt", "loded"] -} diff --git a/site-modules/core/files/vim/colors/my_default.vim b/site-modules/core/files/vim/colors/my_default.vim deleted file mode 100644 index 705e7f5..0000000 --- a/site-modules/core/files/vim/colors/my_default.vim +++ /dev/null @@ -1,28 +0,0 @@ -" Maintainer: Ade Attwood -" Last Change: 2018-07-15 - -" This is a copy of the default colour theme with some edits to -" to the diff view and spelling - -" Set 'background' back to the default. -hi clear Normal -set bg& - -" Remove all existing highlighting and set the defaults. -hi clear - -" Load the syntax highlighting defaults, if it's enabled. -if exists("syntax_on") - syntax reset -endif - -" Add in colours for vim diff -highlight DiffAdd cterm=bold ctermfg=7 ctermbg=28 gui=none guifg=bg guibg=Red -highlight DiffDelete cterm=bold ctermfg=7 ctermbg=9 gui=none guifg=bg guibg=Red -highlight DiffChange cterm=bold ctermfg=7 ctermbg=17 gui=none guifg=bg guibg=Red -highlight DiffText cterm=bold ctermfg=7 ctermbg=20 gui=none guifg=bg guibg=Red - -" Change background colour of highlighted spell words -highlight SpellBad cterm=bold ctermfg=15 ctermbg=9 gui=none guifg=bg guibg=Red - -let colors_name = "my_default" diff --git a/site-modules/core/files/vim/ftdetect/javascript.vim b/site-modules/core/files/vim/ftdetect/javascript.vim deleted file mode 100644 index 5d916ba..0000000 --- a/site-modules/core/files/vim/ftdetect/javascript.vim +++ /dev/null @@ -1,29 +0,0 @@ -" -" Change filetype to javascript.jsx if a js file imports `React` -" -function! s:ScanFile() - let n = 1 - let nmax = line('$') - if line('$') > 500 - let nmax = 500 - endif - while n < nmax - if getline(n) =~# "\\v" - return 1 - break - endif - let n = n + 1 - endwhile - return 0 -endfunction - -function! s:DetectJSX() - if match(&filetype, '\v') != -1 - return - endif - if s:ScanFile() - set filetype=javascript.jsx - endif -endfunction - -autocmd BufNewFile,BufRead *.js call s:DetectJSX() diff --git a/site-modules/core/files/vim/ftdetect/php.class.vim b/site-modules/core/files/vim/ftdetect/php.class.vim deleted file mode 100644 index ea69184..0000000 --- a/site-modules/core/files/vim/ftdetect/php.class.vim +++ /dev/null @@ -1,28 +0,0 @@ -function! s:ScanFile() - let n = 1 - let nmax = line('$') - if line('$') > 500 - let nmax = 500 - endif - while n < nmax - if getline(n) =~ "^class [A-Z]" - return 1 - break - endif - let n = n + 1 - endwhile - return 0 -endfunction - -function! s:DetectPhpClass() - if match(&filetype, '\v') != -1 - return - endif - - if s:ScanFile() - set ft=php.class - return - endif -endfunction - -"autocmd BufNewFile,BufRead *.php call s:DetectPhpClass() diff --git a/site-modules/core/files/vim/ftdetect/typescript.vim b/site-modules/core/files/vim/ftdetect/typescript.vim deleted file mode 100644 index 07a4c2e..0000000 --- a/site-modules/core/files/vim/ftdetect/typescript.vim +++ /dev/null @@ -1,6 +0,0 @@ -" -" Set tsx files to have the typescript.jsx filetype so I can use vim-jsx for -" syntax highlighting -" -autocmd BufNewFile,BufRead *.tsx set filetype=typescript.jsx -autocmd BufNewFile,BufRead *.ts set filetype=typescript diff --git a/site-modules/core/files/vim/ftplugin/diff.vim b/site-modules/core/files/vim/ftplugin/diff.vim deleted file mode 100644 index 8d5ce2d..0000000 --- a/site-modules/core/files/vim/ftplugin/diff.vim +++ /dev/null @@ -1,4 +0,0 @@ -" -" Set default fold for diff files -" -call aa#fold#set_fold('diff') diff --git a/site-modules/core/files/vim/ftplugin/gitcommit.vim b/site-modules/core/files/vim/ftplugin/gitcommit.vim deleted file mode 100644 index 28e8bc7..0000000 --- a/site-modules/core/files/vim/ftplugin/gitcommit.vim +++ /dev/null @@ -1,15 +0,0 @@ -" -" Git commit message specific settings -" -" - -" -" Enable spell by default -" -setlocal spell - -" -" Make diff folds the default fold for commits. When running `git commit -v` -" all the file diffs will be folded -" -call aa#fold#set_fold('diff') diff --git a/site-modules/core/files/vim/ftplugin/json.vim b/site-modules/core/files/vim/ftplugin/json.vim new file mode 100644 index 0000000..3af3aaf --- /dev/null +++ b/site-modules/core/files/vim/ftplugin/json.vim @@ -0,0 +1 @@ +set conceallevel=0 diff --git a/site-modules/core/files/vim/ftplugin/mail.vim b/site-modules/core/files/vim/ftplugin/mail.vim deleted file mode 100644 index 27993ec..0000000 --- a/site-modules/core/files/vim/ftplugin/mail.vim +++ /dev/null @@ -1,6 +0,0 @@ -" -" Mail commit message specific settings -" -" -setlocal spell - diff --git a/site-modules/core/files/vim/ftplugin/markdown.vim b/site-modules/core/files/vim/ftplugin/markdown.vim deleted file mode 100644 index 0ef14ed..0000000 --- a/site-modules/core/files/vim/ftplugin/markdown.vim +++ /dev/null @@ -1,7 +0,0 @@ -" -" Markdown file type specific settings -" -" -setlocal spell - -call aa#languagetool#init() diff --git a/site-modules/core/files/vim/ftplugin/org.vim b/site-modules/core/files/vim/ftplugin/org.vim new file mode 100644 index 0000000..8a16cd0 --- /dev/null +++ b/site-modules/core/files/vim/ftplugin/org.vim @@ -0,0 +1,4 @@ +" Required for formatting links with org +#setlocal conceallevel=2 +#setlocal concealcursor=nc + diff --git a/site-modules/core/files/vim/ftplugin/php.vim b/site-modules/core/files/vim/ftplugin/php.vim deleted file mode 100644 index f0c321a..0000000 --- a/site-modules/core/files/vim/ftplugin/php.vim +++ /dev/null @@ -1,8 +0,0 @@ -" -" Set flods to be indent on php class files -" -if &ft == "php.class" - call aa#fold#set_fold('indent') -else - call aa#emmet#init() -endif diff --git a/site-modules/core/files/vim/init.vim b/site-modules/core/files/vim/init.vim index bceb07b..e407f5c 100644 --- a/site-modules/core/files/vim/init.vim +++ b/site-modules/core/files/vim/init.vim @@ -1,152 +1,55 @@ -" Ade Attwood - -" Vimrc is ordered in the options style -" to view all the options run :options -" and get the docs on all the settings - -" -" Important -" -"call pathogen#infect() -set nocompatible -filetype plugin on -set clipboard=unnamedplus -"set t_Co=256 - -" " Set leader as space bar -" let mapleader="\" +" Use the system clipboard with yank and paste +set clipboard=unnamedplus -" -" Not sorted and new -" -set listchars=tab:▸\ ,extends:❯,precedes:❮ -set pastetoggle= -set wildignore+=*/vendor/*,*/node_modules/*,*/runtime/*,*/public_html/* -set scrolloff=20 -set signcolumn=yes - -" -" Moving around, searching and pattern -" +" Setup better searching +set ignorecase set incsearch +set smartcase -" -" Tags -" +" Stay 20 chars from the top and bottom of the buffer so I am always editing +" in context +set scrolloff=20 -" -" Displaying text -" -set linebreak -set nowrap - -call aa#functions#number_on(0) -cabb tognum call aa#functions#toggle_numbers() - -" -" Highlighting and spelling -" -syntax on -set spelllang=en_gb -set cursorline -set nohlsearch - - -" -" Multiple windows -" -set laststatus=2 - - -" -" Multiple tab pages -" - -" -" Terminal -" - -" " Using the mouse -" set mouse=a - -" -" Printing -" - -" -" Messages and info -" -set ruler -set showcmd - -" -" Selecting text -" - -" -" Editing text -" -set matchpairs+=<:> -set showmatch - -" " Tabs and indenting -" set tabstop=4 set shiftwidth=4 set expandtab set autoindent filetype plugin indent on -" -" Folding -" -hi Folded ctermbg=0 -set foldtext=aa#fold#fold_text() +" Highlight the current line where the cursor is on +set cursorline +let g:vim_json_conceal=0 -command! -nargs=1 -complete=customlist,aa#fold#command_complete SetFold call aa#fold#set_fold() -call aa#fold#set_fold('marker') +" Relative line numbers, this set line numbers a swell so the current line is +" displayed correctly. If this is not set then the current line is always 0 +set relativenumber +set number -" -" Diff mode -" +set conceallevel=0 + +" Ensure the signcolumn is on to stop jumping for LSP diagnostics +set signcolumn=yes + +" Disable swap files +set noswapfile + +" Disable line wrapping +set nowrap + +packadd! command-t -" -" Mapping -" -cabb Q q -cabb W w -cabb WQ wq -cabb Wq wq -cabb __html set ft=html -cabb __php set ft=php -cabb aa vi[:EasyAlign = -cabb ap vip:EasyAlign = -cabb evim e ~/.vimrc -cabb sortp vip:sort -imap I -imap A -inoremap Xlbce -inoremap ,, A, -inoremap ;; A; -inoremap jj :w -nmap s ]sz= -nnoremap -nnoremap d :call pdv#DocumentWithSnip() -nnoremap :resize -5 -nnoremap :vertical resize +5 -nnoremap :resize +5 -nnoremap f za -nnoremap q :q -noremap g :tab Gstatus noremap p :CommandT -noremap :vertical resize -5 +noremap q :bdelete +noremap fs :w + +noremap o :Open noremap [b :bp noremap ]b :bn @@ -154,79 +57,26 @@ noremap ]b :bn noremap [q :cprevious noremap ]q :cnext -noremap ]h :GitGutterNextHunk -noremap [h :GitGutterPrevHunk +inoremap A; -noremap :Run make build -noremap :Run make test -noremap :Run make test FILE="%" +noremap ; gcc +"vnoremap ; gc -nnoremap h :set nohlsearch:nohlsearch -nnoremap / :set hlsearch:nohlsearch/\v\c -nnoremap ? :set hlsearch:nohlsearch? -nnoremap * :set hlsearch:nohlsearch* - -" -" Populate the command pallet with the `Ack` command followed by the visually -" selected text -" -vnoremap a :Ack =aa#buffer#GetVisualSelection() - -" -" Reading and writing files -" -set autoread - -" -" The swap file -" -set noswapfile +" Lint code with nvim-lint on save. This will lint all filetypes with cspell +" and then any other filetypes will be linted per the config. +au BufWritePost lua require('lint').try_lint('cspell') +au BufWritePost lua require('lint').try_lint() -" -" Command line editing -" Executing external commands -" Running make and jumping to errors -" Language specific -" +inoremap jj :w +nnoremap +set wildignore+=*/vendor/*,*/node_modules/*,*/runtime/*,*/public_html/*,*/pack/* -" -" Multi-byte characters -" -set fileencoding=utf-8 -set encoding=utf-8 +" Required for complietion with nvim-cmp +set completeopt=menu,menuone,noselect -" -" Various -" -autocmd BufNewFile,BufRead *.phtml set ft=html - - -" -" Plugins -" - -" vim-airline -let g:airline#extensions#branch#enabled=1 -let g:airline_theme='murmur' -let g:airline_powerline_fonts = 1 -let g:airline#extensions#tabline#show_buffers = 1 -let g:airline#extensions#tabline#show_splits = 0 -let g:airline#extensions#tabline#show_tabs = 1 - -" pdv -let g:pdv_template_dir = $HOME . "/.config/nvim/UltiSnips/pdv_templates" - -" indent-guides -let g:indent_guides_auto_colors = 1 - -" -" Text length markers -" -autocmd BufRead,TextChanged,TextChangedI *.pp,*.sh,*.bash,*.go,*.js,*.jsx,.ts,.tsx call aa#functions#show_column_if_line_too_long(80) -autocmd BufRead,TextChanged,TextChangedI *.php call aa#functions#show_column_if_line_too_long(120) - -" -" Custom gitlab -" -let g:fugitive_gitlab_domains = ['https://git.zportal.co.uk'] +" Format code on save +augroup fmt + autocmd! + autocmd BufWritePre * undojoin | Neoformat +augroup END diff --git a/site-modules/core/files/vim/pack/bundle/opt/.gitignore b/site-modules/core/files/vim/pack/bundle/opt/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/site-modules/core/files/vim/pack/bundle/opt/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/site-modules/core/files/vim/pack/bundle/start/.gitignore b/site-modules/core/files/vim/pack/bundle/start/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/site-modules/core/files/vim/pack/bundle/start/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/site-modules/core/files/vim/plugin/active-highlight.vim b/site-modules/core/files/vim/plugin/active-highlight.vim deleted file mode 100644 index b861437..0000000 --- a/site-modules/core/files/vim/plugin/active-highlight.vim +++ /dev/null @@ -1,13 +0,0 @@ -" -" Highlights the active window in neo Vim. `ActiveWindow` is only available -" in neovim so -" -if has('nvim') - hi ActiveWindow ctermbg=00 | hi InactiveWindow ctermbg=22 - set winhighlight=Normal:ActiveWindow,NormalNC:InactiveWindow - - au VimEnter,WinEnter,BufEnter,BufWinEnter,FocusGained,CompleteDone * hi ActiveWindow ctermbg=00 | hi InactiveWindow ctermbg=22 - au VimLeave,WinLeave,BufLeave,BufWinLeave,FocusLost * hi ActiveWindow ctermbg=22 | hi InactiveWindow ctermbg=22 -else - hi Normal ctermbg=None -endif diff --git a/site-modules/core/files/vim/plugin/colors.vim b/site-modules/core/files/vim/plugin/colors.vim index c9ca962..9871d19 100644 --- a/site-modules/core/files/vim/plugin/colors.vim +++ b/site-modules/core/files/vim/plugin/colors.vim @@ -1,32 +1,33 @@ -" " Set color theme -" let base16colorspace=256 colorscheme base16-eighties -" " Set tailing white space to errors -" match ErrorMsg '\s\+$' -" " Fix jsx end tag highlighting -" +" NOTE: This is only with vim regex highlighting, this dose not apply if you +" are using treesitter to highlighting hi Tag ctermfg=04 hi xmlTag ctermfg=04 hi xmlTagName ctermfg=04 hi xmlEndTag ctermfg=04 -" " Highlight comments to be italic this also targets the language client " diagnostics. -" highlight Comment cterm=italic gui=italic -" -" Make coc diagnostics italic -" -highlight CocErrorSign cterm=italic gui=italic ctermfg=9 guifg=#ff0000 -highlight CocWarningSign cterm=italic gui=italic ctermfg=130 guifg=#ff922b -highlight CocInfoSign cterm=italic gui=italic ctermfg=11 guifg=#fab005 -highlight CocHintSign cterm=italic gui=italic ctermfg=12 guifg=#15aabf +" Remove underline from coursor line number +highlight CursorLineNr cterm=none + +" Set the LSP diagnostics feedback to be italic +highlight DiagnosticError cterm=italic guibg=#51202A guifg=#FF0000 gui=italic +highlight DiagnosticWarn cterm=italic guibg=#51412A guifg=#FFA500 gui=italic +highlight DiagnosticInfo cterm=italic guibg=#1E535D guifg=#00FFFF gui=italic +highlight DiagnosticHint cterm=italic guibg=#1E205D guifg=#0000FF gui=italic + +" hi ActiveWindow ctermbg=00 | hi InactiveWindow ctermbg=22 +" set winhighlight=Normal:ActiveWindow,NormalNC:InactiveWindow +" +" au VimEnter,WinEnter,BufEnter,BufWinEnter,FocusGained,CompleteDone * hi ActiveWindow ctermbg=00 | hi InactiveWindow ctermbg=22 +" au VimLeave,WinLeave,BufLeave,BufWinLeave,FocusLost * hi ActiveWindow ctermbg=22 | hi InactiveWindow ctermbg=22 diff --git a/site-modules/core/files/vim/plugin/comments.lua b/site-modules/core/files/vim/plugin/comments.lua new file mode 100644 index 0000000..536a13f --- /dev/null +++ b/site-modules/core/files/vim/plugin/comments.lua @@ -0,0 +1,2 @@ + +require('Comment').setup() diff --git a/site-modules/core/files/vim/plugin/completion.lua b/site-modules/core/files/vim/plugin/completion.lua new file mode 100644 index 0000000..0e47fda --- /dev/null +++ b/site-modules/core/files/vim/plugin/completion.lua @@ -0,0 +1,55 @@ +local cmp = require'cmp' +local luasnip = require'luasnip' + +local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +cmp.setup({ + mapping = cmp.mapping.preset.insert({ + [''] = cmp.get_config().mapping[''], + [''] = cmp.get_config().mapping[''], + [''] = cmp.mapping(function(_fallback) + if cmp.visible() then + cmp.confirm({ select = true }) + else + vim.api.nvim_feedkeys('\n', 'nt', false) + end + end, { 'i', 's' }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }), + sources = { + { name = "luasnip" }, + { name = 'nvim_lsp' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'orgmode' } + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, +}) + diff --git a/site-modules/core/files/vim/plugin/defer.vim b/site-modules/core/files/vim/plugin/defer.vim deleted file mode 100644 index aa8760c..0000000 --- a/site-modules/core/files/vim/plugin/defer.vim +++ /dev/null @@ -1,40 +0,0 @@ -" -" Defer command for starting work after vim has loaded -" -" This is biased from Greg Hurrell's Profiling and optimization screen cast in -" his implementation he is using the `CursorHold,CursorHoldI` auto command -" that didn't really work for me. This uses `timer_start` to set a timer when -" to start the work. This is then started on `VimEnter` when everything has -" loaded. There are two levels of defer one at `250ms` and `500ms` This is for -" calling functions that depend on something that has already been deferred. -" -" You can use this by adding a function to the user auto command `WincentSoftDefer` -" -" autocmd User WincentSoftDefer call s:do_work() -" - -function HardDefer(timer) - augroup WincentIdleboot - autocmd! - augroup END - - doautocmd User WincentHardDefer - autocmd! User WincentHardDefer -endfunction - -function SoftDefer(timer) - augroup WincentIdleboot - autocmd! - augroup END - - doautocmd User WincentSoftDefer - autocmd! User WincentSoftDefer -endfunction - -augroup WincentIdleboot - autocmd! - if has('vim_starting') - autocmd VimEnter * call timer_start(250, 'SoftDefer') - autocmd VimEnter * call timer_start(500, 'HardDefer') - endif -augroup END diff --git a/site-modules/core/files/vim/plugin/deoplete.vim b/site-modules/core/files/vim/plugin/deoplete.vim deleted file mode 100644 index 671ba55..0000000 --- a/site-modules/core/files/vim/plugin/deoplete.vim +++ /dev/null @@ -1,13 +0,0 @@ -" -" Add deoplete plugin -" -function s:deoplete_init() - if has('nvim') - packadd deoplete - call deoplete#enable() - - call deoplete#custom#source('ultisnips', 'rank', 9999) - endif -endfunction - -"au User WincentHardDefer call s:deoplete_init() diff --git a/site-modules/core/files/vim/plugin/emmet.vim b/site-modules/core/files/vim/plugin/emmet.vim deleted file mode 100644 index 3cc903f..0000000 --- a/site-modules/core/files/vim/plugin/emmet.vim +++ /dev/null @@ -1,12 +0,0 @@ -" -" Init emmet on specified files -" -autocmd FileType html,css,scss,less,javascript.jsx,typescript.jsx call aa#emmet#init() - -"let g:user_emmet_leader_key='' - -" -" Make expand emment expreson like sparkup did -" - -"inoremap :call emmet#expandAbbr(3,"") diff --git a/site-modules/core/files/vim/plugin/file-ops.vim b/site-modules/core/files/vim/plugin/file-ops.vim new file mode 100644 index 0000000..0ed8261 --- /dev/null +++ b/site-modules/core/files/vim/plugin/file-ops.vim @@ -0,0 +1,46 @@ +" Open a file the same way you use :edit. This function will give you a prompt +" for a file with the default value of the directory the current file is in. +function s:open() + let file_name = expand(input("Open file: ", expand("%:h") . "/", "file")) + execute 'edit ' . file_name +endfunction + +command! Open call s:open() + +" Rename the current file on disk and remove all instances of it in vim and +" then switch to the new buffer. +function s:aa_rename() + let file_name = expand(input("New file name: ", expand("%:h") . "/", "file")) + if isdirectory(file_name) || filereadable(file_name) + echoerr "File '" . file_name . "' already exists unable to rename the file" + return + endif + + " Rename the current file to the new name + let current_file = expand("%") + call rename(current_file, file_name) + " Remove the old buffer and remove it from the alternate file list and the + " jump list so you cant get back to this buffer with or + execute "bwipeout " . current_file + " Open the new file as a buffer + execute "edit " . file_name +endfunction + +command! Rename call s:aa_rename() + +" Copy the current buffer. This is the same as `saveas` with some checks +" around the new name of the file to prevent overriteing files that already +" exist. +function s:aa_copy() + let file_name = expand(input("New file name: ", expand("%:h") . "/", "file")) + if isdirectory(file_name) || filereadable(file_name) + echoerr "File '" . file_name . "' already exists unable to rename the file" + return + endif + + " Rename the current file to the new name. This is run with `silent` to + " stop the write message from getting put in the status line. + silent execute "saveas " . file_name +endfunction + +command! Copy call s:aa_copy() diff --git a/site-modules/core/files/vim/plugin/format.vim b/site-modules/core/files/vim/plugin/format.vim deleted file mode 100644 index e055ec4..0000000 --- a/site-modules/core/files/vim/plugin/format.vim +++ /dev/null @@ -1,183 +0,0 @@ -if exists('g:vim_formatter_loaded') - finish -end - -let g:vim_formatter_loaded = 1 - -" -" Set the global formatters definitions variable -" -if !exists('g:formatters') - let g:formatters = {} -endif - -" -" Get the prettier config for the current project -" -if filereadable('./.prettierrc.js') - let s:prettier_config = '.prettierrc.js' -elseif filereadable('./.prettierrc') - let s:prettier_config = '.prettierrc' -else - let s:prettier_config = '~/.dotfiles/.prettierrc.js' -endif - -" -" Set the base prettier command for formatting. This can be used on most of -" the file formats -" -let s:base_prettier_command = 'prettier --config ' . s:prettier_config . ' --stdin --stdin-filepath /tmp/formatted.' - -" -" Typescript formatter definition -" -let g:formatters['typescript'] = s:base_prettier_command . 'ts' -let g:formatters['typescript.jsx'] = s:base_prettier_command . 'tsx' - -" -" Javascript formatter definition -" -let g:formatters['javascript'] = s:base_prettier_command . 'js' -let g:formatters['javascript.jsx'] = s:base_prettier_command . 'jsx' - -" -" HTML formatter definition -" -let g:formatters['html'] = s:base_prettier_command . 'html' - -" -" Styling formatter definition -" -let g:formatters['css'] = s:base_prettier_command . 'css' -let g:formatters['scss'] = s:base_prettier_command . 'scss' -let g:formatters['less'] = s:base_prettier_command . 'less' - -" -" JSON formatter definition -" -let g:formatters['json'] = s:base_prettier_command . 'json' - -" -" YAML formatter definition -" -let g:formatters['yaml'] = s:base_prettier_command . 'yml' - -" -" Markdown formatter definition -" -let g:formatters['markdown'] = s:base_prettier_command . 'md' - -" -" Puppet formatter definition -" -let g:formatters['puppet'] = 'cat - > /tmp/format.pp && puppet-lint --no-autoloader_layout-check --fix /tmp/format.pp >/dev/null 2>&1 && cat /tmp/format.pp' - -" -" PHP formatter definition -" -" This will use the `ruleset.xml` in the root of the project if one can be -" found. If not then it will fall back to use psr2 coding standards -" -if filereadable('./ruleset.xml') - let g:formatters['php'] = 'phpcbf --standard=./ruleset.xml -' - let g:formatters['php.class'] = 'phpcbf --standard=./ruleset.xml -' -else - let g:formatters['php'] = 'phpcbf --standard=psr2 -' - let g:formatters['php.class'] = 'phpcbf --standard=psr2 -' -endif - -" -" Define if you want the plugin to format on save -" -if !exists('g:formatter_on_save') - let g:formatter_on_save = 1 -endif - -" -" Set the plugin to debug mode -" -if !exists('g:formatter_debug') - let g:formatter_debug = 1 -endif - -" -" Variable for enabling and disabling the formatters -" -if !exists('g:formatter_enabled') - let g:formatter_enabled = 1 -endif - -" -" Format the current buffers text biased on the file type and the formatters -" defined -" -function s:format() - " - " Exit is formatting has been disabled - " - if !g:formatter_enabled - return - endif - - " - " Trim white space before formatting - " - %s/\s\+$//e - - " - " Format the buffers content - " - let l:lines = s:format_text(join(getline(1, '$'), "\n"), &filetype) - - " - " Replace the lines of the formatted text with the text in the buffer - " - call aa#buffer#Overwrite(1, line('$'), lines) -endfunction - -" -" Formats defined lines biased on the type defined -" -" a:lines -" The text you want to format -" -" a:type -" The type formatter to use this will defined in the `g:formatters` variable -" -function s:format_text(lines, type) - let l:lines = a:lines - - " - " Just return the lines if there is no formatters defined - " - if !exists("g:formatters['" . a:type . "']") - if g:formatter_debug == 1 - echo '[formatter] No formatter defined for ' . a:type - endif - - return split(lines, "\n") - endif - - " - " Run the formatter command and return the output of the text - " - let l:command = g:formatters[a:type] - let l:formatted_lines = split(system(command, lines), "\n") - - " - " Return original lines if formatter command returns an error - " - if v:shell_error > 1 - echoerr '[formatter] ' . join(formatted_lines, "\n") - return split(lines, "\n") - endif - - return formatted_lines -endfunction - -" -" Defined the autocmd if the plugin is set to format on save -" -if g:formatter_on_save == 1 - autocmd BufWritePre * call s:format() -endif diff --git a/site-modules/core/files/vim/plugin/functions.vim b/site-modules/core/files/vim/plugin/functions.vim deleted file mode 100644 index 0026cfb..0000000 --- a/site-modules/core/files/vim/plugin/functions.vim +++ /dev/null @@ -1,77 +0,0 @@ -" -" Trims all traling white space from every line in a file -" -function! s:aa_trim_white_space() - %s/\s\+$//e -endfunction - -command! -nargs=* -complete=file TrimWhiteSpace call s:aa_trim_white_space() - -" -" Creates a new file or directory updateing the UI with and clearing the -" command t cache. This function uses the nerd tree functions to create files -" or directory. For more info on this you can open nerdtree and press `m` then -" `a` to add a node. If it is a file the file will be opened in a new buffer -" -" a:path -" Path to file or directory. Dirs end in / -" -function! s:aa_new(path) - call g:NERDTreePath.Create(a:path) - - call commandt#Flush() - NERDTreeRefreshRoot - - if filereadable(expand(a:path)) - execute "e " . expand(a:path) - endif -endfunction - -command! -nargs=1 -complete=file New call s:aa_new() - -" -" Runs a shell command in the neovim terminal. This will open up a buffered -" terminal in a split at the bottom -" -" a:command -" The command you want the run in the terminal -" -function! s:aa_run(command) - if strlen($TMUX) > 0 - if (&columns > 180) - let l:split = '-h' - else - let l:split = '-v' - endif - - execute 'silent !tmux split-window -p 50 ' . l:split . ' && tmux send-keys "' . a:command . ' && exit" C-m' - return - endif - - if has('nvim') - if (&columns > 180) - execute 'VTerm ' . a:command . ' && exit' - else - execute 'HTerm ' . a:command . ' && exit' - endif - endif -endfunction - -command! -nargs=* -complete=shellcmd Run call s:aa_run() - - -" -" Git gutter alias commad commands to give them the same api as fugitive -" -command! GaddHunk :GitGutterStageHunk -command! GresetHunk :GitGutterUndoHunk - -" -" Browse command to open urls in a browser. This is to help fugitive `Gbrowse` -" open urls in a browser rather that other programmes -" -function! s:browse(uri) - silent exec "!brave-browser '".a:uri."'" -endfunction - -command! -nargs=1 Browse call s:browse() diff --git a/site-modules/core/files/vim/plugin/js.vim b/site-modules/core/files/vim/plugin/js.vim deleted file mode 100644 index 2963cf7..0000000 --- a/site-modules/core/files/vim/plugin/js.vim +++ /dev/null @@ -1,4 +0,0 @@ -" -" Enable js doc syntax -" -let g:javascript_plugin_jsdoc = 1 diff --git a/site-modules/core/files/vim/plugin/lint.lua b/site-modules/core/files/vim/plugin/lint.lua new file mode 100644 index 0000000..5d0558f --- /dev/null +++ b/site-modules/core/files/vim/plugin/lint.lua @@ -0,0 +1,47 @@ +local lint = require('lint') + +local severities = { + error = vim.diagnostic.severity.ERROR, + info = vim.diagnostic.severity.WARN, +} + +lint.linters.psalm = { + cmd = 'psalm', + stdin = false, + args = { + '--output-format=json', + '--show-info=true' + }, + -- ignore_exitcode = true, + parser = function(output, _) + if vim.trim(output) == '' then + return {} + end + + local errors = vim.json.decode(output) + local diagnostics = {} + + for _, err in ipairs(errors or {}) do + table.insert(diagnostics, { + lnum = err.line_from - 1, + end_lnum = err.line_to - 1, + col = err.column_from - 1, + end_col = err.column_to - 1, + message = err.message, + source = 'psalm', + severity = assert(severities[err.severity], 'missing mapping for severity ' .. err.severity), + }) + end + + return diagnostics + end +} + +lint.linters_by_ft = { + php = {'phpcs'}, + typescript = {'eslint'}, + javascript = {'eslint'}, + typescriptreact = {'eslint'}, + javascriptreact = {'eslint'}, +} + diff --git a/site-modules/core/files/vim/plugin/lsp.lua b/site-modules/core/files/vim/plugin/lsp.lua new file mode 100644 index 0000000..a01c458 --- /dev/null +++ b/site-modules/core/files/vim/plugin/lsp.lua @@ -0,0 +1,51 @@ +local lspconfig = require('lspconfig') + + +local on_attach = function(client, bufnr) + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + local opts = { noremap=true, silent=true } + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) + + -- TODO(ade): Sort out space. This will conflict with the leader key + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) +end + +local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) +capabilities.textDocument.completion.completionItem.snippetSupport = true + +local servers = { 'tsserver', 'intelephense', 'psalm', 'gopls', 'html', 'cssls' } +for _, lsp in ipairs(servers) do + lspconfig[lsp].setup({ + on_attach = on_attach, + capabilities = capabilities, + init_options = { + usePlaceholders = true, + } + }) +end + +lspconfig.emmet_ls.setup({ + on_attach = on_attach, + capabilities = capabilities, + filetypes = { 'html', 'typescriptreact', 'javascriptreact', 'css', 'scss' }, + init_options = { + usePlaceholders = true, + } +}) + +-- Change the diagnostic signs +vim.fn.sign_define('DiagnosticSignError', { text = '✖', texthl = 'DiagnosticSignError', numhl = 'DiagnosticSignError' }) +vim.fn.sign_define('DiagnosticSignHint', { text = '➤', texthl = 'DiagnosticSignHint', numhl = 'DiagnosticSignHint' }) +vim.fn.sign_define('DiagnosticSignInfo', { text = 'ℹ', texthl = 'DiagnosticSignInfo', numhl = 'DiagnosticSignInfo' }) +vim.fn.sign_define('DiagnosticSignWarn', { text = '⚠', texthl = 'DiagnosticSignWarn', numhl = 'DiagnosticSignWarn' }) + diff --git a/site-modules/core/files/vim/plugin/lsv.vim b/site-modules/core/files/vim/plugin/lsv.vim deleted file mode 100644 index 13c4401..0000000 --- a/site-modules/core/files/vim/plugin/lsv.vim +++ /dev/null @@ -1,38 +0,0 @@ -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -inoremap pumvisible() ? coc#_select_confirm() : - \"\u\\=coc#on_enter()\" -nmap gd (coc-definition) -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -function! s:open_as_preview(callstr) - " e.g. the string should look like: +call cursor(,) - let m = matchlist(a:callstr, '^+call cursor(\(\d\+\),\s*\(\d\+\))\s\+\(.*\)') - if len(m) < 4 " TODO: more robust error handling - echohl WarningMsg | echom "ERROR: Invalid callstr format" | echohl None - return - endif - let linenr = m[1] - let filename = expand(m[3]) - call quickui#preview#open(filename, { - \ 'cursor': linenr, - \ 'number' : 1, - \ 'persist': 0, - \ }) -endfunction - -command! -nargs=0 PreviewDefinition :call CocActionAsync('jumpDefinition', ':OpenAsPreview') -command! -nargs=* OpenAsPreview :call s:open_as_preview("") - -autocmd CursorHold * silent call CocActionAsync('highlight') diff --git a/site-modules/core/files/vim/plugin/nerdtree.vim b/site-modules/core/files/vim/plugin/nerdtree.vim deleted file mode 100644 index 7f9b8cb..0000000 --- a/site-modules/core/files/vim/plugin/nerdtree.vim +++ /dev/null @@ -1,34 +0,0 @@ -" Check if NERDTree is open or active -function! s:isNERDTreeOpen() - return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1) -endfunction - -" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable -" file, and we're not in vimdiff -function! s:syncTree() - if &modifiable && s:isNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff - NERDTreeFind - wincmd p - endif -endfunction - -function! ToggleNerdTree() - if s:isNERDTreeOpen() - NERDTreeClose - return - endif - - set eventignore=BufEnter - NERDTreeFind - set eventignore= -endfunction - - -function s:nerdtree_init() - nmap o :call ToggleNerdTree() - autocmd BufEnter * call s:syncTree() - packadd nerdtree -endfunction - - -au User WincentSoftDefer call s:nerdtree_init() diff --git a/site-modules/core/files/vim/plugin/org.lua b/site-modules/core/files/vim/plugin/org.lua new file mode 100644 index 0000000..a44408a --- /dev/null +++ b/site-modules/core/files/vim/plugin/org.lua @@ -0,0 +1,11 @@ +-- TODO(ade): Set up org capture into the website node dir +-- See https://github.com/AdeAttwood/Dotfiles/blob/86bf86d2010d7ec7b579e7b1c06632d5955f0a3c/site-modules/core/files/emacs/src/org.el#L107 + +require('orgmode').setup({ + org_agenda_files = {'~/Code/src/github.com/AdeAttwood/Website/data/*'}, +}) + +-- Dont folt heading on load. +vim.cmd[[autocmd FileType org setlocal nofoldenable]] + +require('orgmode').setup_ts_grammar() diff --git a/site-modules/core/files/vim/plugin/snippets.lua b/site-modules/core/files/vim/plugin/snippets.lua new file mode 100644 index 0000000..dede647 --- /dev/null +++ b/site-modules/core/files/vim/plugin/snippets.lua @@ -0,0 +1,100 @@ +local ls = require('luasnip') +local s = ls.snippet +local sn = ls.snippet_node +local i = ls.insert_node +local f = ls.function_node +local t = ls.text_node +local d = ls.dynamic_node +local fmt = require('luasnip.extras.fmt').fmt + +function p (trig, desc, snip) + return ls.parser.parse_snippet( + { trig = trig, dscr = desc }, + table.concat(snip, '\n') + ) +end + +ls.config.setup({ + store_selection_keys="", + update_events="InsertLeave,TextChangedI", +}) + +ls.add_snippets("all", { + p('todo', 'Todo comment', { 'TODO(${1:ade}): $0' }) +}) + +ls.add_snippets("org", { + p('org-header', 'Org mode header block', { + '#+TITLE: $0', + '#+AUTHOR: Ade Attwood', + '#+EMAIL: hello@adeattwood.co.uk', + '#+DATE: $CURRENT_YEAR-$CURRENT_MONTH-${CURRENT_DATE}' + }) +}) + + +ls.add_snippets("php", { + p('#!', 'Shebang', { '#!/usr/bin/env php' }), + p( '/**', 'Block comment', { + '/**', + ' * ${0}', + ' */' + }), + s( + {trig = 'this', dscr = 'This shorthand'}, + fmt("$this->{}", { + i(0), + }) + ), + s( + {trig = 'ai', dscr = 'Array item'}, + fmt("'{}' => {}", { + i(1), + i(0), + }) + ) +}) + +local js_ts = { + p('#!', 'Shebang', { '#!/usr/bin/env node' }), + s( + {trig = 'import', dscr = 'Import statement'}, + fmt("import {} from '{}'", { + i(0), + i(1) + }) + ), + + s({trig = 'fn', dscr = 'Function'}, { + t('function '), + i(1), + t('('), + i(2), + t(')'), + t({' {', '\t'}), + i(0), + t({'', '}'}) + }), + + s({trig = 'useState', dscr = 'React useState hook'}, { + t('const ['), + i(1, 'state'), + t(', '), + f(function (args) + if args[1] == nil then + return '' + end + + return 'set' .. args[1][1]:gsub("^%l", string.upper) + end, {1}), + t('] = React.useState('), + i(0), + t(');') + }), + p('log', 'Console log statement', { 'console.log(${0});' }) +} + + + +ls.add_snippets("typescriptreact", js_ts) +ls.add_snippets("typescript", js_ts) diff --git a/site-modules/core/files/vim/plugin/status-line.vim b/site-modules/core/files/vim/plugin/status-line.vim new file mode 100644 index 0000000..94db2c5 --- /dev/null +++ b/site-modules/core/files/vim/plugin/status-line.vim @@ -0,0 +1,10 @@ +" The most basic status line ever +function GitStatus() + return trim(system("git diff --shortstat 2> /dev/null | awk '{print \"+\"$4\" -\"$6}'")) +endfunction + +function GitBranch() + return trim(system("git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'no-git'")) +endfunction + +set statusline=\ %y%r\ %m%f:%l:%c%=[%{GitBranch()}]\ %{GitStatus()}\ diff --git a/site-modules/core/files/vim/plugin/term.vim b/site-modules/core/files/vim/plugin/term.vim deleted file mode 100644 index 2432e81..0000000 --- a/site-modules/core/files/vim/plugin/term.vim +++ /dev/null @@ -1,78 +0,0 @@ -" -" All of the good bits from `split_term` -" https://github.com/vimlab/split-term.vim/blob/master/plugin/split-term.vim -" - -let s:force_vertical = exists('g:split_term_vertical') ? 1 : 0 -let s:default_shell = exists('g:split_term_default_shell') ? g:split_term_default_shell : 0 - -au BufEnter * if &buftype == 'terminal' | :startinsert | endif - -" -" Set split directions -" -set splitbelow -set splitright - -" Opens up a new buffer, either vertical or horizontal. Count can be used to -" specify the number of visible columns or rows. -fun! s:openBuffer(count, vertical) - let cmd = a:vertical ? 'vnew' : 'new' - let cmd = a:count ? a:count . cmd : cmd - exe cmd -endf - -" Opens a new terminal buffer, but instead of doing so using 'enew' (same -" window), it uses :vnew and :new instead. Usually, I want to open a new -" terminal and not replace my current buffer. -fun! s:openSplitTerm(args, count, vertical) - let direction = s:force_vertical ? 1 : a:vertical - - call s:openBuffer(a:count, direction) - call s:openTerm(a:args) -endf - -" Opens a new terminal buffer, but instead of doing so using split buffer, it -" uses :tabnew instead. -fun! s:openTabTerm(args) - exe 'tabnew' - call s:openTerm(a:args) -endf - -" Open a new terminal in the active buffer, while defining default mappings -" for this plugin. -fun! s:openTerm(args) - let prevShell = &shell - if exists('g:split_term_default_shell') - exe 'set shell =' . s:default_shell - endif - - exe 'terminal' a:args - - - " - " Turn off line numbers in terminal mode - " - call aa#functions#number_off(1) - - exe 'startinsert' - - " - " Add teminal mappings - " - tnoremap - tnoremap 'pi' - tnoremap h - tnoremap j - tnoremap k - tnoremap l - - if exists('g:split_term_default_shell') - exe 'set shell =' . prevShell - endif -endf - -command! -count -nargs=* Term call s:openTerm() -command! -count -nargs=* VTerm call s:openSplitTerm(, , 1) -command! -count -nargs=* HTerm call s:openSplitTerm(, , 0) -command! -nargs=* TTerm call s:openTabTerm() diff --git a/site-modules/core/files/vim/plugin/treesitter.lua b/site-modules/core/files/vim/plugin/treesitter.lua new file mode 100644 index 0000000..609df58 --- /dev/null +++ b/site-modules/core/files/vim/plugin/treesitter.lua @@ -0,0 +1,12 @@ +require'nvim-treesitter.configs'.setup { + indent = { enable = true }, + rainbow = { enable = true }, + highlight = { + -- `false` will disable the whole extension + enable = true, + additional_vim_regex_highlighting = true, + }, + ensure_installed = { + "typescript", "javascript", "tsx", "php", "html", "go", "org" + }, +} diff --git a/site-modules/core/files/vim/plugin/ultisnips.vim b/site-modules/core/files/vim/plugin/ultisnips.vim deleted file mode 100644 index f9b7ac0..0000000 --- a/site-modules/core/files/vim/plugin/ultisnips.vim +++ /dev/null @@ -1,16 +0,0 @@ -" -" Config for UltiSnips config -" - -let g:UltiSnipsSnippetsDir = "~/.vim/UltiSnips" -let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" -let g:snips_author = "Ade Attwood" -let g:snips_email = "code@adeattwood.co.uk" - -" -" Run super tab script on UltiSnipsExpandTrigger to enable ultisnips and emmet -" on tab press -" -au InsertEnter * exec "inoremap " . g:UltiSnipsExpandTrigger . " =aa#supertab#expand()" diff --git a/site-modules/core/files/zshrc b/site-modules/core/files/zshrc index 4fc286f..da24130 100644 --- a/site-modules/core/files/zshrc +++ b/site-modules/core/files/zshrc @@ -84,7 +84,7 @@ fi # source $ZSH/oh-my-zsh.sh -export EDITOR="emacsclient -nw" +export EDITOR="vim" # # Import local alases if the file exists diff --git a/site-modules/core/manifests/vim.pp b/site-modules/core/manifests/vim.pp index 5574e69..ebf441b 100644 --- a/site-modules/core/manifests/vim.pp +++ b/site-modules/core/manifests/vim.pp @@ -1,64 +1,79 @@ class core::vim { - file { "${user_home}/.vim": + file { "${user_home}/.config/nvim": + ensure => 'directory', + force => true, + owner => $user, + } + + file { "${user_home}/.config/nvim/after": ensure => 'link', force => true, owner => $user, - target => find_file('core/vim'), + target => find_file('core/vim/after'), } - file { "${user_home}/.vimrc": + file { "${user_home}/.config/nvim/ftplugin": + ensure => 'link', + force => true, + owner => $user, + target => find_file('core/vim/ftplugin'), + } + + file { "${user_home}/.config/nvim/plugin": + ensure => 'link', + force => true, + owner => $user, + target => find_file('core/vim/plugin'), + } + + file { "${user_home}/.config/nvim/spell": + ensure => 'link', + force => true, + owner => $user, + target => find_file('core/vim/spell'), + } + + file { "${user_home}/.config/nvim/init.vim": ensure => 'link', force => true, owner => $user, target => find_file('core/vim/init.vim'), } - file { "${user_home}/.config/nvim": - ensure => 'link', - force => true, - owner => $user, - target => find_file('core/vim'), - } - $plugins_start= { + 'auto-pairs' => { url => 'https://github.com/jiangmiao/auto-pairs.git' }, 'base16-vim' => { url => 'https://github.com/chriskempson/base16-vim.git' }, - 'vim-easy-align' => { url => 'https://github.com/junegunn/vim-easy-align.git' }, - 'auto-pairs' => { url => 'git://github.com/jiangmiao/auto-pairs.git' }, - 'indent-line' => { url => 'https://github.com/Yggdroot/indentLine.git' }, - 'nerdcommenter' => { url => 'https://github.com/scrooloose/nerdcommenter.git' }, - 'pdv' => { url => 'https://github.com/tobyS/pdv.git' }, - 'vim-airline' => { url => 'https://github.com/vim-airline/vim-airline' }, - 'vim-fugitive' => { url => 'git://github.com/tpope/vim-fugitive.git' }, - 'vim-tmux-navigator' => { url => 'https://github.com/christoomey/vim-tmux-navigator.git' }, - 'ultisnips' => { url => 'https://github.com/SirVer/ultisnips.git' }, - 'vim-airline-themes' => { url => 'https://github.com/vim-airline/vim-airline-themes.git' }, - 'vim-javascript' => { url => 'https://github.com/pangloss/vim-javascript.git' }, - 'vim-jsx' => { url => 'https://github.com/mxw/vim-jsx.git' }, - 'command-t' => { url => 'https://github.com/wincent/command-t.git' }, + 'cmp_luasnip' => { url => 'https://github.com/saadparwaiz1/cmp_luasnip.git' }, + 'cmp-buffer' => { url => 'https://github.com/hrsh7th/cmp-buffer.git', revision => 'main' }, + 'cmp-nvim-lsp' => { url => 'https://github.com/hrsh7th/cmp-nvim-lsp.git', revision => 'main' }, + 'cmp-path' => { url => 'https://github.com/hrsh7th/cmp-path.git', revision => 'main' }, + 'Comment.nvim' => { url => 'https://github.com/numToStr/Comment.nvim.git' }, 'ferret' => { url => 'https://github.com/wincent/ferret.git' }, - # - # Nerdtree has now been loaded after vim start up - # - 'nerdtree' => { - ensure => 'absent', - url => 'https://github.com/scrooloose/nerdtree.git', - }, - } - - exec { 'Compile command t': - path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ], - command => 'ruby extconf.rb && make', - cwd => "${find_file('core/vim')}/pack/bundle/start/command-t/ruby/command-t/ext/command-t", - provider => 'shell', - #require => [Vim::Plugin_start[command-t]], + 'indent-line' => { url => 'https://github.com/Yggdroot/indentLine.git' }, + 'LuaSnip' => { url => 'https://github.com/L3MON4D3/LuaSnip.git' }, + 'nvim-cmp' => { url => 'https://github.com/hrsh7th/nvim-cmp.git', revision => 'main' }, + 'nvim-lint' => { url => 'https://github.com/mfussenegger/nvim-lint.git' }, + 'nvim-lspconfig' => { url => 'https://github.com/neovim/nvim-lspconfig.git' }, + 'nvim-treesitter' => { url => 'https://github.com/nvim-treesitter/nvim-treesitter.git' }, + 'orgmode' => { url => 'https://github.com/nvim-orgmode/orgmode.git' }, + 'vim-puppet' => { url => 'https://github.com/rodjek/vim-puppet.git' }, + 'vim-surround' => { url => 'https://github.com/tpope/vim-surround.git' }, + 'vim-tmux-navigator' => { url => 'https://github.com/christoomey/vim-tmux-navigator.git' }, } create_resources(core::vim::plugin_start, $plugins_start) $plugins_opt= { - 'emmet-vim' => { url => 'https://github.com/mattn/emmet-vim.git' }, - 'nerdtree' => { url => 'https://github.com/scrooloose/nerdtree.git' }, + 'command-t' => { url => 'https://github.com/wincent/command-t.git' }, } create_resources(core::vim::plugin_opt, $plugins_opt) + + exec { 'Compile command t': + path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ], + command => 'ruby extconf.rb && make', + cwd => "${user_home}/.config/nvim/pack/bundle/opt/command-t/ruby/command-t/ext/command-t", + provider => 'shell', + #require => [Vim::Plugin_start[command-t]], + } } diff --git a/site-modules/core/templates/git/gitconfig.erb b/site-modules/core/templates/git/gitconfig.erb index 10d3621..4ab1f43 100644 --- a/site-modules/core/templates/git/gitconfig.erb +++ b/site-modules/core/templates/git/gitconfig.erb @@ -7,7 +7,7 @@ name = <%= scope.call_function('lookup', ["user_name"]) %> [core] - editor = $ZSH/plugins/emacs/emacsclient.sh -nw + editor = vim autocrlf = input [merge]