new neovim config
This commit is contained in:
19
.config/nvim/init.lua
Normal file
19
.config/nvim/init.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
require("config.lazy")
|
||||||
|
|
||||||
|
vim.opt.expandtab = false
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
vim.opt.relativenumber = false
|
||||||
|
vim.opt.number = true
|
||||||
|
|
||||||
|
local builtin = require("telescope.builtin")
|
||||||
|
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
|
||||||
|
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
|
||||||
|
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
|
||||||
|
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>F", function()
|
||||||
|
require("conform").format({ async = true })
|
||||||
|
end, {})
|
||||||
|
|
||||||
10
.config/nvim/lazy-lock.json
Normal file
10
.config/nvim/lazy-lock.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"blink.cmp": { "branch": "main", "commit": "4f38ce99a472932d5776337f08f7a8180f1f571a" },
|
||||||
|
"catppuccin": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" },
|
||||||
|
"conform.nvim": { "branch": "master", "commit": "374aaf384e2e841607b8e2fe63fa3ad01d111c91" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "28d480e0624b259095e56f353ec911f9f2a0f404" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
|
||||||
|
}
|
||||||
36
.config/nvim/lua/config/lazy.lua
Normal file
36
.config/nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||||
|
-- loading lazy.nvim so that mappings are correct.
|
||||||
|
-- This is also a good place to setup other settings (vim.opt)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- import your plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
|
-- colorscheme that will be used when installing plugins.
|
||||||
|
install = { colorscheme = { "catppuccin-mocha" } },
|
||||||
|
-- automatically check for plugin updates
|
||||||
|
checker = { enabled = true },
|
||||||
|
})
|
||||||
|
|
||||||
54
.config/nvim/lua/plugins/blink.lua
Normal file
54
.config/nvim/lua/plugins/blink.lua
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
return {
|
||||||
|
'saghen/blink.cmp',
|
||||||
|
-- optional: provides snippets for the snippet source
|
||||||
|
--dependencies = { 'rafamadriz/friendly-snippets' },
|
||||||
|
|
||||||
|
-- use a release tag to download pre-built binaries
|
||||||
|
version = '1.*',
|
||||||
|
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
|
||||||
|
-- build = 'cargo build --release',
|
||||||
|
-- If you use nix, you can build from source using latest nightly rust with:
|
||||||
|
-- build = 'nix run .#build-plugin',
|
||||||
|
|
||||||
|
---@module 'blink.cmp'
|
||||||
|
---@type blink.cmp.Config
|
||||||
|
opts = {
|
||||||
|
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||||
|
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||||
|
-- 'enter' for enter to accept
|
||||||
|
-- 'none' for no mappings
|
||||||
|
--
|
||||||
|
-- All presets have the following mappings:
|
||||||
|
-- C-space: Open menu or open docs if already open
|
||||||
|
-- C-n/C-p or Up/Down: Select next/previous item
|
||||||
|
-- C-e: Hide menu
|
||||||
|
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||||
|
--
|
||||||
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
|
keymap = { preset = 'enter' },
|
||||||
|
|
||||||
|
appearance = {
|
||||||
|
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
||||||
|
-- Adjusts spacing to ensure icons are aligned
|
||||||
|
nerd_font_variant = 'mono'
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Only show the documentation popup when manually triggered
|
||||||
|
completion = { documentation = { auto_show = false } },
|
||||||
|
|
||||||
|
-- Default list of enabled providers defined so that you can extend it
|
||||||
|
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||||
|
sources = {
|
||||||
|
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||||
|
},
|
||||||
|
|
||||||
|
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||||
|
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||||
|
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||||
|
--
|
||||||
|
-- See the fuzzy documentation for more information
|
||||||
|
fuzzy = { implementation = "prefer_rust_with_warning" }
|
||||||
|
},
|
||||||
|
opts_extend = { "sources.default" }
|
||||||
|
}
|
||||||
|
|
||||||
9
.config/nvim/lua/plugins/catppuccin.lua
Normal file
9
.config/nvim/lua/plugins/catppuccin.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
"catppuccin/nvim",
|
||||||
|
name = "catppuccin",
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
vim.cmd([[colorscheme catppuccin-macchiato]])
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
9
.config/nvim/lua/plugins/conform.lua
Normal file
9
.config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
python = { "black" },
|
||||||
|
c = { "clang-format" }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
21
.config/nvim/lua/plugins/nvim-lsp.lua
Normal file
21
.config/nvim/lua/plugins/nvim-lsp.lua
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
return {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
dependencies = { 'saghen/blink.cmp' },
|
||||||
|
|
||||||
|
-- example using `opts` for defining servers
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
clangd = {},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
for server, config in pairs(opts.servers) do
|
||||||
|
-- passing config.capabilities to blink.cmp merges with the capabilities in your
|
||||||
|
-- `opts[server].capabilities, if you've defined it
|
||||||
|
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||||
|
lspconfig[server].setup(config)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
15
.config/nvim/lua/plugins/nvim-treesitter.lua
Normal file
15
.config/nvim/lua/plugins/nvim-treesitter.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function ()
|
||||||
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
configs.setup({
|
||||||
|
ensure_installed = { "c", "lua", "vim", "vimdoc" },
|
||||||
|
sync_install = false,
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
5
.config/nvim/lua/plugins/telescope.lua
Normal file
5
.config/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
tag = "0.1.8",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" }
|
||||||
|
}
|
||||||
38
README.md
38
README.md
@@ -1,33 +1,21 @@
|
|||||||
# dotfiles
|
# dotfiles
|
||||||
My attempt to make my personal dotfiles (I'm doing this to learn more about Linux and the Vim's world!)
|
My personal dotfiles!
|
||||||
|
|
||||||
## My setup
|
## My setup
|
||||||
- Neovim
|
- Neovim
|
||||||
|
|
||||||
### Startup
|
## Requirements
|
||||||
Before doing something, you should install vimplug following this [guide](https://github.com/junegunn/vim-plug).
|
- [ripgrep](https://github.com/BurntSushi/ripgrep)
|
||||||
|
|
||||||
After cloned the repo, move the `init.vim` in the neovim config, start neovim and type: `:PlugInstall`. This should do all the stuff needed.
|
## Installation
|
||||||
|
Just copy the folders under `.config` in your `$HOME/.config/`.
|
||||||
### Other
|
|
||||||
Install your preferred LSP (`coc-rust-analyzer`, `coc-python`, and so on...)
|
|
||||||
> Some of them are already installed...
|
|
||||||
|
|
||||||
For python autoformatting you should install `black`:
|
|
||||||
```bash
|
|
||||||
pip install --upgrade black
|
|
||||||
```
|
|
||||||
If you have any issues, try formatting with:
|
|
||||||
```bash
|
|
||||||
python -m black {file}
|
|
||||||
```
|
|
||||||
If you are on Windows you can install clangd by typing:
|
|
||||||
```bash
|
|
||||||
:CocCommand clangd.install
|
|
||||||
```
|
|
||||||
|
|
||||||
## Keybindings
|
## Keybindings
|
||||||
- CTRL + ww -> change window's focus
|
The leader key is the `Space`.
|
||||||
- CTRL + y -> accept autocomplete suggestion
|
|
||||||
- m (with nerdtree focused) -> opens the nerdtree's menu
|
`<leader>ff` - Find files
|
||||||
- F3 -> start the :AutoFormat cmd
|
`<leader>fg` - Live grep
|
||||||
|
`<leader>fb` - Telescope buffers
|
||||||
|
`<leader>fh` - Help tags
|
||||||
|
`<leader>F` - Format file (only works with C files)
|
||||||
|
|
||||||
|
|||||||
38
init.lua
38
init.lua
@@ -1,38 +0,0 @@
|
|||||||
local vim = vim
|
|
||||||
vim.g.mapleader = ' '
|
|
||||||
vim.opt.clipboard = 'unnamed'
|
|
||||||
|
|
||||||
-- vim-plug plugin manager config for Neovim
|
|
||||||
local Plug = vim.fn['plug#']
|
|
||||||
|
|
||||||
vim.call('plug#begin')
|
|
||||||
|
|
||||||
Plug('williamboman/mason.nvim')
|
|
||||||
Plug('williamboman/mason-lspconfig.nvim')
|
|
||||||
Plug('neovim/nvim-lspconfig')
|
|
||||||
Plug('nvim-treesitter/nvim-treesitter', { ['do'] = ':TSUpdate' })
|
|
||||||
Plug('neoclide/coc.nvim', { ['branch'] = 'release' })
|
|
||||||
Plug('nvim-treesitter/nvim-treesitter')
|
|
||||||
Plug('nvim-lua/plenary.nvim')
|
|
||||||
Plug('nvim-telescope/telescope.nvim', { ['tag'] = '0.1.5' })
|
|
||||||
--Plug('numirias/semshi', { ['do'] = ':UpdateRemotePlugins' })
|
|
||||||
|
|
||||||
vim.call('plug#end')
|
|
||||||
|
|
||||||
require('mason').setup()
|
|
||||||
require('mason-lspconfig').setup()
|
|
||||||
|
|
||||||
require('mason-lspconfig').setup_handlers({
|
|
||||||
function(server)
|
|
||||||
require('lspconfig')[server].setup({})
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
|
||||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
|
||||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
|
||||||
|
|
||||||
vim.api.nvim_set_keymap('i', '<Tab>', 'pumvisible() ? "<C-n>" : "<Tab>"', { expr = true, noremap = true })
|
|
||||||
vim.api.nvim_set_keymap('i', '<S-Tab>', 'pumvisible() ? "<C-p>" : "<C-h>"', { expr = true, noremap = true })
|
|
||||||
65
init.vim
65
init.vim
@@ -1,65 +0,0 @@
|
|||||||
let mapleader = "\<Space>"
|
|
||||||
|
|
||||||
set encoding=utf-8
|
|
||||||
set termguicolors
|
|
||||||
set noswapfile
|
|
||||||
set undofile
|
|
||||||
set clipboard=unnamedplus
|
|
||||||
set mouse=a
|
|
||||||
|
|
||||||
set autoindent
|
|
||||||
set expandtab
|
|
||||||
set shiftwidth=4
|
|
||||||
set softtabstop=4
|
|
||||||
|
|
||||||
set number
|
|
||||||
set relativenumber
|
|
||||||
set cursorline
|
|
||||||
|
|
||||||
set showmatch
|
|
||||||
set matchpairs+=<:>
|
|
||||||
set matchtime=5
|
|
||||||
|
|
||||||
set hlsearch
|
|
||||||
set incsearch
|
|
||||||
set ignorecase
|
|
||||||
set smartcase
|
|
||||||
|
|
||||||
call plug#begin()
|
|
||||||
Plug 'tpope/vim-fugitive' " Git integration
|
|
||||||
Plug 'tpope/vim-commentary' " Commenting
|
|
||||||
Plug 'tpope/vim-surround' " Manipulating surroundings
|
|
||||||
Plug 'preservim/nerdtree' " File explorer
|
|
||||||
Plug 'itchyny/lightline.vim' " Statusline
|
|
||||||
|
|
||||||
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Language server protocol support
|
|
||||||
Plug 'SirVer/ultisnips' " Snippet engine
|
|
||||||
Plug 'honza/vim-snippets' " Snippets library
|
|
||||||
Plug 'vim-autoformat/vim-autoformat'
|
|
||||||
|
|
||||||
Plug 'bfrg/vim-cpp-modern'
|
|
||||||
Plug 'rust-lang/rust.vim'
|
|
||||||
Plug 'kh3phr3n/python-syntax'
|
|
||||||
|
|
||||||
Plug 'folke/tokyonight.nvim'
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
colorscheme tokyonight-storm
|
|
||||||
|
|
||||||
let g:coc_global_extensions = [
|
|
||||||
\ 'coc-snippets',
|
|
||||||
\ 'coc-clangd',
|
|
||||||
\ 'coc-rust-analyzer',
|
|
||||||
\ 'coc-python',
|
|
||||||
\]
|
|
||||||
|
|
||||||
if has('nvim')
|
|
||||||
set updatetime=300
|
|
||||||
set winwidth=84
|
|
||||||
set backupdir=~/.config/nvim/backup//
|
|
||||||
set directory=~/.config/nvim/swap//
|
|
||||||
endif
|
|
||||||
|
|
||||||
autocmd VimEnter * NERDTree
|
|
||||||
noremap <F3> :Autoformat<CR>
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user