summaryrefslogtreecommitdiff
path: root/config/nvim-2/vscript
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /config/nvim-2/vscript
Diffstat (limited to 'config/nvim-2/vscript')
-rw-r--r--config/nvim-2/vscript/key.vim2
-rw-r--r--config/nvim-2/vscript/lua.vim122
-rw-r--r--config/nvim-2/vscript/scp.vim29
3 files changed, 153 insertions, 0 deletions
diff --git a/config/nvim-2/vscript/key.vim b/config/nvim-2/vscript/key.vim
new file mode 100644
index 0000000..7a1fcf5
--- /dev/null
+++ b/config/nvim-2/vscript/key.vim
@@ -0,0 +1,2 @@
+let mapleader=","
+nnoremap <Leader>x :!chmod +x %<CR>
diff --git a/config/nvim-2/vscript/lua.vim b/config/nvim-2/vscript/lua.vim
new file mode 100644
index 0000000..8d6eec0
--- /dev/null
+++ b/config/nvim-2/vscript/lua.vim
@@ -0,0 +1,122 @@
+lua << EOF
+
+vim.o.termguicolors = true
+
+local on_attach = function(client, bufnr)
+ local opts = { buffer = bufnr, remap = false }
+
+ vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
+ vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
+ vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
+ vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
+ vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
+ vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
+end
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "lua" },
+ callback = function()
+ vim.lsp.start({
+ name = "lua_ls",
+ cmd = { "lua-language-server" },
+ on_attach = on_attach,
+ })
+ end,
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "python" },
+ callback = function()
+ vim.lsp.start({
+ name = "pyright",
+ cmd = { "pyright-langserver", "--stdio" },
+ on_attach = on_attach,
+ })
+ end,
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "c", "cpp" },
+ callback = function()
+ vim.lsp.start({
+ name = "clangd",
+ cmd = { "clangd" },
+ on_attach = on_attach,
+ })
+ end,
+})
+
+local cmp = require("cmp")
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ vim.snippet.expand(args.body)
+ end,
+ },
+
+ mapping = cmp.mapping.preset.insert({
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<CR>"] = cmp.mapping.confirm({ select = true }),
+ }),
+
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" },
+ { name = "buffer" },
+ }),
+})
+
+vim.diagnostic.config({
+ virtual_text = true,
+ signs = true,
+ underline = true,
+ update_in_insert = false,
+ severity_sort = true,
+
+ float = {
+ border = "rounded",
+ source = true,
+ },
+})
+
+vim.cmd([[
+highlight clear
+syntax reset
+highlight Normal guibg=NONE
+highlight NormalNC guibg=NONE
+highlight SignColumn guibg=NONE
+highlight FoldColumn guibg=NONE
+highlight VertSplit guibg=NONE
+highlight StatusLine guibg=NONE
+highlight StatusLineNC guibg=NONE
+highlight LineNr guibg=NONE
+highlight CursorLine guibg=#151515
+highlight CursorLineNr guibg=NONE gui=bold
+highlight Pmenu guibg=#121212
+highlight PmenuSel guibg=#2a2a2a
+highlight PmenuSbar guibg=#121212
+highlight PmenuThumb guibg=#4a4a4a
+highlight NormalFloat guibg=NONE
+highlight FloatBorder guibg=NONE
+highlight DiagnosticError guifg=#ff6b6b
+highlight DiagnosticWarn guifg=#ffd08a
+highlight DiagnosticInfo guifg=#9fe7ff
+highlight DiagnosticHint guifg=#7dff9a
+highlight DiagnosticVirtualTextError guifg=#ff6b6b guibg=NONE
+highlight DiagnosticVirtualTextWarn guifg=#ffd08a guibg=NONE
+highlight DiagnosticVirtualTextInfo guifg=#9fe7ff guibg=NONE
+highlight DiagnosticVirtualTextHint guifg=#7dff7a guibg=NONE
+highlight DiagnosticUnderlineError gui=undercurl guisp=#ff6b6b
+highlight DiagnosticUnderlineWarn gui=undercurl guisp=#ffd08a
+highlight DiagnosticUnderlineInfo gui=undercurl guisp=#9fe7ff
+highlight DiagnosticUnderlineHint gui=undercurl guisp=#7dff7a
+highlight LspReferenceText guibg=#1f1f1f
+highlight LspReferenceRead guibg=#1f1f1f
+highlight LspReferenceWrite guibg=#1f1f1f
+]])
+
+--autopairs?
+require("nvim-autopairs").setup()
+
+EOF
diff --git a/config/nvim-2/vscript/scp.vim b/config/nvim-2/vscript/scp.vim
new file mode 100644
index 0000000..6824c18
--- /dev/null
+++ b/config/nvim-2/vscript/scp.vim
@@ -0,0 +1,29 @@
+function! Sc(char)
+ let closing = {'(': ')', '[': ']', '{': '}', '<': '>', '"': '"', "'": "'"}
+
+ if has_key(closing, a:char)
+ let line = getline('.')
+ let col = col('.') - 1
+ let before = col > 0 ? line[col-1] : ''
+ let after = col < len(line) ? line[col] : ''
+ if before =~ '\w' && after =~ '\w'
+ return a:char
+ endif
+ if (a:char == '"' || a:char == "'") && before == a:char
+ return a:char
+ endif
+ if after == closing[a:char]
+ return "\<Right>"
+ endif
+ return a:char . closing[a:char] . "\<Left>"
+ endif
+
+ return a:char
+endfunction
+
+inoremap ( <C-R>=Sc('(')<CR>
+inoremap [ <C-R>=Sc('[')<CR>
+inoremap { <C-R>=Sc('{')<CR>
+inoremap < <C-R>=Sc('<')<CR>
+inoremap " <C-R>=Sc('"')<CR>
+inoremap ' <C-R>=Sc("'")<CR>