work setup

This commit is contained in:
Markus Dieckmann 2022-08-23 16:02:27 +02:00
parent 29b84cfe88
commit f4d73c543c
10 changed files with 205 additions and 83 deletions

View File

@ -10,6 +10,8 @@ set textwidth=120
set cursorline set cursorline
hi CursorLine term=bold cterm=bold ctermbg=darkgrey hi CursorLine term=bold cterm=bold ctermbg=darkgrey
set tabstop=2 set tabstop=2
set softtabstop=2
set expandtab
set shiftwidth=2 set shiftwidth=2
set matchpairs+=<:> set matchpairs+=<:>
set showmode set showmode
@ -56,6 +58,12 @@ set termguicolors
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'waycrate/swhkd-vim' Plug 'waycrate/swhkd-vim'
Plug 'kmonad/kmonad-vim' Plug 'kmonad/kmonad-vim'
Plug 'nvim-lua/plenary.nvim'
Plug 'akinsho/toggleterm.nvim', {'tag' : 'v2.*'}
Plug 'https://git.sr.ht/~whynothugo/lsp_lines.nvim'
Plug 'MunifTanjim/nui.nvim'
Plug 'arnarg/todotxt.nvim'
call plug#end() call plug#end()
autocmd vimenter * colorscheme gruvbox autocmd vimenter * colorscheme gruvbox
@ -64,13 +72,18 @@ set termguicolors
set completeopt=menuone,noselect set completeopt=menuone,noselect
highlight NvimTreeFolderIcon guibg=blue highlight NvimTreeFolderIcon guibg=blue
lua require('cmp_config')
lua require('nvimtree') lua require('nvimtree')
lua require('lsp_config') lua require('lsp_config')
lua require('treesitter_config') lua require('treesitter_config')
lua require('dap_config') lua require('dap_config')
lua require('jester') lua require('jester')
lua require('toggleterm_config')
lua require('virtual_lines_config')
lua require('todotxt_config')
"Leader "Leader
nnoremap <SPACE> <Nop> nnoremap <SPACE> <Nop>
@ -89,6 +102,7 @@ let mapleader=" "
nnoremap <esc><esc> :noh<return><esc> nnoremap <esc><esc> :noh<return><esc>
map <leader>f :FZF<CR> map <leader>f :FZF<CR>
map <leader>F :Rg<CR> map <leader>F :Rg<CR>
nnoremap <leader>ca <cmd>lua vim.lsp.buf.code_action()<cr> nnoremap <leader>ca <cmd>lua vim.lsp.buf.code_action()<cr>
nnoremap <leader>gd <cmd>lua vim.lsp.buf.definition()<cr> nnoremap <leader>gd <cmd>lua vim.lsp.buf.definition()<cr>
nnoremap <leader>gD <cmd>lua vim.lsp.buf.declaration()<cr> nnoremap <leader>gD <cmd>lua vim.lsp.buf.declaration()<cr>
@ -96,8 +110,13 @@ let mapleader=" "
nnoremap <leader>rn <cmd>lua vim.lsp.buf.rename()<cr> nnoremap <leader>rn <cmd>lua vim.lsp.buf.rename()<cr>
nnoremap <leader>K <cmd>lua vim.lsp.buf.hover()<cr> nnoremap <leader>K <cmd>lua vim.lsp.buf.hover()<cr>
nnoremap <leader>b :Buffers<cr>
nnoremap <C-L> :bnext<CR>
nnoremap <C-H> :bprevious<CR>
nnoremap <leader>J <cmd>lua vim.diagnostic.open_float()<cr> nnoremap <leader>J <cmd>lua vim.diagnostic.open_float()<cr>
nnoremap <M-F> <cmd>lua vim.lsp.buf.formatting()<cr> nnoremap <M-F> <cmd>lua vim.lsp.buf.format({async = true})<cr>
inoremap <c-s> <cmd>lua vim.lsp.buf.signature_help()<cr> inoremap <c-s> <cmd>lua vim.lsp.buf.signature_help()<cr>
nnoremap <F9> <cmd>lua require'dap'.toggle_breakpoint()<cr> nnoremap <F9> <cmd>lua require'dap'.toggle_breakpoint()<cr>
@ -105,11 +124,15 @@ let mapleader=" "
nnoremap <F10> <cmd>lua require'dap'.step_over()<cr> nnoremap <F10> <cmd>lua require'dap'.step_over()<cr>
nnoremap <F11> <cmd>lua require'dap'.step_into()<cr> nnoremap <F11> <cmd>lua require'dap'.step_into()<cr>
tnoremap <Esc><Esc> <C-\><C-n>
nnoremap <leader>td :ToDoTxtTasksToggle<cr>
autocmd BufWritePre *.ts lua vim.lsp.buf.formatting_sync(nil, 1000) autocmd BufWritePre *.ts lua vim.lsp.buf.formatting_sync(nil, 1000)
command JestRun :lua require'jester'.run({cmd = "yarn run test -t '$result' -- $file"}) command JestRun :lua require'jester'.run({cmd = "npm run test -t '$result' -- $file"})
command JestRunFile :lua require'jester'.run_file({cmd = "yarn run test -t '$result' -- $file"}) command JestRunFile :lua require'jester'.run_file({cmd = "npm run test -t '$result' -- $file"})
command JestRunLast :lua require'jester'.run_last({cmd = "yarn run test -t '$result' -- $file"}) command JestRunLast :lua require'jester'.run_last({cmd = "npm run test -t '$result' -- $file"})
command JestDebug :lua require'jester'.debug({cmd = "yarn run test -t '$result' -- $file"}) command JestDebug :lua require'jester'.debug({cmd = "npm run test -t '$result' -- $file"})
command JestDebugFile :lua require'jester'.debug_file({cmd = "yarn run test -t '$result' -- $file"}) command JestDebugFile :lua require'jester'.debug_file({cmd = "npm run test -t '$result' -- $file"})
command JestDebugLast :lua require'jester'.debug_last({cmd = "yarn run test -t '$result' -- $file"}) command JestDebugLast :lua require'jester'.debug_last({cmd = "npm run test -t '$result' -- $file"})

