From 1005194679057e683b67186720ce7494fc9f4c17 Mon Sep 17 00:00:00 2001 From: Ali Can Zeybek Date: Fri, 16 Jan 2026 22:15:49 +0300 Subject: [PATCH] update --- README.md | 0 init.lua | 17 +- init.vim.old | 274 ------------ lua/core/init.lua | 3 + lua/core/keymaps.lua | 19 + lua/core/lazy.lua | 13 + lua/core/options.lua | 16 + lua/init.lua | 3 + lua/lazy-lock.json | 24 ++ lua/plugins/config/cmp.lua | 43 ++ lua/plugins/config/lsp.lua | 41 ++ lua/plugins/config/lualine.lua | 8 + lua/plugins/config/nvimtree.lua | 9 + lua/plugins/config/treesitter.lua | 41 ++ lua/plugins/config/venn.lua | 29 ++ lua/plugins/init.lua | 98 +++++ lua/user/cmp.lua | 130 ------ lua/user/colorscheme.lua | 8 - lua/user/gitsigns.lua | 48 --- lua/user/keymaps.lua | 38 -- lua/user/lsp/configs.lua | 24 -- lua/user/lsp/handlers.lua | 102 ----- lua/user/lsp/init.lua | 8 - lua/user/lsp/null-ls.lua | 23 -- lua/user/lsp/settings/jsonls.lua | 197 --------- lua/user/lsp/settings/sumneko_lua.lua | 16 - lua/user/lualine.lua | 93 ----- lua/user/nvim-tree.lua | 67 --- lua/user/options.lua | 40 -- lua/user/plugins.lua | 107 ----- lua/user/rust-rools.lua | 12 - lua/user/snippets.lua | 575 -------------------------- lua/user/telescope.lua | 96 ----- lua/user/toggleterm.lua | 40 -- lua/user/treesitter.lua | 17 - lua/utils/reload.lua | 14 + snippets/all.snippets | 1 - snippets/general.snippets | 7 - 38 files changed, 364 insertions(+), 1937 deletions(-) delete mode 100644 README.md delete mode 100644 init.vim.old create mode 100644 lua/core/init.lua create mode 100644 lua/core/keymaps.lua create mode 100644 lua/core/lazy.lua create mode 100644 lua/core/options.lua create mode 100644 lua/init.lua create mode 100644 lua/lazy-lock.json create mode 100644 lua/plugins/config/cmp.lua create mode 100644 lua/plugins/config/lsp.lua create mode 100644 lua/plugins/config/lualine.lua create mode 100644 lua/plugins/config/nvimtree.lua create mode 100644 lua/plugins/config/treesitter.lua create mode 100644 lua/plugins/config/venn.lua create mode 100644 lua/plugins/init.lua delete mode 100644 lua/user/cmp.lua delete mode 100644 lua/user/colorscheme.lua delete mode 100644 lua/user/gitsigns.lua delete mode 100644 lua/user/keymaps.lua delete mode 100644 lua/user/lsp/configs.lua delete mode 100644 lua/user/lsp/handlers.lua delete mode 100644 lua/user/lsp/init.lua delete mode 100644 lua/user/lsp/null-ls.lua delete mode 100644 lua/user/lsp/settings/jsonls.lua delete mode 100644 lua/user/lsp/settings/sumneko_lua.lua delete mode 100644 lua/user/lualine.lua delete mode 100644 lua/user/nvim-tree.lua delete mode 100644 lua/user/options.lua delete mode 100644 lua/user/plugins.lua delete mode 100644 lua/user/rust-rools.lua delete mode 100644 lua/user/snippets.lua delete mode 100644 lua/user/telescope.lua delete mode 100644 lua/user/toggleterm.lua delete mode 100644 lua/user/treesitter.lua create mode 100644 lua/utils/reload.lua delete mode 100644 snippets/all.snippets delete mode 100644 snippets/general.snippets diff --git a/README.md b/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/init.lua b/init.lua index 8415a76..c5f7b96 100644 --- a/init.lua +++ b/init.lua @@ -1,14 +1,3 @@ -require "user.options" -require "user.keymaps" -require "user.plugins" -require "user.colorscheme" -require "user.cmp" -require "user.lsp" -require "user.telescope" -require "user.treesitter" -require "user.gitsigns" -require "user.nvim-tree" -require "user.toggleterm" -require "user.lualine" -require "rust-tools" -require "user.snippets" +-- Load core config +require("core") + diff --git a/init.vim.old b/init.vim.old deleted file mode 100644 index e9430dd..0000000 --- a/init.vim.old +++ /dev/null @@ -1,274 +0,0 @@ -syntax on - -set noerrorbells -set tabstop=4 softtabstop=4 -set shiftwidth=4 -set expandtab -set smartindent -set number -set relativenumber -set smartcase -set ignorecase -set noswapfile -set nobackup -set undodir=~/.vim/undodir -set undofile -set incsearch -set hidden -set colorcolumn=80 -set scrolloff=12 -set signcolumn=yes -set clipboard=unnamedplus -set nocompatible -filetype plugin on - -highlight ColorColumn ctermbg=0 guibg=lightgrey - -call plug#begin('~/.vim/plugged') - -Plug 'morhetz/gruvbox' -Plug 'Xuyuanp/nerdtree-git-plugin' -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'preservim/nerdtree' -Plug 'tiagofumo/vim-nerdtree-syntax-highlight' -Plug 'ryanoasis/vim-devicons' -Plug 'airblade/vim-gitgutter' -Plug 'vim-utils/vim-man' -Plug 'tpope/vim-fugitive' -Plug 'kien/ctrlp.vim' -Plug 'mbbill/undotree' -Plug 'sainnhe/gruvbox-material' -Plug 'xuhdev/vim-latex-live-preview' -" Plug 'lervag/vimtex' -Plug 'nvim-lua/popup.nvim' -Plug 'nvim-lua/plenary.nvim' -Plug 'nvim-telescope/telescope.nvim' -Plug 'godlygeek/tabular' -Plug 'preservim/vim-markdown' -Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' } -Plug 'preservim/vim-pencil' -Plug 'justinmk/vim-sneak' -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' -call plug#end() - -colorscheme gruvbox-material -set background=dark -"highlight Normal ctermbg=None - -if executable('rg') - let g:rg_derive_root='true' -endif - -let g:ctrlp_user_command = ['.git/','git --git-dir=%s/.git ls-files -oc --exclude-standard'] -let mapleader = " " -let g:netrw_browse_split=2 -let g:netrw_banner = 0 -let g:ctrlp_use_caching = 0 -let g:getrw_winsize = 25 -let g:gruvbox_transparent_bg = 1 -let g:sneak#label = 1 -let g:airline_theme='gruvbox_material' -let g:vim_markdown_folding_disabled = 1 -let g:vimtex_view_method = 'zathura' -let g:livepreview_previewer = 'zathura' -let g:vimtex_compiler_method = 'latexrun' -let NERDTreeShowHidden=1 - -"coc stuff -set encoding=UTF-8 -set cmdheight=2 -set updatetime=300 -set shortmess+=c -" Always show the signcolumn, otherwise it would shift the text each time -" diagnostics appear/become resolved. -if has("nvim-0.5.0") || has("patch-8.1.1564") - " Recently vim can merge signcolumn and number column into one - set signcolumn=number -else - set signcolumn=yes -endif - -" Use tab for trigger completion with characters ahead and navigate. -" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by -" other plugin before putting this into your config. -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -" Use to trigger completion. -if has('nvim') - inoremap coc#refresh() -else - inoremap coc#refresh() -endif - -" Make auto-select the first completion item and notify coc.nvim to -" format on enter, could be remapped by other vim plugin -inoremap pumvisible() ? coc#_select_confirm() - \: "\u\\=coc#on_enter()\" - -" Use `[g` and `]g` to navigate diagnostics -" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. -nmap [g (coc-diagnostic-prev) -nmap ]g (coc-diagnostic-next) - -" GoTo code navigation. -nmap gd (coc-definition) -nmap gy (coc-type-definition) -nmap gi (coc-implementation) -nmap gr (coc-references) - -" Use K to show documentation in preview window. -nnoremap K :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - elseif (coc#rpc#ready()) - call CocActionAsync('doHover') - else - execute '!' . &keywordprg . " " . expand('') - endif -endfunction - -" Highlight the symbol and its references when holding the cursor. -autocmd CursorHold * silent call CocActionAsync('highlight') - -" Symbol renaming. -nmap rn (coc-rename) - -" Formatting selected code. -xmap f (coc-format-selected) -nmap f (coc-format-selected) - -augroup mygroup - autocmd! - " Setup formatexpr specified filetype(s). - autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') - " Update signature help on jump placeholder. - autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -augroup end - -" Applying codeAction to the selected region. -" Example: `aap` for current paragraph -xmap a (coc-codeaction-selected) -nmap a (coc-codeaction-selected) - -" Remap keys for applying codeAction to the current buffer. -nmap ac (coc-codeaction) -" Apply AutoFix to problem on the current line. -nmap qf (coc-fix-current) - -" Map function and class text objects -" NOTE: Requires 'textDocument.documentSymbol' support from the language server. -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) - -" Remap and for scroll float windows/popups. -if has('nvim-0.4.0') || has('patch-8.2.0750') - nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" - inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" - vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" -endif - -" Use CTRL-S for selections ranges. -" Requires 'textDocument/selectionRange' support of language server. -nmap (coc-range-select) -xmap (coc-range-select) - -" Add `:Format` command to format current buffer. -command! -nargs=0 Format :call CocAction('format') - -" Add `:Fold` command to fold current buffer. -command! -nargs=? Fold :call CocAction('fold', ) - -" Add `:OR` command for organize imports of the current buffer. -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') - -" Add (Neo)Vim's native statusline support. -" NOTE: Please see `:h coc-status` for integrations with external plugins that -" provide custom statusline: lightline.vim, vim-airline. -set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} - -" Mappings for CoCList -" Show all diagnostics. -nnoremap a :CocList diagnostics -" Manage extensions. -nnoremap e :CocList extensions -" Show commands. -nnoremap c :CocList commands -" Find symbol of current document. -nnoremap o :CocList outline -" Search workspace symbols. -nnoremap s :CocList -I symbols -" Do default action for next item. -nnoremap j :CocNext -" Do default action for previous item. -nnoremap k :CocPrev -" Resume latest coc list. -nnoremap p :CocListResume -"coc stuff end -nnoremap h : wincmd h -nnoremap j : wincmd j -nnoremap k : wincmd k -nnoremap l : wincmd l -nnoremap u : UndotreeShow -nnoremap pv : wincmd v : Ex : vertical resize 30 -nnoremap ps : Rg -nnoremap + : vertical resize +5 -nnoremap - : vertical resize -5 -"nnoremap gd : YcmCompleter GoTo -"nnoremap gf : YcmCompleter FixIt - -nmap :NERDTreeToggle -let g:NERDTreeGitStatusWithFlags = 1 -let g:NERDTreeIgnore = ['^node_modules$'] -"autocmd VimEnter * NERDTree - -nnoremap ff Telescope find_files hidden=true -nnoremap fg Telescope live_grep -nnoremap fb Telescope buffers -nnoremap fh Telescope help_tags - -"fun! TrimWhitespace() -" let l:save = winsaveview() -" keeppatterns %s/\s\+$//e -" call winrestview(l:save) -"endfun - -" augroup THE_PRIMEAGEN -" autocmd! -" " autocmd BufWritePre * :call TrimWhitespace() -" autocmd BufWritePost *.cpp !astyle % -" autocmd BufWritePost *.cpp edit -" autocmd BufWritePost *.cpp redraw! -" augroup END -" -" ================================================= -" pencil -" ================================================= -" -let g:pencil#wrapModeDefault = 'soft' -augroup pencil - autocmd! - autocmd FileType markdown,mkd call pencil#init() - autocmd FileType text call pencil#init() -augroup END - diff --git a/lua/core/init.lua b/lua/core/init.lua new file mode 100644 index 0000000..e7f236d --- /dev/null +++ b/lua/core/init.lua @@ -0,0 +1,3 @@ +require("core.options") +require("core.keymaps") +require("core.lazy") diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua new file mode 100644 index 0000000..de44c63 --- /dev/null +++ b/lua/core/keymaps.lua @@ -0,0 +1,19 @@ +-- Use native Neovim Lua keymap API +local keymap = vim.keymap + +keymap.set("n", "h", "h", { noremap = true, silent = true }) +keymap.set("n", "j", "j", { noremap = true, silent = true }) +keymap.set("n", "k", "k", { noremap = true, silent = true }) +keymap.set("n", "l", "l", { noremap = true, silent = true }) + +local reload = require("utils.reload") + +vim.api.nvim_create_user_command("ReloadConfig", reload.reload, {}) +vim.keymap.set("n", "r", reload.reload, { noremap = true, silent = true }) + +keymap.set("n", "ff", "lua require('telescope.builtin').find_files()", {noremap = true, silent = true}) +keymap.set("n", "fg", "lua require('telescope.builtin').live_grep()" , {noremap = true, silent = true}) +keymap.set("n", "fb", "lua require('telescope.builtin').buffers()" , {noremap = true, silent = true}) +keymap.set("n", "fh", "lua require('telescope.builtin').help_tags()" , {noremap = true, silent = true}) + +vim.keymap.set("n", "gn", vim.diagnostic.goto_next, { noremap = true, silent = true }) diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua new file mode 100644 index 0000000..73f8c97 --- /dev/null +++ b/lua/core/lazy.lua @@ -0,0 +1,13 @@ +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", + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- load plugin list +require("lazy").setup(require("plugins")) + diff --git a/lua/core/options.lua b/lua/core/options.lua new file mode 100644 index 0000000..0e9f77b --- /dev/null +++ b/lua/core/options.lua @@ -0,0 +1,16 @@ +-- core/options.lua + +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.termguicolors = true +vim.opt.expandtab = false +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 8 +vim.opt.colorcolumn = "80" +vim.opt.clipboard="unnamedplus" +vim.g.mapleader = " " +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.clipboard = "unnamedplus" +vim.o.undofile = true +vim.o.undodir = vim.fn.stdpath("data") .. "/undo//" diff --git a/lua/init.lua b/lua/init.lua new file mode 100644 index 0000000..c5f7b96 --- /dev/null +++ b/lua/init.lua @@ -0,0 +1,3 @@ +-- Load core config +require("core") + diff --git a/lua/lazy-lock.json b/lua/lazy-lock.json new file mode 100644 index 0000000..2b9a24d --- /dev/null +++ b/lua/lazy-lock.json @@ -0,0 +1,24 @@ +{ + "LuaSnip": { "branch": "master", "commit": "73813308abc2eaeff2bc0d3f2f79270c491be9d7" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gruvbox-material": { "branch": "master", "commit": "834dbf21836862300ced7444db4262b796330ab7" }, + "indentmini.nvim": { "branch": "main", "commit": "e0f1e381a3949ea6757365fa33f8f1722d3eae90" }, + "lazy.nvim": { "branch": "main", "commit": "59334064f8604ca073791c25dcc5c9698865406e" }, + "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" }, + "nvim-lspconfig": { "branch": "master", "commit": "e688b486fe9291f151eae7e5c0b5a5c4ef980847" }, + "nvim-tree.lua": { "branch": "master", "commit": "e397756d2a79d74314ea4cd3efc41300e91c0ff0" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "venn.nvim": { "branch": "main", "commit": "b09c2f36ddf70b498281845109bedcf08a7e0de0" } +} diff --git a/lua/plugins/config/cmp.lua b/lua/plugins/config/cmp.lua new file mode 100644 index 0000000..89569a4 --- /dev/null +++ b/lua/plugins/config/cmp.lua @@ -0,0 +1,43 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +require("luasnip.loaders.from_vscode").lazy_load() + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [""] = 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" }, + { name = "buffer" }, + { name = "path" }, + }), +}) + diff --git a/lua/plugins/config/lsp.lua b/lua/plugins/config/lsp.lua new file mode 100644 index 0000000..fa95d49 --- /dev/null +++ b/lua/plugins/config/lsp.lua @@ -0,0 +1,41 @@ +--local lspconfig = require("lspconfig") +local cmp_nvim_lsp = require("cmp_nvim_lsp") + +-- Setup capabilities for nvim-cmp completion +local capabilities = cmp_nvim_lsp.default_capabilities() + +-- Common on_attach function to map keys after LSP attaches to buffer +local on_attach = function(client, bufnr) + local bufmap = function(mode, lhs, rhs) + vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, { noremap = true, silent = true }) + end + + -- LSP-related keymaps + bufmap("n", "gd", "lua vim.lsp.buf.definition()") + bufmap("n", "K", "lua vim.lsp.buf.hover()") + bufmap("n", "gi", "lua vim.lsp.buf.implementation()") + bufmap("n", "rn", "lua vim.lsp.buf.rename()") + bufmap("n", "ca", "lua vim.lsp.buf.code_action()") + bufmap("n", "gr", "lua vim.lsp.buf.references()") + bufmap("n", "f", "lua vim.lsp.buf.formatting()") +end + +-- List of servers to setup +local servers = { + "pyright", + "clangd", + "zls", + "lua_ls", + "vimls", + "marksman", + "texlab", +} + +for _, server in ipairs(servers) do + vim.lsp.config(server, { + on_attach = on_attach, + capabilities = capabilities, + }) + -- Enable the server configuration + vim.lsp.enable(server) +end diff --git a/lua/plugins/config/lualine.lua b/lua/plugins/config/lualine.lua new file mode 100644 index 0000000..3753f5b --- /dev/null +++ b/lua/plugins/config/lualine.lua @@ -0,0 +1,8 @@ +require("lualine").setup({ + options = { + theme = "auto", + section_separators = "", + component_separators = "", + }, +}) + diff --git a/lua/plugins/config/nvimtree.lua b/lua/plugins/config/nvimtree.lua new file mode 100644 index 0000000..5045678 --- /dev/null +++ b/lua/plugins/config/nvimtree.lua @@ -0,0 +1,9 @@ +require("nvim-tree").setup({ + sort = { sorter = "case_sensitive" }, + view = { width = 30 }, + renderer = { group_empty = true }, + filters = { dotfiles = true }, +}) + +vim.keymap.set("n", "", ":NvimTreeToggle", { noremap = true, silent = true }) + diff --git a/lua/plugins/config/treesitter.lua b/lua/plugins/config/treesitter.lua new file mode 100644 index 0000000..c943648 --- /dev/null +++ b/lua/plugins/config/treesitter.lua @@ -0,0 +1,41 @@ +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the listed parsers MUST always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", "zig" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (or "all") + ignore_install = { "javascript" }, + + ---- 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 + disable = { "c", "rust" }, + -- 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)) + if ok and stats and stats.size > max_filesize then + return true + 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, + }, +} diff --git a/lua/plugins/config/venn.lua b/lua/plugins/config/venn.lua new file mode 100644 index 0000000..2a3715c --- /dev/null +++ b/lua/plugins/config/venn.lua @@ -0,0 +1,29 @@ + +-- Function to toggle venn keymaps +function _G.Toggle_venn() + local venn_enabled = vim.inspect(vim.b.venn_enabled) + if venn_enabled == "nil" then + vim.b.venn_enabled = true + vim.cmd([[setlocal ve=all]]) + -- Draw a line on HJKL keystrokes + vim.api.nvim_buf_set_keymap(0, "n", "J", "j:VBox", { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(0, "n", "K", "k:VBox", { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(0, "n", "L", "l:VBox", { noremap = true, silent = true }) + vim.api.nvim_buf_set_keymap(0, "n", "H", "h:VBox", { noremap = true, silent = true }) + -- Draw a box with visual selection + vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox", { noremap = true, silent = true }) + else + vim.cmd([[setlocal ve=]]) + vim.api.nvim_buf_del_keymap(0, "n", "J") + vim.api.nvim_buf_del_keymap(0, "n", "K") + vim.api.nvim_buf_del_keymap(0, "n", "L") + vim.api.nvim_buf_del_keymap(0, "n", "H") + vim.api.nvim_buf_del_keymap(0, "v", "f") + vim.b.venn_enabled = nil + end +end + +-- Toggle venn with v globally +vim.api.nvim_set_keymap("n", "v", ":lua Toggle_venn()", { noremap = true, silent = true }) + + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..0295abd --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1,98 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + branch = 'master', + lazy = false, + build = ":TSUpdate", + config = function() + require("plugins.config.treesitter") + end, + }, + { + "nvim-tree/nvim-tree.lua", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("plugins.config.nvimtree") + end, + }, + { + "nvim-lualine/lualine.nvim", + config = function() + require("plugins.config.lualine") + end, + }, + { + "sainnhe/gruvbox-material", + config = function() + vim.cmd([[colorscheme gruvbox-material]]) + end, + }, + { + "neovim/nvim-lspconfig", + dependencies = { + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, + { + "williamboman/nvim-lsp-installer", + + }, + }, + config = function() + require("plugins.config.lsp") + end, + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + config = function() + require("plugins.config.cmp") + end, + }, + { + 'nvim-telescope/telescope.nvim', tag = '0.1.8', + dependencies = { 'nvim-lua/plenary.nvim' } + }, + { + 'nvimdev/indentmini.nvim', + config = function() + require("indentmini").setup() -- use default config + vim.cmd('hi default link IndentLine Comment') + vim.cmd.highlight('IndentLine guifg=#89b482') + vim.cmd.highlight('IndentLineCurrent guifg=#e78a4e') + end, + }, + { + 'jbyuki/venn.nvim', + config = function() + require("plugins.config.venn") + end, + }, + { + "iamcco/markdown-preview.nvim", + build = "cd app && npm install", + cmd = { "MarkdownPreview", "MarkdownPreviewToggle", "MarkdownPreviewStop" }, + ft = { "markdown" }, + config = function() + vim.g.mkdp_auto_start = 0 + vim.g.mkdp_auto_close = 1 + vim.g.mkdp_browser = "/usr/bin/zen-browser" + vim.g.mkdp_theme = "dark" + end, + } +} + diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua deleted file mode 100644 index 20bb746..0000000 --- a/lua/user/cmp.lua +++ /dev/null @@ -1,130 +0,0 @@ -local cmp_status_ok, cmp = pcall(require, "cmp") -if not cmp_status_ok then - return -end - -local snip_status_ok, luasnip = pcall(require, "luasnip") -if not snip_status_ok then - return -end - -require("luasnip/loaders/from_vscode").lazy_load() - -local check_backspace = function() - local col = vim.fn.col "." - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" -end - ---   פּ ﯟ   some other good icons -local kind_icons = { - Text = "", - Method = "m", - Function = "", - Constructor = "", - Field = "", - Variable = "", - Class = "", - Interface = "", - Module = "", - Property = "", - Unit = "", - Value = "", - Enum = "", - Keyword = "", - Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", -} - -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) -- For `luasnip` users. - end, - }, - mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. - [""] = cmp.mapping { - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }, - -- Accept currently selected item. If none selected, `select` first item. - -- Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping.confirm { select = true }, - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif check_backspace() then - fallback() - else - fallback() - end - end, { - "i", - "s", - }), - [""] = 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", - }), - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) - -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind - vim_item.menu = ({ - nvim_lsp = "[LSP]", - luasnip = "[Snippet]", - buffer = "[Buffer]", - path = "[Path]", - })[entry.source.name] - return vim_item - end, - }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - window = { - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - }, - experimental = { - ghost_text = false, - native_menu = false, - }, -} diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua deleted file mode 100644 index f2f6400..0000000 --- a/lua/user/colorscheme.lua +++ /dev/null @@ -1,8 +0,0 @@ -vim.cmd [[ -try - colorscheme gruvbox-material -catch /^Vim\%((\a\+)\)\=:E185/ - colorscheme default - set background=dark -endtry -]] diff --git a/lua/user/gitsigns.lua b/lua/user/gitsigns.lua deleted file mode 100644 index ff72b93..0000000 --- a/lua/user/gitsigns.lua +++ /dev/null @@ -1,48 +0,0 @@ -local status_ok, gitsigns = pcall(require, "gitsigns") -if not status_ok then - return -end - -gitsigns.setup { - signs = { - add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter_opts = { - relative_time = false, - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - yadm = { - enable = false, - }, -} diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua deleted file mode 100644 index 8d7a755..0000000 --- a/lua/user/keymaps.lua +++ /dev/null @@ -1,38 +0,0 @@ -local opts = { noremap = true, silent = true } - -local term_opts = { silent = true } - --- Shorten function name -local keymap = vim.api.nvim_set_keymap - ---Remap space as leader key -keymap("", "", "", opts) -vim.g.mapleader = " " -vim.g.maplocalleader = " " - --- Modes --- normal_mode = "n", --- insert_mode = "i", --- visual_mode = "v", --- visual_block_mode = "x", --- term_mode = "t", --- command_mode = "c", - --- Normal -- --- Better window navigation -keymap("n", "h", ":wincmd h", opts) -keymap("n", "j", ":wincmd j", opts) -keymap("n", "k", ":wincmd k", opts) -keymap("n", "l", ":wincmd l", opts) - -keymap("n", "", ":NvimTreeToggle", opts) - --- window size up / down -keymap("n", "+", ":vertical resize +5", opts) -keymap("n", "-", ":vertical resize -5", opts) - --- Telescope -keymap("n", "ff" , "lua require('telescope.builtin').find_files({hidden = true})",opts) -keymap("n", "fg" , "lua require('telescope.builtin').live_grep()",opts) -keymap("n", "fb" , "lua require('telescope.builtin').buffers()",opts) -keymap("n", "fh" , "lua require('telescope.builtin').help_tags()",opts) diff --git a/lua/user/lsp/configs.lua b/lua/user/lsp/configs.lua deleted file mode 100644 index c10ee83..0000000 --- a/lua/user/lsp/configs.lua +++ /dev/null @@ -1,24 +0,0 @@ -local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer") -if not status_ok then - return -end - -local lspconfig = require("lspconfig") - -local servers = { "jsonls", "lua_ls" , "pyright", "gopls", "ccls", "rust_analyzer"} - -lsp_installer.setup({ - ensure_installed = servers, -}) - -for _, server in pairs(servers) do - local opts = { - on_attach = require("user.lsp.handlers").on_attach, - capabilities = require("user.lsp.handlers").capabilities, - } - local has_custom_opts, server_custom_opts = pcall(require, "user.lsp.settings." .. server) - if has_custom_opts then - opts = vim.tbl_deep_extend("force", opts, server_custom_opts) - end - lspconfig[server].setup(opts) -end diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua deleted file mode 100644 index 4940fd6..0000000 --- a/lua/user/lsp/handlers.lua +++ /dev/null @@ -1,102 +0,0 @@ -local M = {} - --- TODO: backfill this to template -M.setup = function() - local signs = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, - } - - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" }) - end - - local config = { - -- disable virtual text - virtual_text = false, - -- show signs - signs = { - active = signs, - }, - update_in_insert = true, - underline = true, - severity_sort = true, - float = { - focusable = false, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - }, - } - - vim.diagnostic.config(config) - - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "rounded", - width = 60, - }) - - vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { - border = "rounded", - width = 60, - }) -end - -local function lsp_highlight_document(client) - -- Set autocommands conditional on server_capabilities - local status_ok, illuminate = pcall(require, "illuminate") - if not status_ok then - return - end - illuminate.on_attach(client) - -- end -end - -local function lsp_keymaps(bufnr) - local opts = { noremap = true, silent = true } - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "lua vim.diagnostic.open_float()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", 'lua vim.diagnostic.goto_prev({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap( - bufnr, - "n", - "gl", - 'lua vim.diagnostic.open_float({ border = "rounded" })', - opts - ) - vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "q", "lua vim.diagnostic.setloclist()", opts) - vim.cmd([[ command! Format execute 'lua vim.lsp.buf.format{async=true}' ]]) -end - -M.on_attach = function(client, bufnr) - -- vim.notify(client.name .. " starting...") - -- TODO: refactor this into a method that checks if string in list - if client.name == "tsserver" then - client.resolved_capabilities.document_formatting = false - end - lsp_keymaps(bufnr) - lsp_highlight_document(client) -end - -local capabilities = vim.lsp.protocol.make_client_capabilities() - -local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") -if not status_ok then - return -end - -M.capabilities = cmp_nvim_lsp.default_capabilities(capabilities) - -return M diff --git a/lua/user/lsp/init.lua b/lua/user/lsp/init.lua deleted file mode 100644 index 24e42db..0000000 --- a/lua/user/lsp/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -local status_ok, _ = pcall(require, "lspconfig") -if not status_ok then - return -end - -require "user.lsp.configs" -require("user.lsp.handlers").setup() -require "user.lsp.null-ls" diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua deleted file mode 100644 index 27574f4..0000000 --- a/lua/user/lsp/null-ls.lua +++ /dev/null @@ -1,23 +0,0 @@ -local null_ls_status_ok, null_ls = pcall(require, "null-ls") -if not null_ls_status_ok then - return -end - --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting -local formatting = null_ls.builtins.formatting --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics -local diagnostics = null_ls.builtins.diagnostics --- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/code_actions -local code_actions = null_ls.builtins.code_actions - -null_ls.setup({ - debug = false, - sources = { - formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }), - formatting.black.with({ extra_args = { "--fast" } }), - formatting.stylua, - --diagnostics.flake8, - diagnostics.cppcheck, - code_actions.refactoring - }, -}) diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua deleted file mode 100644 index e202e1e..0000000 --- a/lua/user/lsp/settings/jsonls.lua +++ /dev/null @@ -1,197 +0,0 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - -local schemas = { - { - description = "TypeScript compiler configuration file", - fileMatch = { - "tsconfig.json", - "tsconfig.*.json", - }, - url = "https://json.schemastore.org/tsconfig.json", - }, - { - description = "Lerna config", - fileMatch = { "lerna.json" }, - url = "https://json.schemastore.org/lerna.json", - }, - { - description = "Babel configuration", - fileMatch = { - ".babelrc.json", - ".babelrc", - "babel.config.json", - }, - url = "https://json.schemastore.org/babelrc.json", - }, - { - description = "ESLint config", - fileMatch = { - ".eslintrc.json", - ".eslintrc", - }, - url = "https://json.schemastore.org/eslintrc.json", - }, - { - description = "Bucklescript config", - fileMatch = { "bsconfig.json" }, - url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json", - }, - { - description = "Prettier config", - fileMatch = { - ".prettierrc", - ".prettierrc.json", - "prettier.config.json", - }, - url = "https://json.schemastore.org/prettierrc", - }, - { - description = "Vercel Now config", - fileMatch = { "now.json" }, - url = "https://json.schemastore.org/now", - }, - { - description = "Stylelint config", - fileMatch = { - ".stylelintrc", - ".stylelintrc.json", - "stylelint.config.json", - }, - url = "https://json.schemastore.org/stylelintrc", - }, - { - description = "A JSON schema for the ASP.NET LaunchSettings.json files", - fileMatch = { "launchsettings.json" }, - url = "https://json.schemastore.org/launchsettings.json", - }, - { - description = "Schema for CMake Presets", - fileMatch = { - "CMakePresets.json", - "CMakeUserPresets.json", - }, - url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json", - }, - { - description = "Configuration file as an alternative for configuring your repository in the settings page.", - fileMatch = { - ".codeclimate.json", - }, - url = "https://json.schemastore.org/codeclimate.json", - }, - { - description = "LLVM compilation database", - fileMatch = { - "compile_commands.json", - }, - url = "https://json.schemastore.org/compile-commands.json", - }, - { - description = "Config file for Command Task Runner", - fileMatch = { - "commands.json", - }, - url = "https://json.schemastore.org/commands.json", - }, - { - description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.", - fileMatch = { - "*.cf.json", - "cloudformation.json", - }, - url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json", - }, - { - description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.", - fileMatch = { - "serverless.template", - "*.sam.json", - "sam.json", - }, - url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json", - }, - { - description = "Json schema for properties json file for a GitHub Workflow template", - fileMatch = { - ".github/workflow-templates/**.properties.json", - }, - url = "https://json.schemastore.org/github-workflow-template-properties.json", - }, - { - description = "golangci-lint configuration file", - fileMatch = { - ".golangci.toml", - ".golangci.json", - }, - url = "https://json.schemastore.org/golangci-lint.json", - }, - { - description = "JSON schema for the JSON Feed format", - fileMatch = { - "feed.json", - }, - url = "https://json.schemastore.org/feed.json", - versions = { - ["1"] = "https://json.schemastore.org/feed-1.json", - ["1.1"] = "https://json.schemastore.org/feed.json", - }, - }, - { - description = "Packer template JSON configuration", - fileMatch = { - "packer.json", - }, - url = "https://json.schemastore.org/packer.json", - }, - { - description = "NPM configuration file", - fileMatch = { - "package.json", - }, - url = "https://json.schemastore.org/package.json", - }, - { - description = "JSON schema for Visual Studio component configuration files", - fileMatch = { - "*.vsconfig", - }, - url = "https://json.schemastore.org/vsconfig.json", - }, - { - description = "Resume json", - fileMatch = { "resume.json" }, - url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json", - }, -} - -local function extend(tab1, tab2) - for _, value in ipairs(tab2 or {}) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - -local opts = { - settings = { - json = { - schemas = extended_schemas, - }, - }, - setup = { - commands = { - Format = { - function() - vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 }) - end, - }, - }, - }, -} - -return opts diff --git a/lua/user/lsp/settings/sumneko_lua.lua b/lua/user/lsp/settings/sumneko_lua.lua deleted file mode 100644 index 0ac454a..0000000 --- a/lua/user/lsp/settings/sumneko_lua.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - settings = { - - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand("$VIMRUNTIME/lua")] = true, - [vim.fn.stdpath("config") .. "/lua"] = true, - }, - }, - }, - }, -} diff --git a/lua/user/lualine.lua b/lua/user/lualine.lua deleted file mode 100644 index 3318ecd..0000000 --- a/lua/user/lualine.lua +++ /dev/null @@ -1,93 +0,0 @@ -local status_ok, lualine = pcall(require, "lualine") -if not status_ok then - return -end - -local hide_in_width = function() - return vim.fn.winwidth(0) > 80 -end - -local diagnostics = { - "diagnostics", - sources = { "nvim_diagnostic" }, - sections = { "error", "warn" }, - symbols = { error = " ", warn = " " }, - colored = false, - update_in_insert = false, - always_visible = true, -} - -local diff = { - "diff", - colored = false, - symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols - cond = hide_in_width -} - -local mode = { - "mode", - fmt = function(str) - return "-- " .. str .. " --" - end, -} - -local filetype = { - "filetype", - icons_enabled = false, - icon = nil, -} - -local branch = { - "branch", - icons_enabled = true, - icon = "", -} - -local location = { - "location", - padding = 0, -} - --- cool function for progress -local progress = function() - local current_line = vim.fn.line(".") - local total_lines = vim.fn.line("$") - local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" } - local line_ratio = current_line / total_lines - local index = math.ceil(line_ratio * #chars) - return chars[index] -end - -local spaces = function() - return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") -end - -lualine.setup({ - options = { - icons_enabled = true, - theme = "auto", - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, - disabled_filetypes = { "alpha", "dashboard", "NvimTree", "Outline" }, - always_divide_middle = true, - }, - sections = { - lualine_a = { branch, diagnostics }, - lualine_b = { mode }, - lualine_c = {}, - -- lualine_x = { "encoding", "fileformat", "filetype" }, - lualine_x = { diff, spaces, "encoding", filetype }, - lualine_y = { location }, - lualine_z = { progress }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "filename" }, - lualine_x = { "location" }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - extensions = {}, -}) diff --git a/lua/user/nvim-tree.lua b/lua/user/nvim-tree.lua deleted file mode 100644 index 1a41989..0000000 --- a/lua/user/nvim-tree.lua +++ /dev/null @@ -1,67 +0,0 @@ -local status_ok, nvim_tree = pcall(require, "nvim-tree") -if not status_ok then - return -end - -local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") -if not config_status_ok then - return -end - -local tree_cb = nvim_tree_config.nvim_tree_callback - -nvim_tree.setup { - update_focused_file = { - enable = true, - update_cwd = true, - }, - renderer = { - root_folder_modifier = ":t", - icons = { - glyphs = { - default = "", - symlink = "", - folder = { - arrow_open = "", - arrow_closed = "", - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", - symlink_open = "", - }, - git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - untracked = "U", - deleted = "", - ignored = "◌", - }, - }, - }, - }, - diagnostics = { - enable = true, - show_on_dirs = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - view = { - width = 30, - side = "left", - mappings = { - list = { - { key = { "l", "", "o" }, cb = tree_cb "edit" }, - { key = "h", cb = tree_cb "close_node" }, - { key = "v", cb = tree_cb "vsplit" }, - }, - }, - }, -} diff --git a/lua/user/options.lua b/lua/user/options.lua deleted file mode 100644 index 57cc021..0000000 --- a/lua/user/options.lua +++ /dev/null @@ -1,40 +0,0 @@ -local options = { - backup = false, -- creates a backup fil - clipboard = "unnamedplus", -- allows neovim to access the system clipboard - cmdheight = 2, -- more space in the neovim command line for displaying messages - conceallevel = 0, -- so that `` is visible in markdown files - fileencoding = "utf-8", -- the encoding written to a file - hlsearch = true, -- highlight all matches on previous search pattern - ignorecase = true, -- ignore case in search patterns - mouse = "a", -- allow the mouse to be used in neovim - pumheight = 10, -- pop up menu height - termguicolors = true, -- set term gui colors - showtabline = 2, -- always show tabs - smartcase = true, -- smart case - smartindent = true, -- make indenting smarter again - splitbelow = true, -- force all horizontal splits to go below current window - splitright = true, -- force all vertical splits to go to the right of current window - swapfile = false, -- creates a swapfile - undofile = true, -- enable persistent undo - updatetime = 300, -- faster completion (4000ms default) - writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited - expandtab = true, -- convert tabs to spaces - shiftwidth = 4, -- the number of spaces inserted for each indentation - tabstop = 4, -- insert 2 spaces for a tab - number = true, -- set numbered lines - relativenumber = true, -- set relative numbered lines - numberwidth = 4, -- set number column width to 2 {default 4} - wrap = true, -- display lines as one long line - scrolloff = 12, -- is one of my fav - sidescrolloff = 8, -} - -vim.opt.shortmess:append "c" - -for k, v in pairs(options) do - vim.opt[k] = v -end - -vim.cmd "set whichwrap+=<,>,[,],h,l" -vim.cmd [[set iskeyword+=-]] -vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua deleted file mode 100644 index adaa0cf..0000000 --- a/lua/user/plugins.lua +++ /dev/null @@ -1,107 +0,0 @@ -local fn = vim.fn - --- Automatically install packer -local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" -if fn.empty(fn.glob(install_path)) > 0 then - PACKER_BOOTSTRAP = fn.system({ - "git", - "clone", - "--depth", - "1", - "https://github.com/wbthomason/packer.nvim", - install_path, - }) - print("Installing packer close and reopen Neovim...") - vim.cmd([[packadd packer.nvim]]) -end - --- Autocommand that reloads neovim whenever you save the plugins.lua file -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins.lua source | PackerSync - augroup end -]]) - --- Use a protected call so we don't error out on first use -local status_ok, packer = pcall(require, "packer") -if not status_ok then - return -end - ---Install plugins here - -return packer.startup(function(use) - - -- General Libs - use "wbthomason/packer.nvim" -- Have packer manage itself - use "nvim-lua/popup.nvim" -- Popup API of vim in Neovim - use "nvim-lua/plenary.nvim" -- Lua lib required by other plugins - -- Colorschemes - use "sainnhe/gruvbox-material" - use {'shaunsingh/oxocarbon.nvim', run = './install.sh'} - - --cmp plugins - use "hrsh7th/nvim-cmp" -- The completion plugin - use "hrsh7th/cmp-buffer" -- buffer completions - use "hrsh7th/cmp-path" -- path completions - use "saadparwaiz1/cmp_luasnip" -- snippet completions - use "hrsh7th/cmp-nvim-lsp" - use "hrsh7th/cmp-nvim-lua" - - -- snippets - use "L3MON4D3/LuaSnip" --snippet engine - use "rafamadriz/friendly-snippets" -- a bunch of snippets to use - use "honza/vim-snippets" - - -- LSP - use "neovim/nvim-lspconfig" -- enable LSP - use "williamboman/nvim-lsp-installer" -- simple to use language server installer - use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters - - -- Telescope - use "nvim-telescope/telescope.nvim" - - -- TreeSitter - use { "nvim-treesitter/nvim-treesitter" , run = "TSUpdate",} - - -- Git Stuff - use "lewis6991/gitsigns.nvim" - use "f-person/git-blame.nvim" - use "tpope/vim-fugitive" - -- nvim-tree - use {"kyazdani42/nvim-tree.lua",commit = "9c97e6449b0b0269bd44e1fd4857184dfa57bb4c"} - - -- toggleterm - use "akinsho/toggleterm.nvim" - - -- lualine - use "nvim-lualine/lualine.nvim" - - --markdown - use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }) - if PACKER_BOOTSTRAP then - require("packer").sync() - end - --rust - use 'simrat39/rust-tools.nvim' - - --vimwiki - use { - 'vimwiki/vimwiki', - config = function() - vim.g.vimwiki_list = { - { - path = '~/vimwiki/', - syntax = 'markdown', - ext = '.md', - } - } - vim.g.vimwiki_ext2syntax = { - ['.md'] = 'markdown', - ['.markdown'] = 'markdown', - ['.mdown'] = 'markdown', - } - end - } -end) diff --git a/lua/user/rust-rools.lua b/lua/user/rust-rools.lua deleted file mode 100644 index bcda183..0000000 --- a/lua/user/rust-rools.lua +++ /dev/null @@ -1,12 +0,0 @@ -local rt = require("rust-tools") - -rt.setup({ - server = { - on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) - end, - }, -}) diff --git a/lua/user/snippets.lua b/lua/user/snippets.lua deleted file mode 100644 index 512716a..0000000 --- a/lua/user/snippets.lua +++ /dev/null @@ -1,575 +0,0 @@ -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 r = ls.restore_node -local l = require("luasnip.extras").lambda -local rep = require("luasnip.extras").rep -local p = require("luasnip.extras").partial -local m = require("luasnip.extras").match -local n = require("luasnip.extras").nonempty -local dl = require("luasnip.extras").dynamic_lambda -local fmt = require("luasnip.extras.fmt").fmt -local fmta = require("luasnip.extras.fmt").fmta -local types = require("luasnip.util.types") -local conds = require("luasnip.extras.conditions") -local conds_expand = require("luasnip.extras.conditions.expand") - --- If you're reading this file for the first time, best skip to around line 190 --- where the actual snippet-definitions start. - --- Every unspecified option will be set to the default. -ls.setup({ - history = true, - -- Update more often, :h events for more info. - update_events = "TextChanged,TextChangedI", - -- Snippets aren't automatically removed if their text is deleted. - -- `delete_check_events` determines on which events (:h events) a check for - -- deleted snippets is performed. - -- This can be especially useful when `history` is enabled. - delete_check_events = "TextChanged", - 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, - -- mapping for cutting selected text so it's usable as SELECT_DEDENT, - -- SELECT_RAW or TM_SELECTED_TEXT (mapped via xmap). - store_selection_keys = "", - -- luasnip uses this function to get the currently active filetype. This - -- is the (rather uninteresting) default, but it's possible to use - -- eg. treesitter for getting the current filetype by setting ft_func to - -- require("luasnip.extras.filetype_functions").from_cursor (requires - -- `nvim-treesitter/nvim-treesitter`). This allows correctly resolving - -- the current filetype in eg. a markdown-code block or `vim.cmd()`. - ft_func = function() - return vim.split(vim.bo.filetype, ".", true) - end, -}) - --- args is a table, where 1 is the text in Placeholder 1, 2 the text in --- placeholder 2,... -local function copy(args) - return args[1] -end - --- 'recursive' dynamic snippet. Expands to some text followed by itself. -local rec_ls -rec_ls = function() - return sn( - nil, - c(1, { - -- Order is important, sn(...) first would cause infinite loop of expansion. - t(""), - sn(nil, { t({ "", "\t\\item " }), i(1), d(2, rec_ls, {}) }), - }) - ) -end - --- complicated function for dynamicNode. -local function jdocsnip(args, _, old_state) - -- !!! old_state is used to preserve user-input here. DON'T DO IT THAT WAY! - -- Using a restoreNode instead is much easier. - -- View this only as an example on how old_state functions. - local nodes = { - t({ "/**", " * " }), - i(1, "A short Description"), - t({ "", "" }), - } - - -- These will be merged with the snippet; that way, should the snippet be updated, - -- some user input eg. text can be referred to in the new snippet. - local param_nodes = {} - - if old_state then - nodes[2] = i(1, old_state.descr:get_text()) - end - param_nodes.descr = nodes[2] - - -- At least one param. - if string.find(args[2][1], ", ") then - vim.list_extend(nodes, { t({ " * ", "" }) }) - end - - local insert = 2 - for indx, arg in ipairs(vim.split(args[2][1], ", ", true)) do - -- Get actual name parameter. - arg = vim.split(arg, " ", true)[2] - if arg then - local inode - -- if there was some text in this parameter, use it as static_text for this new snippet. - if old_state and old_state[arg] then - inode = i(insert, old_state["arg" .. arg]:get_text()) - else - inode = i(insert) - end - vim.list_extend( - nodes, - { t({ " * @param " .. arg .. " " }), inode, t({ "", "" }) } - ) - param_nodes["arg" .. arg] = inode - - insert = insert + 1 - end - end - - if args[1][1] ~= "void" then - local inode - if old_state and old_state.ret then - inode = i(insert, old_state.ret:get_text()) - else - inode = i(insert) - end - - vim.list_extend( - nodes, - { t({ " * ", " * @return " }), inode, t({ "", "" }) } - ) - param_nodes.ret = inode - insert = insert + 1 - end - - if vim.tbl_count(args[3]) ~= 1 then - local exc = string.gsub(args[3][2], " throws ", "") - local ins - if old_state and old_state.ex then - ins = i(insert, old_state.ex:get_text()) - else - ins = i(insert) - end - vim.list_extend( - nodes, - { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) } - ) - param_nodes.ex = ins - insert = insert + 1 - end - - vim.list_extend(nodes, { t({ " */" }) }) - - local snip = sn(nil, nodes) - -- Error on attempting overwrite. - snip.old_state = param_nodes - return snip -end - --- Make sure to not pass an invalid command, as io.popen() may write over nvim-text. -local function bash(_, _, command) - local file = io.popen(command, "r") - local res = {} - for line in file:lines() do - table.insert(res, line) - end - return res -end - --- Returns a snippet_node wrapped around an insertNode whose initial --- text value is set to the current date in the desired format. -local date_input = function(args, snip, old_state, fmt) - local fmt = fmt or "%Y-%m-%d" - return sn(nil, i(1, os.date(fmt))) -end - --- snippets are added via ls.add_snippets(filetype, snippets[, opts]), where --- opts may specify the `type` of the snippets ("snippets" or "autosnippets", --- for snippets that should expand directly after the trigger is typed). --- --- opts can also specify a key. By passing an unique key to each add_snippets, it's possible to reload snippets by --- re-`:luafile`ing the file in which they are defined (eg. this one). -ls.add_snippets("all", { - -- trigger is `fn`, second argument to snippet-constructor are the nodes to insert into the buffer on expansion. - s("fn", { - -- Simple static text. - t("//Parameters: "), - -- function, first parameter is the function, second the Placeholders - -- whose text it gets as input. - f(copy, 2), - t({ "", "function " }), - -- Placeholder/Insert. - i(1), - t("("), - -- Placeholder with initial text. - i(2, "int foo"), - -- Linebreak - t({ ") {", "\t" }), - -- Last Placeholder, exit Point of the snippet. - i(0), - t({ "", "}" }), - }), - s("class", { - -- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes. - c(1, { - t("public "), - t("private "), - }), - t("class "), - i(2), - t(" "), - c(3, { - t("{"), - -- sn: Nested Snippet. Instead of a trigger, it has a position, just like insertNodes. !!! These don't expect a 0-node!!!! - -- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to. - sn(nil, { - t("extends "), - -- restoreNode: stores and restores nodes. - -- pass position, store-key and nodes. - r(1, "other_class", i(1)), - t(" {"), - }), - sn(nil, { - t("implements "), - -- no need to define the nodes for a given key a second time. - r(1, "other_class"), - t(" {"), - }), - }), - t({ "", "\t" }), - i(0), - t({ "", "}" }), - }), - -- Alternative printf-like notation for defining snippets. It uses format - -- string with placeholders similar to the ones used with Python's .format(). - s( - "fmt1", - fmt("To {title} {} {}.", { - i(2, "Name"), - i(3, "Surname"), - title = c(1, { t("Mr."), t("Ms.") }), - }) - ), - -- To escape delimiters use double them, e.g. `{}` -> `{{}}`. - -- Multi-line format strings by default have empty first/last line removed. - -- Indent common to all lines is also removed. Use the third `opts` argument - -- to control this behaviour. - s( - "fmt2", - fmt( - [[ - foo({1}, {3}) {{ - return {2} * {4} - }} - ]], - { - i(1, "x"), - rep(1), - i(2, "y"), - rep(2), - } - ) - ), - -- Empty placeholders are numbered automatically starting from 1 or the last - -- value of a numbered placeholder. Named placeholders do not affect numbering. - s( - "fmt3", - fmt("{} {a} {} {1} {}", { - t("1"), - t("2"), - a = t("A"), - }) - ), - -- The delimiters can be changed from the default `{}` to something else. - s("fmt4", fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })), - -- `fmta` is a convenient wrapper that uses `<>` instead of `{}`. - s("fmt5", fmta("foo() { return <>; }", i(1, "x"))), - -- By default all args must be used. Use strict=false to disable the check - s( - "fmt6", - fmt("use {} only", { t("this"), t("not this") }, { strict = false }) - ), - -- Use a dynamicNode to interpolate the output of a - -- function (see date_input above) into the initial - -- value of an insertNode. - s("novel", { - t("It was a dark and stormy night on "), - d(1, date_input, {}, { user_args = { "%A, %B %d of %Y" } }), - t(" and the clocks were striking thirteen."), - }), - -- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body. - -- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string. - -- This means they are not SELECTed like in other editors/Snippet engines. - ls.parser.parse_snippet( - "lspsyn", - "Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}" - ), - - -- When wordTrig is set to false, snippets may also expand inside other words. - ls.parser.parse_snippet( - { trig = "te", wordTrig = false }, - "${1:cond} ? ${2:true} : ${3:false}" - ), - - -- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number. - ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"), - -- Using the condition, it's possible to allow expansion only in specific cases. - s("cond", { - t("will only expand in c-style comments"), - }, { - condition = function(line_to_cursor, matched_trigger, captures) - -- optional whitespace followed by // - return line_to_cursor:match("%s*//") - end, - }), - -- there's some built-in conditions in "luasnip.extras.conditions.expand" and "luasnip.extras.conditions.show". - s("cond2", { - t("will only expand at the beginning of the line"), - }, { - condition = conds_expand.line_begin, - }), - s("cond3", { - t("will only expand at the end of the line"), - }, { - condition = conds_expand.line_end, - }), - -- on conditions some logic operators are defined - s("cond4", { - t("will only expand at the end and the start of the line"), - }, { - -- last function is just an example how to make own function objects and apply operators on them - condition = conds_expand.line_end - + conds_expand.line_begin - * conds.make_condition(function() - return true - end), - }), - -- The last entry of args passed to the user-function is the surrounding snippet. - s( - { trig = "a%d", regTrig = true }, - f(function(_, snip) - return "Triggered with " .. snip.trigger .. "." - end, {}) - ), - -- It's possible to use capture-groups inside regex-triggers. - s( - { trig = "b(%d)", regTrig = true }, - f(function(_, snip) - return "Captured Text: " .. snip.captures[1] .. "." - end, {}) - ), - s({ trig = "c(%d+)", regTrig = true }, { - t("will only expand for even numbers"), - }, { - condition = function(line_to_cursor, matched_trigger, captures) - return tonumber(captures[1]) % 2 == 0 - end, - }), - -- Use a function to execute any shell command and print its text. - s("bash", f(bash, {}, { user_args = { "ls" } })), - -- Short version for applying String transformations using function nodes. - s("transform", { - i(1, "initial text"), - t({ "", "" }), - -- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations. - -- This list will be applied in order to the first node given in the second argument. - l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1), - }), - - s("transform2", { - i(1, "initial text"), - t("::"), - i(2, "replacement for e"), - t({ "", "" }), - -- Lambdas can also apply transforms USING the text of other nodes: - l(l._1:gsub("e", l._2), { 1, 2 }), - }), - s({ trig = "trafo(%d+)", regTrig = true }, { - -- env-variables and captures can also be used: - l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}), - }), - -- Set store_selection_keys = "" (for example) in your - -- luasnip.config.setup() call to populate - -- TM_SELECTED_TEXT/SELECT_RAW/SELECT_DEDENT. - -- In this case: select a URL, hit Tab, then expand this snippet. - s("link_url", { - t(''), - i(1), - t(""), - i(0), - }), - -- Shorthand for repeating the text in a given node. - s("repeat", { i(1, "text"), t({ "", "" }), rep(1) }), - -- Directly insert the ouput from a function evaluated at runtime. - s("part", p(os.date, "%Y")), - -- use matchNodes (`m(argnode, condition, then, else)`) to insert text - -- based on a pattern/function/lambda-evaluation. - -- It's basically a shortcut for simple functionNodes: - s("mat", { - i(1, { "sample_text" }), - t(": "), - m(1, "%d", "contains a number", "no number :("), - }), - -- The `then`-text defaults to the first capture group/the entire - -- match if there are none. - s("mat2", { - i(1, { "sample_text" }), - t(": "), - m(1, "[abc][abc][abc]"), - }), - -- It is even possible to apply gsubs' or other transformations - -- before matching. - s("mat3", { - i(1, { "sample_text" }), - t(": "), - m( - 1, - l._1:gsub("[123]", ""):match("%d"), - "contains a number that isn't 1, 2 or 3!" - ), - }), - -- `match` also accepts a function in place of the condition, which in - -- turn accepts the usual functionNode-args. - -- The condition is considered true if the function returns any - -- non-nil/false-value. - -- If that value is a string, it is used as the `if`-text if no if is explicitly given. - s("mat4", { - i(1, { "sample_text" }), - t(": "), - m(1, function(args) - -- args is a table of multiline-strings (as usual). - return (#args[1][1] % 2 == 0 and args[1]) or nil - end), - }), - -- The nonempty-node inserts text depending on whether the arg-node is - -- empty. - s("nempty", { - i(1, "sample_text"), - n(1, "i(1) is not empty!"), - }), - -- dynamic lambdas work exactly like regular lambdas, except that they - -- don't return a textNode, but a dynamicNode containing one insertNode. - -- This makes it easier to dynamically set preset-text for insertNodes. - s("dl1", { - i(1, "sample_text"), - t({ ":", "" }), - dl(2, l._1, 1), - }), - -- Obviously, it's also possible to apply transformations, just like lambdas. - s("dl2", { - i(1, "sample_text"), - i(2, "sample_text_2"), - t({ "", "" }), - dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }), - }), -}, { - key = "all", -}) - -ls.add_snippets("java", { - -- Very long example for a java class. - s("fn", { - d(6, jdocsnip, { 2, 4, 5 }), - t({ "", "" }), - c(1, { - t("public "), - t("private "), - }), - c(2, { - t("void"), - t("String"), - t("char"), - t("int"), - t("double"), - t("boolean"), - i(nil, ""), - }), - t(" "), - i(3, "myFunc"), - t("("), - i(4), - t(")"), - c(5, { - t(""), - sn(nil, { - t({ "", " throws " }), - i(1), - }), - }), - t({ " {", "\t" }), - i(0), - t({ "", "}" }), - }), -}, { - key = "java", -}) - -ls.add_snippets("tex", { - -- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many - -- \item as necessary by utilizing a choiceNode. - s("ls", { - t({ "\\begin{itemize}", "\t\\item " }), - i(1), - d(2, rec_ls, {}), - t({ "", "\\end{itemize}" }), - }), -}, { - key = "tex", -}) - --- set type to "autosnippets" for adding autotriggered snippets. -ls.add_snippets("all", { - s("autotrigger", { - t("autosnippet"), - }), -}, { - type = "autosnippets", - key = "all_auto", -}) - --- in a lua file: search lua-, then c-, then all-snippets. -ls.filetype_extend("lua", { "c" }) --- in a cpp file: search c-snippets, then all-snippets only (no cpp-snippets!!). -ls.filetype_set("cpp", { "c" }) - --- Beside defining your own snippets you can also load snippets from "vscode-like" packages --- that expose snippets in json files, for example . - -require("luasnip.loaders.from_vscode").load({ include = { "python" } }) -- Load only python snippets - --- The directories will have to be structured like eg. (include --- a similar `package.json`) -require("luasnip.loaders.from_vscode").load({ paths = { "./my-snippets" } }) -- Load snippets from my-snippets folder - --- You can also use lazy loading so snippets are loaded on-demand, not all at once (may interfere with lazy-loading luasnip itself). -require("luasnip.loaders.from_vscode").lazy_load() -- You can pass { paths = "./my-snippets/"} as well - --- You can also use snippets in snipmate format, for example . --- The usage is similar to vscode. - --- One peculiarity of honza/vim-snippets is that the file containing global --- snippets is _.snippets, so we need to tell luasnip that the filetype "_" --- contains global snippets: -ls.filetype_extend("all", { "_" }) - -require("luasnip.loaders.from_snipmate").load({ include = { "c" } }) -- Load only snippets for c. - --- Load snippets from my-snippets folder --- The "." refers to the directory where of your `$MYVIMRC` (you can print it --- out with `:lua print(vim.env.MYVIMRC)`. --- NOTE: It's not always set! It isn't set for example if you call neovim with --- the `-u` argument like this: `nvim -u yeet.txt`. -require("luasnip.loaders.from_snipmate").load({ path = { "./my-snippets" } }) --- If path is not specified, luasnip will look for the `snippets` directory in rtp (for custom-snippet probably --- `~/.config/nvim/snippets`). - -require("luasnip.loaders.from_snipmate").lazy_load() -- Lazy loading - --- see DOC.md/LUA SNIPPETS LOADER for some details. -require("luasnip.loaders.from_lua").load({ include = { "c" } }) -require("luasnip.loaders.from_lua").lazy_load({ include = { "all", "cpp" } }) diff --git a/lua/user/telescope.lua b/lua/user/telescope.lua deleted file mode 100644 index 0706b51..0000000 --- a/lua/user/telescope.lua +++ /dev/null @@ -1,96 +0,0 @@ -local status_ok, telescope = pcall(require, "telescope") -if not status_ok then - return -end - -local actions = require "telescope.actions" - -telescope.setup { - defaults = { - - prompt_prefix = " ", - selection_caret = " ", - path_display = { "smart" }, - - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.close, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - [""] = actions.complete_tag, - [""] = actions.which_key, -- keys from pressing - }, - - n = { - [""] = actions.close, - [""] = actions.select_default, - [""] = actions.select_horizontal, - [""] = actions.select_vertical, - [""] = actions.select_tab, - - [""] = actions.toggle_selection + actions.move_selection_worse, - [""] = actions.toggle_selection + actions.move_selection_better, - [""] = actions.send_to_qflist + actions.open_qflist, - [""] = actions.send_selected_to_qflist + actions.open_qflist, - - ["j"] = actions.move_selection_next, - ["k"] = actions.move_selection_previous, - ["H"] = actions.move_to_top, - ["M"] = actions.move_to_middle, - ["L"] = actions.move_to_bottom, - - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - ["gg"] = actions.move_to_top, - ["G"] = actions.move_to_bottom, - - [""] = actions.preview_scrolling_up, - [""] = actions.preview_scrolling_down, - - [""] = actions.results_scrolling_up, - [""] = actions.results_scrolling_down, - - ["?"] = actions.which_key, - }, - }, - }, - pickers = { - -- Default configuration for builtin pickers goes here: - -- picker_name = { - -- picker_config_key = value, - -- ... - -- } - -- Now the picker_config_key will be applied every time you call this - -- builtin picker - }, - extensions = { - -- Your extension configuration goes here: - -- extension_name = { - -- extension_config_key = value, - -- } - -- please take a look at the readme of the extension you want to configure - }, -} diff --git a/lua/user/toggleterm.lua b/lua/user/toggleterm.lua deleted file mode 100644 index 1e88c27..0000000 --- a/lua/user/toggleterm.lua +++ /dev/null @@ -1,40 +0,0 @@ -local status_ok, toggleterm = pcall(require, "toggleterm") -if not status_ok then - return -end - -toggleterm.setup({ - size = 20, - open_mapping = [[]], - hide_numbers = true, - shade_filetypes = {}, - shade_terminals = true, - shading_factor = 2, - start_in_insert = true, - insert_mappings = true, - persist_size = true, - direction = "float", - close_on_exit = true, - shell = vim.o.shell, - float_opts = { - border = "curved", - winblend = 0, - highlights = { - border = "Normal", - background = "Normal", - }, - }, -}) - -function _G.set_terminal_keymaps() - local opts = {noremap = true} - vim.api.nvim_buf_set_keymap(0, 't', '', [[]], opts) - vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[h]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[j]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[k]], opts) - vim.api.nvim_buf_set_keymap(0, 't', '', [[l]], opts) -end - -vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') - diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua deleted file mode 100644 index fba1686..0000000 --- a/lua/user/treesitter.lua +++ /dev/null @@ -1,17 +0,0 @@ -local status_ok, configs = pcall(require, "nvim-treesitter.configs") -if not status_ok then - return -end - -configs.setup({ - ensure_installed = "all", -- one of "all" or a list of languages - ignore_install = { "" }, -- List of parsers to ignore installing - highlight = { - enable = true, -- false will disable the whole extension - disable = { "" }, -- list of language that will be disabled - }, - autopairs = { - enable = true, - }, - indent = { enable = true, disable = { "" } }, -}) diff --git a/lua/utils/reload.lua b/lua/utils/reload.lua new file mode 100644 index 0000000..3b07062 --- /dev/null +++ b/lua/utils/reload.lua @@ -0,0 +1,14 @@ +local M = {} + +function M.reload() + for name, _ in pairs(package.loaded) do + if name:match("^core") or name:match("^plugins") or name == "init" then + package.loaded[name] = nil + end + end + dofile(vim.env.MYVIMRC) + vim.notify("Config reloaded!", vim.log.levels.INFO) +end + +return M + diff --git a/snippets/all.snippets b/snippets/all.snippets deleted file mode 100644 index 0ac72ce..0000000 --- a/snippets/all.snippets +++ /dev/null @@ -1 +0,0 @@ -extends general diff --git a/snippets/general.snippets b/snippets/general.snippets deleted file mode 100644 index e8f675d..0000000 --- a/snippets/general.snippets +++ /dev/null @@ -1,7 +0,0 @@ -snippet today - `strftime('%-d/%-m/%Y')` - -snippet sign - Sincerely, - - Ali Can Zeybek