Initial commit for public dots

This commit is contained in:
2023-07-08 15:20:41 +03:00
commit 2c53e85568
74 changed files with 5096 additions and 0 deletions

View File

@ -0,0 +1,6 @@
-- autopairs
require('nvim-autopairs').setup{}
-- insert () after selecting functions
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))

View File

@ -0,0 +1,27 @@
vim.opt.completeopt = { 'menuone', 'noselect' }
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true
})
},
sources = {
{ name = 'path' },
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'vsnip' }
}
})

View File

@ -0,0 +1,4 @@
-- colorscheme
vim.cmd 'colorscheme wal'
-- vim.cmd 'colorscheme monokai'
vim.cmd 'highlight Pmenu ctermbg=black'

View File

@ -0,0 +1 @@
require("Comment").setup()

View File

@ -0,0 +1,121 @@
local dap = require('dap')
--
-- go
--
-- dap.adapters.go = function(callback, config)
-- local stdout = vim.loop.new_pipe(false)
-- local handle local pid_or_err local port = 38697
-- local opts = {
-- stdio = {nil, stdout},
-- args = {"dap", "-l", "127.0.0.1:" .. port},
-- detached = true
-- }
-- handle, pid_or_err = vim.loop.spawn("dlv", opts, function(code)
-- stdout:close()
-- handle:close()
-- if code ~= 0 then
-- print('dlv exited with code', code)
-- end
-- end)
-- assert(handle, 'Error running dlv: ' .. tostring(pid_or_err))
-- stdout:read_start(function(err, chunk)
-- assert(not err, err)
-- if chunk then
-- vim.schedule(function()
-- require('dap.repl').append(chunk)
-- end)
-- end
-- end)
-- vim.defer_fn(
-- function()
-- callback({type = "server", host = "127.0.0.1", port = port})
-- end,
-- 100)
-- end
dap.adapters.go = {
type = "server",
host = "127.0.0.1",
port = 38697,
}
-- https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_dap.md
dap.configurations.go = {
{
type = "go",
name = "Debug",
request = "launch",
program = "${fileDirname}"
},
{
type = "go",
name = "Debug test", -- configuration for debugging test files
request = "launch",
mode = "test",
program = "${file}"
},
-- works with go.mod packages and sub packages
{
type = "go",
name = "Debug test (go.mod)",
request = "launch",
mode = "test",
program = "./${relativeFileDirname}"
}
}
--
-- python
--
dap.adapters.python = {
type = 'executable';
command = 'python';
args = { '-m', 'debugpy.adapter' };
}
dap.configurations.python = {
{
type = 'python';
request = 'launch';
name = "Launch file";
program = "${file}";
pythonPath = function()
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return '/usr/bin/python'
end
end;
},
}
--
-- C
--
dap.adapters.lldb = {
type = 'executable',
command = '/usr/bin/lldb-vscode',
name = "lldb"
}
dap.configurations.c = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
end,
cwd = '${workspaceFolder}',
stopOnEntry = false,
args = {},
runInTerminal = false,
},
}

View File

@ -0,0 +1 @@
require("dapui").setup()

View File

@ -0,0 +1,5 @@
require('lint').linters_by_ft = {
python = {'mypy'}
}
vim.cmd("au BufWrite <buffer> lua require('lint').try_lint()")

View File

@ -0,0 +1,17 @@
local lsp = require('lspconfig')
-- language servers
lsp.pyright.setup{
settings = {
python = {
analysis = {
typeCheckingMode = "off"
}
}
}
}
lsp.gopls.setup{}
lsp.clangd.setup{}
lsp.texlab.setup{}
lsp.rust_analyzer.setup{}
lsp.jdtls.setup{ cmd = { "jdtls" } }

View File

@ -0,0 +1,8 @@
-- lualine colorscheme
require('lualine').setup{
options = {
theme = 'auto',
section_separators = {'', ''},
component_separators = {'', ''}
}
}

View File

@ -0,0 +1 @@
vim.g.neoformat_enabled_python = {'yapf'}

View File

@ -0,0 +1,8 @@
-- nvim tree
require'nvim-tree'.setup{
auto_close = true,
update_cwd = true,
diagnostics = {
enable = true,
},
}

View File

@ -0,0 +1,8 @@
-- telescope settings
require('telescope').setup{
defaults = {
-- sorting
file_sorter = require'telescope.sorters'.get_fzy_sorter,
generic_sorter = require'telescope.sorters'.get_fzy_sorter,
}
}

View File

@ -0,0 +1,2 @@
vim.o.hidden = true
require("toggleterm").setup{}

View File

@ -0,0 +1,5 @@
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
},
}

View File

@ -0,0 +1,5 @@
-- ignore certain errors
vim.g.vimtex_quickfix_ignore_filters = { 'Underfull', 'Overfull', 'babel' }
-- use zathura as the pdf viewer
vim.g.vimtex_view_general_viewer = 'zathura'

View File

@ -0,0 +1,2 @@
vim.cmd("let g:vimwiki_list = [{'path': '~/misc/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]")
vim.cmd("let g:vimwiki_key_mappings = { 'global': 0, }")

View File

@ -0,0 +1,76 @@
local wk = require("which-key")
wk.register({
a = {
name = "Actions",
r = "Reload Config"
},
d = {
name = "Debug",
b = "Toggle Breakpoint",
c = "Continue",
h = "Telescope",
i = "Step Into",
l = "Run Last",
n = "Step Over",
o = "Step Out",
p = "List Breakpoints",
q = "Stop",
u = "Toggle UI",
v = "Show Variables"
},
g = {
name = "Language",
D = "Go To Declaration",
a = "Code Actions",
d = "Go To Definition",
e = "Show Line Diagnostics",
f = "Format Code",
i = "Show Implementations",
k = "Hover",
n = "Rename",
q = "Show Diagnostics",
r = "Show References",
t = "Show Type Definition"
},
m = {
name = "Keymap",
e = "English",
e = "Hebrew"
},
s = {
name = "Splits & Buffers",
v = "Vertical Split",
z = "Horizontal Split Split",
t = "New Tab",
b = "Show Buffers",
h = "Left Tab",
l = "Right Tab",
},
t = {
name = "Telescope",
l = "Lsp Workspace Symbols",
o = "Old Files",
g = "Grep",
s = "Treesitter",
m = "Git Status",
b = "Git Branches",
c = "Git Commits",
f = "Git Files"
},
C = "Terminal",
F = "Fuzzy Files",
Q = "Quit All",
S = "Save All",
X = "Quit All Without Saving",
c = "Toggle All Terminal",
f = "File Manager",
f = "File Manager",
h = "Left Split",
j = "Down Split",
k = "Up Split",
l = "Right Split",
q = "Quit",
s = "Save",
x = "Quit Without Saving"
}, { prefix = "<leader>" })
wk.setup{}