some stuff

This commit is contained in:
max_richter 2021-11-17 14:04:03 +01:00
parent 4fb9a7aaf4
commit abbbab08e5
16 changed files with 480 additions and 387 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.pnpm-debug.log

View File

@ -1,14 +0,0 @@
{
"0 debug pnpm:scope": {
"selected": 1
},
"1 error pnpm": {
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
"err": {
"name": "pnpm",
"message": "No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles\".",
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
"stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles\".\n at readProjectManifest (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40641:13)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40645:28)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40864:24)\n at async Object.handler (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:129763:24)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133951:20\n at async run (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133926:34)\n at async runPnpm (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134137:5)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134129:7"
}
}
}

View File

@ -0,0 +1,46 @@
require "format".setup {
["*"] = {
{cmd = {"sed -i 's/[ \t]*$//'"}} -- remove trailing whitespace
},
vim = {
{
cmd = {"luafmt -w replace"},
start_pattern = "^lua << EOF$",
end_pattern = "^EOF$"
}
},
vimwiki = {
{
cmd = {"prettier -w --parser babel"},
start_pattern = "^{{{javascript$",
end_pattern = "^}}}$"
}
},
lua = {
{
cmd = {
function(file)
return string.format("luafmt -l %s -w replace %s", vim.bo.textwidth, file)
end
}
}
},
go = {
{
cmd = {"gofmt -w", "goimports -w"},
tempfile_postfix = ".tmp"
}
},
javascript = {
{cmd = {"prettier -w", "./node_modules/.bin/eslint --fix"}}
},
markdown = {
{cmd = {"prettier -w"}},
{
cmd = {"black"},
start_pattern = "^```python$",
end_pattern = "^```$",
target = "current"
}
}
}

1
configs/nvim/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
plugin

View File

@ -10,22 +10,36 @@ local opt = vim.opt
require ("plugins") require ("plugins")
if u.has_plugin("cmp") then if u.has_plugin("cmp") then
vim.g.did_load_filetypes = 1
-- Global options -- Global options
o.number = true -- show line number o.number = true -- show line number
o.tabstop = 2
o.shiftwidth = 2 -- Indents will have a width of 4
o.softtabstop = 2 -- Sets the number of columns for a TAB
o.expandtab = true -- Dont expand TABs to spaces
o.autoindent = true
o.showmatch = true -- show matching brackets o.showmatch = true -- show matching brackets
o.swapfile = false o.swapfile = false
o.autoread = true -- Indentation options
vim.cmd [[
set autoindent
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
]]
o.lazyredraw = true -- Debug indentations
if false then
vim.cmd [[
set list
set listchars=eol:,tab:->,trail:_,nbsp:
]]
end
g.hidden = true --unload buffers when hidden g.hidden = true --unload buffers when hidden
g.filetype = true -- execute autocommands based on filetype g.filetype = true -- execute autocommands based on filetype
o.autoread = true
o.lazyredraw = true
-- Search -- Search
o.inccommand = 'nosplit' -- show substitutions incrementally o.inccommand = 'nosplit' -- show substitutions incrementally
@ -53,8 +67,13 @@ if u.has_plugin("cmp") then
cmd [[set undofile]] cmd [[set undofile]]
cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines
cmd [[command Format :lua vim.lsp.buf.formatting()]]
cmd [[command FormatSync :lua vim.lsp.buf.formatting_sync()]]
cmd [[set noshowmode]] --to get rid of thing like --INSERT-- cmd [[set noshowmode]] --to get rid of thing like --INSERT--
cmd [[set noshowcmd]] --to get rid of display of last command cmd [[set noshowcmd]] --to get rid of display of last command
cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar
cmd [[set noruler]] cmd [[set noruler]]
g.ale_fixers = {"prettier", "eslint"} g.ale_fixers = {"prettier", "eslint"}
@ -65,6 +84,7 @@ if u.has_plugin("cmp") then
cmd("colorscheme material") cmd("colorscheme material")
g.material_terminal_italics = 1 g.material_terminal_italics = 1
g.material_theme_style = "darker" g.material_theme_style = "darker"
-- Remove background color -- Remove background color
require("transparent").setup({enable = true}) require("transparent").setup({enable = true})
cmd("highlight Normal guibg=none") cmd("highlight Normal guibg=none")
@ -150,7 +170,13 @@ if u.has_plugin("cmp") then
-- Treesitter config -- Treesitter config
require "treesitter-conf" require "treesitter-conf"
-- Toggleterm / Lazygit setup -- Autocompletion Setup
o.completeopt = "menuone,noselect,noinsert"
require "autocomplete"
require "snippets"
-- LSP Config
require "lspinstaller-conf"
require "lazy-git" require "lazy-git"
require "autocommands" require "autocommands"

View File

@ -1,14 +0,0 @@
{
"0 debug pnpm:scope": {
"selected": 1
},
"1 error pnpm": {
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
"err": {
"name": "pnpm",
"message": "No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles/configs/nvim/lua\".",
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
"stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles/configs/nvim/lua\".\n at readProjectManifest (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40641:13)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40645:28)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40864:24)\n at async Object.handler (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:129763:24)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133951:20\n at async run (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133926:34)\n at async runPnpm (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134137:5)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134129:7"
}
}
}

View File

