This commit is contained in:
2024-04-02 09:49:23 +02:00
parent 624c83e512
commit 3431afbe52
6 changed files with 281 additions and 128 deletions

18
.eslintrc.json Normal file
View File

@@ -0,0 +1,18 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": "standard-with-typescript",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"indent": ["error", 4],
"semi": ["error", "always"],
"quotes": ["error", "double"],
"comma-dangle": ["error", "only-multiline"]
}
}

6
.prettierrc.json Normal file
View File

@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": false
}

View File

@@ -8,12 +8,15 @@ alias vl='vi ~/.config/nvim/init.lua'
alias vv='vi ~/.config/nvim/vimrc.vim' alias vv='vi ~/.config/nvim/vimrc.vim'
alias gb='git branch' alias gb='git branch'
alias gl='git log' alias gl='git log'
alias pp='vi ~/.profile'
alias pg='git pull origin $(git branch --show-current)' alias pg='git pull origin $(git branch --show-current)'
alias gp='git push origin $(git branch --show-current)' alias gp='git push origin $(git branch --show-current)'
alias gs='git status' alias gs='git status'
alias gd='git diff' alias gd='git diff'
alias ga='git add --all' alias ga='git add --all'
alias l='ls -l'
alias i='ipython' alias i='ipython'
alias python=python3 alias python=python3
alias v="vagrant ssh"
alias tt='vi ~/.tmux.conf'
alias t='tree -a -I "*.pyc|*__pycache__|.git|.data|.pytest_cache|.ruff_cache"'
alias p3=python3
alias l='ls -lrta'

309
init.lua
View File