67
nvim/lua/cmp_config.lua Normal file
View File

@ -0,0 +1,67 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
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
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-p>'] = cmp.mapping.select_next_item(),
['<C-d>'] = 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.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ 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()
elseif has_words_before() then
cmp.complete()
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 = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline('/',{
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':',{
sources = cmp.config.sources({
{name = 'path'}
},{{name='cmdline'}})
})

View File

@ -0,0 +1,8 @@
local dap = require('dap')
dap.adapters.node2 = {
type = 'executable',
command = 'node',
args = {os.getenv('HOME') .. '/dev/microsoft/vscode-node-debug2/out/src/nodeDebug.js'},
}
vim.fn.sign_define('DapBreakpoint', {text='🟥', texthl='', linehl='', numhl=''})
vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''})

51
nvim/lua/debugHelper.lua Normal file
View File

@ -0,0 +1,51 @@
local dap = require('dap')
local function debugJest(testName, filename)
print("starting " .. testName .. " in " .. filename)
dap.run({
type = 'node2',
request = 'launch',
cwd = vim.fn.getcwd(),
runtimeArgs = {'--inspect-brk', '/usr/local/bin/jest', '--no-coverage', '-t', testName, '--', filename},
sourceMaps = true,
protocol = 'inspector',
skipFiles = {'<node_internals>/**/*.js'},
console = 'integratedTerminal',
port = 9229,
})
end
local function attach()
print("attaching")
dap.run({
type = 'node2',
request = 'attach',
cwd = vim.fn.getcwd(),
sourceMaps = true,
protocol = 'inspector',
skipFiles = {'<node_internals>/**/*.js'},
})
end
local function attachToRemote()
print("attaching")
dap.run({
type = 'node2',
request = 'attach',
address = "127.0.0.1",
port = 9229,
localRoot = vim.fn.getcwd(),
remoteRoot = "/home/vcap/app",
sourceMaps = true,
protocol = 'inspector',
skipFiles = {'<node_internals>/**/*.js'},
})
end
return {
debugJest = debugJest,
attach = attach,
attachToRemote = attachToRemote,
}