@ -3,7 +3,7 @@ local cmd = vim.cmd;
cmd [[ cmd [[
augroup auto_format augroup auto_format
au! au!
au BufWritePre * silent! lua vim.lsp.buf.formatting_sync(nil, 300)<CR> au BufWritePre * silent! FormatSync<CR>
augroup END augroup END
augroup highlight_yank augroup highlight_yank

View File

@ -5,15 +5,11 @@ local cmd = vim.cmd;
local options = {noremap = true} local options = {noremap = true}
local remap = {noremap = false} local remap = {noremap = false}
--map("n", "<Space>", "<Nop>", remap)
--map("n", " ", "<Nop>", remap)
g.mapleader = " " g.mapleader = " "
map("n", "<C-p>", ":Telescope find_files<CR>", options) map("n", "<C-p>", ":Telescope find_files<CR>", options)
--map("n", "<C-f>", ":Telescope grep_string<CR>", options)
map("n", "<C-f>", ":Telescope live_grep<CR>", options) map("n", "<C-f>", ":Telescope live_grep<CR>", options)
-- LSP Functionality -- LSP Functionality
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options) map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options) map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
@ -23,7 +19,7 @@ map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", options)
map("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", options) map("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", options)
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options) map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
map("n", "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", options) map("n", "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", options)
map("n", "<Leader><C-f>", "<cmd>lua vim.lsp.buf.formatting()<CR>", options) map("n", "<Leader><C-f>", ":Format<CR>", options)
map("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", options) map("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", options)
map("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", options) map("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", options)
@ -69,6 +65,3 @@ map("i", "<C-s>", "<Esc>:w<CR>i", options)
-- Update vim config -- Update vim config
map("n", "<C-u>", "<Esc>:source $MYVIMRC<CR>", options) map("n", "<C-u>", "<Esc>:source $MYVIMRC<CR>", options)
-- Y yank until the end of line
map("n", "Y", "y$", {noremap = true})

View File

@ -18,10 +18,8 @@ local function on_attach(client)
-- Set some keybinds conditional on server capabilities -- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then if client.resolved_capabilities.document_formatting then
vim.cmd [[command Format :lua vim.lsp.buf.formatting()<CR>]]
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then elseif client.resolved_capabilities.document_range_formatting then
vim.cmd [[command Format :lua vim.lsp.buf.range_formatting()<CR>]]
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end end

View File

@ -6,6 +6,9 @@ return require("packer").startup(function()
-- General Helper Functions -- General Helper Functions
use "nvim-lua/plenary.nvim" use "nvim-lua/plenary.nvim"
-- Faster Filetype Detection
use "nathom/filetype.nvim"
use "alexghergh/nvim-tmux-navigation" use "alexghergh/nvim-tmux-navigation"
-- Theming Section -- Theming Section
@ -17,10 +20,12 @@ return require("packer").startup(function()
use "kyazdani42/nvim-tree.lua" use "kyazdani42/nvim-tree.lua"
use "nvim-lua/popup.nvim" use "nvim-lua/popup.nvim"
use "mhinz/vim-startify" use "mhinz/vim-startify"
use "lukas-reineke/indent-blankline.nvim" --use "lukas-reineke/indent-blankline.nvim"
use "karb94/neoscroll.nvim" use "karb94/neoscroll.nvim"
use "tpope/vim-fugitive" use "tpope/vim-fugitive"
use "tpope/vim-surround"
use "editorconfig/editorconfig-vim"
-- Code Navigation -- Code Navigation
use "dense-analysis/ale" use "dense-analysis/ale"
@ -35,14 +40,20 @@ return require("packer").startup(function()
-- use "lervag/wiki.vim" -- use "lervag/wiki.vim"
-- Syntax / Autocomplete -- Syntax / Autocomplete
use "preservim/nerdcommenter"
use "neovim/nvim-lspconfig" use "neovim/nvim-lspconfig"
use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim"
use "hrsh7th/nvim-cmp" use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-nvim-lsp" use "hrsh7th/cmp-nvim-lsp"
use "hrsh7th/cmp-path" use "hrsh7th/cmp-path"
use "weilbith/nvim-code-action-menu" -- Need to find better alternative use "hrsh7th/cmp-buffer"
use "hrsh7th/cmp-cmdline"
use "L3MON4D3/LuaSnip"
use "saadparwaiz1/cmp_luasnip"
use "rafamadriz/friendly-snippets"
use "tpope/vim-commentary"
use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim"
use "L3MON4D3/LuaSnip" use "L3MON4D3/LuaSnip"
use "windwp/nvim-autopairs" use "windwp/nvim-autopairs"
use "neoclide/jsonc.vim" use "neoclide/jsonc.vim"
@ -56,6 +67,7 @@ return require("packer").startup(function()
-- Autoformat -- Autoformat
--use "sbdchd/neoformat" --use "sbdchd/neoformat"
-- use "lukas-reineke/format.nvim"
-- General Popup Window -- General Popup Window
use "akinsho/nvim-toggleterm.lua" use "akinsho/nvim-toggleterm.lua"

View File

@ -0,0 +1,45 @@
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local types = require("luasnip.util.types")
-- Every unspecified option will be set to the default.
ls.config.set_config({
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI",
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "choiceNode", "Comment" } },
},
},
},
-- treesitter-hl has 100, use something higher (default is 200).
ext_base_prio = 300,
-- minimal increase in priority.
ext_prio_increase = 1,
enable_autosnippets = true,
})
ls.snippets = {
all = {
},
svelte = {
s("slt", {
t('<script lang="ts">'),
i(0),
t('</script>'),
}),
}
}

View File

@ -22,5 +22,3 @@ local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
}, },
highlight = {enable = true} highlight = {enable = true}
} }

View File

@ -27,6 +27,7 @@ alias D="pnpm dev"
alias B="pnpm build" alias B="pnpm build"
alias T="pnpm test" alias T="pnpm test"
alias P="git push" alias P="git push"
alias p="git pull"
alias lt="tree -L 2 --filelimit 150 --dirsfirst" alias lt="tree -L 2 --filelimit 150 --dirsfirst"