@@ -1,112 +1,197 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ vim.fn.system({
"git", "git",
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable", -- latest stable release
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
vim.opt.colorcolumn = "120" vim.opt.colorcolumn = "120"
vim.opt.updatetime = 50 -- improve perf, less frequent swp writes vim.opt.updatetime = 50 -- improve perf, less frequent swp writes
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.opt.hlsearch = false vim.opt.hlsearch = false
vim.opt.incsearch = true vim.opt.incsearch = true
vim.opt.smartindent = true vim.opt.smartindent = true
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes" vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@") vim.opt.isfname:append("@-@")
require("lazy").setup({ require("lazy").setup({
"github/copilot.vim", "folke/tokyonight.nvim",
"folke/tokyonight.nvim", "tpope/vim-commentary",
"tpope/vim-commentary", {
{ "folke/trouble.nvim",
"folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" },
dependencies = { "nvim-tree/nvim-web-devicons" }, opts = {},
opts = { },
}, {
}, "nvim-telescope/telescope.nvim",
{ tag = "0.1.5",
'nvim-telescope/telescope.nvim', tag = '0.1.5', dependencies = { "nvim-lua/plenary.nvim", "BurntSushi/ripgrep" },
dependencies = { 'nvim-lua/plenary.nvim', },
'BurntSushi/ripgrep'} {
}, "nvim-telescope/telescope-fzf-native.nvim",
{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'}, build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
{'VonHeikemen/lsp-zero.nvim', branch = 'v3.x'}, },
{'neovim/nvim-lspconfig'}, { "VonHeikemen/lsp-zero.nvim", branch = "v3.x" },
{'hrsh7th/cmp-nvim-lsp'}, { "neovim/nvim-lspconfig" },
{'hrsh7th/nvim-cmp'}, { "nvim-treesitter/nvim-treesitter" },
{"mfussenegger/nvim-jdtls"}, {
{'L3MON4D3/LuaSnip'}, "stevearc/conform.nvim",
{"neoclide/coc.nvim", branch = 'release'}, event = { "BufReadPre", "BufNewFile" },
{ config = function()
"kylechui/nvim-surround", require("conform").setup({
version = "*", formatters_by_ft = {
event = "VeryLazy", lua = { "stylua" },
config = function() svelte = { { "prettierd", "prettier" } },
require("nvim-surround").setup({ javascript = { { "prettierd", "prettier" } },
}) typescript = { { "prettierd", "prettier" } },
end javascriptreact = { { "prettierd", "prettier" } },
}, typescriptreact = { { "prettierd", "prettier" } },
}) json = { { "prettierd", "prettier" } },
require('telescope').setup { graphql = { { "prettierd", "prettier" } },
extensions = { java = { "google-java-format" },
fzf = { kotlin = { "ktlint" },
fuzzy = true, -- false will only do exact matching ruby = { "standardrb" },
override_generic_sorter = true, -- override the generic sorter markdown = { { "prettierd", "prettier" } },
override_file_sorter = true, -- override the file sorter erb = { "htmlbeautifier" },
case_mode = "smart_case", -- or "ignore_case" or "respect_case" html = { "htmlbeautifier" },
-- the default case_mode is "smart_case" bash = { "beautysh" },
} proto = { "buf" },
} rust = { "rustfmt" },
} yaml = { "yamlfix" },
local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim" toml = { "taplo" },
vim.cmd.source(vimrc) css = { { "prettierd", "prettier" } },
local lsp_zero = require('lsp-zero') scss = { { "prettierd", "prettier" } },
},
lsp_zero.on_attach(function(client, bufnr) format_on_save = {
lsp_zero.default_keymaps({buffer = bufnr}) -- These options will be passed to conform.format()
end) timeout_ms = 500,
require('lspconfig').pyright.setup({ lsp_fallback = true,
virtual_text=false, },
}) })
end,
local config = { },
cmd = { {
-- "mfussenegger/nvim-lint",
"/usr/bin/java", -- Or the absolute path '/path/to/java11_or_newer/bin/java' event = {
"-Declipse.application=org.eclipse.jdt.ls.core.id1", "BufReadPre",
"-Dosgi.bundles.defaultStartLevel=4", "BufNewFile",
"-Declipse.product=org.eclipse.jdt.ls.core.product", },
"-Dlog.protocol=true", config = function()
"-Dlog.level=ALL", local lint = require("lint")
"-Xms1g",
"--add-modules=ALL-SYSTEM", lint.linters_by_ft = {
"--add-opens", javascript = { "eslint_d" },
"java.base/java.util=ALL-UNNAMED", typescript = { "eslint_d" },
"--add-opens", javascriptreact = { "eslint_d" },
"java.base/java.lang=ALL-UNNAMED", typescriptreact = { "eslint_d" },
-- svelte = { "eslint_d" },
"-jar", kotlin = { "ktlint" },
"/usr/local/Cellar/jdtls/1.32.0/libexec/plugins/org.eclipse.equinox.launcher_1.6.700.v20231214-2017.jar", terraform = { "tflint" },
"-configuration", "/usr/local/Cellar/jdtls/1.32.0/libexec/config_mac", ruby = { "standardrb" },
"-data", "/Users/zev/.local/share/nvim/java" }
},
settings = { local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
java = {
signatureHelp = {enabled = true}, vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
import = {enabled = true}, group = lint_augroup,
rename = {enabled = true} callback = function()
} lint.try_lint()
}, end,
init_options = { })
bundles = {}
} vim.keymap.set("n", "<leader>ll", function()
} lint.try_lint()
end, { desc = "Trigger linting for current file" })
end,
},
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/vim-vsnip" },
{ "L3MON4D3/LuaSnip" },
{ 'czheo/mojo.vim' },
{ "neoclide/coc.nvim", branch = "release" },
{
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
config = function()
require("nvim-surround").setup({})
end,
},
})
require("telescope").setup({
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
},
})
local vimrc = vim.fn.stdpath("config") .. "/vimrc.vim"
vim.cmd.source(vimrc)
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
["C-y"] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = "nvim_lsp" },
{ name = "buffer" },
},
})
local lsp_zero = require("lsp-zero")
lsp_zero.on_attach(function(client, bufnr)
lsp_zero.default_keymaps({ buffer = bufnr })
end)
require("lspconfig").pyright.setup({
virtual_text = false,
})
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
require("lspconfig").clangd.setup({
capabilities = capabilities,
})
vim.api.nvim_create_augroup("AutoFormat", {})
vim.api.nvim_create_autocmd(
"BufWritePost",
{
pattern = "*.py",
group = "AutoFormat",
callback = function()
vim.cmd("silent !black --line-length=120 --quiet %")
vim.cmd("edit")
end,
})
local function on_list(options)
vim.fn.setqflist({}, ' ', options)
vim.api.nvim_command('cfirst')
end
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', '<leader>d', function() vim.lsp.buf.definition{on_list=on_list} end, bufopts)
vim.keymap.set('n', '<leader>r', function() vim.lsp.buf.references(nil, {on_list=on_list}) end, bufopts)

View File

@@ -3,12 +3,32 @@ unbind C-b
set-option -g prefix ` set-option -g prefix `
bind-key ` send-prefix bind-key ` send-prefix
# List of plugins
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on' set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) set -g @continuum-save-interval '1'
run '~/.tmux/plugins/tpm/tpm'
run-shell ~/clone/path/resurrect.tmux
set -g mouse on
set -g pane-border-style fg=black
set-option -sg escape-time 10
set-option -g focus-events on
set-option -g default-terminal "screen-256color"
set-option -ga terminal-overrides ',xterm-256color:Tc'
set-option -g history-limit 30000
set-window-option -g aggressive-resize
setw -g mode-keys vi
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi v send -X begin-selection
bind P paste-buffer
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
# bind ctrl-C to escape
bind-key -n C-c send-keys Escape
run '~/.tmux/plugins/tpm/tpm'
# run-shell ~/clone/path/continuum.tmux

