my own vim

This commit is contained in:
Benjamin Kyd
2023-01-27 17:33:00 +00:00
parent 5476a67250
commit 15de8214c4
33 changed files with 1339 additions and 612 deletions

View File

@@ -1,8 +0,0 @@
tt.*
.tests
doc/tags
debug
.repro
foo.*
*.log
data

View File

@@ -1,15 +0,0 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"sumneko_lua": {
"enabled": true
}
}
}
}

View File

@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,4 +1,87 @@
# 💤 LazyVim
# Short Intro
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
![Screenshot](./assets/nvim-screenshot.png)
This is my NeoVim config (for version 0.7.2 and greater).
## Features
Here's a short list of features that this config offers (through the use of 3rd party plugins).
* Autocompletion
* Highlighting
* Navigation
* Find definition/declaration/implementation...
* Find all references (of variables, methods, classes...)
* Jump cursor focus forward/backward in time
* Project tree view (NvimTree)
* Switch between tabs
* Searching
* Search by file name
* Search by file contents
* Search through NeoVim's help
* Refactoring (code actions)
* Rename (variable, method, class...)
* Automatically import
* Simplify code
* Infer type info
* Diagnostics
* Show errors/warnings/hints/info
* Diagnostic panel
* Integration with status line
* Git
* Highlight edited lines in number column
* Navigate between hunks (changes)
* Stage/unstage hunks
* Preview old code
* Status line integration
* Misc
* Special start page
* Indent guide lines
* Motions for surrounding characters (brackets, parentheses...)
* Easy commenting out code
* Pretty status line
* Default colorscheme
* Enabled mouse integration
* Keymappings for 10 finger typing on Slovene keyboard
## Installation
I will make the whole installation process more friendly in the future,
but for now just follow these steps.
1. Download this repo
```bash
git clone git@github.com:optimizacija/neovim-config.git
```
2. Put the contents of this repo where NeoVim can find them. On Linux this is most likely `$HOME/.config/nvim`.
3. Create a *data* folder. This is where NeoVim will search for its packages, including Packer.
- On Linux this is `$HOME/.local/share/nvim`. Otherwise check the output of `:lua print(vim.fn.stdpath('data'))`.
4. Open NeoVim and let it install Packer and all the dependencies (ignore the errors).
5. Open NeoVim again and wait for nvim-treesitter to install all of its dependencies (ignore the errors).
If you're updating an existing config and you're facing some issues,
I would recommend that you remove the contents of *data* folder and retry the installation. (It has helped me in the past)
## Icons
Icons and other special characters are used all around the config to give NeoVim a prettier look.
However, your terminal will not display these icons correctly unless it uses the correct font.
Install one of the icon fonts listed [here](https://www.nerdfonts.com/). Just follow their instructions for your specific OS.
After installation is complete, don't forget to configure your terminal to start using the new font.
Each terminal does this differently, so be sure to checkout [Arch Wiki](https://wiki.archlinux.org/) if you run into any troubles.
## TODOS
I'm working on this config in my spare time, but lately other side projects are getting in the way. I'll try to update it when I can, but also feel free to contribute by submitting a PR with your changes.
Minor:
- improve telescope functionality (support regex)
Major:
- autoformat (prettier)
Misc:
- open previously opened project files

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

View File

@@ -1,2 +1,6 @@
-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")
require('basics')
require('globals')
require('keymappings')
require('plugins')
require('lsp-general')
require('post-plugin-basics')

View File

@@ -1 +0,0 @@
/home/benk/.vimrc

View File

@@ -1,52 +0,0 @@
{
"LazyVim": { "branch": "main", "commit": "835f77f3bebf7b189b0a120ef5fabe6a654b046d" },
"LuaSnip": { "branch": "master", "commit": "3181cef8a5c6a71f263a28e61651233d7a7afeb2" },
"alpha-nvim": { "branch": "main", "commit": "21a0f2520ad3a7c32c0822f943368dc063a569fb" },
"bufferline.nvim": { "branch": "main", "commit": "c7492a76ce8218e3335f027af44930576b561013" },
"catppuccin": { "branch": "main", "commit": "6368edcd0b5e5cb5d9fb7cdee9d62cffe3e14f0e" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
"flit.nvim": { "branch": "main", "commit": "be110f9814a45788d10537fd59b3c76d956bb7ad" },
"friendly-snippets": { "branch": "main", "commit": "046e4d3491baf664e0eef5231d28beb49333578b" },
"gitsigns.nvim": { "branch": "main", "commit": "c52162b7b34a21bdc476425a4ab562c2f7bf1bb1" },
"indent-blankline.nvim": { "branch": "master", "commit": "c4c203c3e8a595bc333abaf168fcb10c13ed5fb7" },
"lazy.nvim": { "branch": "main", "commit": "9b208696e139a404d159963b975a5b90af38439b" },
"leap.nvim": { "branch": "main", "commit": "ff4c3663e5a0a0ecbb3fffbc8318825def35d2aa" },
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c29f9a9f9b01528ca6a44cd14814f5af20778f7a" },
"mason.nvim": { "branch": "main", "commit": "e7303a1632c004ebd2dcd0be1aaa4354586c030b" },
"mini.ai": { "branch": "main", "commit": "270d5b8eb61e4aeede7a8591fdc72db824b0cfd7" },
"mini.bufremove": { "branch": "main", "commit": "f651349d730c17ecdbef5a91c590779fb307ee37" },
"mini.comment": { "branch": "main", "commit": "137cf43aaaed41c733a8e0087fab6ee08bb45293" },
"mini.indentscope": { "branch": "main", "commit": "3a517f11aa9d1434c4cdba1a807df4e5ca42d3ea" },
"mini.pairs": { "branch": "main", "commit": "ead264c5fd846c06752b6f3e0edb1d806c888cf9" },
"mini.surround": { "branch": "main", "commit": "194e3a1c550b2b90019d42b40e029bf6455f374b" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "8238865e1d9c61f1a260c290653f2c419503e0a9" },
"neoconf.nvim": { "branch": "main", "commit": "7209d3a1a38597ae4ae1df0e77ed4413357b2f09" },
"neodev.nvim": { "branch": "main", "commit": "6d98dde102821731cdaddd6a84891f45253cef08" },
"noice.nvim": { "branch": "main", "commit": "20f47dcebd24c84650bb8ed57d8349cc53dffd3f" },
"nui.nvim": { "branch": "main", "commit": "b99e6cb13dc51768abc1c4c8585045a0c0459ef1" },
"null-ls.nvim": { "branch": "main", "commit": "18497120fa0db0a3b9e53870ac8f342be4bffb57" },
"nvim-cmp": { "branch": "main", "commit": "11a95792a5be0f5a40bab5fc5b670e5b1399a939" },
"nvim-lspconfig": { "branch": "master", "commit": "582842c158968a59ed5acf9439bc6eaf637f1839" },
"nvim-navic": { "branch": "master", "commit": "7a2b823152fe4de65ee7925b0e32d26ed73bc57c" },
"nvim-notify": { "branch": "master", "commit": "bdd647f61a05c9b8a57c83b78341a0690e9c29d7" },
"nvim-spectre": { "branch": "master", "commit": "24275beae382e6bd0180b3064cf5729548641a02" },
"nvim-treesitter": { "branch": "master", "commit": "ce6390393aaf250a6b0f513023899a342883d0df" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "71cee2f7b1211fe35918ce5fd0f626c48d9c1e3d" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a0f89563ba36b3bacd62cf967b46beb4c2c29e52" },
"nvim-web-devicons": { "branch": "master", "commit": "3548363849878ef895ce54edda02421279b419d8" },
"persistence.nvim": { "branch": "main", "commit": "d8a3eda0e19b4d5f3180fc832c25baab1709f2a1" },
"plenary.nvim": { "branch": "master", "commit": "1c7e3e6b0f4dd5a174fcea9fda8a4d7de593b826" },
"telescope.nvim": { "branch": "master", "commit": "dce1156ca103b8222e4abbfc63f9c6887abf5ec6" },
"todo-comments.nvim": { "branch": "main", "commit": "74c7d28cb50b0713c881ef69bcb6cdd77d8907d1" },
"tokyonight.nvim": { "branch": "main", "commit": "affb21a81e6d7de073378eb86d02864c594104d9" },
"trouble.nvim": { "branch": "main", "commit": "490f7fe6d227f4f7a64f00be8c7dcd7a508ed271" },
"vim-illuminate": { "branch": "master", "commit": "4e1d43cdc39e35f495c7b39a78a349b4d5badad0" },
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
"vim-startuptime": { "branch": "master", "commit": "cb4c112b9e0f224236ee4eab6bf5153406b3f88b" },
"which-key.nvim": { "branch": "main", "commit": "684e96c5e8477f1ee9b3f2e9a12d802fd12c5531" }
}

View File

@@ -0,0 +1,98 @@
-- ################# Basic settings ################ --
-- ================= Holy leader key ================= --
vim.g.mapleader = ','
-- ================= File management ================= --
-- swapfile has global & local config, eventhough help says otherwise
vim.o.swapfile = false -- can open already open files
vim.bo.swapfile = false
vim.o.backup = false
vim.o.writebackup = false
vim.o.autoread = true -- auto file change detection
-- autocmds are currently not supported by nvim (0.5 nighlty)
vim.api.nvim_command([[
" Triger `autoread` when files changes on disk
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() != 'c' | checktime | endif
" Notification after file change
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
]])
-- ================= Scrolling ================= --
vim.o.scrolloff = 8 -- start scrolling when 8 lines away from margins
-- ================= Indentation ================= --
-- pay attention to 'vim.bo' (buffer local options) and 'vim.o' (global options)
-- see :help options.txt
-- for some reason these values need to be set in both o and bo objects
-- eventhough these options are supposed to be local to buffer
vim.o.tabstop = 4 -- maximum width of tab character (measured in spaces)
vim.bo.tabstop = 4
vim.o.shiftwidth = 4 -- size of indent (measured in spaces), should equal tabstop
vim.bo.shiftwidth = 4
vim.o.softtabstop = 4 -- should be the same as the other two above
vim.bo.softtabstop = 4
vim.o.expandtab = true -- expand tabs to spaces
vim.bo.expandtab = true -- expand tabs to spaces
vim.o.smartindent = true -- smart indenting on new line for C-like programs
vim.bo.smartindent = true
vim.o.autoindent = true -- copy the indentation from previous line
vim.bo.autoindent = true
vim.o.smarttab = true -- tab infront of a line inserts blanks based on shiftwidth
-- ================= Number column ================= --
vim.wo.number = true
vim.cmd [[
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
]] -- h/t https://jeffkreeftmeijer.com/vim-number/
-- ================= Search ================= --
vim.o.ignorecase = true -- Ignorecase when searching
vim.o.incsearch = true -- start searching on each keystroke
vim.o.smartcase = true -- ignore case when lowercase, match case when capital case is used
vim.o.hlsearch = true -- highlight the search results
-- ================= Performance ================= --
vim.o.lazyredraw = true -- useful for when executing macros.
vim.o.ttimeoutlen = 30 -- ms to wait for a key code seq to complete
-- ================= Misc ================= --
vim.wo.wrap = true -- wrap long text into multiple lines
vim.o.history = 10000 -- numbers of entries in history for ':' commands and search patterns (10000 = max)
vim.o.updatetime = 300 -- used for CursorHold event (for document highlighting detection)
vim.o.mouse = 'nv' -- allow mose in normal & visual mode
-- better autocomplete behaviour
-- menuone - show popup menu also when there is only one match available
-- preview - show extra information about currently selected completion
-- noinsert - do not insert any text for match until the user selects it from the menu
vim.o.completeopt='menuone,preview,noinsert'
-- allows hidden buffers
-- this means that a modified buffer doesn't need to be saved when changing
-- tabs/windows.
vim.o.hidden=true
-- Copy paste between vim and everything else
vim.o.clipboard = "unnamedplus"

View File

@@ -1,3 +0,0 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here

View File

@@ -1,3 +0,0 @@
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

View File

@@ -1,46 +0,0 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
-- bootstrap lazy.nvim
-- stylua: ignore
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazy").setup({
spec = {
-- add LazyVim and import its plugins
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
-- import any extras modules here
-- { import = "lazyvim.plugins.extras.lang.typescript" },
-- { import = "lazyvim.plugins.extras.lang.json" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
-- import/override with your plugins
{ import = "plugins" },
},
defaults = {
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
lazy = false,
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
-- have outdated releases, which may break your Neovim install.
version = false, -- always use the latest git commit
-- version = "*", -- try installing the latest stable version for plugins that support semver
},
install = { colorscheme = { "tokyonight", "habamax" } },
checker = { enabled = true }, -- automatically check for plugin updates
performance = {
rtp = {
-- disable some rtp plugins
disabled_plugins = {
"gzip",
-- "matchit",
-- "matchparen",
-- "netrwPlugin",
"tarPlugin",
"tohtml",
"tutor",
"zipPlugin",
},
},
},
})

View File

@@ -1,6 +0,0 @@
-- Options are automatically loaded before lazy.nvim startup
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
-- Add any additional options here
local opt = vim.opt
opt.shiftwidth = 4 -- Size of an indent

View File

@@ -0,0 +1,2 @@
DATA_PATH = vim.fn.stdpath('data')
CACHE_PATH = vim.fn.stdpath('cache')

View File

@@ -0,0 +1,74 @@
-- defaults
local opts = { noremap = true, silent = true }
-- TODO: disabled since trying out "clipboard = unnamedplus" option
-- copy
--vim.api.nvim_set_keymap('', '<C-c>', '"+y', opts)
-- paste
--vim.api.nvim_set_keymap('', '<C-v>', '"+p', opts)
-- cut
--vim.api.nvim_set_keymap('', '<C-x>', '"+d', opts)
-- paste in insert mode
--vim.api.nvim_set_keymap('i', '<C-v>', '<Esc>"+pa', opts)
-- make the cursor stay on the same character when leaving insert mode
vim.api.nvim_set_keymap('i', 'ć', '<Esc>l', opts)
vim.api.nvim_set_keymap('i', 'Ć', '<Esc>l', opts)
-- fast scrolling
vim.api.nvim_set_keymap('n', '<C-Down>', '9j', opts)
vim.api.nvim_set_keymap('n', '<C-Up>', '9k', opts)
vim.api.nvim_set_keymap('v', '<C-Down>', '9j', opts)
vim.api.nvim_set_keymap('v', '<C-Up>', '9k', opts)
-- stay in normal mode after inserting a new line
vim.api.nvim_set_keymap('', 'o', 'o <Bs><Esc>', opts)
vim.api.nvim_set_keymap('', 'O', 'O <Bs><Esc>', opts)
-- mapping that opens .vimrc in a new tab for quick editing
vim.api.nvim_set_keymap('n', '<Leader>ev', '<Cmd>tabe $MYVIMRC<CR>', opts)
-- mapping that sources the vimrc in the current filea doesn't work, should change all require calls to dofile
-- or clear all require cache and reimport
-- vim.api.nvim_set_keymap('n', '<Leader>sv', '<Cmd>lua dofile(vim.fn.stdpath(\'config\')..\'/init.lua\')<CR>', { noremap = true, silent = false })
-- Mapping U to Redo.
vim.api.nvim_set_keymap('', 'U', '<C-r>', opts)
vim.api.nvim_set_keymap('', '<C-r>', '<NOP>', opts)
-- indent via Tab
vim.api.nvim_set_keymap('n', '<Tab>', '>>_', opts)
vim.api.nvim_set_keymap('n', '<S-Tab>', '<<_', opts)
vim.api.nvim_set_keymap('v', '<Tab>', '>>_', opts)
vim.api.nvim_set_keymap('v', '<S-Tab>', '<<_', opts)
vim.api.nvim_set_keymap('i', '<Tab>', '\t', opts)
vim.api.nvim_set_keymap('i', '<S-Tab>', '\b', opts)
-- window movement
--vim.api.nvim_set_keymap('', '<C-w>j', '<C-w>h', opts)
--vim.api.nvim_set_keymap('', '<C-w>k', '<C-w>j', opts)
--vim.api.nvim_set_keymap('', '<C-w>l', '<C-w>k', opts)
--vim.api.nvim_set_keymap('', '<C-w>č', '<C-w>l', opts)
-- opening terminal with shortcut
vim.api.nvim_set_keymap('', '<Leader><CR>', '<Cmd>silent !$TERM &<CR>', opts)
-- jumping back and forth
vim.api.nvim_set_keymap('', '<C-K>', '<C-O>', opts)
vim.api.nvim_set_keymap('', '<C-L>', '<C-I>', opts)
-- LSP
vim.api.nvim_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gt', '<Cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gi', '<Cmd>lua vim.lsp.buf.implementation()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gf', '<Cmd>lua vim.lsp.buf.references()<CR>', opts)
-- usages replaced by LspSaga plugin
-- vim.api.nvim_set_keymap('n', 'ga', '<Cmd>lua vim.lsp.buf.code_action()<CR>', opts) -- eg. autoimport
-- vim.api.nvim_set_keymap('n', 'gn', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- vim.api.nvim_set_keymap('n', 'gN', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
-- vim.api.nvim_set_keymap('n', 'h', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
-- vim.api.nvim_set_keymap('n', 'gr', '<Cmd>lua vim.lsp.buf.rename()<CR>', opts)
-- autocomplete
-- if autocomplete popup menu opens pressing enter will complete the first match
vim.api.nvim_set_keymap('i', '<Tab>', 'v:lua.smart_tab()', {expr = true, noremap = true})
vim.api.nvim_set_keymap('i', '<CR>', 'pumvisible() ? "<C-n><Esc>a" : "<CR>"', {expr = true, noremap = true, silent = true})

View File

@@ -0,0 +1,74 @@
local lsp_installer = require'nvim-lsp-installer'
local lsp_installer_servers = require'nvim-lsp-installer.servers'
-- install LSP servers
local function installServer(name)
local ok, server = lsp_installer_servers.get_server(name)
if ok then
if not server:is_installed() then
server:install()
end
end
end
local function installServers(names)
for _,name in pairs(names) do
installServer(name)
end
end
-- find a list of available ones here: https://github.com/williamboman/nvim-lsp-installer
installServers({'angularls', 'bashls', 'dockerls', 'sumneko_lua', 'pyright', 'jsonls', 'cssls', 'tsserver'})
-- setup installed servers
lsp_installer.on_server_ready(function(server)
local opts = {}
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
if server.name == 'sumneko_lua' then
opts = require'lsp-server-config.lua'
end
-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/ADVANCED_README.md
server:setup(opts)
end)
-- diagnostic symbols
local signs = { Error = "", Warn = "", Hint = "", Info = ""}
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end
-- completion symbols
vim.lsp.protocol.CompletionItemKind = {
"  (Text) ",
"  (Method)",
"  (Function)",
"  (Constructor)",
" ﴲ (Field)",
"[] (Variable)",
"  (Class)",
" ﰮ (Interface)",
"  (Module)",
" 襁 (Property)",
"  (Unit)",
"  (Value)",
" 練 (Enum)",
"  (Keyword)",
"  (Snippet)",
"  (Color)",
"  (File)",
"  (Reference)",
"  (Folder)",
"  (EnumMember)",
" ﲀ (Constant)",
" ﳤ (Struct)",
"  (Event)",
"  (Operator)",
"  (TypeParameter)"
}

View File

@@ -0,0 +1,18 @@
local opts = {
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}
return opts

View File

@@ -0,0 +1,5 @@
-- tab movement
local opts = {noremap = true, silent = true}
vim.api.nvim_set_keymap('', 'J', '<Cmd>BufferPrevious<CR>', opts)
vim.api.nvim_set_keymap('', 'Č', '<Cmd>BufferNext<CR>', opts)
vim.api.nvim_set_keymap('', 'X', '<Cmd>BufferClose<CR>', opts)

View File

@@ -0,0 +1,284 @@
local gl = require('galaxyline')
local section = gl.section
local condition = require('galaxyline.condition')
-- TODO: move to util - credit to kraftwerk28/dotfiles
local function u(code)
if type(code) == 'string' then code = tonumber('0x' .. code) end
local c = string.char
if code <= 0x7f then return c(code) end
local t = {}
if code <= 0x07ff then
t[1] = c(bit.bor(0xc0, bit.rshift(code, 6)))
t[2] = c(bit.bor(0x80, bit.band(code, 0x3f)))
elseif code <= 0xffff then
t[1] = c(bit.bor(0xe0, bit.rshift(code, 12)))
t[2] = c(bit.bor(0x80, bit.band(bit.rshift(code, 6), 0x3f)))
t[3] = c(bit.bor(0x80, bit.band(code, 0x3f)))
else
t[1] = c(bit.bor(0xf0, bit.rshift(code, 18)))
t[2] = c(bit.bor(0x80, bit.band(bit.rshift(code, 12), 0x3f)))
t[3] = c(bit.bor(0x80, bit.band(bit.rshift(code, 6), 0x3f)))
t[4] = c(bit.bor(0x80, bit.band(code, 0x3f)))
end
return table.concat(t)
end
-- li - line icon
local li = {
-- block
b = '',
-- bottom left
bl = u'e0b8', -- '',
-- bottom right
br = u'e0ba', -- '',
-- top left
tl = u'e0bc', -- '',
-- top right
tr = u'e0be' -- '',
}
-- taken from LunarVim
local colors = {
bg = '#292D38',
yellow = '#FFEB68',
dark_yellow = '#D7BA7D',
cyan = '#4EC9B0',
green = '#608B4E',
light_green = '#B5CEA8',
string_orange = '#CE9178',
orange = '#FF8800',
purple = '#C586C0',
magenta = '#D16D9E',
grey = '#858585',
blue = '#569CD6',
vivid_blue = '#4FC1FF',
light_blue = '#9CDCFE',
red = '#D16969',
error_red = '#F44747',
info_yellow = '#FFCC66',
white = '#FFFFFF'
}
-- list of windows for which short line will be used
-- short line is just a shorter status line. it's normally used in
-- places where it's not really needed/desired
gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
-- first section to the left will be a colored block shape that will
-- tell in which mode we're in
section.left[1] = {
ViMode = {
provider = function()
-- define color for each mode
local mode_color = {
n = colors.blue, -- normal
i = colors.grey, -- insert
v = colors.purple, -- visual
[''] = colors.purple, -- visual block
V = colors.purple, -- visual line
c = colors.dark_yellow, -- command
no = colors.blue, -- normal ??
s = colors.orange, -- select ??
S = colors.orange, -- select line ??
[''] = colors.orange, -- select block??
ic = colors.yellow,
R = colors.red, -- Replace
Rv = colors.red, -- replace visual?
cv = colors.blue, -- command ??
ce = colors.blue, -- command ??
r = colors.cyan, -- ??
rm = colors.cyan, -- ??
['r?'] = colors.cyan,
['!'] = colors.blue,
t = colors.blue
}
-- set color with nvim command
vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()])
-- returns the text that will be displayed in this section
return li.b..li.tl..' '
end,
highlight = {colors.red, colors.bg}
}
}
-- git branch icon
section.left[2] = {
GitIcon = {
-- main text
provider = function()
return ''
end,
-- enable only if vim is open in git workspace
condition = condition.check_git_workspace,
-- separator is the stuff after the main text
separator = ' ',
-- separator foreground & background color
separator_highlight = {'NONE', colors.bg},
-- main text foreground & background color
highlight = {colors.orange, colors.bg}
}
}
-- git branch name
section.left[3] = {
GitBranch = {
provider = 'GitBranch',
-- enable only if vim is open in git workspace
condition = condition.check_git_workspace,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.grey, colors.bg}
}
}
-- git added files
section.left[4] = {
DiffAdd = {
provider = 'DiffAdd',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.green, colors.bg}
}
}
-- git modified files
section.left[5] = {
DiffModified = {
provider = 'DiffModified',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.blue, colors.bg}
}
}
-- git removed files
section.left[6] = {
DiffRemove = {
provider = 'DiffRemove',
condition = condition.hide_in_width,
icon = '',
highlight = {colors.red, colors.bg}
}
}
-- diagnostics
section.right[1] = {
DiagnosticError = {
provider = 'DiagnosticError',
icon = '',
highlight = {colors.error_red, colors.bg}
}
}
section.right[2] = {
DiagnosticWarn = {
provider = 'DiagnosticWarn',
icon = '',
highlight = {colors.orange, colors.bg}
}
}
section.right[3] = {
DiagnosticHint = {
provider = 'DiagnosticHint',
icon = '',
highlight = {colors.vivid_blue, colors.bg}
}
}
section.right[4] = {
DiagnosticInfo = {
provider = 'DiagnosticInfo',
icon = '',
highlight = {
colors.info_yellow,
colors.bg
}
}
}
-- cosmetics
section.right[5] = {
Space2 = {
provider = function()
return li.br..li.b
end,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.white, colors.bg}
}
}
-- lsp info
section.right[7] = {
ShowLspClient = {
provider = 'GetLspClient',
condition = function()
local tbl = {['dashboard'] = true, [' '] = true}
if tbl[vim.bo.filetype] then return false end
return true
end,
separator = ' ',
separator_highlight = {colors.grey, colors.white},
icon = '',
highlight = {colors.grey, colors.white}
}
}
-- file type
section.right[8] = {
BufferType = {
provider = 'FileTypeName',
separator = li.b..li.tl..' ',
separator_highlight = {colors.white, colors.bg},
highlight = {colors.grey, colors.bg}
}
}
section.right[9] = {
FileEncode = {
provider = 'FileEncode',
condition = condition.hide_in_width,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.grey, colors.bg}
}
}
-- cosmetics: right dash
section.right[10] = {
LastDash = {
provider = function()
return li.tr..li.b
end,
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.white, colors.bg}
}
}
-- short line settings
section.short_line_left[1] = {
BufferType = {
provider = 'FileTypeName',
separator = ' ',
separator_highlight = {'NONE', colors.bg},
highlight = {colors.grey, colors.bg}
}
}
section.short_line_left[2] = {
SFileName = {
provider = 'SFileName',
condition = condition.buffer_not_empty,
highlight = {
colors.grey,
colors.bg
}
}
}
section.short_line_right[1] = {
BufferIcon = {
provider = 'BufferIcon',
highlight = {
colors.grey,
colors.bg
}
}
}

