update nvim config
This commit is contained in:
parent
522ee244af
commit
b2a4bdc5eb
35
.vimrc
Executable file
35
.vimrc
Executable file
@ -0,0 +1,35 @@
|
||||
syntax on
|
||||
set modelines=0
|
||||
set hidden
|
||||
set number
|
||||
set ruler
|
||||
set visualbell
|
||||
set textwidth=120
|
||||
set cursorline
|
||||
hi CursorLine term=bold cterm=bold ctermbg=darkgrey
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set matchpairs+=<:>
|
||||
set showmode
|
||||
set showcmd
|
||||
set showmatch
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set incsearch
|
||||
set wrapscan
|
||||
set scrolloff=999
|
||||
set backspace=indent,eol,start
|
||||
set mouse=nicr
|
||||
"Leader
|
||||
nnoremap <SPACE> <Nop>
|
||||
let mapleader=" "
|
||||
"mappings
|
||||
map <leader>h :set cursorline!<CR>
|
||||
"map <leader>c :!yarn copy-start<CR>
|
||||
"map <leader>b :!yarn build<CR>
|
||||
"map <leader>bs :!yarn build-start<CR>
|
||||
|
||||
xnoremap p "_dP
|
||||
nnoremap <esc><esc> :noh<return><esc>
|
||||
|
8
nvim/.netrwhist
Normal file
8
nvim/.netrwhist
Normal file
@ -0,0 +1,8 @@
|
||||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhistcnt =6
|
||||
let g:netrw_dirhist_6='/home/markus/.vim'
|
||||
let g:netrw_dirhist_5='/home/markus/dev/typescript/node-pos-erp-mapper/server/components/sap/fi'
|
||||
let g:netrw_dirhist_4='/home/markus/dev/typescript/node-pos-erp-mapper/server/components/sap'
|
||||
let g:netrw_dirhist_3='/home/markus/dev/typescript/node-pos-erp-mapper/server/components'
|
||||
let g:netrw_dirhist_2='/home/markus/dev/typescript/node-pos-erp-mapper/server'
|
||||
let g:netrw_dirhist_1='/home/markus/dev/typescript/node-pos-erp-mapper'
|
161
nvim/init.vim
Normal file
161
nvim/init.vim
Normal file
@ -0,0 +1,161 @@
|
||||
set runtimepath^=/.vim runtimepath+=~/.vim/after
|
||||
let &packpath = &runtimepath
|
||||
"syntax on
|
||||
set modelines=0
|
||||
set hidden
|
||||
set number
|
||||
set ruler
|
||||
set visualbell
|
||||
set textwidth=120
|
||||
set cursorline
|
||||
hi CursorLine term=bold cterm=bold ctermbg=darkgrey
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set matchpairs+=<:>
|
||||
set showmode
|
||||
set showcmd
|
||||
set showmatch
|
||||
set hlsearch
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set incsearch
|
||||
set wrapscan
|
||||
set scrolloff=999
|
||||
set backspace=indent,eol,start
|
||||
set mouse=nicr
|
||||
set termguicolors
|
||||
|
||||
call plug#begin(stdpath('data') . '/plugged')
|
||||
Plug 'junegunn/vim-easy-align'
|
||||
Plug 'morhetz/gruvbox'
|
||||
Plug 'junegunn/fzf', {'do': {->fzf#install()}}
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'gfanto/fzf-lsp.nvim'
|
||||
Plug 'nvim-lua/lsp-status.nvim'
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'machakann/vim-sandwich'
|
||||
Plug 'machakann/vim-highlightedyank'
|
||||
Plug 'bling/vim-airline'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'rhysd/vim-clang-format'
|
||||
Plug 'easymotion/vim-easymotion'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'kosayoda/nvim-lightbulb'
|
||||
Plug 'hrsh7th/cmp-nvim-lsp'
|
||||
Plug 'hrsh7th/cmp-buffer'
|
||||
Plug 'hrsh7th/cmp-path'
|
||||
Plug 'hrsh7th/cmp-cmdline'
|
||||
Plug 'hrsh7th/nvim-cmp'
|
||||
Plug 'saadparwaiz1/cmp_luasnip'
|
||||
Plug 'L3MON4D3/LuaSnip'
|
||||
Plug 'kyazdani42/nvim-web-devicons'
|
||||
Plug 'kyazdani42/nvim-tree.lua'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'mfussenegger/nvim-dap'
|
||||
Plug 'David-Kunz/jester'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
call plug#end()
|
||||
|
||||
autocmd vimenter * colorscheme gruvbox
|
||||
autocmd BufEnter *.60 :setlocal filetype=sixtyfps
|
||||
let g:clang_format#auto_format=0
|
||||
|
||||
set completeopt=menuone,noselect
|
||||
|
||||
"nvim-tree
|
||||
let g:nvim_tree_git_hl = 1 "0 by default, will enable file highlight for git attributes (can be used without the icons).
|
||||
let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories.
|
||||
let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options
|
||||
let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names
|
||||
let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font.
|
||||
let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target.
|
||||
let g:nvim_tree_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree.
|
||||
let g:nvim_tree_special_files = { 'README.md': 1, 'Makefile': 1, 'MAKEFILE': 1 } " List of filenames that gets highlighted with NvimTreeSpecialFile
|
||||
let g:nvim_tree_show_icons = {
|
||||
\ 'git': 1,
|
||||
\ 'folders': 1,
|
||||
\ 'files': 1,
|
||||
\ 'folder_arrows': 0,
|
||||
\ }
|
||||
"If 0, do not show the icons for one of 'git' 'folder' and 'files'
|
||||
"1 by default, notice that if 'files' is 1, it will only display
|
||||
"if nvim-web-devicons is installed and on your runtimepath.
|
||||
"if folder is 1, you can also tell folder_arrows 1 to show small arrows next to the folder icons.
|
||||
"but this will not work when you set indent_markers (because of UI conflict)
|
||||
|
||||
" default will show icon by default if no icon is provided
|
||||
" default shows no icon by default
|
||||
let g:nvim_tree_icons = {
|
||||
\ 'default': '',
|
||||
\ 'symlink': '',
|
||||
\ 'git': {
|
||||
\ 'unstaged': "✗",
|
||||
\ 'staged': "✓",
|
||||
\ 'unmerged': "",
|
||||
\ 'renamed': "➜",
|
||||
\ 'untracked': "★",
|
||||
\ 'deleted': "",
|
||||
\ 'ignored': "◌"
|
||||
\ },
|
||||
\ 'folder': {
|
||||
\ 'arrow_open': "",
|
||||
\ 'arrow_closed': "",
|
||||
\ 'default': "",
|
||||
\ 'open': "",
|
||||
\ 'empty': "",
|
||||
\ 'empty_open': "",
|
||||
\ 'symlink': "",
|
||||
\ 'symlink_open': "",
|
||||
\ }
|
||||
\ }
|
||||
|
||||
" a list of groups can be found at `:help nvim_tree_highlight`
|
||||
highlight NvimTreeFolderIcon guibg=blue
|
||||
|
||||
lua require('nvimtree')
|
||||
lua require('lsp_config')
|
||||
lua require('treesitter_config')
|
||||
lua require('dap_config')
|
||||
lua require('jester')
|
||||
|
||||
"Leader
|
||||
nnoremap <SPACE> <Nop>
|
||||
let mapleader=" "
|
||||
"mappings
|
||||
map <leader>h :set cursorline!<CR>
|
||||
"map <leader>c :!yarn copy-start<CR>
|
||||
"map <leader>b :!yarn build<CR>
|
||||
"map <leader>bs :!yarn build-start<CR>
|
||||
|
||||
nnoremap <C-n> :NvimTreeToggle<CR>
|
||||
nnoremap <leader>r :NvimTreeRefresh<CR>
|
||||
nnoremap <leader>n :NvimTreeFindFile<CR>
|
||||
" NvimTreeOpen, NvimTreeClose, NvimTreeFocus, NvimTreeFindFileToggle, and NvimTreeResize are also available if you need them
|
||||
xnoremap p "_dP
|
||||
nnoremap <esc><esc> :noh<return><esc>
|
||||
map <leader>f :FZF<CR>
|
||||
map <leader>F :Rg<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.declaration()<cr>
|
||||
nnoremap <leader>gr <cmd>lua vim.lsp.buf.references()<cr>
|
||||
nnoremap <leader>rn <cmd>lua vim.lsp.buf.rename()<cr>
|
||||
nnoremap <leader>K <cmd>lua vim.lsp.buf.hover()<cr>
|
||||
|
||||
nnoremap <leader>J <cmd>lua vim.diagnostic.open_float()<cr>
|
||||
nnoremap <M-F> <cmd>lua vim.lsp.buf.formatting()<cr>
|
||||
inoremap <c-s> <cmd>lua vim.lsp.buf.signature_help()<cr>
|
||||
|
||||
nnoremap <F9> <cmd>lua require'dap'.toggle_breakpoint()<cr>
|
||||
nnoremap <F5> <cmd>lua require'dap'.continue()<cr>
|
||||
nnoremap <F10> <cmd>lua require'dap'.step_over()<cr>
|
||||
nnoremap <F11> <cmd>lua require'dap'.step_into()<cr>
|
||||
|
||||
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 JestRunFile :lua require'jester'.run_file({cmd = "yarn run test -t '$result' -- $file"})
|
||||
command JestRunLast :lua require'jester'.run_last({cmd = "yarn run test -t '$result' -- $file"})
|
||||
command JestDebug :lua require'jester'.debug({cmd = "yarn run test -t '$result' -- $file"})
|
||||
command JestDebugFile :lua require'jester'.debug_file({cmd = "yarn run test -t '$result' -- $file"})
|
||||
command JestDebugLast :lua require'jester'.debug_last({cmd = "yarn run test -t '$result' -- $file"})
|
0
nvim/lua/dap_config.lua
Normal file
0
nvim/lua/dap_config.lua
Normal file
22
nvim/lua/jester.lua
Normal file
22
nvim/lua/jester.lua
Normal file
@ -0,0 +1,22 @@
|
||||
require'jester'.setup({
|
||||
cmd = "yarn run test -t '$result' -- $file", -- run command
|
||||
identifiers = {"test", "it"}, -- used to identify tests
|
||||
prepend = {"describe"}, -- prepend describe blocks
|
||||
expressions = {"call_expression"}, -- tree-sitter object used to scan for tests/describe blocks
|
||||
path_to_jest_run = './node_modules/jest/bin/jest', -- used to run tests
|
||||
path_to_jest_debug = './node_modules/jest/bin/jest', -- used for debugging
|
||||
terminal_cmd = ":vsplit | terminal", -- used to spawn a terminal for running tests, for debugging refer to nvim-dap's config
|
||||
dap = { -- debug adapter configuration
|
||||
type = 'node2',
|
||||
request = 'launch',
|
||||
cwd = vim.fn.getcwd(),
|
||||
runtimeArgs = {'--inspect-brk', '$path_to_jest', '--no-coverage', '-t', '$result', '--', '$file'},
|
||||
args = { '--no-cache' },
|
||||
sourceMaps = 'inline',
|
||||
protocol = 'inspector',
|
||||
skipFiles = {'<node_internals>/**/*.js'},
|
||||
console = 'integratedTerminal',
|
||||
port = 9229,
|
||||
disableOptimisticBPs = true
|
||||
}
|
||||
})
|
89
nvim/lua/lsp_config.lua
Normal file
89
nvim/lua/lsp_config.lua
Normal file
@ -0,0 +1,89 @@
|
||||
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local capabilites = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require'lspconfig'.tsserver.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.dockerls.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.eslint.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.gdscript.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.gopls.setup{
|
||||
capabilites = capabilites
|
||||
}
|
||||
require'lspconfig'.rust_analyzer.setup{
|
||||
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()
|
||||
|
66
nvim/lua/nvimtree.lua
Normal file
66
nvim/lua/nvimtree.lua
Normal file
@ -0,0 +1,66 @@
|
||||
require'nvim-tree'.setup {
|
||||
renderer ={
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
icons = {
|
||||
corner = "└ ",
|
||||
edge = "│ ",
|
||||
none = " ",
|
||||
}
|
||||
}
|
||||
},
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
}
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
ignore_list = {}
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {}
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {}
|
||||
},
|
||||
git={
|
||||
ignore = false,
|
||||
enable= true,
|
||||
timeout=500,
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
exclude = {
|
||||
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
|
||||
buftype = { "nofile","terminal","help" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
view = {
|
||||
width = 25,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = 'left',
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {}
|
||||
}
|
||||
}
|
||||
}
|
25
nvim/lua/treesitter_config.lua
Normal file
25
nvim/lua/treesitter_config.lua
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ensure_installed = "all",
|
||||
|
||||
-- Install languages synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- List of parsers to ignore installing
|
||||
ignore_install = { },
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- list of language that will be disabled
|
||||
disable = { },
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user