Completely redid neovim configuration, based on kickstart.nvim
This commit is contained in:
parent
c2b6680375
commit
c7e652d93a
4
nvim/.config/nvim/.gitignore
vendored
Normal file
4
nvim/.config/nvim/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
tags
|
||||
test.sh
|
||||
.luarc.json
|
||||
nvim
|
19
nvim/.config/nvim/LICENSE.md
Normal file
19
nvim/.config/nvim/LICENSE.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
MIT License
|
||||
|
||||
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.
|
130
nvim/.config/nvim/README.md
Normal file
130
nvim/.config/nvim/README.md
Normal file
|
@ -0,0 +1,130 @@
|
|||
# kickstart.nvim
|
||||
|
||||
### Introduction
|
||||
|
||||
A starting point for Neovim that is:
|
||||
|
||||
* Small
|
||||
* Single-file (with examples of moving to multi-file)
|
||||
* Documented
|
||||
* Modular
|
||||
|
||||
This repo is meant to be used as by **YOU** to begin your Neovim journey; remove the things you don't use and add what you miss.
|
||||
|
||||
Distribution Alternatives:
|
||||
- [LazyVim](https://www.lazyvim.org/): A delightful distribution maintained by @folke (the author of lazy.nvim, the package manager used here)
|
||||
|
||||
### Installation
|
||||
|
||||
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.
|
||||
|
||||
* Backup your previous configuration
|
||||
* (Recommended) Fork this repo (so that you have your own copy that you can modify).
|
||||
* Clone the kickstart repo into `$HOME/.config/nvim/` (Linux/Mac) or `~/AppData/Local/nvim/` (Windows)
|
||||
* If you don't want to include it as a git repo, you can just clone it and then move the files to this location
|
||||
* Start Neovim (`nvim`) and allow `lazy.nvim` to complete installation.
|
||||
* Restart Neovim
|
||||
* **You're ready to go!**
|
||||
|
||||
Additional system requirements:
|
||||
- Make sure to review the readmes of the plugins if you are experiencing errors. In particular:
|
||||
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) is required for multiple [telescope](https://github.com/nvim-telescope/telescope.nvim#suggested-dependencies) pickers.
|
||||
- See as well [Windows Installation](#Windows-Installation)
|
||||
|
||||
### Configuration And Extension
|
||||
|
||||
* Inside of your fork, feel free to modify any file you like! It's your fork!
|
||||
* Then there are two primary configuration options available:
|
||||
* Include the `lua/kickstart/plugins/*` files in your configuration.
|
||||
* Add new configuration in `lua/custom/plugins/*` files, which will be auto sourced using `lazy.nvim`
|
||||
* NOTE: To enable this, you need to uncomment `{ import = 'custom.plugins' }` in your `init.lua`
|
||||
|
||||
You can also merge updates/changes from the repo back into your fork, to keep up-to-date with any changes for the default configuration
|
||||
|
||||
#### Example: Adding an autopairs plugin
|
||||
|
||||
In the file: `lua/custom/plugins/autopairs.lua`, add:
|
||||
|
||||
```lua
|
||||
-- File: lua/custom/plugins/autopairs.lua
|
||||
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup {}
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
This will automatically install `nvim-autopairs` and enable it on startup. For more information, see documentation for [lazy.nvim](https://github.com/folke/lazy.nvim).
|
||||
|
||||
#### Example: Adding a file tree plugin
|
||||
|
||||
In the file: `lua/custom/plugins/filetree.lua`, add:
|
||||
|
||||
```lua
|
||||
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function ()
|
||||
require('neo-tree').setup {}
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
This will install the tree plugin and add the command `:NeoTree` for you. You can explore the documentation at [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) for more information.
|
||||
|
||||
#### Example: Adding a file to change default options
|
||||
|
||||
To change default options, you can add a file in the `/after/plugin/` folder (see `:help load-plugins`) to include your own options, keymaps, autogroups, and more. The following is an example `defaults.lua` file (located at `$HOME/.config/nvim/after/plugin/defaults.lua`).
|
||||
|
||||
```lua
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||
```
|
||||
|
||||
### Contribution
|
||||
|
||||
Pull-requests are welcome. The goal of this repo is not to create a Neovim configuration framework, but to offer a starting template that shows, by example, available features in Neovim. Some things that will not be included:
|
||||
|
||||
* Custom language server configuration (null-ls templates)
|
||||
* Theming beyond a default colorscheme necessary for LSP highlight groups
|
||||
|
||||
Each PR, especially those which increase the line count, should have a description as to why the PR is necessary.
|
||||
|
||||
### FAQ
|
||||
|
||||
* What should I do if I already have a pre-existing neovim configuration?
|
||||
* You should back it up, then delete all files associated with it.
|
||||
* This includes your existing init.lua and the neovim files in `~/.local` which can be deleted with `rm -rf ~/.local/share/nvim/`
|
||||
* You may also want to look at the [migration guide for lazy.nvim](https://github.com/folke/lazy.nvim#-migration-guide)
|
||||
* What if I want to "uninstall" this configuration:
|
||||
* See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information
|
||||
* Are there any cool videos about this plugin?
|
||||
* Current iteration of kickstart (coming soon)
|
||||
* Here is one about the previous iteration of kickstart: [video introduction to Kickstart.nvim](https://youtu.be/stqUbv-5u2s).
|
||||
|
||||
### Windows Installation
|
||||
|
||||
Installation may require installing build tools, and updating the run command for `telescope-fzf-native`
|
||||
|
||||
See `telescope-fzf-native` documention 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' }
|
||||
```
|
||||
|
122
nvim/.config/nvim/Session.vim
Normal file
122
nvim/.config/nvim/Session.vim
Normal file
|
@ -0,0 +1,122 @@
|
|||
let SessionLoad = 1
|
||||
let s:so_save = &g:so | let s:siso_save = &g:siso | setg so=0 siso=0 | setl so=-1 siso=-1
|
||||
let v:this_session=expand("<sfile>:p")
|
||||
silent only
|
||||
silent tabonly
|
||||
cd ~/.dotfiles/nvim/.config/nvim
|
||||
if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||
let s:wipebuf = bufnr('%')
|
||||
endif
|
||||
let s:shortmess_save = &shortmess
|
||||
if &shortmess =~ 'A'
|
||||
set shortmess=aoOA
|
||||
else
|
||||
set shortmess=aoO
|
||||
endif
|
||||
badd +379 init.lua
|
||||
badd +18 lua/plugins/trouble.lua
|
||||
badd +5 lua/plugins/undotree.lua
|
||||
badd +1 lua/themes/gruvbox.lua
|
||||
badd +3 lua/plugins/todo-comments.lua
|
||||
badd +9 lua/options.lua
|
||||
badd +17 lua/keymaps.lua
|
||||
badd +15 lua/autocmds.lua
|
||||
badd +1 lua/plugins/autopairs.lua
|
||||
badd +1 lua/plugins/autotag.lua
|
||||
badd +4 lua/plugins/bufdel.lua
|
||||
badd +1 lua/plugins/bufferline.lua
|
||||
badd +1 lua/plugins/colorizer.lua
|
||||
badd +1 lua/plugins/comment.lua
|
||||
badd +9 lua/plugins/diffview.lua
|
||||
badd +1 lua/plugins/guess-indent.lua
|
||||
badd +1 lua/plugins/neotree.lua
|
||||
badd +7 lua/plugins/surround.lua
|
||||
badd +1 lua/plugins/tmux-navigation.lua
|
||||
badd +1 lua/plugins/whitespace.lua
|
||||
badd +22 lua/kickstart/plugins/autoformat.lua
|
||||
badd +39 ~/Projects/rust/automation_rs/src/main.rs
|
||||
badd +13 lua/plugins/treesj.lua
|
||||
badd +10 ~/.dotfiles/nvim/.config/nvim/lua/plugins/symbols-outline.lua
|
||||
badd +3 lua/plugins/null-ls.lua
|
||||
argglobal
|
||||
%argdel
|
||||
edit init.lua
|
||||
let s:save_splitbelow = &splitbelow
|
||||
let s:save_splitright = &splitright
|
||||
set splitbelow splitright
|
||||
wincmd _ | wincmd |
|
||||
vsplit
|
||||
1wincmd h
|
||||
wincmd w
|
||||
let &splitbelow = s:save_splitbelow
|
||||
let &splitright = s:save_splitright
|
||||
wincmd t
|
||||
let s:save_winminheight = &winminheight
|
||||
let s:save_winminwidth = &winminwidth
|
||||
set winminheight=0
|
||||
set winheight=1
|
||||
set winminwidth=0
|
||||
set winwidth=1
|
||||
exe 'vert 1resize ' . ((&columns * 142 + 142) / 284)
|
||||
exe 'vert 2resize ' . ((&columns * 141 + 142) / 284)
|
||||
argglobal
|
||||
balt lua/options.lua
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 379 - ((53 * winheight(0) + 35) / 70)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 379
|
||||
normal! 045|
|
||||
wincmd w
|
||||
argglobal
|
||||
if bufexists(fnamemodify("lua/plugins/null-ls.lua", ":p")) | buffer lua/plugins/null-ls.lua | else | edit lua/plugins/null-ls.lua | endif
|
||||
if &buftype ==# 'terminal'
|
||||
silent file lua/plugins/null-ls.lua
|
||||
endif
|
||||
balt lua/keymaps.lua
|
||||
setlocal fdm=manual
|
||||
setlocal fde=0
|
||||
setlocal fmr={{{,}}}
|
||||
setlocal fdi=#
|
||||
setlocal fdl=0
|
||||
setlocal fml=1
|
||||
setlocal fdn=20
|
||||
setlocal fen
|
||||
silent! normal! zE
|
||||
let &fdl = &fdl
|
||||
let s:l = 3 - ((2 * winheight(0) + 35) / 70)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
keepjumps exe s:l
|
||||
normal! zt
|
||||
keepjumps 3
|
||||
normal! 024|
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 142 + 142) / 284)
|
||||
exe 'vert 2resize ' . ((&columns * 141 + 142) / 284)
|
||||
tabnext 1
|
||||
if exists('s:wipebuf') && len(win_findbuf(s:wipebuf)) == 0 && getbufvar(s:wipebuf, '&buftype') isnot# 'terminal'
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
endif
|
||||
unlet! s:wipebuf
|
||||
set winheight=1 winwidth=20
|
||||
let &shortmess = s:shortmess_save
|
||||
let &winminheight = s:save_winminheight
|
||||
let &winminwidth = s:save_winminwidth
|
||||
let s:sx = expand("<sfile>:p:r")."x.vim"
|
||||
if filereadable(s:sx)
|
||||
exe "source " . fnameescape(s:sx)
|
||||
endif
|
||||
let &g:so = s:so_save | let &g:siso = s:siso_save
|
||||
doautoall SessionLoadPost
|
||||
unlet SessionLoad
|
||||
" vim: set ft=vim :
|
534
nvim/.config/nvim/init.lua
Normal file
534
nvim/.config/nvim/init.lua
Normal file
|
@ -0,0 +1,534 @@
|
|||
--[[
|
||||
|
||||
=====================================================================
|
||||
==================== READ THIS BEFORE CONTINUING ====================
|
||||
=====================================================================
|
||||
|
||||
Kickstart.nvim is *not* a distribution.
|
||||
|
||||
Kickstart.nvim is a template for your own configuration.
|
||||
The goal is that you can read every line of code, top-to-bottom, and understand
|
||||
what your configuration is doing.
|
||||
|
||||
Once you've done that, you should start exploring, configuring and tinkering to
|
||||
explore Neovim!
|
||||
|
||||
If you don't know anything about Lua, I recommend taking some time to read through
|
||||
a guide. One possible example:
|
||||
- https://learnxinyminutes.com/docs/lua/
|
||||
|
||||
And then you can explore or search through `:help lua-guide`
|
||||
|
||||
|
||||
Kickstart Guide:
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
You should run that command and read that help section for more information.
|
||||
|
||||
In addition, I have some `NOTE:` items throughout the file.
|
||||
These are for you, the reader to help understand what is happening. Feel free to delete
|
||||
them once you know what you're doing, but they should serve as a guide for when you
|
||||
are first encountering a few different constructs in your nvim config.
|
||||
|
||||
I hope you enjoy your Neovim journey,
|
||||
- TJ
|
||||
|
||||
P.S. You can delete this when you're done too. It's your config now :)
|
||||
--]]
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
-- Install package manager
|
||||
-- https://github.com/folke/lazy.nvim
|
||||
-- `:help lazy.nvim.txt` for more info
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
'https://github.com/folke/lazy.nvim.git',
|
||||
'--branch=stable', -- latest stable release
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local symbols = require('constant.symbols');
|
||||
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
-- You can configure plugins using the `config` key.
|
||||
--
|
||||
-- You can also configure plugins after the setup call,
|
||||
-- as they will be available in your neovim runtime.
|
||||
require('lazy').setup({
|
||||
|
||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||
-- The configuration is done below. Search for lspconfig to find it below.
|
||||
{ -- LSP Configuration & Plugins
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing!
|
||||
'folke/neodev.nvim',
|
||||
|
||||
-- Add document color
|
||||
'mrshmllow/document-color.nvim',
|
||||
|
||||
-- Rename with immediate visual feedback
|
||||
{
|
||||
'smjonas/inc-rename.nvim',
|
||||
config = function()
|
||||
require('inc_rename').setup {
|
||||
preview_empty_name = true,
|
||||
}
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'ray-x/lsp_signature.nvim',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
},
|
||||
opts = {
|
||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||
hint_enable = false,
|
||||
handler_opts = {
|
||||
-- TODO: Setup borders for other lsp stuff (Maybe using noice?)
|
||||
border = "single"
|
||||
}}
|
||||
},
|
||||
|
||||
{ -- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-path', 'onsails/lspkind-nvim', },
|
||||
},
|
||||
|
||||
-- Useful plugin to show you pending keybinds.
|
||||
{ 'folke/which-key.nvim', opts = {} },
|
||||
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
-- See `:help gitsigns.txt`
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Set lualine as statusline
|
||||
'nvim-lualine/lualine.nvim',
|
||||
-- See `:help lualine.txt`
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'gruvbox',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
},
|
||||
sections = {
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{ 'diagnostics', symbols = {error = '', warn = '', info = '', hint = ''} },
|
||||
},
|
||||
lualine_c = {
|
||||
{ 'filename',
|
||||
path = 1,
|
||||
symbols = {
|
||||
modified = symbols.file.modified,
|
||||
readonly = symbols.file.readonly,
|
||||
}
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
'encoding', { 'fileformat', icons_enabled = false }, 'filetype',
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_c = {
|
||||
{ 'filename', path = 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help indent_blankline.txt`
|
||||
opts = {
|
||||
char = '¦',
|
||||
show_trailing_blankline_indent = false,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
{ 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-ui-select.nvim' } },
|
||||
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
||||
-- Only load if `make` is available. Make sure you have the system
|
||||
-- requirements installed.
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
-- NOTE: If you are having trouble with this installation,
|
||||
-- refer to the README for telescope-fzf-native for more instructions.
|
||||
build = 'make',
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
},
|
||||
config = function()
|
||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
||||
end,
|
||||
},
|
||||
|
||||
require 'themes.gruvbox',
|
||||
{ import = 'plugins' },
|
||||
}, {
|
||||
install = {
|
||||
colorscheme = {
|
||||
'gruvbox',
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
require('options')
|
||||
require('keymaps')
|
||||
require('autocmds')
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
".git/",
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
['<c-d>'] = "delete_buffer",
|
||||
['<Tab>'] = "move_selection_next",
|
||||
['<S-Tab>'] = "move_selection_previous",
|
||||
},
|
||||
i = {
|
||||
['<c-d>'] = "delete_buffer",
|
||||
['<Tab>'] = "move_selection_next",
|
||||
['<S-Tab>'] = "move_selection_previous",
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require('telescope.themes').get_dropdown {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
require('telescope.builtin').current_buffer_fuzzy_find({
|
||||
-- Show matches in the order they appear in the document
|
||||
sorting_strategy = "ascending",
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', function()
|
||||
require('telescope.builtin').grep_string({
|
||||
-- Show matches in the order they appear in the document
|
||||
sorting_strategy = "ascending",
|
||||
})
|
||||
end, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' })
|
||||
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = true,
|
||||
|
||||
highlight = { enable = true },
|
||||
-- Disabled because it caueses issues with nvim-autopair
|
||||
indent = { enable = false, disable = { 'python' } },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = '<c-space>',
|
||||
node_incremental = '<c-space>',
|
||||
scope_incremental = '<c-s>',
|
||||
node_decremental = '<M-space>',
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
['aa'] = '@parameter.outer',
|
||||
['ia'] = '@parameter.inner',
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
[']m'] = '@function.outer',
|
||||
[']]'] = '@class.outer',
|
||||
},
|
||||
goto_next_end = {
|
||||
[']M'] = '@function.outer',
|
||||
[']['] = '@class.outer',
|
||||
},
|
||||
goto_previous_start = {
|
||||
['[m'] = '@function.outer',
|
||||
['[['] = '@class.outer',
|
||||
},
|
||||
goto_previous_end = {
|
||||
['[M'] = '@function.outer',
|
||||
['[]'] = '@class.outer',
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
['<leader>a'] = '@parameter.inner',
|
||||
},
|
||||
swap_previous = {
|
||||
['<leader>A'] = '@parameter.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- LSP settings.
|
||||
-- Set the diagnostic symbols (Also used by Neo-tree)
|
||||
local signs = { Error = symbols.diagnostic.error, Warn = symbols.diagnostic.warning, Hint = symbols.diagnostic.hint, Info = symbols.diagnostic.info }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(client, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader>rn', function()
|
||||
return ':IncRename ' .. vim.fn.expand('<cword>')
|
||||
end, { expr = true, desc = '[R]e[n]ame' })
|
||||
|
||||
-- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
-- Should allow code actions in visual mode
|
||||
vim.keymap.set({'v', 'n'}, '<leader>ca', vim.lsp.buf.code_action, { buffer = bufnr, desc = 'LSP: [C]ode [A]ction', remap=true })
|
||||
-- nmap('<leader>ca', require('telescope.builtin')., '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = 'Format current buffer with LSP' })
|
||||
|
||||
-- Attach document colour support
|
||||
if client.server_capabilities.colorProvider then
|
||||
require("document-color").buf_attach(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
local servers = {
|
||||
clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
rust_analyzer = {
|
||||
-- enable clippy on save
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
command = "clippy",
|
||||
},
|
||||
check = {
|
||||
allTargets = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
tsserver = {},
|
||||
tailwindcss = {},
|
||||
-- cssls = {},
|
||||
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
capabilities.textDocument.colorProvider = {
|
||||
dynamicRegistration = true
|
||||
}
|
||||
|
||||
-- Setup mason so it can manage external tooling
|
||||
require('mason').setup()
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require 'mason-lspconfig'
|
||||
|
||||
mason_lspconfig.setup {
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
}
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
local lspkind = require 'lspkind'
|
||||
|
||||
luasnip.config.setup {}
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- Include the source of the cmp entry
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "text",
|
||||
menu = {
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
path = "[Path]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = 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 = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
}
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
|
@ -1,107 +0,0 @@
|
|||
let g:nvim_tree_show_icons = {
|
||||
\ 'git': 0,
|
||||
\ 'folders': 1,
|
||||
\ 'files': 0,
|
||||
\ 'folder_arrows': 0,
|
||||
\ }
|
||||
let g:nvim_tree_icons = {
|
||||
\ 'folder': {
|
||||
\ 'arrow_open': "",
|
||||
\ 'arrow_closed': "",
|
||||
\ 'default': "",
|
||||
\ 'open': "",
|
||||
\ 'empty': "",
|
||||
\ 'empty_open': "",
|
||||
\ 'symlink': "",
|
||||
\ 'symlink_open': "",
|
||||
\ }
|
||||
\ }
|
||||
lua require('plugins')
|
||||
|
||||
" Load vim config in current directory
|
||||
silent! so .vimlocal
|
||||
|
||||
" DelimitMate
|
||||
let delimitMate_expand_cr = 1
|
||||
let delimitMate_expand_space = 1
|
||||
let delimitMate_balance_matchpairs = 1
|
||||
|
||||
" Theme
|
||||
colorscheme gruvbox
|
||||
set t_Co=256
|
||||
set t_ZH=[3m
|
||||
set t_ZR=[23m
|
||||
set background=dark
|
||||
|
||||
" Ident
|
||||
" set list lcs=tab:┃\ ,trail:·
|
||||
set list lcs=tab:¦\ ,trail:·
|
||||
|
||||
" Airline
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline_theme='gruvbox'
|
||||
" let g:airline_theme='codedark'
|
||||
let g:airline_section_z = '%3p%% %#__accent_bold#%4l%#__restore__#%#__accent_bold#/%L%#__restore__# :%3v'
|
||||
let g:airline_section_warning = ''
|
||||
|
||||
if !exists('g:airline_symbols')
|
||||
let g:airline_symbols = {}
|
||||
endif
|
||||
|
||||
let g:airline_symbols.dirty = " ±"
|
||||
let g:airline_symbols.notexists = " "
|
||||
|
||||
" Preferences
|
||||
syntax on
|
||||
filetype plugin indent on
|
||||
set smartindent
|
||||
set number
|
||||
set laststatus=2
|
||||
set softtabstop=4
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set noexpandtab
|
||||
set mouse=n
|
||||
set hidden
|
||||
set updatetime=300
|
||||
set noshowmode
|
||||
|
||||
set foldmethod=expr
|
||||
set foldexpr=nvim_treesitter#foldexpr()
|
||||
set foldnestmax=1
|
||||
set foldlevel=20
|
||||
|
||||
" Keybindings
|
||||
nnoremap <F2> <cmd>NvimTreeToggle<cr>
|
||||
nnoremap <M-h> <cmd>TmuxNavigateLeft<cr>
|
||||
nnoremap <M-j> <cmd>TmuxNavigateDown<cr>
|
||||
nnoremap <M-k> <cmd>TmuxNavigateUp<cr>
|
||||
nnoremap <M-l> <cmd>TmuxNavigateRight<cr>
|
||||
nnoremap <tab> <cmd>bn<cr>
|
||||
nnoremap <S-tab> <cmd>bp<cr>
|
||||
nnoremap <C-b> <cmd>Bdelete<cr>
|
||||
nnoremap <F3> <cmd>TroubleToggle workspace_diagnostics<cr>
|
||||
nnoremap <F4> <cmd>call ToggleQuickfixList()<cr>
|
||||
nnoremap <F1> <cmd>noh<cr>
|
||||
map <S-j> 10j
|
||||
map <S-k> 10k
|
||||
|
||||
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
||||
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
||||
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
||||
nnoremap <leader>ls <cmd>Telescope lsp_document_symbols<cr>
|
||||
nnoremap <leader>ln <cmd>lua vim.lsp.diagnostic.goto_next()<cr>
|
||||
nnoremap <leader>lp <cmd>lua vim.lsp.diagnostic.goto_prev()<cr>
|
||||
nnoremap <leader>ll :lua vim.lsp.buf.
|
||||
nnoremap <leader>lc <cmd>lua vim.lsp.buf.code_action()<cr>
|
||||
nnoremap <leader>lh <cmd>lua vim.lsp.buf.hover()<cr>
|
||||
nnoremap <leader>lf <cmd>lua vim.lsp.buf.formatting()<cr>
|
||||
|
||||
highlight! CmpItemAbbrMatch ctermfg=Cyan
|
||||
highlight! CmpItemAbbrMatchFuzzy ctermfg=Cyan
|
||||
highlight! NvimTreeFolderName ctermfg=Blue
|
||||
highlight! NvimTreeOpenedFolderName ctermfg=Blue cterm=bold
|
||||
highlight! NvimTreeEmptyFolderName ctermfg=Blue
|
||||
|
||||
autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif
|
47
nvim/.config/nvim/lazy-lock.json
Normal file
47
nvim/.config/nvim/lazy-lock.json
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" },
|
||||
"LuaSnip": { "branch": "master", "commit": "bc8ec05022743d3f08bda7a76c6bb5e9a9024581" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "eb4e95be22c55890b90fc01a8223e0c0ea4a0862" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "372d5cb485f2062ac74abc5b33054abac21d8b58" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "53bfb95b1ed1d87f6a276abdd322b267be0b5adf" },
|
||||
"guess-indent.nvim": { "branch": "main", "commit": "b8ae749fce17aa4c267eec80a6984130b94f80b2" },
|
||||
"inc-rename.nvim": { "branch": "main", "commit": "fb1b7468f27d874feb209eac46be5205e20b7fd3" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "1882019270be445a8cad4353f1530574f2b2d02d" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "c68b3a003483cf382428a43035079f78474cd11e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "c28a7427c3fb29322db136f0564ec58807b26747" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a5ca8b03972b347b74b2ad2f7f23f120a514593b" },
|
||||
"mason.nvim": { "branch": "main", "commit": "84af7a1fa1dbdb0f201849be7993d999a05d973b" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "2b2f74828eeb02cf29d6b21aa32eedadadc94ca7" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "864b35006d3de24c60e44b566de8018f919b13e6" },
|
||||
"nui.nvim": { "branch": "main", "commit": "1f43b13d133eb4b4f53a4485379d9afa58808389" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "5855128178fa78293acdfb5b4e41ef046779240b" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "0fd6519d44eac3a6736aafdb3fe9da916c3701d4" },
|
||||
"nvim-bufdel": { "branch": "main", "commit": "9f1ed6ef6594df9a74762a86f469d12036584976" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "dde3084106a70b9a79d48f426f6d6fec6fd203f7" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1ec6f5cbf6ffc44c84783d70039df5295ca22b4e" },
|
||||
"nvim-surround": { "branch": "main", "commit": "e6047128e57c1aff1566fb9f627521d2887fc77a" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "543f090a45cef28156162883d2412fffecb6b750" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "584ccea56e2d37b31ba292da2b539e1a4bb411ca" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "38203f5e6c62617b3c07662dc71ce3047ecd90d3" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b55fe6175f0001347a433c9df358c8cbf8a4e90f" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "25698e4033cd6cd3745454bfc837dd670eba0480" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "a736bbe08c8eff370dfa60701f1e669816d4e3c8" },
|
||||
"treesj": { "branch": "main", "commit": "56958f35592b8439dd5014220fc0f3a6e5b01ded" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "2ae7237c2917d661f458443c9a88680f8ca2d7b2" },
|
||||
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4b73390eec680b4c061ea175eb32c0ff3412271d" },
|
||||
"whitespace.nvim": { "branch": "master", "commit": "525f67b3f01910c73f07f0848839aab0b7ab9f42" }
|
||||
}
|
34
nvim/.config/nvim/lua/autocmds.lua
Normal file
34
nvim/.config/nvim/lua/autocmds.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
-- Highlight on yank
|
||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = 'YankHighlight'})
|
||||
end,
|
||||
group = highlight_group,
|
||||
pattern = '*',
|
||||
})
|
||||
|
||||
-- show cursor line only in active window
|
||||
local cursor_group = vim.api.nvim_create_augroup('ActiveCursor', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
|
||||
callback = function()
|
||||
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
|
||||
if ok and cl then
|
||||
vim.wo.cursorline = true
|
||||
vim.api.nvim_win_del_var(0, "auto-cursorline")
|
||||
end
|
||||
end,
|
||||
group = cursor_group,
|
||||
pattern = '*',
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
|
||||
callback = function()
|
||||
local cl = vim.wo.cursorline
|
||||
if cl then
|
||||
vim.api.nvim_win_set_var(0, "auto-cursorline", cl)
|
||||
vim.wo.cursorline = false
|
||||
end
|
||||
end,
|
||||
group = cursor_group,
|
||||
pattern = '*',
|
||||
})
|
16
nvim/.config/nvim/lua/constant/symbols/diagnostic.lua
Normal file
16
nvim/.config/nvim/lua/constant/symbols/diagnostic.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
-- Symbols to use for diagnostics
|
||||
return {
|
||||
-- LSP Status symbols
|
||||
error = "",
|
||||
warning = "",
|
||||
info = "",
|
||||
hint = "",
|
||||
|
||||
-- Comment type symbols
|
||||
bug = "",
|
||||
todo = "",
|
||||
hack = "",
|
||||
performance = "",
|
||||
note = "",
|
||||
test = "",
|
||||
}
|
6
nvim/.config/nvim/lua/constant/symbols/file.lua
Normal file
6
nvim/.config/nvim/lua/constant/symbols/file.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
-- Symbols to use for files
|
||||
return {
|
||||
icon = '',
|
||||
modified = '●',
|
||||
readonly = ''
|
||||
}
|
6
nvim/.config/nvim/lua/constant/symbols/fold.lua
Normal file
6
nvim/.config/nvim/lua/constant/symbols/fold.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
-- Symbols to use for folds
|
||||
return {
|
||||
open = '',
|
||||
closed = '',
|
||||
empty = ''
|
||||
}
|
15
nvim/.config/nvim/lua/constant/symbols/git.lua
Normal file
15
nvim/.config/nvim/lua/constant/symbols/git.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
-- Symbols to use for git
|
||||
return {
|
||||
-- Change type
|
||||
added = '✚',
|
||||
modified = '●',
|
||||
deleted = '✖',
|
||||
renamed = '',
|
||||
|
||||
-- Status type
|
||||
untracked = '',
|
||||
ignored = '',
|
||||
unstaged = '',
|
||||
staged = '',
|
||||
conflict = '',
|
||||
}
|
6
nvim/.config/nvim/lua/constant/symbols/init.lua
Normal file
6
nvim/.config/nvim/lua/constant/symbols/init.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
diagnostic = require("constant.symbols.diagnostic"),
|
||||
fold = require("constant.symbols.fold"),
|
||||
file = require("constant.symbols.file"),
|
||||
git = require("constant.symbols.git"),
|
||||
}
|
19
nvim/.config/nvim/lua/keymaps.lua
Normal file
19
nvim/.config/nvim/lua/keymaps.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- See `:help vim.keymap.set()`
|
||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { noremap = true, silent = true })
|
||||
|
||||
-- Remap for dealing with word wrap
|
||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
|
||||
-- Keybinds for resizing windows
|
||||
vim.keymap.set("n", "<S-Up>", "<cmd>resize +2<CR>")
|
||||
vim.keymap.set("n", "<S-Down>", "<cmd>resize -2<CR>")
|
||||
vim.keymap.set("n", "<S-Left>", "<cmd>vertical resize -2<CR>")
|
||||
vim.keymap.set("n", "<S-Right>", "<cmd>vertical resize +2<CR>")
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||
-- Disabled in favor of using Trouble (<F3>)
|
||||
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
53
nvim/.config/nvim/lua/options.lua
Normal file
53
nvim/.config/nvim/lua/options.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
-- See `:help vim.o`
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case insensitive searching UNLESS /C or capital in search
|
||||
vim.o.ignorecase = true
|
||||
vim.o.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- Default tab settings
|
||||
-- Tab settings are automatically detected by vim-sleuth
|
||||
-- Can be overriden by .editorconfig and modeline
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.expandtab = false
|
||||
vim.o.smarttab = true
|
||||
|
||||
-- Ask for confirmation instead of failing
|
||||
vim.o.confirm = true
|
||||
|
||||
-- Turn on cursorline
|
||||
vim.o.cursorline = true
|
|
@ -1,287 +0,0 @@
|
|||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
end
|
||||
|
||||
require('packer').startup(function()
|
||||
use 'antoinemadec/FixCursorHold.nvim'
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use 'gruvbox-community/gruvbox'
|
||||
use 'tomasiser/vim-code-dark'
|
||||
use 'vim-airline/vim-airline'
|
||||
|
||||
use 'Raimondi/delimitMate'
|
||||
-- use 'scrooloose/nerdtree'
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = {
|
||||
},
|
||||
}
|
||||
use 'tpope/vim-commentary'
|
||||
use 'tpope/vim-surround'
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
use 'tpope/vim-dispatch'
|
||||
use 'milkypostman/vim-togglelist'
|
||||
use 'moll/vim-bbye'
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
use {'nvim-telescope/telescope-ui-select.nvim' }
|
||||
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||
|
||||
use 'neovim/nvim-lspconfig'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-cmdline'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'onsails/lspkind-nvim'
|
||||
use 'ray-x/lsp_signature.nvim'
|
||||
use {
|
||||
"folke/trouble.nvim",
|
||||
config = function()
|
||||
require("trouble").setup {
|
||||
signs = {
|
||||
-- icons / text used for a diagnostic
|
||||
error = "error",
|
||||
warning = "warn",
|
||||
hint = "hint",
|
||||
information = "info"
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
|
||||
use 'windwp/nvim-ts-autotag'
|
||||
use 'JoosepAlviste/nvim-ts-context-commentstring'
|
||||
|
||||
use 'hrsh7th/cmp-vsnip'
|
||||
use 'hrsh7th/vim-vsnip'
|
||||
use "rafamadriz/friendly-snippets"
|
||||
|
||||
use 'leafgarland/typescript-vim'
|
||||
use 'peitalin/vim-jsx-typescript'
|
||||
end)
|
||||
|
||||
--Remap for dealing with word wrap
|
||||
vim.api.nvim_set_keymap('n', 'k', "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', 'j', "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true })
|
||||
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {
|
||||
}
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
}
|
||||
}
|
||||
}
|
||||
-- To get fzf loaded and working with telescope, you need to call
|
||||
-- load_extension, somewhere after setup function:
|
||||
require('telescope').load_extension('fzf')
|
||||
require("telescope").load_extension("ui-select")
|
||||
|
||||
require "lsp_signature".setup({
|
||||
hint_enable = false,
|
||||
handler_opts = {
|
||||
border = "none" -- double, rounded, single, shadow, none
|
||||
},
|
||||
padding = ' ',
|
||||
})
|
||||
|
||||
require'nvim-tree'.setup()
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require 'cmp'
|
||||
|
||||
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
|
||||
|
||||
local feedkey = function(key, mode)
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
||||
end
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
}
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup({
|
||||
enabled = function()
|
||||
-- disable completion in comments
|
||||
local context = require 'cmp.config.context'
|
||||
-- keep command mode completion enabled when cursor is in a comment
|
||||
if vim.api.nvim_get_mode().mode == 'c' then
|
||||
return true
|
||||
else
|
||||
return not context.in_syntax_group("Comment")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- lsp setup
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = {
|
||||
spacing = 8,
|
||||
},
|
||||
signs = true,
|
||||
update_in_insert = false
|
||||
}
|
||||
)
|
||||
|
||||
vim.o.updatetime = 100
|
||||
|
||||
-- Taken from: https://github.com/wookayin/dotfiles/blob/master/nvim/lua/config/lsp.lua
|
||||
-- Makes it so the diagnostic popup does not keep overwriting other popups
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
float = {
|
||||
focusable = false, -- See neovim#16425
|
||||
},
|
||||
})
|
||||
_G.LspDiagnosticsShowPopup = function()
|
||||
return vim.diagnostic.open_float(0, {scope="cursor"})
|
||||
end
|
||||
|
||||
-- Show diagnostics in a pop-up window on hover
|
||||
_G.LspDiagnosticsPopupHandler = function()
|
||||
local current_cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local last_popup_cursor = vim.w.lsp_diagnostics_last_cursor or {nil, nil}
|
||||
|
||||
-- Show the popup diagnostics window,
|
||||
-- but only once for the current cursor location (unless moved afterwards).
|
||||
if not (current_cursor[1] == last_popup_cursor[1] and current_cursor[2] == last_popup_cursor[2]) then
|
||||
vim.w.lsp_diagnostics_last_cursor = current_cursor
|
||||
local _, winnr = _G.LspDiagnosticsShowPopup()
|
||||
end
|
||||
end
|
||||
vim.cmd [[
|
||||
augroup LSPDiagnosticsOnHover
|
||||
autocmd!
|
||||
autocmd CursorHold * lua _G.LspDiagnosticsPopupHandler()
|
||||
augroup END
|
||||
]]
|
||||
|
||||
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
local servers = { 'clangd', 'tsserver', 'gopls', 'pylsp' }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
-- on_attach = my_custom_on_attach,
|
||||
capabilities = capabilities
|
||||
}
|
||||
end
|
||||
|
||||
nvim_lsp.cssls.setup {
|
||||
capabilities = capabilities,
|
||||
cmd = {"vscode-css-languageserver", "--stdio"}
|
||||
}
|
||||
|
||||
local lspkind = require('lspkind')
|
||||
cmp.setup {
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
with_text = true,
|
||||
mode = "text",
|
||||
menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[Latex]",
|
||||
})
|
||||
}),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true
|
||||
}
|
||||
}
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "all",
|
||||
}
|
||||
require('nvim-ts-autotag').setup()
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
context_commentstring = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
-- vim.o.completeopt = 'menuone,noselect'
|
7
nvim/.config/nvim/lua/plugins/autopairs.lua
Normal file
7
nvim/.config/nvim/lua/plugins/autopairs.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- vim: ts=4 sts=4 sw=4 noet
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
6
nvim/.config/nvim/lua/plugins/autotag.lua
Normal file
6
nvim/.config/nvim/lua/plugins/autotag.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
-- https://github.com/windwp/nvim-ts-autotag
|
||||
return {
|
||||
'windwp/nvim-ts-autotag',
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
13
nvim/.config/nvim/lua/plugins/bufdel.lua
Normal file
13
nvim/.config/nvim/lua/plugins/bufdel.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
-- https://github.com/ojroques/nvim-bufdel
|
||||
return {
|
||||
'ojroques/nvim-bufdel',
|
||||
cmd = { "BufDel", "BuffDelOthers" },
|
||||
keys = {
|
||||
{ '<leader>bd', function()
|
||||
require('bufdel').delete_buffer_expr(nil, false)
|
||||
end, silent = true, desc = '[B]uffer [d]elete' },
|
||||
{ '<leader>bD', function()
|
||||
require('bufdel').delete_buffer_others(false)
|
||||
end, silent = true, desc = '[B]uffer [D]elete others' },
|
||||
},
|
||||
}
|
61
nvim/.config/nvim/lua/plugins/bufferline.lua
Normal file
61
nvim/.config/nvim/lua/plugins/bufferline.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
-- https://github.com/akinsho/bufferline.nvim
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "v3.*",
|
||||
dependencies = {
|
||||
'ojroques/nvim-bufdel',
|
||||
},
|
||||
config = function()
|
||||
-- Enable mousemoveevent if possible
|
||||
vim.o.mousemoveevent = true;
|
||||
|
||||
local bufferline = require('bufferline');
|
||||
|
||||
-- Setup keybinds to move between buffers
|
||||
vim.keymap.set('n', '<tab>', function()
|
||||
bufferline.cycle(1)
|
||||
end, { silent = true, desc = 'Goto next buffer' })
|
||||
vim.keymap.set('n', '<S-tab>', function()
|
||||
bufferline.cycle(-1)
|
||||
end, { silent = true, desc = 'Goto previous buffer' })
|
||||
|
||||
-- Setup keybinds to move buffers around
|
||||
vim.keymap.set('n', '<leader>b[', function()
|
||||
bufferline.move(-1)
|
||||
end, { silent = true, desc = '[B]uffer to the [ left' })
|
||||
vim.keymap.set('n', '<leader>b]', function()
|
||||
bufferline.move(1)
|
||||
end, { silent = true, desc = '[B]uffer to the ] right' })
|
||||
|
||||
local symbols = require('constant.symbols');
|
||||
|
||||
bufferline.setup {
|
||||
options = {
|
||||
show_buffer_icons = false,
|
||||
show_buffer_close_icons = true,
|
||||
diagnostics = "nvim_lsp",
|
||||
close_command = "BufDel %d",
|
||||
right_mouse_command = "BufDel %d",
|
||||
separator_style = "thick",
|
||||
left_trunc_marker = '',
|
||||
right_trunc_marker = '',
|
||||
sort_by = "insert_at_end",
|
||||
indicator = {
|
||||
style = 'none',
|
||||
},
|
||||
modified_icon = symbols.file.modified,
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local s = " "
|
||||
for e, n in pairs(diagnostics_dict) do
|
||||
local sym = e == "error" and symbols.diagnostic.error .. ' '
|
||||
or (e == "warning" and symbols.diagnostic.warning .. ' ')
|
||||
or (e == "info" and symbols.diagnostic.info .. ' ' or symbols.diagnostic.hint .. ' ' )
|
||||
s = s .. n .. sym
|
||||
end
|
||||
return s
|
||||
end
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
29
nvim/.config/nvim/lua/plugins/colorizer.lua
Normal file
29
nvim/.config/nvim/lua/plugins/colorizer.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
-- https://github.com/NvChad/nvim-colorizer.lua
|
||||
return {
|
||||
'NvChad/nvim-colorizer.lua',
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
filetypes = {
|
||||
'*', -- Enable color highlighting for all files
|
||||
'!neo-tree', -- Exclude neo-tree
|
||||
},
|
||||
buftypes = {
|
||||
"*",
|
||||
"!prompt",
|
||||
"!popup",
|
||||
},
|
||||
always_update = true,
|
||||
},
|
||||
-- Fix lazy loading: https://github.com/NvChad/nvim-colorizer.lua
|
||||
config = function(_, opts)
|
||||
local colorizer = require('colorizer');
|
||||
colorizer.setup(opts)
|
||||
|
||||
-- nvim-colorizer doesn't work on the initial buffer if we lazy load, so force it to attach
|
||||
-- on load.
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
if bufnr and not colorizer.is_buffer_attached(bufnr) then
|
||||
colorizer.attach_to_buffer(bufnr)
|
||||
end
|
||||
end
|
||||
}
|
6
nvim/.config/nvim/lua/plugins/comment.lua
Normal file
6
nvim/.config/nvim/lua/plugins/comment.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
-- https://github.com/numToStr/Comment.nvim
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
}
|
12
nvim/.config/nvim/lua/plugins/guess-indent.lua
Normal file
12
nvim/.config/nvim/lua/plugins/guess-indent.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
-- https://github.com/NMAC427/guess-indent.nvim
|
||||
return {
|
||||
-- Adds a command to automatically detect the identation settings
|
||||
-- Prefer to use .editorconfig for projects and modeline for files
|
||||
'NMAC427/guess-indent.nvim',
|
||||
keys = {
|
||||
{ "<leader>gi", "<cmd>GuessIndent<cr>", desc = "[G]uess [I]ndentation" },
|
||||
},
|
||||
opts = {
|
||||
auto_cmd = false,
|
||||
},
|
||||
}
|
65
nvim/.config/nvim/lua/plugins/neotree.lua
Normal file
65
nvim/.config/nvim/lua/plugins/neotree.lua
Normal file
|
@ -0,0 +1,65 @@
|
|||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
version = "v2.x",
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'MunifTanjim/nui.nvim',
|
||||
},
|
||||
cmd = { 'Neotree' },
|
||||
keys = {
|
||||
{ '<F2>', '<cmd>Neotree toggle reveal filesystem float<cr>', desc = 'Open floating Neo-tree window' },
|
||||
},
|
||||
config = function ()
|
||||
local symbols = require('constant.symbols');
|
||||
|
||||
require('neo-tree').setup {
|
||||
close_if_last_window = true,
|
||||
enable_diagnostics = true,
|
||||
source_selector = {
|
||||
winbar = true,
|
||||
},
|
||||
default_component_configs = {
|
||||
icon = {
|
||||
folder_closed = symbols.fold.closed,
|
||||
folder_open = symbols.fold.open,
|
||||
folder_empty = symbols.fold.empty,
|
||||
default = symbols.file.icon,
|
||||
},
|
||||
modified = {
|
||||
symbol = symbols.file.modified,
|
||||
},
|
||||
name = {
|
||||
use_git_status_colors = false,
|
||||
},
|
||||
git_status = {
|
||||
symbols = symbols.git,
|
||||
}
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
hide_by_name = {
|
||||
".git"
|
||||
}
|
||||
},
|
||||
use_libuv_file_watcher = true,
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
["<C-c>"] = "close_window",
|
||||
["<esc>"] = "close_window",
|
||||
},
|
||||
},
|
||||
buffers = {
|
||||
window = {
|
||||
mappings = {
|
||||
["bd"] = nil,
|
||||
["<C-d>"] = "buffer_delete",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
12
nvim/.config/nvim/lua/plugins/null-ls.lua
Normal file
12
nvim/.config/nvim/lua/plugins/null-ls.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
'jose-elias-alvarez/null-ls.nvim',
|
||||
config = function ()
|
||||
local null_ls = require('null-ls')
|
||||
|
||||
null_ls.setup {
|
||||
sources = {
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
7
nvim/.config/nvim/lua/plugins/surround.lua
Normal file
7
nvim/.config/nvim/lua/plugins/surround.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- https://github.com/kylechui/nvim-surround
|
||||
return {
|
||||
'kylechui/nvim-surround',
|
||||
version = '*', -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = 'VeryLazy',
|
||||
config = true,
|
||||
}
|
10
nvim/.config/nvim/lua/plugins/symbols-outline.lua
Normal file
10
nvim/.config/nvim/lua/plugins/symbols-outline.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
-- https://github.com/simrat39/symbols-outline.nvim
|
||||
return {
|
||||
'simrat39/symbols-outline.nvim',
|
||||
keys = {
|
||||
{ '<F5>', function()
|
||||
require('symbols-outline').toggle_outline()
|
||||
end, desc = 'Toggle symbols outline' },
|
||||
},
|
||||
opts = {},
|
||||
}
|
18
nvim/.config/nvim/lua/plugins/tmux-navigation.lua
Normal file
18
nvim/.config/nvim/lua/plugins/tmux-navigation.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
-- https://github.com/alexghergh/nvim-tmux-navigation
|
||||
return {
|
||||
'alexghergh/nvim-tmux-navigation',
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local nvim_tmux_nav = require('nvim-tmux-navigation')
|
||||
|
||||
nvim_tmux_nav.setup {
|
||||
disable_when_zoomed = true,
|
||||
keybindings = {
|
||||
left = '<M-h>',
|
||||
down = '<M-j>',
|
||||
up = '<M-k>',
|
||||
right = '<M-l>',
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
58
nvim/.config/nvim/lua/plugins/todo-comments.lua
Normal file
58
nvim/.config/nvim/lua/plugins/todo-comments.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
-- https://github.com/folke/todo-comments.nvim
|
||||
return {
|
||||
-- NOTE: Using a fork for the time being upstream does not support authors
|
||||
-- 'folke/todo-comments.nvim',
|
||||
'doongjohn/todo-comments.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
},
|
||||
config = function()
|
||||
local symbols = require('constant.symbols')
|
||||
|
||||
vim.keymap.set("n", "]t", function()
|
||||
require("todo-comments").jump_next()
|
||||
end, { desc = "Next todo comment" })
|
||||
|
||||
vim.keymap.set("n", "[t", function()
|
||||
require("todo-comments").jump_prev()
|
||||
end, { desc = "Previous todo comment" })
|
||||
|
||||
if pcall(require, "trouble") then
|
||||
-- TODO: Use cwd to only show todo's in the current file
|
||||
-- vim.keymap.set("n", "<F4>", "<cmd>TroubleToggle todo cwd=%<cr>", { desc = "Next todo comment" })
|
||||
vim.keymap.set("n", "<F4>", "<cmd>TroubleToggle todo<cr>", { desc = "Next todo comment" })
|
||||
end
|
||||
if pcall(require, "telescope") then
|
||||
vim.keymap.set('n', '<leader>st', '<cmd>TodoTelescope<cr>', { desc = '[S]earch [T]odo' })
|
||||
end
|
||||
|
||||
require('todo-comments').setup {
|
||||
keywords = {
|
||||
FIX = { icon = symbols.diagnostic.bug },
|
||||
TODO = { icon = symbols.diagnostic.todo },
|
||||
HACK = { icon = symbols.diagnostic.hack },
|
||||
WARN = { icon = symbols.diagnostic.warning },
|
||||
PERF = { icon = symbols.diagnostic.performance },
|
||||
NOTE = { icon = symbols.diagnostic.note },
|
||||
TEST = { icon = symbols.diagnostic.test },
|
||||
},
|
||||
highlight = {
|
||||
-- TODO: Have multiline, but end when %p (punctuation) is at the end of a line
|
||||
multiline = false,
|
||||
before = "fg",
|
||||
pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:?]],
|
||||
},
|
||||
search = {
|
||||
pattern = [[\b(KEYWORDS)(\(.*\))?:?]]
|
||||
},
|
||||
colors = {
|
||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
|
||||
info = { "Todo", "#2563EB" },
|
||||
hint = { "DiagnosticHint", "#10B981" },
|
||||
default = { "Identifier", "#7C3AED" },
|
||||
test = { "Identifier", "#FF00FF" }
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
13
nvim/.config/nvim/lua/plugins/treesj.lua
Normal file
13
nvim/.config/nvim/lua/plugins/treesj.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
-- https://github.com/Wansmer/treesj
|
||||
return {
|
||||
'Wansmer/treesj',
|
||||
keys = {
|
||||
{ '<space>m', function()
|
||||
require('treesj').toggle()
|
||||
end, desc = "Split or Join code block" },
|
||||
},
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
opts = {
|
||||
use_default_keymaps = false,
|
||||
}
|
||||
}
|
18
nvim/.config/nvim/lua/plugins/trouble.lua
Normal file
18
nvim/.config/nvim/lua/plugins/trouble.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
-- https://github.com/folke/trouble.nvim
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
cmd = { 'Trouble', 'TroubleToggle', },
|
||||
keys = {
|
||||
{ '<F3>', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Goto previous buffer' },
|
||||
},
|
||||
config = function ()
|
||||
local symbols = require('constant.symbols');
|
||||
require('trouble').setup {
|
||||
icons = false,
|
||||
auto_close = true,
|
||||
fold_open = symbols.fold.open, -- icon used for open folds
|
||||
fold_closed = symbols.fold.close, -- icon used for closed folds
|
||||
use_diagnostic_signs = true,
|
||||
}
|
||||
end
|
||||
}
|
7
nvim/.config/nvim/lua/plugins/undotree.lua
Normal file
7
nvim/.config/nvim/lua/plugins/undotree.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
-- https://github.com/mbbill/undotree
|
||||
return {
|
||||
'mbbill/undotree',
|
||||
keys = {
|
||||
{ '<F6>', vim.cmd.UndotreeToggle, desc = 'Toggle undotree' },
|
||||
},
|
||||
}
|
19
nvim/.config/nvim/lua/plugins/whitespace.lua
Normal file
19
nvim/.config/nvim/lua/plugins/whitespace.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
'johnfrankmorgan/whitespace.nvim',
|
||||
config = function ()
|
||||
require('whitespace-nvim').setup({
|
||||
-- configuration options and their defaults
|
||||
|
||||
-- `highlight` configures which highlight is used to display
|
||||
-- trailing whitespace
|
||||
highlight = 'CursorLine',
|
||||
|
||||
-- `ignored_filetypes` configures which filetypes to ignore when
|
||||
-- displaying trailing whitespace
|
||||
ignored_filetypes = { 'TelescopePrompt', 'Trouble', 'help' },
|
||||
})
|
||||
|
||||
-- remove trailing whitespace with a keybinding
|
||||
vim.keymap.set('n', '<Leader>t', require('whitespace-nvim').trim, { desc = "Remove trailing whitespace" })
|
||||
end
|
||||
}
|
23
nvim/.config/nvim/lua/themes/gruvbox.lua
Normal file
23
nvim/.config/nvim/lua/themes/gruvbox.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- https://github.com/ellisonleao/gruvbox.nvim
|
||||
return {
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
priority = 1000,
|
||||
config = function()
|
||||
local config = require("gruvbox").config
|
||||
local colors = require("gruvbox.palette").get_base_colors(vim.o.background, config.contrast)
|
||||
|
||||
require('gruvbox').setup {
|
||||
background = "dark",
|
||||
italic = {
|
||||
strings = false,
|
||||
},
|
||||
overrides = {
|
||||
YankHighlight = { fg = colors.blue, bg = colors.bg0, reverse = config.inverse },
|
||||
IncSearch = { fg = colors.aqua },
|
||||
Search = { fg = colors.aqua },
|
||||
}
|
||||
}
|
||||
|
||||
vim.cmd.colorscheme 'gruvbox'
|
||||
end,
|
||||
}
|
|
@ -1,257 +0,0 @@
|
|||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/home/tim/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/tim/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/tim/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/tim/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/home/tim/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
["FixCursorHold.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/FixCursorHold.nvim",
|
||||
url = "https://github.com/antoinemadec/FixCursorHold.nvim"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-cmdline"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
["cmp-vsnip"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
|
||||
url = "https://github.com/hrsh7th/cmp-vsnip"
|
||||
},
|
||||
delimitMate = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/delimitMate",
|
||||
url = "https://github.com/Raimondi/delimitMate"
|
||||
},
|
||||
["friendly-snippets"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/friendly-snippets",
|
||||
url = "https://github.com/rafamadriz/friendly-snippets"
|
||||
},
|
||||
gruvbox = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/gruvbox",
|
||||
url = "https://github.com/gruvbox-community/gruvbox"
|
||||
},
|
||||
["lsp_signature.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/lsp_signature.nvim",
|
||||
url = "https://github.com/ray-x/lsp_signature.nvim"
|
||||
},
|
||||
["lspkind-nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
|
||||
url = "https://github.com/onsails/lspkind-nvim"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-ts-autotag"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag",
|
||||
url = "https://github.com/windwp/nvim-ts-autotag"
|
||||
},
|
||||
["nvim-ts-context-commentstring"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/nvim-ts-context-commentstring",
|
||||
url = "https://github.com/JoosepAlviste/nvim-ts-context-commentstring"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["telescope-fzf-native.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope-fzf-native.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
|
||||
},
|
||||
["telescope-ui-select.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope-ui-select.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-ui-select.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["trouble.nvim"] = {
|
||||
config = { "\27LJ\2\n<EFBFBD>\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\nsigns\1\0\0\1\0\4\nerror\nerror\16information\tinfo\thint\thint\fwarning\twarn\nsetup\ftrouble\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/trouble.nvim",
|
||||
url = "https://github.com/folke/trouble.nvim"
|
||||
},
|
||||
["typescript-vim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/typescript-vim",
|
||||
url = "https://github.com/leafgarland/typescript-vim"
|
||||
},
|
||||
["vim-airline"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-airline",
|
||||
url = "https://github.com/vim-airline/vim-airline"
|
||||
},
|
||||
["vim-bbye"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-bbye",
|
||||
url = "https://github.com/moll/vim-bbye"
|
||||
},
|
||||
["vim-code-dark"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-code-dark",
|
||||
url = "https://github.com/tomasiser/vim-code-dark"
|
||||
},
|
||||
["vim-commentary"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-commentary",
|
||||
url = "https://github.com/tpope/vim-commentary"
|
||||
},
|
||||
["vim-dispatch"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-dispatch",
|
||||
url = "https://github.com/tpope/vim-dispatch"
|
||||
},
|
||||
["vim-jsx-typescript"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-jsx-typescript",
|
||||
url = "https://github.com/peitalin/vim-jsx-typescript"
|
||||
},
|
||||
["vim-surround"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-surround",
|
||||
url = "https://github.com/tpope/vim-surround"
|
||||
},
|
||||
["vim-tmux-navigator"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator",
|
||||
url = "https://github.com/christoomey/vim-tmux-navigator"
|
||||
},
|
||||
["vim-togglelist"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-togglelist",
|
||||
url = "https://github.com/milkypostman/vim-togglelist"
|
||||
},
|
||||
["vim-vsnip"] = {
|
||||
loaded = true,
|
||||
path = "/home/tim/.local/share/nvim/site/pack/packer/start/vim-vsnip",
|
||||
url = "https://github.com/hrsh7th/vim-vsnip"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: trouble.nvim
|
||||
time([[Config for trouble.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n<EFBFBD>\1\0\0\4\0\6\0\t6\0\0\0'\2\1\0B\0\2\0029\0\2\0005\2\4\0005\3\3\0=\3\5\2B\0\2\1K\0\1\0\nsigns\1\0\0\1\0\4\nerror\nerror\16information\tinfo\thint\thint\fwarning\twarn\nsetup\ftrouble\frequire\0", "config", "trouble.nvim")
|
||||
time([[Config for trouble.nvim]], false)
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
|
@ -1,491 +0,0 @@
|
|||
" Vim syntax file
|
||||
" Language: C
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2016 Nov 17
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:ft = matchstr(&ft, '^\([^.]\)\+')
|
||||
|
||||
" A bunch of useful C keywords
|
||||
syn keyword cStatement goto break return continue asm
|
||||
syn keyword cLabel case default
|
||||
syn keyword cConditional if else switch
|
||||
syn keyword cRepeat while for do
|
||||
|
||||
syn keyword cTodo contained TODO FIXME XXX
|
||||
syn match cTodo contained "@todo"
|
||||
syn match cTodo contained "@note"
|
||||
|
||||
" It's easy to accidentally add a space after a backslash that was intended
|
||||
" for line continuation. Some compilers allow it, which makes it
|
||||
" unpredictable and should be avoided.
|
||||
syn match cBadContinuation contained "\\\s\+$"
|
||||
|
||||
" cCommentGroup allows adding matches for special things in comments
|
||||
syn cluster cCommentGroup contains=cTodo,cBadContinuation
|
||||
|
||||
" String and Character constants
|
||||
" Highlight special characters (those which have a backslash) differently
|
||||
syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
|
||||
if !exists("c_no_utf")
|
||||
syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
|
||||
endif
|
||||
|
||||
if !exists("c_no_cformat")
|
||||
" Highlight % items in strings.
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
else
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
endif
|
||||
syn match cFormat display "%%" contained
|
||||
endif
|
||||
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat")
|
||||
" ISO C++11
|
||||
syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat")
|
||||
" ISO C99
|
||||
syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
else
|
||||
" older C or C++
|
||||
syn match cFormat display "%%" contained
|
||||
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
endif
|
||||
|
||||
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
|
||||
|
||||
syn cluster cStringGroup contains=cCppString,cCppSkip
|
||||
|
||||
syn match cCharacter "L\='[^\\]'"
|
||||
syn match cCharacter "L'[^']*'" contains=cSpecial
|
||||
if exists("c_gnu")
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
|
||||
else
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
|
||||
endif
|
||||
syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
|
||||
syn match cSpecialCharacter display "L'\\x\x\+'"
|
||||
|
||||
if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11"))
|
||||
" ISO C11 or ISO C++ 11
|
||||
if exists("c_no_cformat")
|
||||
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend
|
||||
else
|
||||
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
endif
|
||||
syn match cCharacter "[Uu]'[^\\]'"
|
||||
syn match cCharacter "[Uu]'[^']*'" contains=cSpecial
|
||||
if exists("c_gnu")
|
||||
syn match cSpecialError "[Uu]'\\[^'\"?\\abefnrtv]'"
|
||||
syn match cSpecialCharacter "[Uu]'\\['\"?\\abefnrtv]'"
|
||||
else
|
||||
syn match cSpecialError "[Uu]'\\[^'\"?\\abfnrtv]'"
|
||||
syn match cSpecialCharacter "[Uu]'\\['\"?\\abfnrtv]'"
|
||||
endif
|
||||
syn match cSpecialCharacter display "[Uu]'\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "[Uu]'\\x\x\+'"
|
||||
endif
|
||||
|
||||
"when wanted, highlight trailing white space
|
||||
if exists("c_space_errors")
|
||||
if !exists("c_no_trail_space_error")
|
||||
syn match cSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists("c_no_tab_space_error")
|
||||
syn match cSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" This should be before cErrInParen to avoid problems with #define ({ xxx })
|
||||
if exists("c_curly_error")
|
||||
syn match cCurlyError "}"
|
||||
syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold
|
||||
else
|
||||
syn region cBlock start="{" end="}" transparent fold
|
||||
endif
|
||||
|
||||
" Catch errors caused by wrong parenthesis and brackets.
|
||||
" Also accept <% for {, %> for }, <: for [ and :> for ] (C99)
|
||||
" But avoid matching <::.
|
||||
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
|
||||
if exists("c_no_curly_error")
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "^^<%\|^%>"
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
||||
endif
|
||||
elseif exists("c_no_bracket_error")
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "<%\|%>"
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
||||
endif
|
||||
else
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
syn match cParenError display "[\])]"
|
||||
syn match cErrInParen display contained "<%\|%>"
|
||||
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
syn match cParenError display "[\])]"
|
||||
syn match cErrInParen display contained "[\]{}]\|<%\|%>"
|
||||
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell
|
||||
endif
|
||||
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
|
||||
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
|
||||
endif
|
||||
|
||||
if s:ft ==# 'c' || exists("cpp_no_cpp11")
|
||||
syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
|
||||
endif
|
||||
|
||||
"integer number, or floating point number without a dot and with "f".
|
||||
syn case ignore
|
||||
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
|
||||
" Same, but without octal error (for comments)
|
||||
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
|
||||
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
"hex number
|
||||
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
" Flag the first zero of an octal number as something special
|
||||
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
|
||||
syn match cOctalZero display contained "\<0"
|
||||
syn match cFloat display contained "\d\+f"
|
||||
"floating point number, with dot, optional exponent
|
||||
syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
|
||||
"floating point number, starting with a dot, optional exponent
|
||||
syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
|
||||
"floating point number, without dot, with exponent
|
||||
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
|
||||
if !exists("c_no_c99")
|
||||
"hexadecimal floating point number, optional leading digits, with dot, with exponent
|
||||
syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
|
||||
"hexadecimal floating point number, with leading digits, optional dot, with exponent
|
||||
syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
|
||||
endif
|
||||
|
||||
" flag an octal number with wrong digits
|
||||
syn match cOctalError display contained "0\o*[89]\d*"
|
||||
syn case match
|
||||
|
||||
if exists("c_comment_strings")
|
||||
" A comment can contain cString, cCharacter and cNumber.
|
||||
" But a "*/" inside a cString in a cComment DOES end the comment! So we
|
||||
" need to use a special type of cString: cCommentString, which also ends on
|
||||
" "*/", and sees a "*" at the start of the line as comment again.
|
||||
" Unfortunately this doesn't very well work for // type of comments :-(
|
||||
syn match cCommentSkip contained "^\s*\*\($\|\s\+\)"
|
||||
syn region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
|
||||
syn region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
|
||||
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
" Use "extend" here to have preprocessor lines not terminate halfway a
|
||||
" comment.
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
|
||||
else
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
|
||||
endif
|
||||
else
|
||||
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
|
||||
else
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend
|
||||
endif
|
||||
endif
|
||||
" keep a // comment separately, it terminates a preproc. conditional
|
||||
syn match cCommentError display "\*/"
|
||||
syn match cCommentStartError display "/\*"me=e-1 contained
|
||||
|
||||
syn keyword cOperator sizeof
|
||||
if exists("c_gnu")
|
||||
syn keyword cStatement __asm__
|
||||
syn keyword cOperator typeof __real__ __imag__
|
||||
endif
|
||||
syn keyword cType int long short char void
|
||||
syn keyword cType signed unsigned float double
|
||||
if !exists("c_no_ansi") || exists("c_ansi_typedefs")
|
||||
syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t
|
||||
syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
|
||||
syn keyword cType mbstate_t wctrans_t wint_t wctype_t
|
||||
endif
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn keyword cType _Bool bool _Complex complex _Imaginary imaginary
|
||||
syn keyword cType int8_t int16_t int32_t int64_t
|
||||
syn keyword cType uint8_t uint16_t uint32_t uint64_t
|
||||
if !exists("c_no_bsd")
|
||||
" These are BSD specific.
|
||||
syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t
|
||||
endif
|
||||
syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
|
||||
syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
|
||||
syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
|
||||
syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
|
||||
syn keyword cType intptr_t uintptr_t
|
||||
syn keyword cType intmax_t uintmax_t
|
||||
endif
|
||||
if exists("c_gnu")
|
||||
syn keyword cType __label__ __complex__ __volatile__
|
||||
endif
|
||||
|
||||
syn keyword cStructure struct union enum typedef
|
||||
syn keyword cStorageClass static register auto volatile extern const
|
||||
if exists("c_gnu")
|
||||
syn keyword cStorageClass inline __attribute__
|
||||
endif
|
||||
if !exists("c_no_c99") && s:ft !=# 'cpp'
|
||||
syn keyword cStorageClass inline restrict
|
||||
endif
|
||||
if !exists("c_no_c11")
|
||||
syn keyword cStorageClass _Alignas alignas
|
||||
syn keyword cOperator _Alignof alignof
|
||||
syn keyword cStorageClass _Atomic
|
||||
syn keyword cOperator _Generic
|
||||
syn keyword cStorageClass _Noreturn noreturn
|
||||
syn keyword cOperator _Static_assert static_assert
|
||||
syn keyword cStorageClass _Thread_local thread_local
|
||||
syn keyword cType char16_t char32_t
|
||||
endif
|
||||
|
||||
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
|
||||
if exists("c_gnu")
|
||||
syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__ __func__
|
||||
endif
|
||||
syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__
|
||||
syn keyword cConstant __STDC_VERSION__
|
||||
syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX
|
||||
syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
|
||||
syn keyword cConstant CHAR_MIN INT_MIN LONG_MIN SHRT_MIN
|
||||
syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX
|
||||
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
|
||||
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
|
||||
if !exists("c_no_c99")
|
||||
syn keyword cConstant __func__ __VA_ARGS__
|
||||
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
|
||||
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
|
||||
syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX
|
||||
syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX
|
||||
syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN
|
||||
syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX
|
||||
syn keyword cConstant UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX
|
||||
syn keyword cConstant INT_FAST8_MIN INT_FAST16_MIN INT_FAST32_MIN INT_FAST64_MIN
|
||||
syn keyword cConstant INT_FAST8_MAX INT_FAST16_MAX INT_FAST32_MAX INT_FAST64_MAX
|
||||
syn keyword cConstant UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX
|
||||
syn keyword cConstant INTPTR_MIN INTPTR_MAX UINTPTR_MAX
|
||||
syn keyword cConstant INTMAX_MIN INTMAX_MAX UINTMAX_MAX
|
||||
syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX
|
||||
syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX
|
||||
endif
|
||||
syn keyword cConstant FLT_RADIX FLT_ROUNDS
|
||||
syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON
|
||||
syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON
|
||||
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON
|
||||
syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP
|
||||
syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP
|
||||
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP
|
||||
syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP
|
||||
syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
|
||||
syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP
|
||||
syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL
|
||||
syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
|
||||
syn keyword cConstant LC_NUMERIC LC_TIME
|
||||
syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN
|
||||
syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
|
||||
" Add POSIX signals as well...
|
||||
syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP
|
||||
syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
|
||||
syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU
|
||||
syn keyword cConstant SIGUSR1 SIGUSR2
|
||||
syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF
|
||||
syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam
|
||||
syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET
|
||||
syn keyword cConstant TMP_MAX stderr stdin stdout
|
||||
syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
|
||||
" POSIX 2001
|
||||
syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG
|
||||
syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ
|
||||
" non-POSIX signals
|
||||
syn keyword cConstant SIGWINCH SIGINFO
|
||||
" Add POSIX errors as well
|
||||
syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
|
||||
syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
|
||||
syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR
|
||||
syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV
|
||||
syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS
|
||||
syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM
|
||||
syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV
|
||||
" math.h
|
||||
syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4
|
||||
syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2
|
||||
endif
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn keyword cConstant true false
|
||||
endif
|
||||
|
||||
" Accept %: for # (C99)
|
||||
syn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
|
||||
syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>"
|
||||
if !exists("c_no_if0")
|
||||
syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip
|
||||
syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
|
||||
syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
|
||||
else
|
||||
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
|
||||
endif
|
||||
syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
|
||||
syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold
|
||||
syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
|
||||
else
|
||||
syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
|
||||
endif
|
||||
syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
|
||||
syn region cCppOutSkip contained start="^\s*\zs\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip
|
||||
syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc
|
||||
endif
|
||||
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn match cIncluded display contained "<[^>]*>"
|
||||
syn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
|
||||
"syn match cLineSkip "\\$"
|
||||
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock
|
||||
syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
|
||||
" Highlight User Labels
|
||||
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
|
||||
if s:ft ==# 'c' || exists("cpp_no_cpp11")
|
||||
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell,@cStringGroup
|
||||
endif
|
||||
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
|
||||
syn cluster cLabelGroup contains=cUserLabel
|
||||
syn match cUserCont display "^\s*\zs\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\I\i*\s*:$" contains=@cLabelGroup
|
||||
if s:ft ==# 'cpp'
|
||||
syn match cUserCont display "^\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
else
|
||||
syn match cUserCont display "^\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
endif
|
||||
|
||||
syn match cUserLabel display "\I\i*" contained
|
||||
|
||||
" Avoid recognizing most bitfields as labels
|
||||
syn match cBitField display "^\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
|
||||
syn match cBitField display ";\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
|
||||
|
||||
if exists("c_minlines")
|
||||
let b:c_minlines = c_minlines
|
||||
else
|
||||
if !exists("c_no_if0")
|
||||
let b:c_minlines = 50 " #if 0 constructs can be long
|
||||
else
|
||||
let b:c_minlines = 15 " mostly for () constructs
|
||||
endif
|
||||
endif
|
||||
if exists("c_curly_error")
|
||||
syn sync fromstart
|
||||
else
|
||||
exec "syn sync ccomment cComment minlines=" . b:c_minlines
|
||||
endif
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link cFormat cSpecial
|
||||
hi def link cCppString cString
|
||||
hi def link cCommentL cComment
|
||||
hi def link cCommentStart cComment
|
||||
hi def link cLabel Label
|
||||
hi def link cUserLabel Label
|
||||
hi def link cConditional Conditional
|
||||
hi def link cRepeat Repeat
|
||||
hi def link cCharacter Character
|
||||
hi def link cSpecialCharacter cSpecial
|
||||
hi def link cNumber Number
|
||||
hi def link cOctal Number
|
||||
hi def link cOctalZero PreProc " link this to Error if you want
|
||||
hi def link cFloat Float
|
||||
hi def link cOctalError cError
|
||||
hi def link cParenError cError
|
||||
hi def link cErrInParen cError
|
||||
hi def link cErrInBracket cError
|
||||
hi def link cCommentError cError
|
||||
hi def link cCommentStartError cError
|
||||
hi def link cSpaceError cError
|
||||
hi def link cSpecialError cError
|
||||
hi def link cCurlyError cError
|
||||
hi def link cOperator Operator
|
||||
hi def link cStructure Structure
|
||||
hi def link cStorageClass StorageClass
|
||||
hi def link cInclude Include
|
||||
hi def link cPreProc PreProc
|
||||
hi def link cDefine Macro
|
||||
hi def link cIncluded cString
|
||||
hi def link cError Error
|
||||
hi def link cStatement Statement
|
||||
hi def link cCppInWrapper cCppOutWrapper
|
||||
hi def link cCppOutWrapper cPreCondit
|
||||
hi def link cPreConditMatch cPreCondit
|
||||
hi def link cPreCondit PreCondit
|
||||
hi def link cType Type
|
||||
hi def link cConstant Constant
|
||||
hi def link cCommentString cString
|
||||
hi def link cComment2String cString
|
||||
hi def link cCommentSkip cComment
|
||||
hi def link cString String
|
||||
hi def link cComment Comment
|
||||
hi def link cSpecial SpecialChar
|
||||
hi def link cTodo Todo
|
||||
hi def link cBadContinuation Error
|
||||
hi def link cCppOutSkip cCppOutIf2
|
||||
hi def link cCppInElse2 cCppOutIf2
|
||||
hi def link cCppOutIf2 cCppOut
|
||||
hi def link cCppOut Comment
|
||||
|
||||
let b:current_syntax = "c"
|
||||
|
||||
unlet s:ft
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
" vim: ts=8
|
|
@ -1,119 +0,0 @@
|
|||
" Vim syntax file
|
||||
" Language: C++
|
||||
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
|
||||
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
|
||||
" Last Change: 2015 Nov 10
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Read the C syntax to start with
|
||||
if version < 600
|
||||
so <sfile>:p:h/c.vim
|
||||
else
|
||||
runtime! syntax/c.vim
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
" C++ extensions
|
||||
syn keyword cppStatement new delete this friend using
|
||||
syn keyword cppAccess public protected private
|
||||
syn keyword cppModifier inline virtual explicit export
|
||||
syn keyword cppType bool wchar_t
|
||||
syn keyword cppExceptions throw try catch
|
||||
syn keyword cppOperator operator typeid
|
||||
syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
|
||||
syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1
|
||||
syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
|
||||
syn keyword cppStorageClass mutable
|
||||
syn keyword cppStructure class typename template namespace
|
||||
syn keyword cppBoolean true false
|
||||
syn keyword cppConstant __cplusplus
|
||||
|
||||
" C++ 11 extensions
|
||||
if !exists("cpp_no_cpp11")
|
||||
syn keyword cppModifier override final
|
||||
syn keyword cppType nullptr_t
|
||||
syn keyword cppExceptions noexcept
|
||||
syn keyword cppStorageClass constexpr decltype thread_local
|
||||
syn keyword cppConstant nullptr
|
||||
syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT
|
||||
syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
|
||||
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
|
||||
endif
|
||||
|
||||
" C++ 14 extensions
|
||||
if !exists("cpp_no_cpp14")
|
||||
syn match cppNumber display "\<0b[01]\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
endif
|
||||
|
||||
" The minimum and maximum operators in GNU C++
|
||||
syn match cppMinMax "[<>]?"
|
||||
|
||||
" Default highlighting
|
||||
if version >= 508 || !exists("did_cpp_syntax_inits")
|
||||
if version < 508
|
||||
let did_cpp_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
HiLink cppAccess cppStatement
|
||||
HiLink cppCast cppStatement
|
||||
HiLink cppExceptions Exception
|
||||
HiLink cppOperator Operator
|
||||
HiLink cppStatement Statement
|
||||
HiLink cppModifier Type
|
||||
HiLink cppType Type
|
||||
HiLink cppStorageClass StorageClass
|
||||
HiLink cppStructure Structure
|
||||
HiLink cppBoolean Boolean
|
||||
HiLink cppConstant Constant
|
||||
HiLink cppRawStringDelimiter Delimiter
|
||||
HiLink cppRawString String
|
||||
HiLink cppNumber Number
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
|
||||
function! RawStringEnableCodeSnip(filetype,start,end,textSnipHl) abort
|
||||
let ft=toupper(a:filetype)
|
||||
let group='textGroup'.ft
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax=b:current_syntax
|
||||
" Remove current syntax definition, as some syntax files (e.g. cpp.vim)
|
||||
" do nothing if b:current_syntax is defined.
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
|
||||
try
|
||||
execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim'
|
||||
catch
|
||||
endtry
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax=s:current_syntax
|
||||
else
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
execute 'syntax region textSnip'.ft.'
|
||||
\ matchgroup='.a:textSnipHl.'
|
||||
\ start=+'.a:start.'+ end=+'.a:end.'+
|
||||
\ contains=@'.group
|
||||
endfunction
|
||||
|
||||
|
||||
call RawStringEnableCodeSnip("chaiscript", 'R"chaiscript(', ')chaiscript"', 'cppRawString')
|
||||
call RawStringEnableCodeSnip("lua", 'R"lua(', ')lua"', 'cppRawString')
|
||||
|
||||
let b:current_syntax = "cpp"
|
||||
|
||||
" vim: ts=8
|
|
@ -1,39 +0,0 @@
|
|||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
" @todo \ at end of line should continue on next line
|
||||
|
||||
" Hello this is a test to see if it auto wraps the text when the text has been
|
||||
" going on for way too long
|
||||
|
||||
" syn match langSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
|
||||
" We only highlight valid escape characters as for now it just ignores unknown
|
||||
" thing
|
||||
syn match langSpecial display contained "\\[abfnrtv]"
|
||||
syn match langError "^.\+"
|
||||
syn keyword langTodo contained TODO FIXME XXX NOTE
|
||||
syn match langTodo contained "@todo"
|
||||
syn match langTodo contained "@note"
|
||||
syn region langSection start="^\s*\[" end="\]"
|
||||
syn match langKey "^.\{-}\ze="
|
||||
syn match langValue "[#=]\zs.*$" contains=langSub,langSpecial,langValue
|
||||
syn match langValue contained "\\\n.\+" contains=langValue
|
||||
" syn match langSub "{[^}]\+}" " This is for fmt support
|
||||
syn match langSub "{\d\+}"
|
||||
syn match langComment "[#;].*$" contains=langTodo
|
||||
|
||||
hi def link langTodo Todo
|
||||
hi def link langSpecial Special
|
||||
hi def link langSection Type
|
||||
hi def link langKey Identifier
|
||||
hi def link langValue String
|
||||
hi def link langValue2 String
|
||||
hi def link langSub Constant
|
||||
hi def link langComment Comment
|
||||
hi def link langError Error
|
||||
|
||||
|
||||
let b:current_syntax = "lang"
|
||||
|
||||
" vim: sts=2 sw=2 et
|
Loading…
Reference in New Issue
Block a user