View File

@@ -0,0 +1,56 @@
require('gitsigns').setup {
keymaps = {
-- Default keymap options
noremap = tue,
buffer = true,
['n <leader>hn'] = { expr = true, "&diff ? '<leader>hn' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"},
['n <leader>hN'] = { expr = true, "&diff ? '<leader>hN' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"},
['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>',
['n <leader>hR'] = '<cmd>lua require"gitsigns".reset_buffer()<CR>',
['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line()<CR>',
},
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 = 100,
ignore_whitespace = false,
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
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
},
}

View File

@@ -0,0 +1,8 @@
-- settings for both plugins:
-- 'lukas-reineke/indent-blankline.nvim'
-- 'Yggdroot/indentLine'
vim.api.nvim_command("let g:indentLine_char = '⎸'")
vim.api.nvim_command("let g:indentLine_fileTypeExclude = ['text', 'markdown', 'help']")
vim.api.nvim_command("let g:indentLine_bufNameExclude = ['STARTIFY', 'NVIMTREE']")
vim.api.nvim_command("let g:indent_blankline_extra_indent_level = -1")

View File

@@ -0,0 +1,7 @@
-- Lua
require('lsp-colors').setup({
Error = '#F44747',
Warning = '#FF8800',
Hint = '#4FC1FF',
Information = '#FFCC66'
})

View File

@@ -0,0 +1,40 @@
local opts = {silent = true, noremap = true}
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>TroubleToggle<cr>", opts)
require('trouble').setup{
position = "bottom", -- position of the list can be: bottom, top, left, right
icons = true, -- use devicons for filenames
mode = "document_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
close = "q", -- close the list
cancel = {"ć", "Ć"}, -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "H", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = {"zM", "zm"}, -- close all folds
open_folds = {"zR", "zr"}, -- open all folds
toggle_fold = {"zA", "za"}, -- toggle fold of current file
previous = "l", -- preview item
next = "k" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = ""
},
use_diagnostic_signs = true -- enabling this will use the signs defined in your lsp client
}

