diff --git a/UltiSnips/README.md b/UltiSnips/README.md deleted file mode 100644 index 05101bf..0000000 --- a/UltiSnips/README.md +++ /dev/null @@ -1 +0,0 @@ -# These are custom snippets that suit my needs diff --git a/UltiSnips/all.snippets b/UltiSnips/all.snippets deleted file mode 100644 index f16483c..0000000 --- a/UltiSnips/all.snippets +++ /dev/null @@ -1,7 +0,0 @@ -global !p -from vimsnippets import get_comment_format -endglobal - -snippet todo "TODO comment" bw -`!p snip.rv=get_comment_format()[0]` TODO: ${2:Something} $0${3: <${4:`!v strftime('%m/%d, %Y')`}${5:, `!v g:snips_author`}>} `!p snip.rv=get_comment_format()[2]` -endsnippet diff --git a/UltiSnips/c.snippets b/UltiSnips/c.snippets deleted file mode 100644 index fd516a4..0000000 --- a/UltiSnips/c.snippets +++ /dev/null @@ -1,13 +0,0 @@ -snippet cm "Comment Section" -/* ${0} */ -endsnippet - -snippet st "printf" -printf(${0}); -endsnippet - -snippet inc "Includes" -#include -#include - -endsnippet diff --git a/UltiSnips/cs.snippets b/UltiSnips/cs.snippets deleted file mode 100644 index b270afb..0000000 --- a/UltiSnips/cs.snippets +++ /dev/null @@ -1,11 +0,0 @@ -snippet main "Public main class" -public static void Main() -{ - System.Console.WriteLine("Hello"); -} - -endsnippet - -snippet st "println" -System.Console.WriteLine(${0}); -endsnippet diff --git a/UltiSnips/dart.snippets b/UltiSnips/dart.snippets deleted file mode 100644 index c2b7fd7..0000000 --- a/UltiSnips/dart.snippets +++ /dev/null @@ -1,571 +0,0 @@ -snippet imat "Import Material" -import 'package:flutter/material.dart'; - -endsnippet - -snippet context "BuildContext" i -BuildContext context -endsnippet - -snippet fn "Async Function" -void ${1:func}() { - ${0} -} - -endsnippet - -snippet afn "Async Function" -Future ${1:func}() async { - ${0} -} -endsnippet - -snippet wfunc "Widget Function" -Widget build${1:Widget}() { - return ${0:Container()}; -} -endsnippet - -snippet el "} else {" -} else { -endsnippet - -snippet elif "} else if () {" -} else if (${0}) { -endsnippet - -snippet msa "MaterialStateProperty.all" -MaterialStateProperty.all(${0}), -endsnippet - -snippet msr "MaterialStateProperty.resolveWith" -MaterialStateProperty.resolveWith<${1}>((states) => states.contains(MaterialState.pressed) ? null : null), -endsnippet - -snippet wh "Width and height" -width: ${1}, -height: ${0}, -endsnippet - -snippet iwh "Infinity Width and height" -width: double.infinity, -height: double.infinity, -endsnippet - -snippet oprs "onPressed" -final void Function() onPressed; -endsnippet - -snippet pa "Padding" -padding: EdgeInsets.only(${1:left: ${2:0}}${3:, right: ${4:0}}${5:, top: ${6:0}}${7:, bottom: ${8:0}}), -endsnippet - -snippet paa "Padding All" -padding: EdgeInsets.all(${1:8.0}), -endsnippet - -snippet pah "Padding Horizontal" -padding: EdgeInsets.symmetric(horizontal: ${0:0}), -endsnippet - -snippet pav "Padding Vertical" -padding: EdgeInsets.symmetric(vertical: ${0:0}), -endsnippet - -snippet pat "Padding Top" -padding: EdgeInsets.only(top: ${0:0}), -endsnippet - -snippet pab "Padding Bottom" -padding: EdgeInsets.only(bottom: ${0:0}), -endsnippet - -snippet pal "Padding Left" -padding: EdgeInsets.only(left: ${0:0}), -endsnippet - -snippet par "Padding Right" -padding: EdgeInsets.only(right: ${0:0}), -endsnippet - -snippet mar "Margin" -margin: EdgeInsets.only(${1:left: ${2:0}}${3:, right: ${4:0}}${5:, top: ${6:0}}${7:, bottom: ${8:0}}), -endsnippet - -snippet mara "Margin All" -margin: EdgeInsets.all(${1:8.0}), -endsnippet - -snippet marh "Margin Horizontal" -margin: EdgeInsets.symmetric(horizontal: ${0:0}), -endsnippet - -snippet marv "Margin Vertical" -margin: EdgeInsets.symmetric(vertical: ${0:0}), -endsnippet - -snippet mart "Margin Top" -margin: EdgeInsets.only(top: ${0:0}), -endsnippet - -snippet marb "Margin Bottom" -margin: EdgeInsets.only(bottom: ${0:0}), -endsnippet - -snippet marl "Margin Left" -margin: EdgeInsets.only(left: ${0:0}), -endsnippet - -snippet marr "Margin Right" -margin: EdgeInsets.only(right: ${0:0}), -endsnippet - -snippet marv "Margin Vertical" -margin: EdgeInsets.only(top: ${1:0}, bottom: ${1}),${0} -endsnippet - -snippet br "BorderRadius" -borderRadius: BorderRadius.all(Radius.circular(${0})), -endsnippet - -snippet sbr "Shape with BorderRadius" -shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(${0})), -), -endsnippet - -snippet dur "Duration" -duration: const Duration(milliseconds: ${0}), -endsnippet - -snippet dec "BoxDecoration" -decoration: BoxDecoration( - color: ${1}, -),${0} -endsnippet - -snippet ba "BorderRadius" -border: Border.all( - width: ${1}, - color: ${2}, -), -endsnippet - -snippet mai "MainAxis" -mainAxisAlignment: MainAxisAlignment.${0} -endsnippet - -snippet crs "CrossAxis" -crossAxisAlignment: CrossAxisAlignment.${0} -endsnippet - -snippet mainmin "MainAxisSize.min" -mainAxisSize: MainAxisSize.min -endsnippet - -snippet row "Row" -Row(children: [ - ${0} -]), -endsnippet - -snippet rowa "Row with alignment" -Row( - mainAxisAlignment: MainAxisAlignment.${1:start}, - crossAxisAlignment: CrossAxisAlignment.${2:start}, - children: [ - ${0} - ], -), -endsnippet - -snippet col "Column" -Column(children: [ - ${0} -]), -endsnippet - -snippet cola "Column with alignment" -Column( - mainAxisAlignment: MainAxisAlignment.${1:start}, - crossAxisAlignment: CrossAxisAlignment.${2:start}, - children: [ - ${0} - ], -), -endsnippet - -snippet sta "Stack" -Stack(children: [ - ${0} -]), -endsnippet - -snippet cs "const SizedBox()" -const SizedBox()${0} -endsnippet - -snippet co "Container" -Container()${0} -endsnippet - -snippet con "Container" -Container( - child: ${0}, -) -endsnippet - -snippet exp "Expanded" -Expanded( - child: ${0}, -), -endsnippet - -snippet flx "Flexible" -Flexible( - child: ${0}, -), -endsnippet - -snippet cons "Container Sized" -Container( - width: ${1}, - height: ${2}, - child: ${0}, -) -endsnippet - -snippet cen "Center" -Center(child: ${0}) -endsnippet - -snippet t "Text" -Text("${1}"),${0} -endsnippet - -snippet ts "Text with text style" -Text(${1}, style: ${2}),${0} -endsnippet - -snippet rts "Rich Text with text style" -RichText( - text: TextSpan(children: [ - TextSpan(text: ${1}, style: ${2}),${0} - ]), -), -endsnippet - -snippet ss "TextStyle" -TStyle(c: ${1}, s: ${2:14}, w: F.w${3:5})${0} -endsnippet - - -snippet nbuilder "NotifierBuilder" -NotifierBuilder( - notifier: null, - builder: (context) { - return Container(); - }, -) -endsnippet - -snippet sw "SizedBox with width" -const SizedBox(width: ${1}),${0} -endsnippet - -snippet sh "SizedBox with height" -const SizedBox(height: ${1}),${0} -endsnippet - -snippet swh "SizedBox with width and height" -SizedBox(width: ${1}, height: ${2}),${0} -endsnippet - -snippet scaf "Scaffold" -Scaffold( - appBar: AppBar( - title: Text('${1:Title}'), - ), - body: ${2:Container()}${0}, -); -endsnippet - -# snippet sf "New Stateful Widget" b -# class ${1:name} extends StatefulWidget { -# ${1:name}({super.key}); -# @override -# _${1/([A-Za-z_]+).*/$1/}State createState() => _${1/([A-Za-z_]+).*/$1/}State(); -# } -# class _${1/([A-Za-z_]+).*/$1/}State extends State<${1/([A-Za-z_]+).*/$1/}> { -# @override -# Widget build(context) { -# return ${2:Container()}; -# } -# } -# endsnippet - -snippet sf "New Stateful Widget" b -class ${1:MyState} extends StatefulWidget { - $1({super.key}); - @override - _$1State createState() => _$1State(); -} -class _$1State extends State<$1> { - @override - Widget build(context) { - return ${2:Container()}; - } -} -endsnippet - -snippet sl "New Stateless Widget" b -class ${1:name} extends StatelessWidget { - ${1:name}({super.key}); - @override - Widget build(context) { - return ${2:Container()}; - } -} -endsnippet - -snippet wt "Colors.white" -color: colorWhite, -endsnippet - -snippet inits "initState" -@override -void initState() { - ${0} - super.initState(); -} -endsnippet - -snippet dispose "dispose" -@override -void dispose() { - ${0:} - super.dispose(); -} -endsnippet - -snippet listv "ListView.builder" -ListView.builder( - itemCount: ${1:1}, - itemBuilder: (context, index) { - return ${2:Container()}; - }, -) -endsnippet - -snippet future "Future Builder" -FutureBuilder( - future: ${1:Future}, - initialData: ${2:InitialData}, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) - return ${3:Container();} - return ${4:Container();} - }, -) -endsnippet - -snippet stream "Stream Builder" -StreamBuilder<${1:dynamic}>( - stream: ${2:yourStream}, - builder: (context, snapshot) { - if (snapshot.hasData) { - // TODO: do something with the data - return ${3:Container()}; - } else if (snapshot.hasError) { - // TODO: do something with the error - return ${4:Text(snapshot.error.toString())}; - } - // TODO: the data is not ready, show a loading indicator - return ${5:Center(child: CircularProgressIndicator())}; - }, -), -endsnippet - -snippet try "try catch" -try { - ${0} -} catch (e, stack) { - print(e); - print(stack); -} -endsnippet - -snippet for "standard for loop without brackets" -for (var ${1:i} = 0; ${1:i} < ${2:n}; ++${1:i}) - ${3:// TODO} -endsnippet - -snippet forr "standard for loop" -for (var ${1:i} = 0; ${1:i} < ${2:n}; ++${1:i}) { - ${3:// TODO} -} -endsnippet - -snippet fori "For in loop" -for (var ${1:item} in ${2:object}) { - ${3:// TODO} -} -endsnippet - -snippet ssm "Multi-line Set State" -setState(() { - ${1:// TODO} -}); -endsnippet - -snippet sss "Single-line Set State" -setState(() => ${1:/* TODO */} ); -endsnippet - -snippet sst "Empty Set State" -setState(() {})${0} -endsnippet - -snippet rf "Request focus" -FocusScope.of(context).requestFocus(${1:FocusNode()})${0} -endsnippet - -snippet rfn "Request focusnode (new)" -FocusScope.of(context).requestFocus(FocusNode()); -endsnippet - -snippet push "Navigator push" -Navigator.of(context).push( - MaterialPageRoute(builder: (context) => ${1:Page()}), -)${0} -endsnippet - -snippet pop "Navigator pop" -Navigator.of(context).pop(${1})${0} -endsnippet - -snippet rmb "RawMaterialButton" -RawMaterialButton( - elevation: ${1:0}, - onPressed: () {}, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(${2:5})), - ), - fillColor: ${3:Colors.transparent}, - child: ${5:Container()}, -), -endsnippet - -snippet mo "Get MediaQuery" -MediaQuery.of(context)${0} -endsnippet - -snippet st "print();" -print(${0}); -endsnippet - -snippet sbj "Behavior subject" -Stream<${1:int}> get ${2:my}Stream => _${2:my}Subject.stream; -BehaviorSubject<${1}> _${2:my}Subject; -_${2:my}Subject = BehaviorSubject<${1}>(); -endsnippet - -snippet f "Function" -() => -endsnippet - -snippet adelay "await Future.delayed" -await Future.delayed(const Duration(milliseconds: ${1:300})); -endsnippet - -snippet delay "Future.delayed" -Future.delayed(const Duration(milliseconds: ${1:300})).then((_) { - ${2} -}); -endsnippet - -snippet now "DateTime.now()" -DateTime.now() -endsnippet - -snippet rt "required this." -required this.${1}, ${0} -endsnippet - -snippet posr "Positioned right" -Positioned( - top: ${1:0}, - right: ${2:0}, - bottom: ${3:0}, - child: ${0:Container()}, -), -endsnippet - -snippet posl "Positioned left" -Positioned( - top: ${1:0}, - left: ${2:0}, - bottom: ${3:0}, - child: ${0:Container()}, -), -endsnippet - -snippet post "Positioned top" -Positioned( - top: ${1:0}, - left: ${2:0}, - right: ${3:0}, - child: ${0:Container()}, -), -endsnippet - -snippet posb "Positioned bottom" -Positioned( - bottom: ${1:0}, - left: ${2:0}, - right: ${3:0}, - child: ${0:Container()}, -), -endsnippet - -snippet postr "Positioned top right" -Positioned( - top: ${1:0}, - right: ${2:0}, - child: ${3:Container()}, -), -endsnippet - -snippet posbl "Positioned bottom left" -Positioned( - bottom: ${1:0}, - left: ${2:0}, - child: ${3:Container()}, -), -endsnippet - -snippet posbr "Positioned bottom right" -Positioned( - bottom: ${1:0}, - right: ${2:0}, - child: ${3:Container()}, -), -endsnippet - -snippet postl "Positioned top left" -Positioned( - top: ${1:0}, - left: ${2:0}, - child: ${3:Container()}, -), -endsnippet - -snippet fa "fix add type" -// TYPEADD -endsnippet - -snippet .f "fix add type" i -.forEach((${1:item}) { - ${0:// TODO} -}); -endsnippet diff --git a/UltiSnips/go.snippets b/UltiSnips/go.snippets deleted file mode 100644 index 2f9f2f7..0000000 --- a/UltiSnips/go.snippets +++ /dev/null @@ -1,84 +0,0 @@ -snippet checke "Check Error" -if err != nil { - return err -} -${0} -endsnippet - -snippet no "utils.NoError" -if utils.NoError(err) { - ${0} -} -endsnippet - -snippet forr "For loop range" -for _, ${1:thing} := range ${2:things} { - ${3://TODO} -} -endsnippet - -snippet fori "For loop i" -for i := 0; i < n; i++ { - ${1://TODO} -} -endsnippet - -snippet re "Return Error if any" -if err != nil { - return err -} -${0} -endsnippet - -snippet ie "Check Error" -if err != nil { - panic(err) -} -${0} -endsnippet - -snippet st "Println" -fmt.Println(${1})${0} -endsnippet - -snippet lt "Log Println" -log.Println(${1})${0} -endsnippet - -snippet sf "Printf" -fmt.Printf("${1}\n")${0} -endsnippet - -snippet lf "Log Printf" -log.Printf("${1}\n")${0} -endsnippet - -snippet fn "Function" -func ${1:function}() { - ${0: // todo} -} -endsnippet - -snippet lt "Log Println" -log.Println(${1})${0} -endsnippet - -snippet start "Starting code" -package main - -import ( - "fmt" -) - -func main() { - fmt.Println("hello") -} -endsnippet - -snippet cq "Current Question" -app.result.questions[app.curResultIndex]${0} -endsnippet - -snippet fa "fix add type" -// TYPEADD -endsnippet diff --git a/UltiSnips/java.snippets b/UltiSnips/java.snippets deleted file mode 100644 index 7b79451..0000000 --- a/UltiSnips/java.snippets +++ /dev/null @@ -1,4 +0,0 @@ -snippet st "System.out.Println();" -System.out.println(${0}); -endsnippet - diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets deleted file mode 100644 index b46e209..0000000 --- a/UltiSnips/javascript.snippets +++ /dev/null @@ -1,444 +0,0 @@ -snippet st "console.log" -console.log(${0}); -endsnippet - -snippet fl "Firebase Function Log" -/*LOG*/ functions.logger.log(${0}); -endsnippet - -snippet f "Arrow Function" -(${1:arg}) => { - ${0} -} -endsnippet - -snippet fn "Empty Function" -function ${1:functionName}() { - ${0} -} -endsnippet - -snippet cf "Constant Function" -const ${1:funcName} = () => { - ${0} -} -endsnippet - -snippet ef "Export Function" -export function ${1:functionName}() { - ${0} -} -endsnippet - -snippet eaf "Export Async Function" -export async function ${1:functionName}() { - ${0} -} -endsnippet - -snippet eafa "Export Async Function With Args" -const ${1}DefaultArgs = { - ${2} -}; -export async function ${1:functionName}(options = ${1}DefaultArgs) { - options = { ...${1}DefaultArgs, ...options }; - ${0:// todo} -} -endsnippet - -snippet ssr "NextJS ServerSide Rendering" -export async function getServerSideProps() { - return { - props: { - // - }, - }; -} -endsnippet - -snippet ssg "NextJS ServerSide Generation" -export async function getStaticProps() { - return { - props: { - // - }, - }; -} -endsnippet - -snippet rs "res.status" -res.status(${1:200}).send("${2:text}")${0} -endsnippet - -snippet af "Async Arrow Function" -async (${1}) => { - ${0} -} -endsnippet - -snippet afn "Async Function" -async function ${1:FunctionName}() { - ${0} -} -endsnippet - -snippet try "Try Catch" -try { - // -} catch (e) { - console.error(e); -} -endsnippet - -snippet eh "Error Handler" -return await errorHandler(async () => { - ${0:// Todo} -}); -endsnippet - -snippet c "Comment Block" -/* - * ${0} -*/ -endsnippet - -snippet pm "@param" -@param ${1:parameter}: ${0:description} -endsnippet - -# React & JSX - -snippet t "Tag" -<${1:div}> - ${2} - -${0} -endsnippet - -snippet ta "Tag with Attributes" -<${1:div} ${2:className=""}> - ${3} - -${0} -endsnippet - -snippet ti "Tag Inline" -<${1} /> -${0} -endsnippet - -snippet br "
" -
-endsnippet - - -snippet rrcc "React Redux Class Component" b -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import styles from './${2:$1}.css'; - -class ${1:`!v expand('%:t:r')`} extends Component { - static propTypes = { - children: PropTypes.node, - className: PropTypes.string, - dispatch: PropTypes.func.isRequired, - }; - - constructor(props) { - super(props); - } - - render() { - return ( -
- $3 -
- ); - } -} - -function mapStateToProps(state) { - return {}; -} - -export default connect(mapStateToProps)($1); -endsnippet - -snippet rcc "React Class Component" b -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import styles from './${2:$1}.css'; - -class ${1:`!v expand('%:t:r')`} extends Component { - static propTypes = { - ${2:children: PropTypes.node, - className: PropTypes.string,} - }; - - constructor(props) { - super(props); - } - - render() { - return ( - <${3:div} className={styles.base}> - $0 - - ); - } -} - -export default $1; -endsnippet - -snippet rfc "React Functional Component" b -import React from 'react'; -import PropTypes from 'prop-types'; -import styles from './${2:$1}.css'; - -function ${1:`!v expand('%:t:r')`}({ $3 }) { - return ( - <${5:div} className={styles.base}> - $0 - - ); -} - -$1.defaultProps = {$4}; - -$1.propTypes = {`!p -props = t[3] -if props: - snip >> 1 - for prop in props.split(', '): - snip += prop + ': PropTypes.any,' -` -}; - -export default $1; -endsnippet - -snippet rsc "React Styled Component" b -import styled from 'styled-components'; - -const ${1:`!v expand('%:t:r')`} = styled.${2:div}\` - $3 -\`; - -export default $1; -endsnippet - -snippet rsci "React Styled Component Interpolation" b -import styled, { css } from 'styled-components'; - -const ${1:`!v expand('%:t:r')`} = styled.${2:div}\`${props => css\` - ${3:${props.$4 && \` - $5 - \`}} -\`}\`; - -export default $1; -endsnippet - -snippet pp "Get Props" -${props => props.${1}}; -endsnippet - -snippet cn "className" -className="$1" -endsnippet - -snippet dp "Default Props" b -${1:`!v expand('%:t:r')`.}defaultProps = { - $2 -}; -endsnippet - -snippet set "Set State" -this.setState({ - ${1}: ${2} -}); -endsnippet - -snippet props "Get Property" i -this.props.${1} -endsnippet - -snippet state "Get State" i -this.state.${1} -endsnippet - -snippet ref "Ref" i -ref={${1:ref} => { this.${2:name} = $1; }} -endsnippet - - -# Component Lifecycle -snippet cwm "Component Will Mount" b -componentWillMount() { - $1 -} -endsnippet - -snippet cdm "Component Did Mount" b -componentDidMount() { - $1 -} -endsnippet - -snippet cwrp "Component Will Receive Props" b -componentWillReceiveProps(nextProps) { - $1 -} -endsnippet - -snippet scup "Should Component Update" b -shouldComponentUpdate(nextProps, nextState) { - $1 -} -endsnippet - -snippet cwup "Component Will Update" b -componentWillUpdate(nextProps, nextState) { - $1 -} -endsnippet - -snippet cdup "Component Did Update" b -componentDidUpdate(prevProps, prevState) { - $1 -} -endsnippet - -snippet cwu "Component Will Unmount" b -componentWillUnmount() { - $1 -} -endsnippet - -snippet ren "Render" -render() { - return ${1:( - ${2:
${3}
} - );} -} -endsnippet - - -# PropTypes -snippet pt "PropTypes Definition" b -${1:`!v expand('%:t:r')`.}propTypes = { - ${2:className}: ${3:PropTypes.string}, -}; -endsnippet - -snippet pt.a "PropTypes Array" w -PropTypes.array${1:,} -endsnippet - -snippet pt.b "PropTypes Boolean" w -PropTypes.bool${1:,} -endsnippet - -snippet pt.f "PropTypes Function" w -PropTypes.func${1:,} -endsnippet - -snippet pt.n "PropTypes Number" w -PropTypes.number${1:,} -endsnippet - -snippet pt.o "PropTypes Object" w -PropTypes.object${1:,} -endsnippet - -snippet pt.s "PropType String" w -PropTypes.string${1:,} -endsnippet - -snippet pt.no "PropTypes Node" w -PropTypes.node${1:,} -endsnippet - -snippet pt.e "PropTypes Element" w -PropTypes.element${1:,} -endsnippet - -snippet pt.io "PropTypes instanceOf" w -PropTypes.instanceOf(${2:PropTypes.string})${1:,} -endsnippet - -snippet pt.one "PropTypes oneOf" w -PropTypes.oneOf(['$2'$3])${1:,} -endsnippet - -snippet pt.onet "PropTypes oneOfType" w -PropTypes.oneOfType([ - $2 -])${1:,} -endsnippet - -snippet pt.ao "PropTypes arrayOf" w -PropTypes.arrayOf(${2:PropTypes.string})${1:,} -endsnippet - -snippet pt.oo "PropTypes objectOf" w -PropTypes.objectOf(${2:PropTypes.string})${1:,} -endsnippet - -snippet pt.sh "PropTyes Shape" w -PropTypes.shape({ - $2 -})${1:,} -endsnippet - -snippet ir "isRequired" w -isRequired, -endsnippet - -snippet rs "React useState" -const [$1, set${1}] = useState(${0:''}) -endsnippet - -snippet test "Test" -test("${1:test}", ${2:async}() => { - ${3:// ...} -}); -endsnippet - -snippet ex "Expect" -expect(${1:1+1}).toBe(${2:2}); -endsnippet - - -snippet route "New Route" -import express from "express"; - -const ${1:some}Routes = express.Router(); - -${0:// TODO} - -export default ${1:some}Routes; -endsnippet - -snippet l "log" -log(${0}); -endsnippet - -snippet ehs "errorHandlers.silent" -await errorHandlers.silent(async () => { - ${0:// todo} -}); -endsnippet - -snippet eha "errorHandlers.safe" -await errorHandlers.safe({ - action: async () => { - ${0:// todo} - }, - teardown: async () => { - // todo - }, -}); -endsnippet diff --git a/UltiSnips/lua.snippets b/UltiSnips/lua.snippets deleted file mode 100644 index 33ce63d..0000000 --- a/UltiSnips/lua.snippets +++ /dev/null @@ -1,11 +0,0 @@ -snippet f "Empty function" -function () - ${0} -end -endsnippet - -snippet conf "Config function" -config = function () - ${0} -end -endsnippet diff --git a/UltiSnips/markdown.snippets b/UltiSnips/markdown.snippets deleted file mode 100644 index 13b1f74..0000000 --- a/UltiSnips/markdown.snippets +++ /dev/null @@ -1,10 +0,0 @@ -snippet th "Table Heading" -| ${1:Key} | ${2:Value} | -|-|-| -${0} -endsnippet - -snippet tr "Table Row" -| ${1:Term} | ${2:Definition} | -${0} -endsnippet diff --git a/UltiSnips/python.snippets b/UltiSnips/python.snippets deleted file mode 100644 index 05c5799..0000000 --- a/UltiSnips/python.snippets +++ /dev/null @@ -1,8 +0,0 @@ -snippet pri "print" -print(${0}) -endsnippet - -snippet main "__main__" -if __name__ == '__main__': - ${0} -endsnippet diff --git a/UltiSnips/racket.snippets b/UltiSnips/racket.snippets deleted file mode 100644 index c8542e6..0000000 --- a/UltiSnips/racket.snippets +++ /dev/null @@ -1,9 +0,0 @@ -snippet fn "Function" -(define (${1:name} [${2:arg : Real}]) : Real - ${0:(+ 1 1)}) -endsnippet - -snippet st "print();" -(displayln ${0}) -endsnippet - diff --git a/UltiSnips/swift.snippets b/UltiSnips/swift.snippets deleted file mode 100644 index 7ee7b69..0000000 --- a/UltiSnips/swift.snippets +++ /dev/null @@ -1,4 +0,0 @@ -snippet st "print" -print(${0}) -endsnippet - diff --git a/UltiSnips/tex.snippets b/UltiSnips/tex.snippets deleted file mode 100644 index 884d236..0000000 --- a/UltiSnips/tex.snippets +++ /dev/null @@ -1,9 +0,0 @@ -# snip -snippet mid "\mid \mid" - \\mid ${1} \\mid ${0} -endsnippet - -snippet srt "\sqrt{}" - \\sqrt{${1}} ${0} -endsnippet - diff --git a/UltiSnips/typescriptreact.snippets b/UltiSnips/typescriptreact.snippets deleted file mode 100644 index 778db64..0000000 --- a/UltiSnips/typescriptreact.snippets +++ /dev/null @@ -1,38 +0,0 @@ -snippet ssg "NextJS ServerSide Generation" -export async function getStaticProps() { - return { - props: { - // - }, - }; -} -endsnippet - -snippet t "Tag" -<${1:div}> - ${2} - -${0} -endsnippet - -snippet ta "Tag with Attributes" -<${1:div} ${2:className=""}> - ${3} - -${0} -endsnippet - -snippet tn "Tag with class Names" -<${1:div} className="${2}"> - ${0} - -endsnippet - -snippet ti "Tag Inline" -<${1} /> -${0} -endsnippet - -snippet br "
" -
-endsnippet diff --git a/UltiSnips/vim.snippets b/UltiSnips/vim.snippets deleted file mode 100644 index 8ad7f02..0000000 --- a/UltiSnips/vim.snippets +++ /dev/null @@ -1,7 +0,0 @@ -snippet sec "Comment Section" -" === -" === ${1:New Section} -" === -${0} -endsnippet - diff --git a/lua/core/cursor.lua b/lua/core/cursor.lua index b7b54c9..2098b6d 100644 --- a/lua/core/cursor.lua +++ b/lua/core/cursor.lua @@ -6,7 +6,7 @@ if vim.g.neovide then vim.o.guifont = "Source Code Pro:h16" -- text below applies for VimScript vim.g.neovide_transparency = 0.75 -- 全屏,在i3和sway的配置中设置了并且速度更快 - vim.g.neovide_fullscreen = true + -- vim.g.neovide_fullscreen = true end -- === diff --git a/lua/core/init.lua b/lua/core/init.lua index ddc8f25..5404cd4 100644 --- a/lua/core/init.lua +++ b/lua/core/init.lua @@ -38,6 +38,8 @@ vim.o.updatetime = 100 vim.o.mouse = 'a' -- 开启颜色 vim.o.termguicolors = true +-- 将updatetime设置为较低的值以提高性能 +vim.opt.updatetime = 200 -- 设置编码格式 vim.o.fileencodings = 'utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1' diff --git a/lua/core/keymap.lua b/lua/core/keymap.lua index 38d3bff..db30692 100644 --- a/lua/core/keymap.lua +++ b/lua/core/keymap.lua @@ -145,6 +145,52 @@ mapkey("x", ">", ">gv") mapkey("x", "", "", ">gv") +-- === +-- === 批量替换 +-- === + +-- 设置快捷键,替换所有文件内容 +mapcmd("sa", "lua search_and_replace()") +-- 设置快捷键,替换当前文件内容 +mapcmd("sr", "lua search_and_replace_current_file()") + +-- 替换当前目录及子目录下所有文件内容 +function search_and_replace() + -- 获取用户输入的查找内容,使用 input() 函数动态输入替换内容 + local search_text = vim.fn.input("Search for: ") + + -- 获取用户输入的替换内容 + local replace_text = vim.fn.input("Replace with: ") + + -- 执行替换命令 + if search_text ~= "" and replace_text ~= "" then + local cmd = 'execute "!grep -rl \\"' .. search_text .. '\\" ./ | xargs sed -i \\"s/' .. search_text .. '/' .. replace_text .. '/g\\""' + vim.cmd(cmd) + print("Replaced all occurrences of '" .. search_text .. "' with '" .. replace_text .. "'") + else + print("Search or replace text cannot be empty.") + end +end + +-- 替换当前文件内容 +function search_and_replace_current_file() + -- 获取用户输入的查找内容 + local search_text = vim.fn.input("Search for in current file: ") + + -- 获取用户输入的替换内容 + local replace_text = vim.fn.input("Replace with: ") + + -- 执行替换命令 + if search_text ~= "" and replace_text ~= "" then + -- 使用 sed 替换当前文件中的匹配内容,并正确转义引号 + local cmd = string.format('!sed -i \'s/%s/%s/g\' %%', search_text, replace_text) + vim.cmd(cmd) + print("Replaced all occurrences of '" .. search_text .. "' with '" .. replace_text .. "' in current file.") + else + print("Search or replace text cannot be empty.") + end +end + -- === -- === Other useful stuff -- === @@ -159,9 +205,8 @@ mapkey("", "", "/<++>:nohlsearchc4l") mapcmd("sc", "set spell!") -- 运行代码 - vim.cmd([[ - au filetype dart noremap r :wall:term tmux a + au filetype dart noremap r :wall:Telescope flutter commands au filetype python noremap r :wall:set splitbelow:sp:term python % au filetype go noremap r :wall:set splitbelow:sp:term go run % au filetype markdown noremap r :MarkdownPreview diff --git a/lua/lazy/index.lua b/lua/lazy/index.lua index 2f3be26..1bf9b0b 100644 --- a/lua/lazy/index.lua +++ b/lua/lazy/index.lua @@ -18,11 +18,17 @@ vim.opt.rtp:prepend(vim.env.LAZY or lazypath) vim.keymap.set("n", "l", ":Lazy", { noremap = true }) require("lazy").setup({ -- cmp自动补全 - require("lazy.plugins.autocomplete").config, + require("lazy.plugins.blinkcmp"), -- lsp配置,全局的错误和警告提示,修复建议,重命名变量,格式化代码等等 require("lazy.plugins.lspconfig"), + -- ai编程助手Fitten Code + require("lazy.plugins.fittencode"), + -- 免费大语言模型 (LLM) 支持 + require("lazy.plugins.llm"), -- 顶部的winbar,可以鼠标点击 require("lazy.plugins.winbar"), + -- command line浮动弹窗 + require("lazy.plugins.cmdline"), -- 代码函数名称浏览时固定,`[c`可以跳转到上下文 require("lazy.plugins.stickyScroll"), -- fold折叠,根据treesitter来折叠,可以兼容我设置的o快捷键 @@ -51,6 +57,8 @@ require("lazy").setup({ require("lazy.plugins.pairs"), -- flutter require("lazy.plugins.flutter"), + -- 用于改进在 Neovim 中查看 Markdown 文件的插件 + require("lazy.plugins.render-markdown"), -- markdown preview require("lazy.plugins.markdownpreview"), -- 底部状态栏+主题 themes @@ -59,10 +67,12 @@ require("lazy").setup({ require("lazy.plugins.comment"), -- 文件缓冲标签栏 require("lazy.plugins.bufferline"), - -- explorer tree 文件列表,现在已经换成yazi fm-nvim启动joshuto ranger Lazygit + -- explorer tree 文件列表,现在已使用yazi require("lazy.plugins.filemanager"), -- minifiles也是文件管理器,功能较少 require("lazy.plugins.minifiles"), + -- crtl+g快捷键在neovim中启动lazygit + require("lazy.plugins.lazygit"), -- telescope模糊查找 require("lazy.plugins.telescope"), -- 代码雨插件 @@ -72,9 +82,13 @@ require("lazy").setup({ -- sudo write require("lazy.plugins.suda"), -- jump使用flash.nvim插件实现,f单个字母时按f下一处,建议先esc退出再可视模式此时才可以继续使用f,斜杠粘贴整个单词查找的时候不好用 - -- require("lazy.plugins.jump"), + require("lazy.plugins.jump"), -- which-key使用多个字母快捷键停留时会提示 -- require("lazy.plugins.whichkey"), -- cw推荐的indent缩进线hlchunk,可以根据线条的款式来分辨缩进 -- require("lazy.plugins.indent"), + -- ai编程助手supermaven + -- require("lazy.plugins.supermaven"), + -- 自动补全插件 + -- require("lazy.plugins.autocomplete").config, }) diff --git a/lua/lazy/plugins/autocomplete.lua b/lua/lazy/plugins/autocomplete.lua index 94df626..72fcb09 100644 --- a/lua/lazy/plugins/autocomplete.lua +++ b/lua/lazy/plugins/autocomplete.lua @@ -68,14 +68,14 @@ M.config = { [''] = cmp.mapping.complete(), [''] = cmp.mapping.complete(), -- 代码片段下一处位置 - [""] = cmp.mapping( + [""] = cmp.mapping( function() cmp_ultisnips_mappings.compose { "expand", "jump_forwards" } (function() end) end, { "i", "s", --[[ "c" (to enable the mapping in command mode) ]] } ), -- 代码片段上一处位置 - [""] = cmp.mapping( + [""] = cmp.mapping( function(fallback) cmp_ultisnips_mappings.jump_backwards(fallback) end, @@ -104,6 +104,7 @@ M.config = { c = function(fallback) if cmp.visible() then cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }) + cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }) else fallback() end @@ -135,6 +136,7 @@ M.config = { { name = 'path' }, -- 本地路径补全 { name = 'nvim_lsp' }, { name = 'ultisnips' }, -- For ultisnips users. + { name = 'fittencode', group_index = 1 }, }, { { name = 'buffer' }, }) diff --git a/lua/lazy/plugins/blinkcmp.lua b/lua/lazy/plugins/blinkcmp.lua new file mode 100644 index 0000000..fbc0a47 --- /dev/null +++ b/lua/lazy/plugins/blinkcmp.lua @@ -0,0 +1,66 @@ +return { + 'saghen/blink.cmp', + dependencies = 'rafamadriz/friendly-snippets', + version = '*', + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + keymap = { + preset = 'none', + [''] = { 'show', 'show_documentation', 'hide_documentation' }, + -- [''] = { 'hide' }, + -- fallback命令将运行下一个非闪烁键盘映射(回车键的默认换行等操作需要) + [''] = { 'accept', 'fallback' }, -- 'select_and_accept'会选择第一项插入 + [''] = { 'select_prev', 'snippet_backward', 'fallback' }, + [''] = { 'select_next', 'snippet_forward', 'fallback' }, + + [''] = { 'scroll_documentation_up', 'fallback' }, + [''] = { 'scroll_documentation_down', 'fallback' }, + + [''] = { 'snippet_forward', 'fallback' }, + [''] = { 'snippet_backward', 'fallback' }, + + }, + completion = { + -- 示例:使用'prefix'对于'foo_|_bar'单词将匹配'foo_'(光标前面的部分),使用'full'将匹配'foo__bar'(整个单词) + keyword = { range = 'full' }, + -- 选择补全项目时显示文档(0.5秒延迟) + documentation = { auto_show = true, auto_show_delay_ms = 500 }, + -- 不预选第一个项目,选中后自动插入该项目文本 + list = { selection = { preselect = false, auto_insert = true } }, + }, + -- 指定文件类型启用/禁用 + enabled = function() + return not vim.tbl_contains({ + -- "lua", + -- "markdown" + }, vim.bo.filetype) + and vim.bo.buftype ~= "prompt" + and vim.b.completion ~= false + end, + + appearance = { + -- 将后备高亮组设置为 nvim-cmp 的高亮组 + -- 当您的主题不支持眨眼.cmp 时很有用 + -- 将在未来版本中删除 + use_nvim_cmp_as_default = true, + -- 将“Nerd Font Mono”设置为“mono”,将“Nerd Font”设置为“normal” + -- 调整间距以确保图标对齐 + nerd_font_variant = 'mono' + }, + + -- 已定义启用的提供程序的默认列表,以便您可以扩展它 + sources = { + default = { 'buffer', 'lsp', 'path', 'snippets', }, + providers = { + -- score_offset设置优先级数字越大优先级越高 + buffer = { score_offset = 3 }, + lsp = { score_offset = 2 }, + path = { score_offset = 1 }, + snippets = { score_offset = 4 }, + } + }, + }, + -- 由于“opts_extend”,您的配置中的其他位置无需重新定义它 + opts_extend = { "sources.default" } +} diff --git a/lua/lazy/plugins/cmdline.lua b/lua/lazy/plugins/cmdline.lua new file mode 100644 index 0000000..5d05b24 --- /dev/null +++ b/lua/lazy/plugins/cmdline.lua @@ -0,0 +1,34 @@ +return { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + }, + config = function() + require("noice").setup({ + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + }) + end +} + + diff --git a/lua/lazy/plugins/filemanager.lua b/lua/lazy/plugins/filemanager.lua index 51b8fda..2f99242 100644 --- a/lua/lazy/plugins/filemanager.lua +++ b/lua/lazy/plugins/filemanager.lua @@ -1,62 +1,13 @@ -- === --- === explorer tree 文件列表 fm-nvim启动joshuto ranger Lazygit +-- === explorer tree 文件列表 -- === return { - "DreamMaoMao/yazi.nvim", -- 使用yazi替代joshuto和ranger,仍然使用fm-nvim来启动lazygit - dependencies = { - "nvim-telescope/telescope.nvim", - "nvim-lua/plenary.nvim", - 'is0n/fm-nvim',commit = 'ad7b80dc99cb8b14977f7ea233a9a299dc8879c0', -- 这个提交解决了joshuto无法启动的问题 - }, + "mikavilpas/yazi.nvim", -- 使用yazi替代joshuto和ranger,仍然使用fm-nvim来启动lazygit + event = "VeryLazy", keys = { { "tt", "Yazi", desc = "Toggle Yazi" }, - { "", "Lazygit", desc = "Toggle Lazygit" }, }, config = function() - require('fm-nvim').setup{ - -- UI Options - ui = { - float = { - -- Floating window border (see ':h nvim_open_win') - border = "single", - -- Num from 0 - 1 for measurements - height = 0.9, - width = 0.8, - }, - }, - } end } - - --- local map = require("core.keymap") --- -- 打开文件树 --- -- map:cmd('tt', "Ranger") --- map:cmd('tt', "Joshuto") --- -- 使用lazygit --- map:cmd('', "Lazygit") - --- return { --- 'is0n/fm-nvim', --- commit = 'ad7b80dc99cb8b14977f7ea233a9a299dc8879c0', -- 这个提交解决了joshuto无法启动的问题 --- config = function() --- require('fm-nvim').setup{ --- -- UI Options --- ui = { --- float = { --- -- Floating window border (see ':h nvim_open_win') --- border = "single", --- -- Num from 0 - 1 for measurements --- height = 0.9, --- width = 0.8, --- }, --- }, --- -- Terminal commands used w/ file manager (have to be in your $PATH) --- cmds = { --- joshuto_cmd = "", --- }, --- } --- end --- } - diff --git a/lua/lazy/plugins/fittencode.lua b/lua/lazy/plugins/fittencode.lua new file mode 100644 index 0000000..acd765e --- /dev/null +++ b/lua/lazy/plugins/fittencode.lua @@ -0,0 +1,23 @@ +-- === +-- === 一个ai编程助手 +-- === + +return { + 'luozhiya/fittencode.nvim', + config = function() + require('fittencode').setup({ + -- completion_mode ='source', + keymaps = { + inline = { + [''] = 'accept_all_suggestions', -- 接受所有建议 + [''] = 'accept_line', -- 接受当前行 + -- [''] = 'accept_word', -- 接受当前单词 + [''] = 'revoke_line', -- 撤销当前行 + -- [''] = 'revoke_word', -- 撤销当前单词 + [''] = 'triggering_completion', -- 触发补全 + }, + }, + }) + end, +} + diff --git a/lua/lazy/plugins/flutter.lua b/lua/lazy/plugins/flutter.lua index 50fd3e3..63862ad 100644 --- a/lua/lazy/plugins/flutter.lua +++ b/lua/lazy/plugins/flutter.lua @@ -1,17 +1,59 @@ -- === -- === flutter-tools -- === - return { - 'akinsho/flutter-tools.nvim', + 'nvim-flutter/flutter-tools.nvim', + lazy = false, dependencies = { 'nvim-lua/plenary.nvim', - 'dart-lang/dart-vim-plugin', + 'stevearc/dressing.nvim', -- optional for vim.ui.select + 'mfussenegger/nvim-dap', }, - ft= {"dart"}, - lazy = true, config = function() - require("flutter-tools").setup {} -- use defaults + require("telescope").load_extension("flutter") + require("flutter-tools").setup { + ui = { + border = "rounded", + notification_style = "native", + }, + decorations = { + statusline = { + app_version = true, + device = true, + }, + }, + widget_guides = { + enabled = true, -- 轮廓窗口的缩进参考线 + debug = true, + }, + closing_tags = { + highlight = "Comment", + prefix = "// ", + enabled = true, + }, + lsp = { + color = { + enabled = true, + background = true, + foreground = false, + virtual_text = false, + virtual_text_str = "■", + }, + settings = { + showTodos = true, + enableSnippets = true, + completeFunctionCalls = false, + }, + }, + debugger = { + enabled = true, + run_via_dap = false, + }, + dev_log = { + enabled = true, + open_cmd = "edit", -- 用于打开日志缓冲区的命令,可以设置为"tabedit"或"split"或者"vsplit"缓冲区将在不同位置打开 + }, + } -- use defaults end } diff --git a/lua/lazy/plugins/lazygit.lua b/lua/lazy/plugins/lazygit.lua new file mode 100644 index 0000000..0efa04f --- /dev/null +++ b/lua/lazy/plugins/lazygit.lua @@ -0,0 +1,15 @@ +-- === +-- === 在neovim中启动lazygit +-- === + +return { + "kdheepak/lazygit.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + keys = { + { "", "LazyGit", desc = "Toggle Lazygit" }, + }, + config = function() + end +} diff --git a/lua/lazy/plugins/llm.lua b/lua/lazy/plugins/llm.lua new file mode 100644 index 0000000..e755e0a --- /dev/null +++ b/lua/lazy/plugins/llm.lua @@ -0,0 +1,45 @@ +return { + "Kurama622/llm.nvim", + dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" }, + cmd = { "LLMSesionToggle", "LLMSelectedTextHandler" }, + config = function() + require("llm").setup({ + prompt = "请用中文回答", + prefix = { + user = { text = "😃 ", hl = "Title" }, + assistant = { text = "⚡ ", hl = "Added" }, + }, + url = "http://localhost:11434/api/chat", -- your url + model = "qwen2.5-coder:0.5b", + + streaming_handler = function(chunk, line, assistant_output, bufnr, winid, F) + if not chunk then + return assistant_output + end + local tail = chunk:sub(-1, -1) + if tail:sub(1, 1) ~= "}" then + line = line .. chunk + else + line = line .. chunk + local status, data = pcall(vim.fn.json_decode, line) + if not status or not data.message.content then + return assistant_output + end + assistant_output = assistant_output .. data.message.content + F.WriteContent(bufnr, winid, data.message.content) + line = "" + end + return assistant_output + end, + keys = { + -- The keyboard mapping for the input window. + ["Input:Submit"] = { mode = "n", key = "" }, + }, + }) + end, + keys = { + { "ac", mode = "n", "LLMSessionToggle" }, + { "ae", mode = "v", "LLMSelectedTextHandler 请解释下面这段代码" }, + { "t", mode = "x", "LLMSelectedTextHandler 英译汉" }, + }, +} diff --git a/lua/lazy/plugins/lspconfig.lua b/lua/lazy/plugins/lspconfig.lua index a986c20..a9ed85f 100644 --- a/lua/lazy/plugins/lspconfig.lua +++ b/lua/lazy/plugins/lspconfig.lua @@ -3,8 +3,9 @@ return { branch = 'v3.x', dependencies = { { 'neovim/nvim-lspconfig' }, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, + { 'saghen/blink.cmp' }, + { 'williamboman/mason.nvim' }, + { 'williamboman/mason-lspconfig.nvim' }, { "MysticalDevil/inlay-hints.nvim", event = "LspAttach", @@ -27,16 +28,16 @@ return { lsp_zero.on_attach(function(client, bufnr) lsp_zero.default_keymaps({ buffer = bufnr }) local opts = { buffer = bufnr } - vim.keymap.set('n', 'h', vim.lsp.buf.hover, opts) -- h显示提示文档 - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) -- gd跳转到定义的位置 - vim.keymap.set('n', 'go', vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置 - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置 - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -- rn变量重命名 + vim.keymap.set('n', 'h', vim.lsp.buf.hover, opts) -- h显示提示文档 + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) -- gd跳转到定义的位置 + vim.keymap.set('n', 'go', vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置 + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置 + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -- rn变量重命名 vim.keymap.set({ 'n', 'x' }, 'f', function() vim.lsp.buf.format({ async = true }) end, opts) -- f进行代码格式化 - vim.keymap.set('n', 'aw', vim.lsp.buf.code_action, opts) -- aw可以在出现警告或错误的地方打开建议的修复方法 - vim.keymap.set('n', 'd', vim.diagnostic.open_float, opts) -- d浮动窗口显示所在行警告或错误信息 - vim.keymap.set('n', '-', vim.diagnostic.goto_prev, opts) -- -跳转到上一处警告或错误的地方 - vim.keymap.set('n', '=', vim.diagnostic.goto_next, opts) -- +跳转到下一处警告或错误的地方 + vim.keymap.set('n', 'aw', vim.lsp.buf.code_action, opts) -- aw可以在出现警告或错误的地方打开建议的修复方法 + vim.keymap.set('n', 'd', vim.diagnostic.open_float, opts) -- d浮动窗口显示所在行警告或错误信息 + vim.keymap.set('n', '-', vim.diagnostic.goto_prev, opts) -- -跳转到上一处警告或错误的地方 + vim.keymap.set('n', '=', vim.diagnostic.goto_next, opts) -- +跳转到下一处警告或错误的地方 end) -- “符号栏”是行号旁边的装订线中的一个空格。当一行中出现警告或错误时,Neovim 会向您显示一个字母 lsp_zero.set_sign_icons({ @@ -51,12 +52,10 @@ return { ensure_installed = servers -- 直接把前面的servers列表传递过来 }) -- cmp相关配置,通过for读取servers列表循环批量激活语言服务 - local capabilities = require("cmp_nvim_lsp").default_capabilities() local lspconfig = require('lspconfig') for _, lsp in ipairs(servers) do lspconfig[lsp].setup { - -- on_attach = my_custom_on_attach, - capabilities = capabilities, + capabilities = require('blink.cmp').get_lsp_capabilities(), settings = { gopls = { hints = { -- gopls开启hints diff --git a/lua/lazy/plugins/minifiles.lua b/lua/lazy/plugins/minifiles.lua index a34d9ee..075cdb9 100644 --- a/lua/lazy/plugins/minifiles.lua +++ b/lua/lazy/plugins/minifiles.lua @@ -8,6 +8,8 @@ return { go_in_plus = 'i', go_out = 'N', go_out_plus = 'n', + mark_goto = "'", + mark_set = 'm', reset = '', reveal_cwd = '@', show_help = 'g?', diff --git a/lua/lazy/plugins/render-markdown.lua b/lua/lazy/plugins/render-markdown.lua new file mode 100644 index 0000000..6c8ebd8 --- /dev/null +++ b/lua/lazy/plugins/render-markdown.lua @@ -0,0 +1,9 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = { + sign = { enabled = false }, + }, +} diff --git a/lua/lazy/plugins/supermaven.lua b/lua/lazy/plugins/supermaven.lua new file mode 100644 index 0000000..90db740 --- /dev/null +++ b/lua/lazy/plugins/supermaven.lua @@ -0,0 +1,15 @@ +-- === +-- === 一个ai编程助手,号称是最快的copilot +-- === +return { + "supermaven-inc/supermaven-nvim", + config = function() + require("supermaven-nvim").setup({ + keymaps = { + accept_suggestion = "", + clear_suggestion = "", + accept_word = "", + }, + }) + end +} diff --git a/lua/lazy/plugins/translate.lua b/lua/lazy/plugins/translate.lua index c11cd5a..5a37723 100644 --- a/lua/lazy/plugins/translate.lua +++ b/lua/lazy/plugins/translate.lua @@ -1,4 +1,3 @@ --- 可视视图下 return { "kraftwerk28/gtranslate.nvim", dependencies = "nvim-lua/plenary.nvim", @@ -11,3 +10,30 @@ return { end } +-- return{ +-- "JuanZoran/Trans.nvim", +-- build = function () require'Trans'.install() end, +-- keys = { +-- -- 可以换成其他你想映射的键 +-- { 'tr', mode = { 'n', 'x' }, 'Translate', desc = '󰊿 Translate' }, +-- { 'tk', mode = { 'n', 'x' }, 'TransPlay', desc = ' Auto Play' }, +-- -- 目前这个功能的视窗还没有做好,可以在配置里将view.i改成hover +-- { 'ti', 'TranslateInput', desc = '󰊿 Translate From Input' }, +-- }, +-- dependencies = { 'kkharji/sqlite.lua', }, +-- opts = { +-- dir = os.getenv 'HOME' .. '/.vim/dict', +-- theme = 'dracula', -- default | tokyonight | dracula +-- frontend = { +-- hover = { +-- keymaps = { +-- pageup = '', +-- pagedown = '', +-- pin = '[', +-- close = ']', +-- toggle_entry = ';', +-- } +-- } +-- } +-- } +-- } diff --git a/snippets/lua.json b/snippets/lua.json new file mode 100644 index 0000000..e550e8d --- /dev/null +++ b/snippets/lua.json @@ -0,0 +1,37 @@ +{ + "sec": { + "prefix": "sec", + "body": [ + "-- ===", + "-- === ${0}", + "-- ===" + ], + "description": "Section comment" + }, + "return": { + "prefix": "return", + "body": [ + "return {", + "\t${1}", + "\tconfig = function()", + "\t\t${2}", + "\tend", + "}" + ], + "description": "Return with config function" + }, + "require_keymap": { + "prefix": "require_keymap", + "body": [ + "local map = require(\"core.keymap\")" + ], + "description": "Require keymap for Neovim" + }, + "require_plugins": { + "prefix": "require_plugins", + "body": [ + "require(\"lazy.plugins.${0}\")" + ], + "description": "Require plugins for Neovim" + } +}