Compare commits

...

3 Commits

Author SHA1 Message Date
Steffen Rademacker 9bf8a2459a fix wezterm session spawning 7 months ago
Steffen Rademacker 393d6b79b5 wezterm session support 7 months ago
Steffen Rademacker 8ddcc1b869 linting and formatters working 7 months ago

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
brew install neovim
brew install jq
gem install neovim
pip install neovim
@ -8,7 +9,6 @@ pip install neovim
ln -s ~/dotfiles/nvim ~/.config/nvim
# additional language-servers for nvim-lspconfig
npm install -g fixjson
npm install -g eslint_d
npm install -g jsonlint
npm install -g markdownlint-cli

@ -28,8 +28,9 @@ require('lazy').setup({
-- modern neovim with treesitter, lsp, cmp, vsnips and telescope
{ 'neovim/nvim-lspconfig', config = get_config('lspconfig') },
{ 'nvim-treesitter/nvim-treesitter', config = get_config('treesitter'), build = ':TSUpdate' },
{ 'nvim-treesitter/nvim-treesitter-textobjects', dependencies = 'nvim-treesitter/nvim-treesitter' },
{ 'nvim-treesitter/nvim-treesitter-refactor', dependencies = 'nvim-treesitter/nvim-treesitter' },
{ 'windwp/nvim-ts-autotag', dependencies = 'nvim-treesitter/nvim-treesitter' },
{ 'andymass/vim-matchup', dependencies = 'nvim-treesitter/nvim-treesitter' },
{ 'nvim-telescope/telescope.nvim', dependencies = 'nvim-lua/plenary.nvim', config = get_config('telescope') },
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
{ 'hrsh7th/vim-vsnip', config = get_config('vsnip') },
@ -60,14 +61,13 @@ require('lazy').setup({
{ 'kylechui/nvim-surround', event = 'VeryLazy', config = true },
{ 'numToStr/Comment.nvim', config = true },
{ 'numToStr/Navigator.nvim', config = true },
{ 'tpope/vim-ragtag' }, -- TODO still needed?!
{ 'tpope/vim-repeat' }, -- TODO still needed?!
{ 'windwp/nvim-autopairs', event = 'InsertEnter', config = true },
-- more plugins and integrations
{ 'nvim-pack/nvim-spectre', dependencies = 'nvim-lua/plenary.nvim', config = true },
{ 'voldikss/vim-floaterm', config = get_config('floaterm') },
{ 'mfussenegger/nvim-lint', config = get_config('lint') },
-- TODO formatter with eslint, stylelint, markdownlint and code_actions?
{ 'stevearc/conform.nvim', event = { 'BufWritePre' }, config = get_config('conform') },
{ 'nvim-neorg/neorg',
build = ':Neorg sync-parsers',
dependencies = 'nvim-lua/plenary.nvim',
@ -135,7 +135,10 @@ cmd 'colorscheme gruvbox-baby'
cmd 'language en_US.UTF-8'
-- autoresize windows/splits everytime we change to a buffer
createCmd({ 'BufEnter', 'BufWinEnter' }, { pattern = { '*' }, command = 'wincmd =' })
createCmd({ 'VimResized', 'FocusGained' }, {
pattern = { '*' },
command = 'wincmd =',
})
-- make dash-spearated-keywords in css and json a keyword
createCmd({ 'BufEnter', 'BufWinEnter' }, {

@ -0,0 +1,44 @@
require('conform').setup({
formatters = {
localstylelint = {
stdin = true,
command = function()
local local_repo = vim.fn.system({ 'git', 'rev-parse', '--show-toplevel' }):gsub('%s+', '')
local local_stylelint = vim.fn.resolve(local_repo .. '/node_modules/.bin/stylelint')
if vim.fn.filereadable(local_stylelint) then
return local_stylelint
end
return 'stylelint'
end,
args = {
'--fix',
'--stdin',
'--stdin-filename',
vim.fn.expand('%:p'),
'--config-basedir',
vim.fn.system({ 'git', 'rev-parse', '--show-toplevel' }),
},
},
},
})
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = { '*.json' },
callback = function(args)
require('conform').format({ formatters = { 'jq' }, quiet = true })
end,
})
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = { '*.css', '*.scss' },
callback = function(args)
require('conform').format({ formatters = { 'localstylelint' }, quiet = true })
end,
})
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = { '*.js', '*.jsx', '*.ts', '*.tsx' },
callback = function(args)
require('conform').format({ formatters = { 'eslint_d' }, quiet = true })
end,
})

@ -4,27 +4,23 @@ require('lint').linters_by_ft = {
yaml = { 'yamllint' },
css = { 'stylelint' },
scss = { 'stylelint' },
json = { 'fixjson' },
json = { 'jsonlint' },
javascript = { 'eslint_d' },
javascriptreact = { 'eslint_d' },
typescript = { 'tsc', 'eslint_d' },
typescriptreact = { 'tsc', 'eslint_d' },
typescript = { 'eslint_d' },
typescriptreact = { 'eslint_d' },
}
-- stylelint always relative to current git-dir
local stylelint = require('lint').linters.stylelint
stylelint['stdin'] = false
stylelint['args'] = {
'-f',
'--formatter',
'json',
"--stdin",
"--stdin-filename",
vim.fn.expand("%:p"),
'--config-basedir',
function()
return vim.fn.system({ 'git', 'rev-parse', '--show-toplevel' })
end,
'--stdin-filename',
function()
return vim.fn.expand('%:p')
end,
vim.fn.system({ 'git', 'rev-parse', '--show-toplevel' }),
}
require('lint').linters.stylelint = stylelint

@ -28,13 +28,31 @@ require('nvim-treesitter.configs').setup({
},
highlight = { enable = true },
indent = { enable = true },
textobjects = {
select = {
autotag = { enable = true },
matchup = { enable = true },
refactor = {
highlight_definitions = {
enable = true,
lookahead = true,
include_surrounding_whitespace = true,
clear_on_cursor_move = true,
},
}
navigation = {
enable = true,
keymaps = {
goto_definition = 'gd',
list_definitions = 'gl',
list_definitions_toc = false,
goto_next_usage = 'gn',
goto_previous_usage = 'gp',
},
},
smart_rename = {
enable = true,
keymaps = {
smart_rename = 'gr',
},
},
},
})
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'

@ -7,65 +7,61 @@ wk.register({
['-'] = { '<cmd>FloatermNew nnn<cr>', 'invoke floaterm with nnn as file picker' },
[';'] = { ':', 'Colon with semicolon' },
['<F5>'] = { '<cmd>checktime<cr><cmd>redraw!<cr>', 'redraw/reload with F5' },
['<up>'] = { '<cmd>bfirst<cr>', 'buffer navigation with arrow keys' },
['<right>'] = { '<cmd>bnext<cr>', 'buffer navigation with arrow keys' },
['<down>'] = { '<cmd>blast<cr>', 'buffer navigation with arrow keys' },
['<left>'] = { '<cmd>bprevious<cr>', 'buffer navigation with arrow keys' },
['<right>'] = { '<cmd>bnext<cr>', 'buffer navigation with arrow keys' },
['<up>'] = { '<cmd>bfirst<cr>', 'buffer navigation with arrow keys' },
['¬'] = { '>>', 'bubbling lines with alt-hjkl', noremap = false },
['˙'] = { '<<', 'bubbling lines with alt-hjkl', noremap = false },
[''] = { ':move .+1<cr>', 'bubbling lines with alt-hjkl', noremap = false },
['˚'] = { ':move .-2<cr>', 'bubbling lines with alt-hjkl', noremap = false },
['¬'] = { '>>', 'bubbling lines with alt-hjkl', noremap = false },
[''] = { ':move .+1<cr>', 'bubbling lines with alt-hjkl', noremap = false },
g = {
name = 'code-related mappings',
-- for more code-mappings: see treesitter.lua
D = { '<cmd>lua vim.lsp.buf.declaration()<cr>', 'show/go to declaration' },
I = { '<cmd>lua vim.lsp.buf.implementation()<cr>', 'show/go to implementation' },
L = { '<cmd>lua vim.lsp.buf.references()<cr>', 'show/go to referennces' },
a = { '<cmd>lua vim.lsp.buf.code_action()<cr>', 'run code action' },
b = { '<cmd>Gitsigns blame_line<cr>', 'git blame line' },
d = { '<cmd>lua vim.lsp.buf.definition()<cr>', 'show/go to definition' },
e = { '<cmd>lua vim.diagnostic.goto_next()<cr>', 'go to next error in file' },
f = { '<cmd>lua vim.lsp.buf.formatting()<cr>', 'format file with LSP' },
f = { '<cmd>lua vim.lsp.buf.format()<cr>', 'format file with LSP' },
h = { '<cmd>lua vim.lsp.buf.hover()<cr>', 'show hover info' },
r = { '<cmd>lua vim.lsp.buf.rename()<cr>', 'lsp rename' },
x = { '<cmd>execute "/\\v^[<\\|=>]{7}/"<cr>', 'find git conflicts in file' },
D = { '<cmd>lua vim.lsp.buf.declaration()<cr>', 'show/go to declaration' },
I = { '<cmd>lua vim.lsp.buf.implementation()<cr>', 'show/go to implementation' },
R = { '<cmd>lua vim.lsp.buf.references()<cr>', 'show/go to referennces' },
},
K = { '', 'K man-pages mapping removed' },
N = { 'Nzzzv', 'kepping it centered with N' },
Q = { '', 'Q ex-mode-mapping removed' },
S = { function() require('flash').treesitter() end, 'flash treesitter select' },
j = { 'gj', 'j and k with wrapped lines' },
k = { 'gk', 'j and k with wrapped lines' },
n = { 'nzzzv', 'kepping it centered with n' },
s = { function() require('flash').jump() end, 'flash jump' },
v = { '<C-V>', 'remapping visual/visual-block mode' },
K = { '', 'K man-pages mapping removed' },
N = { 'Nzzzv', 'kepping it centered with N' },
Q = { '', 'Q ex-mode-mapping removed' },
S = { function() require('flash').treesitter() end, 'flash treesitter select' },
Y = { 'y$', 'yank till end of line with Y' },
-- with <CTRL> as modifier
['<C-h>'] = { '<cmd>NavigatorLeft<cr>', 'move to the lefthand split' },
['<C-j>'] = { '<cmd>NavigatorDown<cr>', 'move to the rigthand split' },
['<C-k>'] = { '<cmd>NavigatorUp<cr>', 'move to the upper split' },
['<C-l>'] = { '<cmd>NavigatorRight<cr>', 'move to the lower split' },
['<C-V>'] = { 'v', 'remapping visual/visual-block mode' },
})
-- all normal mode leader key mappings in one place
wk.register({
['\\'] = { '<C-w>v<C-w>l', 'Vertical split' },
['-'] = { '<C-w>s<C-w>j', 'Horizontal split' },
[','] = { '<cmd>Telescope find_files<cr>', 'find files' },
['-'] = { '<C-w>s<C-w>j', 'Horizontal split' },
['.'] = { '<cmd>Telescope buffers<cr>', 'find buffers' },
['\''] = { '<cmd>Telescope git_files<cr>', 'find in git files' },
[';'] = { '<cmd>Telescope command_history<cr>', 'find in command history' },
['/'] = { '<cmd>Telescope search_history<cr>', 'find in search history' },
[';'] = { '<cmd>Telescope command_history<cr>', 'find in command history' },
['\''] = { '<cmd>Telescope git_files<cr>', 'find in git files' },
['\\'] = { '<C-w>v<C-w>l', 'Vertical split' },
[']'] = { '<cmd>Telescope current_buffer_fuzzy_find<cr>', 'find line in current buffer' },
a = { '<cmd>Telescope live_grep<cr>', 'live ripgrep' },
b = { '<cmd>Telescope git_branches<cr>', 'git branches' },
c = { '<cmd>Telescope git_bcommits<cr>', 'commits for buffer' },
f = { '<cmd>Spectre<cr>', 'open spectre for search/replace' },
l = { '<cmd>FloatermNew lazygit<cr>', 'open lazygit' },
t = { '<cmd>FloatermNew<cr>', 'open new terminal' },
v = {
@ -79,20 +75,17 @@ wk.register({
-- visual-mode mappings
wk.register({
[';'] = { ':', 'Colon with semicolon' },
['¬'] = { '>gv', 'bubbling lines with alt-hjkl', noremap = false },
['˙'] = { '<gv', 'bubbling lines with alt-hjkl', noremap = false },
[''] = { ":move '>+1<cr>gv", 'bubbling lines with alt-hjkl', noremap = false },
['˚'] = { ":move '<-2<cr>gv", 'bubbling lines with alt-hjkl', noremap = false },
['¬'] = { '>gv', 'bubbling lines with alt-hjkl', noremap = false },
[''] = { ":move '>+1<cr>gv", 'bubbling lines with alt-hjkl', noremap = false },
v = { '<C-V>', 'remapping visual/visual-block mode' },
['<C-V>'] = { 'v', 'remapping visual/visual-block mode' },
}, { mode = 'v' })
-- non-normal-mode mappings
-- insert-substitute-mode mappings for snippets
wk.register({
['<C-j>'] = { 'vsnip#available(1) ? "<Plug>(vsnip-expand-or-jump)" : "<C-j>"', 'snippet expansion' },
}, { mode = 'i', expr = true, noremap = true })
wk.register({
['<C-j>'] = { 'vsnip#available(-1) ? "<Plug>(vsnip-jump-prev)" : "<C-j>"', 'snippet expansion' },
}, {
mode = 's',
expr = true,
noremap = true
})
}, { mode = 's', expr = true, noremap = true })

@ -22,6 +22,31 @@ local function conditionalActivatePane(window, pane, pane_direction, vim_directi
end
end
-- open new development session with splits and commands
-- this expects the default src / public-dist structure to work
local function newDevelopmentSession(path_and_title)
local sites_dir = wezterm.home_dir .. '/Sites/'
local dev_tab, dev_pane, dev_window = mux.spawn_window({
cwd = sites_dir .. path_and_title,
workspace = path_and_title,
})
local src_tab, src_pane, dev_window = dev_window:spawn_tab({
cwd = sites_dir .. path_and_title,
})
dev_tab:set_title('zsh')
dev_pane:send_text('v package.json\n')
devgit_pane = dev_pane:split({
workspace = path_and_title,
direction = 'Right',
cwd = sites_dir .. path_and_title .. '/src',
})
devgit_pane:send_text('ggpl && gs\n')
src_tab:set_title('src')
src_pane:send_text('cd src && v\n:Telescope find_files\n')
mux.set_active_workspace(path_and_title)
end
-- base config
config.color_scheme = 'GruvboxDark'
config.font = wezterm.font('FiraCode Nerd Font')
@ -84,6 +109,18 @@ config.keys = {
end),
},
},
{
key = 'd',
mods = 'LEADER',
action = act.PromptInputLine {
description = 'Enter name for new workspace',
action = wezterm.action_callback(function(window, pane, line)
if line then
newDevelopmentSession(line:gsub('%s+', ''))
end
end),
},
},
{
key = '$',
mods = 'LEADER',
@ -145,30 +182,30 @@ end)
-- always maximise and start default session with mutt, neorg and dotfiles
wezterm.on('gui-startup', function()
local tab, pane, window = mux.spawn_window({})
window:gui_window():maximize()
-- Set a workspace for coding on a current project
-- Top pane is for the editor, bottom pane is for the build tool
local homeDir = wezterm.home_dir
-- local tab, build_pane, window = mux.spawn_window({
-- workspace = 'default',
-- cwd = homeDir
-- })
--
-- local editor_pane = build_pane:split({
-- direction = 'Right',
-- size = 0.5,
-- cwd = homeDir,
-- })
--
-- build_pane:send_text 'ls -al\n'
--
-- local tab, pane, window = mux.spawn_window {
-- workspace = 'dev',
-- }
--
-- mux.set_active_workspace 'default'
local home_dir = wezterm.home_dir
local tab, pane, window = mux.spawn_window({ cwd = home_dir })
local todo_tab, todo_pane, window = window:spawn_tab({ cwd = home_dir .. '/Notes' })
local dot_tab, dot_pane, window = window:spawn_tab({ cwd = home_dir .. '/Dotfiles' })
local git_pane = dot_pane:split({ direction = 'Right', cwd = home_dir .. '/Dotfiles' })
tab:set_title('mail')
pane:send_text('O && m\n')
dot_tab:set_title('dotfiles')
dot_pane:send_text('v nvim/init.lua\n')
todo_tab:set_title('todo')
todo_pane:send_text('v index.norg\n')
git_pane:send_text('gs\n')
tab:activate()
-- initialize some sessions for MRU projects and folders
newDevelopmentSession('dev')
newDevelopmentSession('ag/core')
newDevelopmentSession('ag/web')
newDevelopmentSession('ag/sp')
newDevelopmentSession('pax/frontend')
newDevelopmentSession('wwz/frontend')
mux.set_active_workspace('default')
window:gui_window():maximize()
end)
return config

@ -28,7 +28,7 @@ export HOMEBREW_NO_ENV_HINTS=true
# nnn
export NNN_OPTS='deHR'
export NNN_BMS='a:~/Sites/ag;d:~/Dotfiles;s:~/Sites;l:~/Downloads;h:~/'
export NNN_BMS='a:~/Sites;s:~/Dotfiles;d:~/Downloads;h:~/'
export NNN_FCOLORS='c1e26c2e006033f5c6d6abc4'
export NNN_PLUG='p:preview-tui;j:autojump'
export NNN_FIFO='/tmp/nnn.fifo'

Loading…
Cancel
Save