View File

@@ -0,0 +1,8 @@
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap('n', 'ga', '<Cmd>lua require("lspsaga.codeaction").code_action()<CR>', opts) -- eg. autoimport
vim.api.nvim_set_keymap('v', 'ga', ':<C-U>lua require("lspsaga.codeaction").range_code_action()<CR>', opts) -- eg. autoimport
vim.api.nvim_set_keymap('n', 'h', '<Cmd>lua require("lspsaga.hover").render_hover_doc()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gr', '<Cmd>lua require("lspsaga.rename").rename()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gn', '<Cmd>lua require"lspsaga.diagnostic".lsp_jump_diagnostic_prev()<CR>', opts)
vim.api.nvim_set_keymap('n', 'gN', '<Cmd>lua require"lspsaga.diagnostic".lsp_jump_diagnostic_next()<CR>', opts)

View File

@@ -0,0 +1,58 @@
-- TODO( fix
local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
mapping = {
['<C-b>'] = 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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Setup lspconfig.
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
--capabilities = capabilities
-- }

View File

@@ -0,0 +1,67 @@
local opts = {silent = true, noremap = true}
vim.api.nvim_set_keymap('n', '<C-n>', '<Cmd>NvimTreeToggle<CR>', opts)
vim.api.nvim_set_keymap('n', '<leader>r', '<Cmd>NvimTreeRefresh<CR>', opts)
-- find the currently open file in tree
vim.api.nvim_set_keymap('n', '<leader>n', '<Cmd>NvimTreeFindFile<CR>', opts)
local tree_cb = require'nvim-tree.config'.nvim_tree_callback
local list = {
{ key = "<C-t>", cb = tree_cb("tabnew") },
{ key = "<CR>", cb = tree_cb("edit") },
{ key = "o", cb = tree_cb("edit") },
{ key = "<2-LeftMouse>", cb = tree_cb("edit") },
{ key = "<2-RightMouse>", cb = tree_cb("cd") },
{ key = "<Tab>", cb = tree_cb("preview") },
{ key = "R", cb = tree_cb("refresh") },
{ key = "a", cb = tree_cb("create") },
{ key = "d", cb = tree_cb("remove") },
{ key = "r", cb = tree_cb("rename") },
{ key = "x", cb = tree_cb("cut") },
{ key = "y", cb = tree_cb("copy") },
{ key = "p", cb = tree_cb("paste") },
{ key = "<", cb = tree_cb("dir_up") },
{ key = "q", cb = tree_cb("close") }
}
require'nvim-tree'.setup {
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 = false,
update_cwd = false,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = false,
custom = {}
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = 'left',
mappings = {
custom_only = false,
list = list,
}
}
}