View File

@@ -1,5 +1,7 @@
set autoindent expandtab tabstop=4 shiftwidth=4 set autoindent expandtab tabstop=4 shiftwidth=4
set hidden set hidden
let g:python3_host_prog = '/usr/local/vitol/pyenv/versions/3.11.4/bin/python'
" When editing a file, always jump to the last known cursor position. " When editing a file, always jump to the last known cursor position.
autocmd BufReadPost * autocmd BufReadPost *
@@ -8,7 +10,6 @@ autocmd BufReadPost *
\ | endif \ | endif
nnoremap <silent> <C-s> :w<cr> nnoremap <silent> <C-s> :w<cr>
nnoremap <silent> <C-n> :noh<cr>
nnoremap <C-l> :bn<cr> nnoremap <C-l> :bn<cr>
nnoremap <C-h> :bp<cr> nnoremap <C-h> :bp<cr>
inoremap <silent> <C-S> <esc>:w<cr>i inoremap <silent> <C-S> <esc>:w<cr>i
@@ -16,30 +17,50 @@ let mapleader=" "
nnoremap <leader>w :w<cr>:bw<cr> nnoremap <leader>w :w<cr>:bw<cr>
nnoremap <silent> <leader>W :bw<cr> nnoremap <silent> <leader>W :bw<cr>
nnoremap <leader>v :e ~/.config/nvim/init.lua<cr> nnoremap <leader>v :e ~/.config/nvim/init.lua<cr>
nnoremap <leader>r :e ~/.config/nvim/vimrc.vim<cr> nnoremap <leader>m :e ~/.config/nvim/vimrc.vim<cr>
nnoremap <leader>t :e ~/.tmux.conf<cr>
nnoremap <silent> <leader>x :Sex<cr>
nnoremap <leader>s :source ~/.config/nvim/init.lua<cr> nnoremap <leader>s :source ~/.config/nvim/init.lua<cr>
nnoremap <leader>q :xa<cr> nnoremap <leader>q :xa<cr>
nnoremap <leader>f <cmd>Telescope find_files<cr> nnoremap <leader>f <cmd>Telescope find_files<cr>
nnoremap <leader>g <cmd>Telescope live_grep<cr> nnoremap <leader>g <cmd>Telescope live_grep<cr>
nnoremap <leader>b <cmd>Telescope buffers<cr> nnoremap <leader>b <cmd>Telescope buffers<cr>
nnoremap <leader>h <cmd>Telescope help_tags<cr> nnoremap <leader>h <cmd>Telescope help_tags<cr>
nnoremap <leader>l <cmd>Lazy<cr>
nmap <silent> <leader>j <Plug>(coc-diagnostic-prev) nmap <silent> <leader>j <Plug>(coc-diagnostic-prev)
nmap <silent> <leader>d <Plug>(coc-diagnostic-next) nmap <silent> <leader>d <Plug>(coc-diagnostic-next)
inoremap <expr><Tab> CheckBackspace() ? "\<Tab>" : "\<C-n>" function! s:c_cycle(count) abort
let qf_info = getqflist({ 'idx': 0, 'size': 0 })
let size = qf_info->get('size')
if size == 0
return
endif
let idx = qf_info->get('idx')
let num = (idx + size + a:count) % size
if num == 0
let num = size
endif
execute num .. 'cc'
endfunction
command! -nargs=1 CCycle call s:c_cycle(<q-args>)
nnoremap <expr> [n '<Cmd>CCycle -' .. v:count1 .. '<CR>'
nnoremap <expr> ]n '<Cmd>CCycle ' .. v:count1 .. '<CR>'
vnoremap <C-k> :m '<-2<CR>gv=gv vnoremap <C-k> :m '<-2<CR>gv=gv
vnoremap <C-j> :m '>+1<CR>gv=gv vnoremap <C-j> :m '>+1<CR>gv=gv
nnoremap <C-k> :m -2<CR> nnoremap <C-k> :m -2<CR>
nnoremap <C-j> :m +1<CR> nnoremap <C-j> :m +1<CR>
function! CheckBackspace() abort augroup tokyonight-night
let col = col('.') - 1 autocmd!
return !col || getline('.')[col - 1] =~# '\s' autocmd ColorScheme * highlight Normal guibg=NONE ctermbg=NONE
endfunction autocmd ColorScheme * highlight NonText guibg=NONE ctermbg=NONE
augroup END
colorscheme tokyonight-night colorscheme tokyonight-night
set background=dark
let g:LanguageClient_useVirtualText = 0 " disable inline errors let g:LanguageClient_useVirtualText = 0 " disable inline errors