View File

@ -1,16 +1,19 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
local capabilites = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) local capabilites = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require'lspconfig'.tsserver.setup{ require'lspconfig'.tsserver.setup{
capabilites = capabilites capabilites = capabilites
} }
require'lspconfig'.jsonls.setup{
capabilites = capabilites
}
require'lspconfig'.dockerls.setup{ require'lspconfig'.dockerls.setup{
capabilites = capabilites capabilites = capabilites
} }
require'lspconfig'.eslint.setup{ require'lspconfig'.eslint.setup{
capabilites = capabilites capabilites = capabilites,
settings= {
run = "onSave"
}
} }
require'lspconfig'.gdscript.setup{ require'lspconfig'.gdscript.setup{
capabilites = capabilites capabilites = capabilites
@ -28,68 +31,5 @@ require'lspconfig'.bashls.setup{
capabilites = capabilites capabilites = capabilites
} }
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
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-p>'] = cmp.mapping.select_next_item(),
['<C-d>'] = 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.
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping.confirm({ 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()
elseif has_words_before() then
cmp.complete()
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 = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
cmp.setup.cmdline('/',{
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':',{
sources = cmp.config.sources({
{name = 'path'}
},{{name='cmdline'}})
})
require'fzf_lsp'.setup() require'fzf_lsp'.setup()

View File

@ -10,7 +10,7 @@ require'nvim-tree'.setup {
folder_arrow= false folder_arrow= false
}, },
glyphs = { glyphs = {
default= "", default= "",
symlink= "", symlink= "",
git= { git= {
unstaged= "", unstaged= "",
@ -57,10 +57,11 @@ require'nvim-tree'.setup {
open_on_setup = false, open_on_setup = false,
ignore_ft_on_setup = {}, ignore_ft_on_setup = {},
open_on_tab = false, open_on_tab = false,
hijack_cursor = false, hijack_cursor = true,
auto_reload_on_write = true,
update_cwd = false, update_cwd = false,
diagnostics = { diagnostics = {
enable = false, enable = true,
icons = { icons = {
hint = "", hint = "",
info = "", info = "",
@ -88,6 +89,7 @@ require'nvim-tree'.setup {
}, },
actions = { actions = {
open_file = { open_file = {
resize_window = false,
window_picker = { window_picker = {
exclude = { exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
@ -97,8 +99,7 @@ require'nvim-tree'.setup {
} }
}, },
view = { view = {
width = 25, width = 35,
height = 30,
hide_root_folder = false, hide_root_folder = false,
side = 'left', side = 'left',
mappings = { mappings = {

View File

@ -0,0 +1,9 @@
todo = require('todotxt-nvim')
todo.setup({
todo_file = '/home/mardie/todotxt/todo.txt',
sidebar = {
width = 40,
position = 'right'
}
}
)

View File

@ -0,0 +1,11 @@
require"toggleterm".setup{
open_mapping = [[<c-y>]],
hide_numbers = true,
direction = 'float',
float_opts = {
border = 'curved'
},
winbar = {
enabled = false
}
}

View File

@ -0,0 +1,9 @@
lines = require('lsp_lines')
lines.setup()
vim.diagnostic.config({ virtual_text = false });
vim.keymap.set(
"",
"tl",
lines.toggle,
{ desc = "Toggle lsp_lines" }
);

View File

@ -1,2 +1,5 @@
#!/bin/bash #!/bin/bash
docker build -t dotfiles/local_startpage:latest . REPO="startpage"
docker build -t $REPO:latest .
docker tag $REPO:latest registry.brudi.xyz/$REPO:latest
docker push registry.brudi.xyz/$REPO:latest