View File

@@ -0,0 +1,8 @@
require'nvim-treesitter.configs'.setup {
-- will install treesitter for all available languages
ensure_installed = 'all',
ignore_install = {'haskell'}, -- broken
highlight = {
enable = true
}
}

View File

@@ -0,0 +1,64 @@
-- Find files using lua fuctions
local opts = { silent = true, noremap = true }
vim.api.nvim_set_keymap('n', '<Leader>ff', "<Cmd>lua require'telescope.builtin'.find_files()<CR>", {silent=false, noremap=true})
vim.api.nvim_set_keymap('n', '<Leader>fg', "<Cmd>lua require'telescope.builtin'.live_grep()<CR>", opts)
vim.api.nvim_set_keymap('n', '<Leader>fb', "<Cmd>lua require'telescope.builtin'.buffers()<CR>", opts)
vim.api.nvim_set_keymap('n', '<Leader>fh', "<Cmd>lua require'telescope.builtin'.help_tags()<CR>", opts)
local actions = require('telescope.actions')
require('telescope').setup {
defaults = {
-- program to use for searching with its arguments
find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
-- prompt_position = 'top', -- have prompt at the top (has no effect on vertical configuration)
prompt_prefix = '', -- symbol on prompt window
selection_caret = '', -- symbol on selected row in results window
entry_prefix = ' ', -- symbol on non-selected rows in results window
initial_mode = 'insert', -- start in insert mode
selection_strategy = 'reset', -- what happens to selection when list changes
sorting_strategy = 'ascending', -- start with most important search on top
layout_strategy = 'vertical', -- vertical layout
layout_config = {
vertical = {
mirror = true, -- windows should be in this order from top to bottom: search, results, preview
preview_height = 0.5 -- preview window takes 0.5 of the total window height
}
},
file_sorter = require'telescope.sorters'.get_fuzzy_file,
file_ignore_patterns = {'node_modules/.*'}, -- never search in node_modules/ dir
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
display_path = true,
winblend = 0, -- window should not be transparent
border = {}, -- no border?
borderchars = {'', '', '', '', '', '', '', ''}, -- border chars
color_devicons = true, -- colorize used icons
use_less = true, -- less is bash program for preview file contents
set_env = {['COLORTERM'] = 'truecolor'}, -- use all the colors
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
-- preview_cutoff = 120,
mappings = {
i = {
['<C-k>'] = actions.move_selection_next,
['<C-l>'] = actions.move_selection_previous,
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
-- ['ć'] = actions.close,
['<CR>'] = actions.select_default + actions.center,
},
n = {
['<C-k>'] = actions.move_selection_next,
['<C-l>'] = actions.move_selection_previous,
['<C-q>'] = actions.smart_send_to_qflist + actions.open_qflist,
['ć'] = actions.close,
}
}
},
extensions = {
fzy_native = {
override_generic_sorter = false,
override_file_sorter = true,
}
}
}

