mirror of
https://github.com/mentos1386/dotfiles.git
synced 2025-01-31 00:35:42 +00:00
feat: swtich away from coc nvim-lsp and co.
This commit is contained in:
parent
dbf3533ae5
commit
59f50c658e
6 changed files with 366 additions and 203 deletions
|
@ -32,3 +32,5 @@
|
|||
|
||||
[http]
|
||||
postBuffer = 3221225472
|
||||
[credential]
|
||||
helper = libsecret
|
||||
|
|
|
@ -110,5 +110,9 @@ sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.
|
|||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||
workspace_backup .config/nvim/init.vim
|
||||
workspace_link nvim/init.vim .config/nvim/init.vim
|
||||
workspace_backup .config/nvim/coc-settings.json
|
||||
workspace_link nvim/coc-settings.json .config/nvim/coc-settings.json
|
||||
|
||||
for file in nvim/lua/*
|
||||
do
|
||||
workspace_backup .config/nvim/lua/$(basename $file)
|
||||
workspace_link nvim/lua/$(basename $file) .config/nvim/lua/$(basename $file)
|
||||
done
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"git.addedSign.hlGroup": "GitGutterAdd",
|
||||
"git.changedSign.hlGroup": "GitGutterChange",
|
||||
"git.removedSign.hlGroup": "GitGutterDelete",
|
||||
"git.topRemovedSign.hlGroup": "GitGutterDelete",
|
||||
"git.changeRemovedSign.hlGroup": "GitGutterChangeDelete",
|
||||
"git.addGBlameToVirtualText": true,
|
||||
"languageserver": {
|
||||
"terraform": {
|
||||
"command": "terraform-ls",
|
||||
"args": ["serve"],
|
||||
"filetypes": ["terraform", "tf"],
|
||||
"initializationOptions": {},
|
||||
"settings": {}
|
||||
},
|
||||
"graphql": {
|
||||
"command": "graphql-lsp",
|
||||
"args": ["server", "-m", "stream"],
|
||||
// customize filetypes to your needs
|
||||
"filetypes": ["typescript", "typescriptreact", "graphql"]
|
||||
}
|
||||
},
|
||||
"coc.preferences.formatOnSaveFiletypes": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"json",
|
||||
"graphql",
|
||||
"prisma",
|
||||
"terraform",
|
||||
"jsonc",
|
||||
"rust"
|
||||
],
|
||||
"tsserver.useLocalTsdk": true,
|
||||
"coc.preferences.formatOnType": true,
|
||||
"yaml.schemaStore.enable": true,
|
||||
"yaml.schemas": {
|
||||
"kubernetes": ["/**/kubernetes/**/*.yaml", "/**/k8s/**/*.yaml"],
|
||||
"https://json.schemastore.org/github-workflow.json": "/.github/workflows/*.yaml"
|
||||
}
|
||||
}
|
211
nvim/init.vim
211
nvim/init.vim
|
@ -8,6 +8,8 @@ autocmd VimEnter *
|
|||
"--- Plugins
|
||||
call plug#begin()
|
||||
|
||||
" Dependencies by multiple plugins
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
" General
|
||||
Plug 'ojroques/vim-oscyank'
|
||||
Plug 'tpope/vim-obsession'
|
||||
|
@ -18,6 +20,7 @@ Plug 'sainnhe/edge'
|
|||
Plug 'Yggdroot/indentLine'
|
||||
Plug 'koenverburg/peepsight.nvim'
|
||||
Plug 'norcalli/nvim-colorizer.lua'
|
||||
Plug 'j-hui/fidget.nvim'
|
||||
" Git
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
" Search/Files
|
||||
|
@ -27,76 +30,26 @@ Plug 'ANGkeith/telescope-terraform-doc.nvim'
|
|||
Plug 'fannheyward/telescope-coc.nvim'
|
||||
" Ignore/Edit files
|
||||
Plug 'vim-scripts/gitignore'
|
||||
" Languages
|
||||
Plug 'NoahTheDuke/vim-just'
|
||||
" Coding helpers
|
||||
Plug 'zbirenbaum/copilot.lua'
|
||||
Plug 'zbirenbaum/copilot-cmp'
|
||||
Plug 'Exafunction/codeium.nvim'
|
||||
Plug 'petertriho/cmp-git'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'github/copilot.vim'
|
||||
Plug 'williamboman/mason.nvim'
|
||||
Plug 'williamboman/mason-lspconfig.nvim'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'mhartington/formatter.nvim'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-cmdline'
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
|
||||
call plug#end()
|
||||
|
||||
"""""
|
||||
"--- CodeServer Configurations
|
||||
let g:coc_global_extensions = [
|
||||
\ 'coc-tsserver',
|
||||
\ 'coc-prettier',
|
||||
\ 'coc-yaml',
|
||||
\ 'coc-json',
|
||||
\ 'coc-git',
|
||||
\ 'coc-pyright',
|
||||
\ 'coc-pairs',
|
||||
\ 'coc-prisma',
|
||||
\ 'coc-sh',
|
||||
\ 'coc-typos',
|
||||
\ 'coc-docker',
|
||||
\ 'coc-go',
|
||||
\ 'coc-html',
|
||||
\ 'coc-sql',
|
||||
\ 'coc-toml',
|
||||
\ 'coc-rust-analyzer',
|
||||
\ ]
|
||||
if isdirectory('./node_modules') && isdirectory('./node_modules/prettier')
|
||||
let g:coc_global_extensions += ['coc-prettier']
|
||||
endif
|
||||
if isdirectory('./node_modules') && isdirectory('./node_modules/eslint')
|
||||
let g:coc_global_extensions += ['coc-eslint']
|
||||
endif
|
||||
|
||||
" Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
" <C-g>u breaks current undo, please make your own choice.
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
" Find symbol of current document.
|
||||
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||
" Diagnostic list
|
||||
nnoremap <silent><nowait> <space>d :<C-u>CocList diagnostics<cr>
|
||||
" Symbols list
|
||||
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Code actions
|
||||
nmap <leader>do <Plug>(coc-codeaction)
|
||||
" Rename current world
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call ShowDocumentation()<CR>
|
||||
function! ShowDocumentation()
|
||||
if CocAction('hasProvider', 'hover')
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
call feedkeys('K', 'in')
|
||||
endif
|
||||
endfunction
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
" Remap keys for applying codeAction to the current buffer.
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Apply AutoFix to problem on the current line.
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
"""""
|
||||
"--- TMUX/Clipboard fixes
|
||||
set t_Co=256
|
||||
|
@ -124,94 +77,19 @@ if exists('##TextYankPost')
|
|||
augroup END
|
||||
endif
|
||||
|
||||
""""
|
||||
"--- Treesitter configuration
|
||||
lua <<EOF
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {
|
||||
"python",
|
||||
"bash",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"graphql",
|
||||
"hcl",
|
||||
"terraform",
|
||||
"javascript",
|
||||
"json",
|
||||
"make",
|
||||
"markdown",
|
||||
"prisma",
|
||||
"proto",
|
||||
"rust",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
"glsl",
|
||||
"glimmer",
|
||||
"jsonc",
|
||||
},
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
-- list of language that will be disabled
|
||||
disable = { "" },
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
-- dont enable this, messes up python indentation
|
||||
enable = false,
|
||||
disable = {},
|
||||
},
|
||||
}
|
||||
EOF
|
||||
|
||||
"""""
|
||||
"--- Custom Configurations
|
||||
"--- Misc
|
||||
augroup JsonToJsonc
|
||||
autocmd! FileType json set filetype=jsonc
|
||||
augroup END
|
||||
|
||||
lua <<EOF
|
||||
require'peepsight'.setup({
|
||||
-- typescript
|
||||
"arrow_function",
|
||||
"function_declaration",
|
||||
"generator_function_declaration",
|
||||
"method_definition",
|
||||
})
|
||||
require'peepsight'.enable()
|
||||
EOF
|
||||
au BufRead,BufNewFile *.mdx setfiletype markdown
|
||||
|
||||
"""""
|
||||
"--- Telescope Configuration
|
||||
lua <<EOF
|
||||
require'telescope'.setup {
|
||||
defaults = {
|
||||
layout_strategy = 'vertical',
|
||||
},
|
||||
extensions = {
|
||||
terraform_doc = {
|
||||
url_open_command = "xdg-open",
|
||||
latest_provider_symbol = " ",
|
||||
wincmd = "botright new",
|
||||
wrap = "nowrap",
|
||||
}
|
||||
}
|
||||
}
|
||||
require'telescope'.load_extension('terraform_doc')
|
||||
require'telescope'.load_extension('coc')
|
||||
EOF
|
||||
|
||||
"""""
|
||||
"--- VIM Configuration
|
||||
set encoding=UTF-8
|
||||
set autoread " will re-read opened file if changed externaly
|
||||
set autoread " will re-read opened file if changed externally
|
||||
set autowrite
|
||||
set splitright
|
||||
set splitbelow
|
||||
|
@ -238,12 +116,38 @@ set hidden
|
|||
set shortmess+=c
|
||||
|
||||
"""""
|
||||
"- Custom commands
|
||||
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
||||
" Custom configurations
|
||||
lua require('code_helpers')
|
||||
lua require('code_look')
|
||||
|
||||
"""""
|
||||
"- Custom Filetypes
|
||||
au BufRead,BufNewFile *.mdx setfiletype markdown
|
||||
"--- Fidget
|
||||
lua <<EOF
|
||||
require("fidget").setup {
|
||||
notification = {
|
||||
override_vim_notify = true,
|
||||
},
|
||||
}
|
||||
EOF
|
||||
|
||||
"""""
|
||||
"--- Telescope Configuration
|
||||
lua <<EOF
|
||||
require'telescope'.setup {
|
||||
defaults = {
|
||||
layout_strategy = 'vertical',
|
||||
},
|
||||
extensions = {
|
||||
terraform_doc = {
|
||||
url_open_command = "xdg-open",
|
||||
latest_provider_symbol = " ",
|
||||
wincmd = "botright new",
|
||||
wrap = "nowrap",
|
||||
}
|
||||
}
|
||||
}
|
||||
require'telescope'.load_extension('terraform_doc')
|
||||
EOF
|
||||
|
||||
"""""
|
||||
"- Keybindings
|
||||
|
@ -271,21 +175,10 @@ nnoremap <leader>fcdi <cmd>Telescope coc diagnostics<cr>
|
|||
nnoremap <leader>fcde <cmd>Telescope coc definitions<cr>
|
||||
nnoremap <leader>fcds <cmd>Telescope coc document_symbols<cr>
|
||||
nnoremap <leader>fcws <cmd>Telescope coc workspace_symbols<cr>
|
||||
" Typos coc
|
||||
" Move to next misspelled word after the cursor, 'wrapscan' applies.
|
||||
nmap ]s <Plug>(coc-typos-next)
|
||||
" Move to previous misspelled word after the cursor, 'wrapscan' applies.
|
||||
nmap [s <Plug>(coc-typos-prev)
|
||||
" Fix typo at cursor position
|
||||
nmap z= <Plug>(coc-typos-fix)
|
||||
|
||||
"""""
|
||||
"--- Colorizer
|
||||
set termguicolors
|
||||
lua require'colorizer'.setup()
|
||||
|
||||
"""""
|
||||
"- Visuals
|
||||
set termguicolors
|
||||
set noshowmode
|
||||
set number
|
||||
set cursorline
|
||||
|
|
248
nvim/lua/code_helpers.lua
Normal file
248
nvim/lua/code_helpers.lua
Normal file
|
@ -0,0 +1,248 @@
|
|||
-- Copilot provider
|
||||
require("copilot").setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enabled = false },
|
||||
filetypes = {
|
||||
javascript = true,
|
||||
typescript = true,
|
||||
rust = true,
|
||||
},
|
||||
})
|
||||
require("copilot_cmp").setup()
|
||||
|
||||
-- Codeium provider
|
||||
require("codeium").setup({})
|
||||
|
||||
-- Git providers
|
||||
require("cmp_git").setup()
|
||||
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "copilot" },
|
||||
{ name = "codeium" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "git" },
|
||||
-- { name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- LSP
|
||||
require("mason").setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"typos_lsp", -- all
|
||||
"angularls", -- angular
|
||||
"ansiblels", -- ansible
|
||||
"bashls", -- bash
|
||||
"bufls", -- buf
|
||||
"cssls", -- css
|
||||
"denols", -- deno
|
||||
"dockerls", -- docker
|
||||
"docker_compose_language_service", -- docker-compose
|
||||
"eslint", -- eslint
|
||||
"elixirls", -- elixir
|
||||
"golangci_lint_ls", -- golangci-lint
|
||||
"gopls", -- gopls
|
||||
"graphql", -- graphql
|
||||
"html", -- html
|
||||
"htmx", -- htmx
|
||||
"helm_ls", -- helm
|
||||
"jsonls", -- json
|
||||
"tsserver", -- javascript/typescript
|
||||
"autotools-language-server", -- make
|
||||
"marksman", -- markdown
|
||||
"vale_ls", -- markdown/prose
|
||||
"swift_mesonls", -- meson
|
||||
"prismals", -- prisma
|
||||
"pyright", -- python
|
||||
"rust_analyzer", -- rust
|
||||
"taplo", -- toml
|
||||
"terraformls", -- terraform
|
||||
"tflint", -- terraform
|
||||
"yamlls", -- yaml
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
local function quickfix()
|
||||
vim.lsp.buf.code_action({
|
||||
filter = function(a)
|
||||
return a.isPreferred
|
||||
end,
|
||||
apply = true,
|
||||
})
|
||||
end
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set("n", "<leader>qf", quickfix, opts)
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set("n", "<space>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<space>f", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Formatter
|
||||
local util = require("formatter.util")
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup({
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
-- Set the log level
|
||||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
-- Formatter configurations for filetype "lua" go here
|
||||
-- and will be executed in order
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
|
||||
javascript = {
|
||||
require("formatter.filetypes.javascript").prettier,
|
||||
},
|
||||
typescript = {
|
||||
require("formatter.filetypes.typescript").prettier,
|
||||
},
|
||||
json = {
|
||||
require("formatter.filetypes.json").prettier,
|
||||
},
|
||||
graphql = {
|
||||
require("formatter.filetypes.graphql").prettier,
|
||||
},
|
||||
rust = {
|
||||
require("formatter.filetypes.rust").rustfmt,
|
||||
},
|
||||
go = {
|
||||
require("formatter.filetypes.go").gofmt,
|
||||
},
|
||||
python = {
|
||||
require("formatter.filetypes.python").black,
|
||||
},
|
||||
elixir = {
|
||||
require("formatter.filetypes.elixir").mix_format,
|
||||
},
|
||||
sh = {
|
||||
require("formatter.filetypes.sh").shfmt,
|
||||
},
|
||||
proto = {
|
||||
require("formatter.filetypes.proto").buf_format,
|
||||
},
|
||||
|
||||
-- Use the special "*" filetype for defining formatter configurations on
|
||||
-- any filetype
|
||||
["*"] = {
|
||||
-- "formatter.filetypes.any" defines default configurations for any
|
||||
-- filetype
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
||||
local augroup = vim.api.nvim_create_augroup
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
augroup("__formatter__", { clear = true })
|
||||
autocmd("BufWritePost", {
|
||||
group = "__formatter__",
|
||||
command = ":FormatWrite",
|
||||
})
|
58
nvim/lua/code_look.lua
Normal file
58
nvim/lua/code_look.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
-- Colors the code
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"python",
|
||||
"bash",
|
||||
"dockerfile",
|
||||
"go",
|
||||
"graphql",
|
||||
"hcl",
|
||||
"terraform",
|
||||
"javascript",
|
||||
"json",
|
||||
"make",
|
||||
"markdown",
|
||||
"prisma",
|
||||
"proto",
|
||||
"rust",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
"glsl",
|
||||
"glimmer",
|
||||
"jsonc",
|
||||
"lua",
|
||||
"blueprint",
|
||||
},
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
-- list of language that will be disabled
|
||||
disable = { "" },
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
-- dont enable this, messes up python indentation
|
||||
enable = false,
|
||||
disable = {},
|
||||
},
|
||||
})
|
||||
|
||||
-- Only colorizes the function/class/codeblock that the cursor is in
|
||||
require("peepsight").setup({
|
||||
-- typescript
|
||||
"arrow_function",
|
||||
"function_declaration",
|
||||
"generator_function_declaration",
|
||||
"method_definition",
|
||||
})
|
||||
require("peepsight").enable()
|
||||
|
||||
-- Transforms hex colors to their respective color
|
||||
require("colorizer").setup()
|
Loading…
Reference in a new issue