1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-16 22:41:15 +02:00

nvim: imported nvim from master branch

This commit is contained in:
TiynGer
2023-08-08 00:17:46 +02:00
parent 879dfa8d5e
commit 07dfe4ec7d
23 changed files with 1308 additions and 162 deletions

View File

@@ -0,0 +1,117 @@
-- autocmd
-- read files correctly
vim.filetype.add({
extension = {
c = 'c',
h = 'c',
html = 'html',
java = 'java',
js = 'javascript',
lua = 'lua',
md = 'markdown',
nim = 'nim',
py = 'python',
tex = 'tex',
}
})
-- settings for filetype: c
vim.api.nvim_create_autocmd({ 'VimLeave' },
{
pattern = { 'c' },
command = '!cclear'
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'c' },
command = 'set colorcolumn=80'
})
-- settings for filetype: java
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'java' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'java' },
command = 'set colorcolumn=100'
})
-- settings for filetype: javascript
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'javascript' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
-- settings for filetype: lua
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'lua' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'lua' },
command = 'set colorcolumn=100'
})
-- settings for filetype: markdown
vim.api.nvim_create_autocmd({ 'FileType' },
{
pattern = { 'markdown' },
command = 'setlocal shiftwidth=2 softtabstop=2',
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'markdown' },
command = 'set colorcolumn=100'
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'markdown' },
command = 'set conceallevel=2'
})
-- settings for filetype: nim
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'nim' },
command = 'set colorcolumn=80'
})
-- settings for filetype: python
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'python' },
command = 'set colorcolumn=80'
})
-- settings for filetype: tex
vim.api.nvim_create_autocmd({ 'VimLeave' },
{
pattern = { 'tex' },
command = '!texclear %'
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
{
pattern = { 'tex' },
command = 'set colorcolumn=80'
})

View File

@@ -0,0 +1,84 @@
-- keymap
-- set mapleader for hotkeys
vim.g.mapleader = ","
-- unmap unwanted commands
vim.api.nvim_set_keymap('n', '<F1>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F9>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F10>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F11>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F12>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F2>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F3>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F4>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F5>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F6>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F7>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F8>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F9>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F10>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F11>', '<NOP>', { noremap = true })
vim.api.nvim_set_keymap('i', '<F12>', '<NOP>', { noremap = true })
-- shortcut for split navigation
vim.api.nvim_set_keymap('n', '<C-h>', '<C-w>h', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-j>', '<C-w>j', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-k>', '<C-w>k', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-l>', '<C-w>l', { noremap = true })
-- mapping Dictionaries
vim.api.nvim_set_keymap('n', '<F6>', ':setlocal spell! spelllang=de_de<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F7>', ':setlocal spell! spelllang=en_us<CR>', { noremap = true })
-- compiler for languages
vim.api.nvim_set_keymap('n', '<leader>c', ':w! | !compiler <c-r>%<CR>', { noremap = true })
-- save file as sudo on files that require root permission
vim.api.nvim_set_keymap('c', 'w!!', '"silent! write !sudo tee % >/dev/null" <bar> edit!', { noremap = true })
-- alias for replacing
vim.api.nvim_set_keymap('n', '<leader>ss', ':%s//gI<Left><Left><Left>', { noremap = true })
-- irc compatibility for interactivity
vim.api.nvim_set_keymap('n', '<leader>is', ':.w >> in<cr>dd', { noremap = true })
-- open corresponding file (pdf/html/...,md)
vim.api.nvim_set_keymap('n', '<leader>p', ':!opout <c-r>%<CR><CR>', { noremap = true })
-- iamcco/markdown-preview.nvim
vim.api.nvim_create_autocmd('FileType', {
pattern = 'markdown',
callback = function()
vim.api.nvim_set_keymap('n', '<leader>p', ':MarkdownPreviewToggle<CR>', { noremap = true })
end,
})
-- SmiteshP/nvim-navbuddy
vim.api.nvim_set_keymap('n', '<F3>', ':Navbuddy<CR>', {})
-- nvim-tree/nvim-tree.lua
vim.api.nvim_set_keymap('n', '<F2>', ':NvimTreeToggle toggle<CR>', {})
-- tpope/vim-fugitive
vim.api.nvim_set_keymap('n', '<leader>ga', ':Git add %:p<CR><CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gd', ':Git diff<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gc', ':Git commit<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gh', ':diffget //3<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gr', ':Gread<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gu', ':diffget //2<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>gs', ':G<CR>', { noremap = true })
-- hrsh7th/nvim-cmp
vim.api.nvim_set_keymap('n', 'gD', ':lua vim.lsp.buf.declaration()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gd', ':lua vim.lsp.buf.definition()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gy', ':lua vim.lsp.buf.type_definition()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gi', ':lua vim.lsp.buf.implementation()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F5>', ':lua vim.lsp.buf.rename()<CR>', { noremap = true })
vim.api.nvim_set_keymap('n', '<F8>', ':lua vim.lsp.buf.format()<CR>', { noremap = true })
-- nvim-telescope/telescope.nvim
vim.api.nvim_set_keymap('n', '<F4>', ':Telescope find_files<CR>', { noremap = true })

View File

@@ -0,0 +1,169 @@
-- loadplugins
-- bootstrap lazy
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
return require("lazy").setup({
-- indicate git diff status of line
'lewis6991/gitsigns.nvim',
-- show indentation lines (in empty lines too)
'lukas-reineke/indent-blankline.nvim',
-- improved java syntax highlighting
{
'uiiaoo/java-syntax.vim',
ft = { 'java' },
},
-- custom statusline
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', }
},
-- show signature while typing
'ray-x/lsp_signature.nvim',
-- preview for markdown filetypes
{
"iamcco/markdown-preview.nvim",
ft = { 'markdown' },
build = "cd app && yarn install",
},
-- latex asynchronous pdf rendering
{
'donRaphaco/neotex',
ft = { 'tex' },
},
-- nim language support
{
'zah/nim.vim',
ft = { 'nim' },
},
-- automatic closing of brackets
'windwp/nvim-autopairs',
-- autocompletion and its sources
{
'hrsh7th/nvim-cmp',
dependencies = { 'hrsh7th/cmp-buffer',
-- standalone cmp sources
'hrsh7th/cmp-path',
'lukas-reineke/cmp-under-comparator',
-- lsp cmp source
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
'onsails/lspkind-nvim',
-- luasnip cmp source
'l3mon4d3/luasnip',
'saadparwaiz1/cmp_luasnip',
-- lang server management
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'jose-elias-alvarez/null-ls.nvim',
'LostNeophyte/null-ls-embedded',
'jay-babu/mason-null-ls.nvim',
-- dependencies
'nvim-lua/plenary.nvim',
},
},
-- fix for cursorhold function
'antoinemadec/fixcursorhold.nvim',
-- showing color of hex values, etc
'norcalli/nvim-colorizer.lua',
-- show tags
{
"SmiteshP/nvim-navbuddy",
dependencies = {
"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
},
},
-- fileexplorer on the side
{
"nvim-tree/nvim-tree.lua",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
},
-- better language highlighting by improved parsing
'nvim-treesitter/nvim-treesitter',
-- automatically close html-tags
{
'windwp/nvim-ts-autotag',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
},
-- folding improvements
{
'kevinhwang91/nvim-ufo',
dependencies = { 'kevinhwang91/promise-async' },
},
-- colorful brackets
'luochen1990/rainbow',
-- fuzzy finder
{
'nvim-telescope/telescope.nvim',
version = '0.1.2',
dependencies = { 'nvim-lua/plenary.nvim' },
},
-- clean up white spaces and empty lines before writing
"mcauley-penney/tidy.nvim",
-- todo symbols and highlighting
{
'folke/todo-comments.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
},
-- git wrapper
'tpope/vim-fugitive',
-- golang language support
{
'fatih/vim-go',
ft = { 'go' },
},
-- markdown language support
{
'preservim/vim-markdown',
ft = { 'markdown' },
dependencies = { 'godlygeek/tabular' },
},
-- bulk renamer
'qpkorr/vim-renamer',
-- additional quote/parantheses funtions
'tpope/vim-surround',
-- colorscheme
'tiyn/vim-tccs',
})