View File

@@ -0,0 +1,127 @@
local fn = vim.fn
local installPath = DATA_PATH..'/site/pack/packer/start/packer.nvim'
-- install packer if it's not installed already
local packerBootstrap = nil
if fn.empty(fn.glob(installPath)) > 0 then
packerBootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', installPath})
vim.cmd [[packadd packer.nvim]]
end
local packer = require('packer').startup(function(use)
-- Packer should manage itself
use 'wbthomason/packer.nvim'
-- colorscheme
use 'drewtempelmeyer/palenight.vim'
-- git integration
use {
'lewis6991/gitsigns.nvim',
requires = {
'nvim-lua/plenary.nvim'
}
}
-- surround vim
use 'tpope/vim-surround'
-- nerd commenter
use 'scrooloose/nerdcommenter'
-- status line
use 'glepnir/galaxyline.nvim'
-- show recent files on empty nvim command
use 'mhinz/vim-startify'
-- lsp config
use {
'neovim/nvim-lspconfig',
'williamboman/nvim-lsp-installer',
}
-- for LSP autocompletion
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'hrsh7th/nvim-cmp'
-- For vsnip users.
use 'hrsh7th/cmp-vsnip'
use 'hrsh7th/vim-vsnip'
-- TODO: prettify telescope vim, make it use regex & shorten the window
-- telescope - searching / navigation
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
-- better hotfix window (for showing and searching through results in telescope's find usages)
-- TODO: learn how to use?
use {"kevinhwang91/nvim-bqf"}
-- better highlighting
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
use {
'kyazdani42/nvim-tree.lua',
requires = 'kyazdani42/nvim-web-devicons',
config = function() require'nvim-tree'.setup {} end
}
-- which-key
use {
"folke/which-key.nvim",
config = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
}
-- prettier tabs
use 'romgrk/barbar.nvim'
-- nice diagnostic pane on the bottom
use 'folke/lsp-trouble.nvim'
-- support the missing lsp diagnostic colors
use 'folke/lsp-colors.nvim'
-- better LSP UI (for code actions, rename etc.)
use 'tami5/lspsaga.nvim'
-- show indentation levels
use 'lukas-reineke/indent-blankline.nvim'
-- highlight variables under cursor
use 'RRethy/vim-illuminate'
-- this will automatically install listed dependencies
-- only the first time NeoVim is opened, because that's when Packer gets installed
if packerBootstrap then
require('packer').sync()
end
end)
-- plugin specific configs go here
require('plugin-config/nvim-cmp')
require('plugin-config/telescope')
require('plugin-config/nvim-tree')
require('plugin-config/nvim-treesitter')
require('plugin-config/barbar')
require('plugin-config/lsp-colors')
require('plugin-config/lsp-trouble')
require('plugin-config/lspsaga')
require('plugin-config/galaxyline')
require('plugin-config/gitsigns')
require('plugin-config/indent-guide-lines')
return packer

View File

@@ -1,269 +0,0 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under config.plugins will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- add symbols-outline
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
config = true,
},
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local cmp = require("cmp")
opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } }))
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add telescope-fzf-native
{
"telescope.nvim",
dependencies = {
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").load_extension("fzf")
end,
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"help",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
-- add tsx and treesitter
ensure_installed = {
"tsx",
"typescript",
},
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
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
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
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" }),
})
end,
},
}

