Dump nixos config after scrubing

This commit is contained in:
Mariano Uvalle 2025-05-03 23:42:03 -07:00
commit 5fa4c76c24
854 changed files with 30072 additions and 0 deletions

View file

@ -0,0 +1,177 @@
;---Most generic types---
(module) @module
(identifier) @variable
(concrete_type) @type
;---annotations----
(annotation_type_def
(annotation_pre_colon
(identifier) @type))
(annotation_type_def
(annotation_pre_colon
(identifier) @function)
(function_type))
;----decleration types----
(value_declaration
(decl_left
(identifier_pattern
(identifier) @variable.parameter)))
;---records----
(field_name) @variable.member
(record_field_pattern
(_
(identifier) @variable))
;matches the second identifier and all subsequent ones
(field_access_expr
(identifier) @variable.member)
;highlight module members as records instead of free variables
; avoids highlighting them as out-of-scope vars
(variable_expr
(module) (identifier) @variable.member)
;----comments----
(line_comment) @comment @spell
(doc_comment) @comment.documentation @spell
;-----Punctuation----
[
"?"
(arrow)
(fat_arrow)
"|"
","
":"
] @punctuation.delimiter
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
"|"
"&"
"<-"
".."
(operator)
] @operator
(wildcard_pattern) @constant.builtin
[
"if"
"then"
"else"
] @keyword.conditional
[
(implements)
(when)
(is)
"as"
(to)
] @keyword
;----headers-----
[
"app"
"expect"
"module"
"package"
"import"
] @keyword
[
(import_as)
"imports"
] @keyword.import
(value_declaration
(decl_left
(identifier_pattern
(identifier) @function))
(expr_body
(anon_fun_expr)))
;----tags----
(tags_type
(tag_type) @constructor)
[
(tag)
(opaque_tag)
] @constructor
;-----builtins----
(variable_expr
(module) @module
(identifier) @boolean
(#any-of? @boolean "true" "false")
(#eq? @module "Bool"))
"dbg" @keyword.debug
;----function invocations ----
(function_call_pnc_expr
caller: (variable_expr
(identifier) @function.call))
(function_call_pnc_expr
caller: (field_access_expr
(identifier) @function.call .))
(bin_op_expr
(operator
"|>") @operator
(variable_expr
(identifier) @function))
;----function arguments----
(argument_patterns
(identifier_pattern
(identifier) @variable.parameter))
(argument_patterns
(_
(identifier_pattern
(identifier) @variable.parameter)))
(argument_patterns
(_
(_
(identifier_pattern
(identifier) @variable.parameter))))
;-----consts-----
[
(int)
(uint)
(iint)
(xint)
(natural)
] @number
[
(decimal)
(float)
] @number.float
(string) @string
(multiline_string) @string
(char) @character

View file

@ -0,0 +1,61 @@
; (value_declaration(expr_body(anon_fun_expr)))@indent.ignore
[
(when_is_expr)
(when_is_branch)
(record_expr)
(anon_fun_expr)
(list_expr)
(parenthesized_expr)
(function_call_pnc_expr)
(tuple_expr)
(backpassing_expr)
(imports)
(exposes)
(exposes_list)
(exposing)
;;patterns
(record_pattern)
(tuple_pattern)
(list_pattern)
;;ability stuff
(ability_implementation)
(opaque_type_def)
;;types
(record_type)
(tags_type)
(record_expr)
(implements_implementation)
"{"
"("
"["
]
@indent.begin
; ((record_type)
; @indent.align
; (#set! indent.open_delimiter "{")
; (#set! indent.close_delimiter "}"))
; ((record_expr)
; @indent.align
; (#set! indent.open_delimiter "{")
; (#set! indent.close_delimiter "}"))
; ((tags_type) @indent.align
; (#set! indent.open_delimiter "[")
; (#set! indent.close_delimiter "]"))
; ((implements_implementation) @indent.align
; (#set! indent.open_delimiter "[")
; (#set! indent.close_delimiter "]"))
(expr_body)@indent.begin
(ERROR "=")@indent.begin
(then )@indent.begin
(else)@indent.begin
[
; result:(_)
"]"
"}"
")"
]@indent.branch

View file

@ -0,0 +1,57 @@
;injection from function calls
(function_call_pnc_expr
(variable_expr (identifier) @injection.language)
(const [(multiline_string) (string)] @injection.content)
(#any-eq? @injection.language
"json"
"toml"
"yaml"
"xml"
"sql"
"lua"
"js"
"html"
"css"
"http"
"jq"
"latex"
"md"
"nix"
"regex"
)
)
;injection from piping function calls
(bin_op_expr
part: (const
[(multiline_string) (string)] @injection.content
)
part: (operator)
part: (variable_expr
(identifier) @injection.language
)
(#any-eq? @injection.language
"json"
"toml"
"yaml"
"xml"
"sql"
"lua"
"js"
"html"
"css"
"http"
"jq"
"latex"
"md"
"nix"
"regex"
)
)
(
[
(line_comment)
(doc_comment)
] @injection.content
(#set! injection.language "comment")
)

View file

@ -0,0 +1,42 @@
(expr_body) @local.scope
(argument_patterns
(identifier_pattern
(identifier) @local.definition))
; (argument_patterns(long_identifier)@local.definition)
(exposes_list
(identifier) @local.reference)
(import_expr(as)(module)@local.definition)
(opaque_type_def
(apply_type
(concrete_type) @local.definition.type))
(alias_type_def
(apply_type
(concrete_type) @local.definition.type))
(value_declaration
(decl_left
(identifier_pattern
(identifier) @local.definition.function))
(expr_body
(anon_fun_expr)))
(value_declaration
(decl_left
(identifier_pattern
(identifier) @local.definition.var)))
(identifier_pattern
(identifier) @local.definition)
(when_is_branch pattern: (_ (identifier_pattern (identifier) @local.definition)))
(spread_pattern (identifier) @local.definition)
(identifier) @local.reference
(tag_expr
(tag)) @local.reference

View file

@ -0,0 +1,33 @@
(anon_fun_expr
(expr_body) @function.inner
) @function.outer
(argument_patterns
((_) @parameter.inner . ","? @parameter.outer) @parameter.outer
)
(function_type
((_) @parameter.inner . ","? @parameter.outer) @parameter.outer(#not-eq? @parameter.inner "->")
)
(function_pnc_expr
.
(_)
(parenthesized_expr (expr_body) @parameter.inner) @parameter.outer
)
(function_pnc_expr
.
(_) ((_) @parameter.inner) @parameter.outer
)
[
(annotation_type_def ) @class.inner
(alias_type_def ) @class.inner
(opaque_type_def ) @class.inner
] @class.outer
(apply_type_arg) @parameter.inner
(line_comment) @comment.outer
(doc_comment) @comment.outer

View file

@ -0,0 +1,54 @@
-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
------------- VSCode specific config ----------------
-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true})
vim.g.mapleader = ' '
-- Exit insert mode with ,h.
vim.api.nvim_set_keymap('i', ',h', '<ESC>', {noremap = true, silent = true})
-- Quick save.
vim.api.nvim_set_keymap('n', '<Leader>fw', ':w<CR>', {silent = true})
-- Remap for colemak-dhm.
-- Left.
vim.api.nvim_set_keymap('', 'm', 'h', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'h', 'm', {noremap = true, silent = true})
-- Down.
vim.api.nvim_set_keymap('', 'j', 'n', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'n', 'j', {noremap = true, silent = true})
-- Up.
vim.api.nvim_set_keymap('', 'k', 'e', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'e', 'k', {noremap = true, silent = true})
-- Right.
vim.api.nvim_set_keymap('', 'l', 'i', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'i', 'l', {noremap = true, silent = true})
-- C-g as ESC
vim.api.nvim_set_keymap('n', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('i', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('v', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('s', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('x', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('c', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('o', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('l', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('t', '<C-g>', '<ESC>', {silent = true})
-- Move right when in insert mode.
vim.api.nvim_set_keymap("i", '<C-l>', '<Right>', {noremap = true, silent = true})
-- Lsp
vim.api.nvim_set_keymap('n', '<Leader>lgd', "<cmd>lua require('vscode-neovim').call('editor.action.goToDeclaration')<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgr', "<cmd>lua require('vscode-neovim').call('editor.action.referenceSearch.trigger')<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lr', "<cmd>lua require('vscode-neovim').call('editor.action.rename')<CR>", {noremap = true, silent = true})
-- Tab movement.
vim.api.nvim_set_keymap('n', '<Leader>m', "<cmd>lua require('vscode-neovim').call('workbench.action.previousEditorInGroup')<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>i', "<cmd>lua require('vscode-neovim').call('workbench.action.nextEditorInGroup')<CR>", {noremap = true, silent = true})

View file

@ -0,0 +1,32 @@
require('settings')
require('nv-globals')
require('plugins')
require('colorscheme')
require('settings')
-- Must go after plugins.
require("oil").setup()
-- LSP
require('lsp')
require('lsp.typescript-ls')
require('lsp.python-ls')
require('lsp.lua-ls')
require('lsp.go-ls')
require('lsp.ocaml-ls')
require('lsp.sml-ls')
require('lsp.arduino-ls')
require('lsp.roc-ls')
require('lsp.zls-ls')
-- Completion
require('completion')
require('nv-prettier')
require('nv-telescope')
require('langs.roc')
-- Set up keymaps after everything is configured.
require('keymappings')

View file

@ -0,0 +1,13 @@
vim.api.nvim_set_option('background', 'dark')
vim.api.nvim_set_option('termguicolors', true)
-- colorscheme
vim.cmd([[
colorscheme palenight
highlight ColorColumn ctermbg=0 guibg=grey
hi CurrentWord guibg=#444444
hi CurrentWordTwins guibg=#606060
hi CursorLine guibg=#32384d
]])
-- BG color is #282D3F

View file

@ -0,0 +1,118 @@
vim.o.completeopt = "menuone,noselect"
-- Avoid having a "Pattern not found" message
vim.cmd("set shortmess+=c")
local cmp = require'cmp'
local snippy = require('snippy')
cmp.setup({
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
snippet = {
expand = function(args)
snippy.expand_snippet(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-Space>'] = cmp.mapping.confirm({ select = true }),
['<C-e>'] = cmp.mapping.abort(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'async_path' },
{ name = 'snippy' },
}, {
{ name = 'buffer' },
})
})
snippy.setup({
mappings = {
is = {
['<Tab>'] = 'expand_or_advance',
['<S-Tab>'] = 'previous',
},
},
})
require('lspsaga').setup({})
-- require'compe'.setup {
-- enabled = true;
-- autocomplete = true;
-- debug = false;
-- min_length = 1;
-- preselect = 'always';
-- throttle_time = 80;
-- source_timeout = 200;
-- incomplete_delay = 400;
-- max_abbr_width = 100;
-- max_kind_width = 100;
-- max_menu_width = 100;
-- documentation = true;
-- source = {
-- path = true;
-- buffer = false;
-- calc = false;
-- vsnip = false; -- Could be used if I want to start using snippets.
-- nvim_lsp = true;
-- nvim_lua = true;
-- tags = true;
-- snippets_nvim = true;
-- treesitter = true;
-- };
-- }
-- vim.cmd([[
-- autocmd FileType ocaml call compe#setup({
-- \ 'preselect': 'disable'
-- \ }, 0)
-- ]])
-- local t = function(str)
-- return vim.api.nvim_replace_termcodes(str, true, true, true)
-- end
-- _G.comp_jump_if_avail = function()
-- if vim.fn.pumvisible() == 1 then
-- return t "<C-n>"
-- end
-- end
-- _G.comp_jump_prev_if_avail = function()
-- if vim.fn.pumvisible() == 1 then
-- return t "<C-p>"
-- end
-- end
-- _G.tab_complete = function()
-- if vim.fn.pumvisible() == 1 then
-- return vim.fn['compe#confirm']('')
-- else
-- return t "<Tab>"
-- end
-- end
-- _G.enter_complete = function()
-- if vim.bo.filetype == "ocaml" then
-- return t "<CR>"
-- elseif vim.fn.pumvisible() == 1 then
-- return vim.fn['compe#confirm']('')
-- else
-- return t "<CR>"
-- end
-- end
-- vim.api.nvim_set_keymap("i", "<C-n>", "v:lua.comp_jump_if_avail()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<C-n>", "v:lua.comp_jump_if_avail()", {expr = true})
-- vim.api.nvim_set_keymap("i", "<C-e>", "v:lua.comp_jump_prev_if_avail()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<C-e>", "v:lua.comp_jump_prev_if_avail()", {expr = true})
-- -- The next 4 funtcions don't work if compe doesn't automatically select the first option.
-- -- meaning the preselect option has to be set to alwasy.
-- vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
-- vim.api.nvim_set_keymap("i", "<CR>", "v:lua.enter_complete()", {expr = true})
-- vim.api.nvim_set_keymap("s", "<CR>", "v:lua.enter_complete()", {expr = true})

View file

@ -0,0 +1,95 @@
local lsp = vim.lsp
local handlers = lsp.handlers
-- local saga = require('lspsaga')
-- saga.init_lsp_saga()
-- Space as leader.
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', {noremap = true, silent = true})
vim.g.mapleader = ' '
-- Exit insert mode with ,h.
vim.api.nvim_set_keymap('i', ',h', '<ESC>', {noremap = true, silent = true})
-- Remap for colemak-dhm.
-- Left.
vim.api.nvim_set_keymap('', 'm', 'h', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'h', 'm', {noremap = true, silent = true})
-- Down.
vim.api.nvim_set_keymap('', 'j', 'n', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'n', 'j', {noremap = true, silent = true})
-- Up.
vim.api.nvim_set_keymap('', 'k', 'e', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'e', 'k', {noremap = true, silent = true})
-- Right.
vim.api.nvim_set_keymap('', 'l', 'i', {noremap = true, silent = true})
vim.api.nvim_set_keymap('', 'i', 'l', {noremap = true, silent = true})
-- C-g as ESC
vim.api.nvim_set_keymap('n', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('i', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('v', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('s', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('x', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('c', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('o', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('l', '<C-g>', '<ESC>', {silent = true})
vim.api.nvim_set_keymap('t', '<C-g>', '<ESC>', {silent = true})
-- Move right when in insert mode.
vim.api.nvim_set_keymap("i", '<C-l>', '<Right>', {noremap = true, silent = true})
-- Leader window movement.
vim.api.nvim_set_keymap("n", '<Leader>wm', '<C-w>h', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", '<Leader>wn', '<C-w>j', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", '<Leader>we', '<C-w>k', {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", '<Leader>wi', '<C-w>l', {noremap = true, silent = true})
-- Quick save.
vim.api.nvim_set_keymap('n', '<Leader>fw', ':w<CR>', {silent = true})
-- Toggle between buffers.
vim.api.nvim_set_keymap('n', '<Leader><Leader>', '<C-^>', {noremap = true, silent = true})
-- Find files inside the current folder.
vim.api.nvim_set_keymap('n', '<Leader>ff', '<cmd>Telescope find_files<cr>',{})
-- Find files and folders allowing creation.
vim.api.nvim_set_keymap('n', '<Leader>fb', '<cmd>Telescope file_browser<cr>', {noremap = true})
-- File brosers starting at the cwd.
vim.api.nvim_set_keymap('n', '<Leader>fc', '<cmd>Telescope file_browser path=%:p:h<cr>', {noremap = true})
-- File browser that allows edits in-buffer.
vim.keymap.set("n", "<Leader>fo", "<CMD>Oil<CR>", { desc = "Open parent directory" })
-- Do a grep search in the current folder.
vim.api.nvim_set_keymap('n', '<Leader>ps', ':Rg<cr>',{})
-- Search among the currently open buffers.
vim.api.nvim_set_keymap('n', '<Leader>bs', '<cmd>Telescope buffers<cr>',{})
-- Code actions.
vim.api.nvim_set_keymap('n', '<Leader>ca', "<Cmd>lua vim.lsp.buf.code_action()<CR>",{silent = true, noremap = true})
vim.api.nvim_set_keymap('x', '<Leader>ca', "<Cmd>lua vim.lsp.buf.range_code_action()<CR>",{silent = true, noremap = true})
-- Flutter commands.
vim.api.nvim_set_keymap('n', '<Leader>fl', "<cmd>lua require('telescope').extensions.flutter.commands()<cr>",{silent = true, noremap = true})
-- Hover doc popup
local pop_opts = { border = "rounded", max_width = 80 }
handlers["textDocument/hover"] = lsp.with(handlers.hover, pop_opts)
handlers["textDocument/signatureHelp"] = lsp.with(handlers.signature_help, pop_opts)
vim.api.nvim_set_keymap('n', '<Leader>lgd', '<cmd>lua vim.lsp.buf.definition()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgD', '<cmd>lua vim.lsp.buf.declaration()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgr', '<cmd>lua vim.lsp.buf.references()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lgi', '<cmd>lua vim.lsp.buf.implementation()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<Leader>lf', '<cmd>lua vim.lsp.buf.format()<CR>', {noremap = true, silent = true})
vim.keymap.set('v', '<Leader>lrf', vim.lsp.buf.format)
vim.api.nvim_set_keymap('n', '<Leader>lr', '<cmd>Lspsaga rename<CR>', {silent = true})
vim.api.nvim_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true, silent = true})
------ Trouble
vim.api.nvim_set_keymap("n", "<leader>lld", '<cmd>lua vim.diagnostic.open_float({scope="line"})<CR>',
{silent = true, noremap = true}
) -- Mnemonic "lsp line diagnostics"
vim.api.nvim_set_keymap("n", "<leader>lwd", "<cmd>Trouble workspace_diagnostics<cr>",
{silent = true, noremap = true}
) -- Mnemonic "lsp workspace diagnostics"
vim.api.nvim_set_keymap("n", "<leader>ldd", "<cmd>Trouble document_diagnostics<cr>",
{silent = true, noremap = true}
) -- Mnemonic "lsp document diagnostics"

View file

@ -0,0 +1,26 @@
-- make .roc files have the correct filetype
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = { "*.roc" },
command = "set filetype=roc",
})
-- add roc tree-sitter
local parsers = require("nvim-treesitter.parsers").get_parser_configs()
parsers.roc = {
install_info = {
url = "https://github.com/faldor20/tree-sitter-roc",
files = { "src/parser.c", "src/scanner.c" },
},
}
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
-- 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,
},
}

View file

@ -0,0 +1,9 @@
require'lspconfig'.arduino_language_server.setup {
cmd = {
"arduino-language-server",
"-cli-config", "/Users/aym/Library/Arduino15/arduino-cli.yaml",
"-fqbn", "adafruit:nrf52:feather52841",
"-cli", "arduino-cli",
"-clangd", "clangd"
}
}

View file

@ -0,0 +1,8 @@
local elixir_ls_binary = "/Users/" .. USER .. "/.config/nvim/lang-srvrs/elixir-ls/language_server.sh"
require'lspconfig'.elixirls.setup{
cmd = { elixir_ls_binary };
}
vim.api.nvim_command('autocmd BufWritePost *.ex :lua vim.lsp.buf.formatting()')
vim.api.nvim_command('autocmd BufWritePost *.exs :lua vim.lsp.buf.formatting()')

View file

@ -0,0 +1,3 @@
require("flutter-tools").setup{
} -- use defaults

View file

@ -0,0 +1,74 @@
local lspconfig = require "lspconfig"
-- local capabilities = require('cmp_nvim_lsp').default_capabilities()
lspconfig.gopls.setup {
on_attach = function(client, bufnr)
require "lsp_signature".on_attach({
bind = true,
-- floating_window = true,
--hint_enable = true,
fix_pos = true,
use_lspsaga = true,
handler_opts = {
border = "rounded" -- double, single, shadow, none
},
})
end,
cmd = {"gopls", "serve"},
settings = {
autostart = true,
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
autostart = true,
root_dir = lspconfig.util.root_pattern(".git","go.mod"),
init_options = {usePlaceholders = true, completeUnimported = true},
-- capabilities = capabilities,
single_file_support = true;
}
------ Configre vim-go
-- Disable autocomplete since we already have it with native lsp.
vim.g.go_code_completion_enabled = 0
-- Disable gopls for the same reasons as above.
vim.g.go_gopls_enabled = 0
-- Simplify code when formatting.
vim.g.go_fmt_command = 'gofmt'
vim.g.go_fmt_options = {
gofmt = '-s',
}
vim.g.go_imports_mode = 'goimports'
-- Could confilg with lsp saga, should experiment.
vim.g.go_doc_keywordprg_enabled = 0
-- Use my own universal mappings for lsp.
vim.g.go_def_mapping_enabled = 0
-- Use globally installed binaries first. (gopls) installed through brew.
vim.g.go_search_bin_path_first = 0
-- When auto-creating a template file, use the package rather than a file.
vim.g.go_template_use_pkg = 1
-- Configure folding.
-- vim.cmd("autocmd FileType go setlocal foldmethod=syntax")
-- vim.g.go_fmt_experimental = 1
-- Use a ruler for go files.
vim.cmd("autocmd FileType go setlocal colorcolumn=80")
-- Automatically add comment symbol on next line and wrap it.
vim.cmd("autocmd FileType go setlocal fo+=c fo+=r")
-- Highlights.
vim.g.go_highlight_operators = 1
vim.g.go_highlight_types = 1
vim.g.go_highlight_extra_types = 1
vim.g.go_highlight_functions = 1
vim.g.go_highlight_function_calls = 1

View file

@ -0,0 +1,35 @@
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require'lspconfig'.lua_ls.setup {
on_init = function(client)
if client.workspace_folders then
local path = client.workspace_folders[1].name
if vim.uv.fs_stat(path..'/.luarc.json') or vim.uv.fs_stat(path..'/.luarc.jsonc') then
return
end
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT'
},
-- Make the server aware of Neovim runtime files
workspace = {
checkThirdParty = false,
library = {
vim.env.VIMRUNTIME
-- Depending on the usage, you might want to add additional paths here.
-- "${3rd}/luv/library"
-- "${3rd}/busted/library",
}
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
-- library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
},
capabilities = capabilities,
}

View file

@ -0,0 +1,4 @@
require("lsp-format").setup{}
require'lspconfig'.ocamllsp.setup{
on_attach = require("lsp-format").on_attach
}

View file

@ -0,0 +1,5 @@
-- require'lspconfig'.pyright.setup{}
-- Autoformat on save.
-- vim.cmd("autocmd BufWritePre *.py execute ':Black'")

View file

@ -0,0 +1,12 @@
require'lspconfig'.roc_ls.setup{
offset_encoding = "utf-8",
}
-- Should get rid of this once semantic highlighting gets better!
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
callback = function(ev)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
client.server_capabilities.semanticTokensProvider = nil
end,
})

View file

@ -0,0 +1,7 @@
local lspconfig = require "lspconfig"
local capabilities = require('cmp_nvim_lsp').default_capabilities()
lspconfig.millet.setup{
cmd = { "millet-ls" },
capabilities = capabilities,
}

View file

@ -0,0 +1,4 @@
require'lspconfig'.ts_ls.setup{
filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
root_dir = require('lspconfig/util').root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")
}

View file

@ -0,0 +1 @@
require'lspconfig'.zls.setup{}

View file

@ -0,0 +1,2 @@
DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache')

View file

@ -0,0 +1,4 @@
vim.g["prettier#autoformat"] = 1
vim.g["prettier#autoformat_require_pragma"] = 0
vim.g["prettier#exec_cmd_async"] = 1

View file

@ -0,0 +1,11 @@
-- This is your opts table
require("telescope").setup {
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {}
}
}
}
require("telescope").load_extension("ui-select")
require("telescope").load_extension "file_browser"

View file

@ -0,0 +1,137 @@
local execute = vim.api.nvim_command
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
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
execute 'packadd packer.nvim'
end
return require('packer').startup(function(use)
-- Packer can manage itself as an optional plugin
use 'wbthomason/packer.nvim'
-- LSP
use 'neovim/nvim-lspconfig'
use ({
'nvimdev/lspsaga.nvim',
config = function()
require('lspsaga').setup({})
end,
})
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
}
-- Autocomplete
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'https://codeberg.org/FelipeLema/cmp-async-path'
use 'dcampos/nvim-snippy'
use 'dcampos/cmp-snippy'
use 'hrsh7th/nvim-cmp'
-- Function signatures
use "ray-x/lsp_signature.nvim"
-- Theme
use 'drewtempelmeyer/palenight.vim'
use 'kyazdani42/nvim-web-devicons'
-- Syntax
use 'sheerun/vim-polyglot'
-- use {
--- 'prettier/vim-prettier',
-- run = "yarn install",
-- ft = {"javascript", "typescript", "json"}
-- }
use {'styled-components/vim-styled-components', branch = "main"}
use 'dominikduda/vim_current_word'
use {
'lukas-reineke/indent-blankline.nvim',
ft = {'yaml', 'yml', 'helm'},
config = function()
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
require("indent_blankline").setup {
show_end_of_line = true,
space_char_blankline = " ",
}
end
}
use 'airblade/vim-rooter'
-- Find tools.
use { "nvim-telescope/telescope-file-browser.nvim" }
use {'nvim-telescope/telescope-ui-select.nvim' }
use {
'nvim-telescope/telescope.nvim',
requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}},
}
use { "junegunn/fzf" }
use { "junegunn/fzf.vim" }
-- Diagnostics
-- Lua
use {
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
}
end
}
-- Git symobls.
use {
'lewis6991/gitsigns.nvim',
tag = 'release',
config = function()
require('gitsigns').setup()
end
}
use 'jiangmiao/auto-pairs'
use 'itchyny/lightline.vim'
use 'itchyny/vim-gitbranch'
-- Golang
use 'fatih/vim-go'
-- Flutter/Dart
use {'akinsho/flutter-tools.nvim', requires = 'nvim-lua/plenary.nvim'}
-- Pyhton
-- use 'a-vrma/black-nvim'
use {
'psf/black', branch = "stable"
}
-- Ocaml
use "lukas-reineke/lsp-format.nvim"
-- Comments
use 'tpope/vim-commentary'
-- Smooth scrolling
use 'psliwka/vim-smoothie'
-- Yuck (Eww config language).
-- use 'elkowar/yuck.vim'
-- Better file viewer
use({
"stevearc/oil.nvim",
config = function()
require("oil").setup()
end,
})
end)

View file

@ -0,0 +1,81 @@
-- Comes from the Chris@Machine config.
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object"
vim.o.hidden = true -- Required to keep multiple buffers open multiple buffers
vim.wo.wrap = false -- Display long lines as just one line
vim.o.fileencoding = "utf-8" -- The encoding written to file
vim.o.splitbelow = true -- Horizontal splits will automatically be below
vim.o.splitright = true -- Vertical splits will automatically be to the right
vim.o.conceallevel = 0 -- So that I can see `` in markdown files
vim.cmd('set ts=4') -- Insert 2 spaces for a tab
vim.cmd('set sw=4') -- Change the number of space characters inserted for indentation
vim.bo.expandtab = true -- Converts tabs to spaces
vim.bo.smartindent = true -- Makes indenting smart
vim.wo.number = true -- set numbered lines
vim.wo.cursorline = true -- Enable highlighting of the current line
--vim.o.showtabline = 2 -- Always show tabs
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore
vim.o.backup = false -- This is recommended by coc
vim.o.writebackup = false -- This is recommended by coc
vim.wo.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text each time
vim.o.updatetime = 300 -- Faster completion
vim.o.timeoutlen = 500 -- By default timeoutlen is 1000 ms
vim.cmd(":set number relativenumber")
vim.cmd("autocmd FileType helm set nofixendofline")
vim.cmd("autocmd FileType yaml set nofixendofline")
vim.cmd("autocmd FileType yml set nofixendofline")
vim.cmd("autocmd BufReadPost * :lua require('gitsigns').setup()")
------ Folding
-- vim.o.foldlevel = 99
-- Persist folds.
-- Ignore errors.
-- vim.cmd([[
-- augroup AutoSaveFolds
-- autocmd!
-- autocmd BufWinLeave * silent! mkview
-- autocmd BufWinEnter * silent! loadview
-- augroup END
-- ]])
-- Show full file path in lightline.
vim.cmd([[
let g:lightline = {
\ 'colorscheme' : 'palenight',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'filename': 'FilenameForLightline',
\ 'gitbranch': 'gitbranch#name'
\ }
\ }
function! FilenameForLightline()
let root = fnamemodify(get(b:, 'gitbranch_path'), ':h:h')
let path = expand('%:p')
if path[:len(root)-1] ==# root
return path[len(root)+1:]
endif
return expand('%')
endfunction
]])
-- Custom command for ripgrep.
-- vim.cmd([[
-- function! RipgrepFzf(query, fullscreen)
-- let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
-- let initial_command = printf(command_fmt, shellescape(a:query))
-- let reload_command = printf(command_fmt, '{q}')
-- let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
-- call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
-- endfunction
-- command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
-- ]])