From 72c54e68ad52f60b384d56a1ef3d9c78671d2ff1 Mon Sep 17 00:00:00 2001 From: Frizzus Date: Fri, 11 Oct 2024 11:24:10 +0200 Subject: [PATCH] beaucoup de choses --- LICENSE | 21 +++++ README.md | 233 ---------------------------------------------- ftdetect/red.vim | 1 + ftdetect/reds.vim | 1 + init.lua | 23 ++++- syntax/reds.vim | 165 ++++++++++++++++++++++++++++++++ 6 files changed, 206 insertions(+), 238 deletions(-) create mode 100644 LICENSE delete mode 100644 README.md create mode 100644 ftdetect/red.vim create mode 100644 ftdetect/reds.vim create mode 100644 syntax/reds.vim diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..8e115aae --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 David Feng + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 800ca990..00000000 --- a/README.md +++ /dev/null @@ -1,233 +0,0 @@ -# kickstart.nvim - -## Introduction - -A starting point for Neovim that is: - -* Small -* Single-file -* Completely Documented - -**NOT** a Neovim distribution, but instead a starting point for your configuration. - -## Installation - -### Install Neovim - -Kickstart.nvim targets *only* the latest -['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest -['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. -If you are experiencing issues, please make sure you have the latest versions. - -### Install External Dependencies - -External Requirements: -- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) -- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) -- Clipboard tool (xclip/xsel/win32yank or other depending on platform) -- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - - if you have it set `vim.g.have_nerd_font` in `init.lua` to true -- Language Setup: - - If you want to write Typescript, you need `npm` - - If you want to write Golang, you will need `go` - - etc. - -> **NOTE** -> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes -> and quick install snippets - -### Install Kickstart - -> **NOTE** -> [Backup](#FAQ) your previous configuration (if any exists) - -Neovim's configurations are located under the following paths, depending on your OS: - -| OS | PATH | -| :- | :--- | -| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows (cmd)| `%localappdata%\nvim\` | -| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | - -#### Recommended Step - -[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo -so that you have your own copy that you can modify, then install by cloning the -fork to your machine using one of the commands below, depending on your OS. - -> **NOTE** -> Your fork's url will be something like this: -> `https://github.com//kickstart.nvim.git` - -You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file -too - it's ignored in the kickstart repo to make maintenance easier, but it's -[recommmended to track it in version control](https://lazy.folke.io/usage/lockfile). - -#### Clone kickstart.nvim -> **NOTE** -> If following the recommended step above (i.e., forking the repo), replace -> `nvim-lua` with `` in the commands below - -
Linux and Mac - -```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim -``` - -
- -
Windows - -If you're using `cmd.exe`: - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" -``` - -If you're using `powershell.exe` - -``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" -``` - -
- -### Post Installation - -Start Neovim - -```sh -nvim -``` - -That's it! Lazy will install all the plugins you have. Use `:Lazy` to view -current plugin status. Hit `q` to close the window. - -Read through the `init.lua` file in your configuration folder for more -information about extending and exploring Neovim. That also includes -examples of adding popularly requested plugins. - - -### Getting Started - -[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) - -### FAQ - -* What should I do if I already have a pre-existing neovim configuration? - * You should back it up and then delete all associated files. - * This includes your existing init.lua and the neovim files in `~/.local` - which can be deleted with `rm -rf ~/.local/share/nvim/` -* Can I keep my existing configuration in parallel to kickstart? - * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` - to maintain multiple configurations. For example, you can install the kickstart - configuration in `~/.config/nvim-kickstart` and create an alias: - ``` - alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' - ``` - When you run Neovim using `nvim-kickstart` alias it will use the alternative - config directory and the matching local directory - `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim - distribution that you would like to try out. -* What if I want to "uninstall" this configuration: - * See [lazy.nvim uninstall](https://lazy.folke.io/usage#-uninstalling) information -* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? - * The main purpose of kickstart is to serve as a teaching tool and a reference - configuration that someone can easily use to `git clone` as a basis for their own. - As you progress in learning Neovim and Lua, you might consider splitting `init.lua` - into smaller parts. A fork of kickstart that does this while maintaining the - same functionality is available here: - * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) - * Discussions on this topic can be found here: - * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) - * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) - -### Install Recipes - -Below you can find OS specific install instructions for Neovim and dependencies. - -After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. - -#### Windows Installation - -
Windows with Microsoft C++ Build Tools and CMake -Installation may require installing build tools and updating the run command for `telescope-fzf-native` - -See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) - -This requires: - -- Install CMake and the Microsoft C++ Build Tools on Windows - -```lua -{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } -``` -
-
Windows with gcc/make using chocolatey -Alternatively, one can install gcc and make which don't require changing the config, -the easiest way is to use choco: - -1. install [chocolatey](https://chocolatey.org/install) -either follow the instructions on the page or use winget, -run in cmd as **admin**: -``` -winget install --accept-source-agreements chocolatey.chocolatey -``` - -2. install all requirements using choco, exit previous cmd and -open a new one so that choco path is set, and run in cmd as **admin**: -``` -choco install -y neovim git ripgrep wget fd unzip gzip mingw make -``` -
-
WSL (Windows Subsystem for Linux) - -``` -wsl --install -wsl -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
- -#### Linux Install -
Ubuntu Install Steps - -``` -sudo add-apt-repository ppa:neovim-ppa/unstable -y -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip neovim -``` -
-
Debian Install Steps - -``` -sudo apt update -sudo apt install make gcc ripgrep unzip git xclip curl - -# Now we install nvim -curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz -sudo rm -rf /opt/nvim-linux64 -sudo mkdir -p /opt/nvim-linux64 -sudo chmod a+rX /opt/nvim-linux64 -sudo tar -C /opt -xzf nvim-linux64.tar.gz - -# make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ -``` -
-
Fedora Install Steps - -``` -sudo dnf install -y gcc make git ripgrep fd-find unzip neovim -``` -
- -
Arch Install Steps - -``` -sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim -``` -
- diff --git a/ftdetect/red.vim b/ftdetect/red.vim new file mode 100644 index 00000000..917b0554 --- /dev/null +++ b/ftdetect/red.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.red set filetype=reds diff --git a/ftdetect/reds.vim b/ftdetect/reds.vim new file mode 100644 index 00000000..a77da2ef --- /dev/null +++ b/ftdetect/reds.vim @@ -0,0 +1 @@ +au BufNewFile,BufRead *.reds set filetype=reds diff --git a/init.lua b/init.lua index ea86b792..f79e3969 100644 --- a/init.lua +++ b/init.lua @@ -157,6 +157,20 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- custom settings +-- function Test() +-- print 'test' +-- end +-- vim.api.nvim_create_user_command('Test', Test(), {}) +vim.cmd.colorscheme 'retrobox' + +vim.cmd.set 'tabline=no' +vim.cmd.set 'nonumber' +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 +vim.o.expandtab = true +-- + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -176,10 +190,10 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) -- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -835,7 +849,6 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' -- You can configure highlights by doing something like: vim.cmd.hi 'Comment gui=none' diff --git a/syntax/reds.vim b/syntax/reds.vim new file mode 100644 index 00000000..f99fa295 --- /dev/null +++ b/syntax/reds.vim @@ -0,0 +1,165 @@ +" Vim syntax file +" Language: Red/System +" Maintainer: David Feng +" Filenames: *.reds +" Last Change: 2017-09-03 +" URL: https://github.com/DavidFeng/vim-red +" + +" quit when a syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +" Red/System is case insensitive +syn case ignore + +setlocal iskeyword=@,48-57,?,!,.,',+,-,*,&,\|,=,_,~ + +syn keyword redsTodo contained TODO + +" Comments +syn match redsComment ";.*$" contains=redsTodo + +" Words +syn match redsWord "\a\k*" +syn match redsWordPath "[^[:space:]]/[^[:space]]"ms=s+1,me=e-1 + +" Booleans +syn keyword redsBoolean true false on off yes no + +" Values +" Integers +syn match redsInteger "\<[+-]\=\d\+\('\d*\)*\>" +" Decimals +syn match redsFloat "[+-]\=\(\d\+\('\d*\)*\)\=[,.]\d*\(e[+-]\=\d\+\)\=" +syn match redsFloat "[+-]\=\d\+\('\d*\)*\(e[+-]\=\d\+\)\=" +" Time +syn match redsTime "[+-]\=\(\d\+\('\d*\)*\:\)\{1,2}\d\+\('\d*\)*\([.,]\d\+\)\=\([AP]M\)\=\>" +syn match redsTime "[+-]\=:\d\+\([.,]\d*\)\=\([AP]M\)\=\>" +" Strings +syn region redsString oneline start=+"+ skip=+^"+ end=+"+ contains=redsSpecialCharacter +syn region redsString start=+[^#]{+ end=+}+ skip=+{[^}]*}+ contains=redsSpecialCharacter +" Binary +syn region redsBinary start=+\d*#{+ end=+}+ contains=redsComment +" File +syn match redsFile "%\(\k\+/\)*\k\+[/]\=" contains=redsSpecialCharacter +syn region redsFile oneline start=+%"+ end=+"+ contains=redsSpecialCharacter +" Issues +syn match redsIssue "#\(\d\+-\)*\d\+" +" Tuples +syn match redsTuple "\(\d\+\.\)\{2,}" + +" Characters +syn match redsSpecialCharacter contained "\^[^[:space:][]" +syn match redsSpecialCharacter contained "%\d\+" + + +" Operators +" Math operators +syn match redsMathOperator "\(\*\{1,2}\|+\|-\|/\{1,2}\)" +syn keyword redsMathFunction abs absolute add arccosine arcsine arctangent cosine +syn keyword redsMathFunction divide exp log-10 log-2 log-e max maximum min +syn keyword redsMathFunction minimum multiply negate power random remainder sine +syn keyword redsMathFunction square-root subtract tangent +" Binary operators +syn keyword redsBinaryOperator complement and or xor ~ +" Logic operators +syn match redsLogicOperator "[<>=]=\=" +syn match redsLogicOperator "<>" +syn keyword redsLogicOperator not +syn keyword redsLogicFunction all any +syn keyword redsLogicFunction head? tail? +syn keyword redsLogicFunction negative? positive? zero? even? odd? +syn keyword redsLogicFunction binary? block? char? date? decimal? email? empty? +syn keyword redsLogicFunction file? found? function? integer? issue? logic? money? +syn keyword redsLogicFunction native? none? object? paren? path? port? series? +syn keyword redsLogicFunction string? time? tuple? url? word? +syn keyword redsLogicFunction exists? input? same? value? + +" Datatypes +syn keyword redsType binary! block! char! date! decimal! email! file! +syn keyword redsType function! integer! issue! logic! money! native! +syn keyword redsType none! object! paren! path! port! string! time! +syn keyword redsType tuple! url! word! +syn keyword redsTypeFunction type? + +" Control statements +syn keyword redsStatement break catch exit halt reduce return shield +syn keyword redsConditional if else either +syn keyword redsRepeat for forall foreach forskip loop repeat while until do + +" Series statements +syn keyword redsStatement change clear copy fifth find first format fourth free +syn keyword redsStatement func function head insert last match next parse past +syn keyword redsStatement pick remove second select skip sort tail third trim length? + +" Context +syn keyword redsStatement alias bind use + +" Object +syn keyword redsStatement import make make-object reds info? + +" I/O statements +syn keyword redsStatement delete echo form format import input load mold prin +syn keyword redsStatement print probe read save secure send write +syn keyword redsOperator size? modified? + +" Debug statement +syn keyword redsStatement help probe trace + +" Misc statements +syn keyword redsStatement func function free + +" Constants +syn keyword redsConstant none + + +" Define the default highlighting. +" Only when an item doesn't have highlighting yet + +hi def link redsTodo Todo + +hi def link redsStatement Statement +hi def link redsLabel Label +hi def link redsConditional Conditional +hi def link redsRepeat Repeat + +hi def link redsOperator Operator +hi def link redsLogicOperator redsOperator +hi def link redsLogicFunction redsLogicOperator +hi def link redsMathOperator redsOperator +hi def link redsMathFunction redsMathOperator +hi def link redsBinaryOperator redsOperator +hi def link redsBinaryFunction redsBinaryOperator + +hi def link redsType Type +hi def link redsTypeFunction redsOperator + +hi def link redsWord Identifier +hi def link redsWordPath redsWord +hi def link redsFunction Function + +hi def link redsCharacter Character +hi def link redsSpecialCharacter SpecialChar +hi def link redsString String + +hi def link redsNumber Number +hi def link redsInteger redsNumber +hi def link redsFloat redsNumber +hi def link redsTime redsNumber +hi def link redsBinary redsNumber +hi def link redsFile redsString +hi def link redsIssue redsNumber +hi def link redsTuple redsNumber +hi def link redsFloat Float +hi def link redsBoolean Boolean + +hi def link redsConstant Constant + +hi def link redsComment Comment + +hi def link redsError Error + + +let b:current_syntax = "reds"