View File

@@ -0,0 +1,10 @@
-- ################# Basic settings dependent on plugins ################ --
-- ================= Visualization ================= --
vim.o.termguicolors = true
vim.o.background = 'dark'
-- TODO: Catpuchino
vim.cmd('colorscheme palenight')
vim.api.nvim_command('let g:palenight_terminal_italics=1')

View File

@@ -0,0 +1,239 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/benk/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/benk/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/benk/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/benk/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/benk/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
["barbar.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/barbar.nvim",
url = "https://github.com/romgrk/barbar.nvim"
},
["cmp-buffer"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-cmdline"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
url = "https://github.com/hrsh7th/cmp-cmdline"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-path"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
["cmp-vsnip"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/cmp-vsnip",
url = "https://github.com/hrsh7th/cmp-vsnip"
},
["galaxyline.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/galaxyline.nvim",
url = "https://github.com/glepnir/galaxyline.nvim"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["indent-blankline.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
},
["lsp-colors.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/lsp-colors.nvim",
url = "https://github.com/folke/lsp-colors.nvim"
},
["lsp-trouble.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/lsp-trouble.nvim",
url = "https://github.com/folke/lsp-trouble.nvim"
},
["lspsaga.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
url = "https://github.com/tami5/lspsaga.nvim"
},
nerdcommenter = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nerdcommenter",
url = "https://github.com/scrooloose/nerdcommenter"
},
["nvim-bqf"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-bqf",
url = "https://github.com/kevinhwang91/nvim-bqf"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lsp-installer"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
url = "https://github.com/williamboman/nvim-lsp-installer"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
config = { "\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14nvim-tree\frequire\0" },
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/kyazdani42/nvim-tree.lua"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/kyazdani42/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["palenight.vim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/palenight.vim",
url = "https://github.com/drewtempelmeyer/palenight.vim"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["vim-illuminate"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/vim-illuminate",
url = "https://github.com/RRethy/vim-illuminate"
},
["vim-startify"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/vim-startify",
url = "https://github.com/mhinz/vim-startify"
},
["vim-surround"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/vim-surround",
url = "https://github.com/tpope/vim-surround"
},
["vim-vsnip"] = {
loaded = true,
path = "/home/benk/.local/share/nvim/site/pack/packer/start/vim-vsnip",
url = "https://github.com/hrsh7th/vim-vsnip"
}
}
time([[Defining packer_plugins]], false)
-- Config for: nvim-tree.lua
time([[Config for nvim-tree.lua]], true)
try_loadstring("\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14nvim-tree\frequire\0", "config", "nvim-tree.lua")
time([[Config for nvim-tree.lua]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

View File

@@ -1,3 +0,0 @@
indent_type = "Spaces"
indent_width = 2
column_width = 120