summaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
authornavewindre <boneyaard@gmail.com>2024-09-11 18:10:13 +0200
committernavewindre <boneyaard@gmail.com>2024-09-11 18:10:13 +0200
commit10de9e37c33ac82ab4fdbfe33b7405cf4c84c5c9 (patch)
tree88adecd909236042ed0c111f412180b6e6655097 /vimrc
parentce15124bb35606c219df336fdb162bed2772303b (diff)
v2
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc379
1 files changed, 247 insertions, 132 deletions
diff --git a/vimrc b/vimrc
index 0259cbe..1909822 100644
--- a/vimrc
+++ b/vimrc
@@ -1,109 +1,54 @@
set autoindent expandtab tabstop=2 shiftwidth=2 number
set mouse=a
+set mousemodel=popup
set noshowmode
set termguicolors
set title
set smartcase
+set showtabline=2
+set nocompatible
filetype plugin on
-let g:lightline = {
- \ 'colorscheme': 'landscape',
- \ }
-
-call plug#begin()
-
-Plug 'chriskempson/base16-vim'
-Plug 'neovim/nvim-lspconfig'
-Plug 'hrsh7th/cmp-nvim-lsp'
-Plug 'hrsh7th/cmp-buffer'
-Plug 'hrsh7th/cmp-path'
-Plug 'hrsh7th/cmp-cmdline'
-Plug 'hrsh7th/nvim-cmp'
-Plug 'itchyny/lightline.vim'
-Plug 'shawnohare/hadalized.nvim'
-Plug 'preservim/nerdtree'
-Plug 'bignimbus/pop-punk.vim'
-Plug 'romgrk/barbar.nvim'
-Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
-Plug 'nvim-lua/plenary.nvim'
-Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.8' }
-Plug 'hrsh7th/cmp-vsnip'
-Plug 'hrsh7th/vim-vsnip'
-Plug 'TabbyML/vim-tabby'
-Plug 'Yggdroot/indentLine'
-Plug 'johnfrankmorgan/whitespace.nvim'
-
-let g:tabby_keybinding_accept = '<Tab>'
-
-call plug#end()
-
-function! SW()
- if winnr('$') > 1
- wincmd w
- else
- BufferNext
- endif
-endfunction
-
-function! Q()
- if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1
- NERDTreeClose
- else
- if winnr('$') > 1
- q
- else
- let buffers = filter(range(1, bufnr('$')), 'buflisted(v:val)')
- if len(buffers) > 1
- BufferClose
- else
- call feedkeys(':q')
- endif
- endif
- endif
-endfunction
-
-nnoremap <C-e> :NERDTree<CR>
-inoremap <C-e> <Esc>:NERDTree<CR>
-vnoremap <C-e> <Esc>:NERDTree<CR>
-
-nnoremap <Esc> :call Q()<CR>
-nnoremap <Tab> :call SW()<CR>
-nnoremap <C-Tab> :BufferNext<CR>
-
-nnoremap <F1> :BufferPick<CR>
-inoremap <F1> <ESC>:BufferPick<CR>
-vnoremap <F1> <ESC>:BufferPick<CR>
-
-nnoremap <F2> :Telescope live_grep<CR>
-nnoremap <C-f> :Telescope current_buffer_fuzzy_find<CR>
-
-nnoremap <F4> :lua ToggleDiagnostics()<CR>
-
-vnoremap <Tab> >gv
-nnoremap <S-Tab> <gv
-inoremap <S-Tab> <C-d>
-vnoremap <S-Tab> <gv
-
-colorscheme base16-synth-midnight-dark
-highlight LineNr guibg=#000000
-highlight Identifier ctermfg=1 guifg=#06ea61
-highlight String ctermfg=1 guifg=#ea5971
-highlight Character ctermfg=1 guifg=#dddddd
-highlight CmpItemKindDefault guifg=#7cede9 guibg=#222222
-highlight Variable guifg=#00FF00 ctermfg=Green
-highlight javaScriptIdentifier guifg=#ff40ff ctermfg=Blue
-highlight Delimiter ctermfg=14 guifg=#f77440
-let g:vim_json_conceal=0
-let g:markdown_syntax_conceal=0
-let g:indentLine_color_term=239
-let g:indentLine_color_gui='#141414'
-
-let NERDTreeQuitOnOpen=1
-
lua <<EOF
+ local Plug = vim.fn['plug#'];
+ vim.call('plug#begin');
+
+ Plug('chriskempson/base16-vim')
+ Plug('neovim/nvim-lspconfig')
+ Plug('hrsh7th/cmp-nvim-lsp')
+ Plug('hrsh7th/cmp-buffer')
+ Plug('hrsh7th/cmp-path')
+ Plug('hrsh7th/cmp-cmdline')
+ Plug('hrsh7th/nvim-cmp')
+ Plug('itchyny/lightline.vim')
+ Plug('shawnohare/hadalized.nvim')
+ Plug('preservim/nerdtree')
+ Plug('bignimbus/pop-punk.vim')
+ Plug('nvim-treesitter/nvim-treesitter', { ['do'] = ':TSUpdate' })
+ Plug('nvim-lua/plenary.nvim')
+ Plug('nvim-telescope/telescope.nvim', { tag = '0.1.8' })
+ Plug('hrsh7th/cmp-vsnip')
+ Plug('hrsh7th/vim-vsnip')
+ Plug('TabbyML/vim-tabby')
+ Plug('Yggdroot/indentLine')
+ Plug('johnfrankmorgan/whitespace.nvim')
+ Plug('sheerun/vim-polyglot')
+ Plug('dense-analysis/ale')
+ Plug('stevearc/dressing.nvim')
+ Plug('nvim-lua/plenary.nvim')
+ Plug('MunifTanjim/nui.nvim')
+ Plug('MeanderingProgrammer/render-markdown.nvim')
+ Plug('nvim-tree/nvim-web-devicons')
+ Plug('HakonHarnes/img-clip.nvim')
+ Plug('jcdickinson/wpm.nvim')
+
+ Plug('yetone/avante.nvim', { ['branch'] = 'main', ['do'] = function() require('avante.api').build() end } )
+ vim.call('plug#end');
+
-- Set up nvim-cmp.
local cmp = require'cmp'
+ vim.opt.updatetime = 500
local diagnostics_enabled = true
function ToggleDiagnostics()
diagnostics_enabled = not diagnostics_enabled
@@ -165,15 +110,20 @@ lua <<EOF
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
- cmp.setup.cmdline(':', {
+ cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
- })
+ })
+ require("wpm").setup({
+ sample_count = 8,
+ sample_interval = 750,
+ percentile = 1
+ })
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
@@ -182,10 +132,10 @@ lua <<EOF
capabilities = capabilities
}
- require('lspconfig')['tsserver'].setup {
+ require('lspconfig')['ts_ls'].setup {
capabilities = capabilities
}
-
+
require('lspconfig')['intelephense'].setup {
capabilities = capabilities
}
@@ -194,17 +144,6 @@ lua <<EOF
capabilities = capabilities
}
- require('barbar').setup {
- animation = false,
- icons = {
- filetype = {
- enabled = false
- }
- },
- minimum_padding = 1,
- maximum_padding = 1,
- }
-
vim.diagnostic.config({
signs = false
})
@@ -217,29 +156,16 @@ lua <<EOF
})
require'nvim-treesitter.configs'.setup {
- -- A list of parser names, or "all" (the listed parsers MUST always be installed)
- ensure_installed = { "c", "cpp", "javascript", "lua", "vim", "vimdoc", "java", "query", "markdown", "markdown_inline" },
-
- -- Install parsers synchronously (only applied to `ensure_installed`)
+ ensure_installed = { "c", "cpp", "javascript", "html", "lua", "vim", "vimdoc", "java", "sql", "query", "markdown", "markdown_inline" },
sync_install = false,
-
- -- Automatically install missing parsers when entering buffer
- -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
+ textobjects = { enable = true },
+ injections = {
+ enable = true,
+ },
auto_install = true,
-
- -- List of parsers to ignore installing (or "all")
-
- ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
-
highlight = {
enable = true,
-
- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
- -- the name of the parser)
- -- list of language that will be disabled
- -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
@@ -248,13 +174,202 @@ lua <<EOF
end
end,
- -- 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,
},
+ query_linter = {
+ enable = true,
+ lint_events = {"BufWrite", "CursorHold"},
+ },
+ }
+
+ require('img-clip').setup( {
+ -- recommended settings
+ default = {
+ embed_image_as_base64 = false,
+ prompt_for_file_name = false,
+ drag_and_drop = {
+ insert_mode = true,
+ },
+ },
+ } )
+
+ require('render-markdown').setup {
+ file_types = { "markdown", "Avante" },
+ enable = true,
}
-
+ require('avante_lib').load()
+ require('avante').setup({
+ mappings = {
+ --- @class AvanteConflictMappings
+ diff = {
+ ours = "co",
+ theirs = "ct",
+ all_theirs = "ca",
+ both = "cb",
+ cursor = "cc",
+ next = "]x",
+ prev = "[x",
+ },
+ suggestion = {
+ accept = "<M-l>",
+ next = "<M-]>",
+ prev = "<M-[>",
+ dismiss = "<C-]>",
+ },
+ jump = {
+ next = "]]",
+ prev = "[[",
+ },
+ submit = {
+ normal = "<CR>",
+ insert = "<C-s>",
+ },
+ },
+ provider = "ollama",
+ vendors = {
+ ---@type AvanteProvider
+ ollama = {
+ ["local"] = true,
+ endpoint = "127.0.0.1:11434/v1",
+ model = "llama3.1:8b-instruct-q5_K_M",
+ parse_curl_args = function(opts, code_opts)
+ return {
+ url = opts.endpoint .. "/chat/completions",
+ headers = {
+ ["Accept"] = "application/json",
+ ["Content-Type"] = "application/json",
+ },
+ body = {
+ model = opts.model,
+ messages = require("avante.providers").copilot.parse_message(code_opts), -- you can make your own message, but this is very advanced
+ max_tokens = 8192,
+ stream = true,
+ },
+ }
+ end,
+ parse_response_data = function(data_stream, event_state, opts)
+ require("avante.providers").openai.parse_response(data_stream, event_state, opts)
+ end,
+ },
+ },
+
+ })
EOF
+
+let g:lightline = {
+ \ 'colorscheme': 'landscape',
+ \ 'active': {
+ \ 'left': [ [ 'mode', 'paste' ],
+ \ [ 'readonly', 'filename', 'modified' ] ],
+ \ 'right': [ [ 'lineinfo' ],
+ \ [ 'percent' ],
+ \ [ 'fileformat', 'fileencoding', 'filetype', 'wpm' ] ]
+ \ },
+ \ 'tabline': {
+ \ 'left': [ ['tabs'] ],
+ \ 'right': [ ['buffers'] ]
+ \ },
+ \ 'component_function': {
+ \ 'tabline_tabs': 'TablineTabs',
+ \ 'wpm': 'WPM'
+ \ }
+\ }
+
+function WPM()
+ return (luaeval("require('wpm').historic_graph()") . ' ' . luaeval("require('wpm').wpm()")) . 'wpm'
+endfunction
+
+function! TablineTabs()
+ return lightline#tabline()
+endfunction
+
+
+let g:tabby_keybinding_accept = '<Tab>'
+autocmd Filetype json let g:indentLine_setConceal = 0
+
+function! SW()
+ if winnr('$') > 1
+ wincmd w
+ else
+ tabnext
+ endif
+endfunction
+
+function! Q()
+ if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1
+ NERDTreeClose
+ else
+ if winnr('$') > 1
+ q
+ else
+ call feedkeys(':q')
+ endif
+ endif
+endfunction
+
+function! GoToTab(tab_number)
+ execute 'tabn ' . a:tab_number
+endfunction
+
+
+function! InputTabNumber()
+ let l:tab_number = nr2char(getchar())
+ if l:tab_number =~ '\d'
+ call GoToTab(str2nr(l:tab_number))
+ endif
+endfunction
+
+nnoremap <C-e> :NERDTree<CR>
+inoremap <C-e> <Esc>:NERDTree<CR>
+vnoremap <C-e> <Esc>:NERDTree<CR>
+
+nnoremap <Esc> :call Q()<CR>
+nnoremap <Tab> :call SW()<CR>
+
+nnoremap <F1> :call InputTabNumber()<CR>
+inoremap <F1> <ESC>:call InputTabNumber()<CR>
+vnoremap <F1> <ESC>:call InputTabNumber()<CR>
+
+nnoremap <F2> :Telescope live_grep<CR>
+nnoremap <C-f> :Telescope current_buffer_fuzzy_find<CR>
+
+nnoremap <F4> :lua ToggleDiagnostics()<CR>
+
+vnoremap <Tab> >gv
+nnoremap <S-Tab> <gv
+inoremap <S-Tab> <C-d>
+vnoremap <S-Tab> <gv
+
+let g:NERDTreeCustomOpenArgs = {
+ \ 'file': {'where': 't', 'reuse': 'all'},
+ \ 'dir': {}
+\ }
+
+colorscheme base16-synth-midnight-dark
+hi LineNr guibg=#000000
+hi String ctermfg=1 guifg=#ea5971
+hi Character ctermfg=1 guifg=#dddddd
+hi CmpItemKindDefault guifg=#7cede9 guibg=#101010
+hi javaScriptIdentifier guifg=#ff40ff ctermfg=Blue
+hi Delimiter ctermfg=14 guifg=#cccccc
+hi AvanteConflictCurrent guibg=#101010
+hi AvanteConflictIncoming guibg=#102010
+hi PmenuSel guibg=#ffffff guifg=#202020
+hi Variable guifg=#40FF40 ctermfg=Green
+hi @variable guifg=#40FF40 ctermfg=Green
+hi Identifier guifg=#27ea91
+hi def link @lsp.typemod.variable.defaultLibrary.javascript Special
+hi def link @punctuation.special.javascript Delimiter
+hi SpecialChar ctermfg=9 guifg=#e4600e
+
+let g:vim_json_conceal=0
+let g:markdown_syntax_conceal=0
+let g:indentLine_color_term=239
+let g:indentLine_color_gui='#141414'
+let NERDTreeQuitOnOpen=1
+
+aunmenu PopUp.How-to\ disable\ mouse
+aunmenu PopUp.Inspect
+aunmenu PopUp.-1-
+aunmenu PopUp.-2-