mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-26 13:50:51 +01:00
Added new neovim config: WIP
This commit is contained in:
parent
c1e4547e47
commit
88e3a5c360
7 changed files with 371 additions and 480 deletions
|
@ -1,13 +1,25 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
{ pkgs, home, lib, config, ... }:
|
||||
let
|
||||
cfg = config.luj.programs.neovim;
|
||||
dusk-vim = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "dusk-vim";
|
||||
onedarker = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "onedarker";
|
||||
version = "1.0.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "notusknot";
|
||||
repo = "dusk-vim";
|
||||
rev = "8eb71f092ebfa173a6568befbe522a56e8382756";
|
||||
sha256 = "09l4hda5jnyigc2hhlirv1rc8hsnsc4zgcv4sa4br8fryi73nf4g";
|
||||
owner = "lunarvim";
|
||||
repo = "onedarker.nvim";
|
||||
rev = "2d02768b6801d0acdef7f6e1ac8db0929581d5bc";
|
||||
sha256 = "sha256-admAB4ybJpN/4+MtZd9CEQKZEq8nBZJsLiB6gUUylrc=";
|
||||
};
|
||||
};
|
||||
|
||||
coc-sql = pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "coq-sql";
|
||||
version = "1.0.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "fannheyward";
|
||||
repo = "coc-sql";
|
||||
rev = "0ac7d35200bda0abcc1b0f91ad5cb08eb44b1eca";
|
||||
sha256 = "sha256-admAB4ybJpN/4+MtZd9CEQKZEq8nBZJsLiB6gUUylrc=";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -19,55 +31,80 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
home.packages = with pkgs; [ nixfmt git nodejs ripgrep ];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# File tree
|
||||
nvim-web-devicons
|
||||
nvim-tree-lua
|
||||
package = pkgs.unstable.neovim-unwrapped;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
|
||||
coc = {
|
||||
enable = true;
|
||||
settings = {
|
||||
coc.preferences.formatOnSaveFiletypes = [ "nix" "rust" "sql" ];
|
||||
languageserver = {
|
||||
nix = {
|
||||
command = "rnix-lsp";
|
||||
filetypes = [
|
||||
"nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
withPython3 = true;
|
||||
plugins = with pkgs.unstable.vimPlugins; [
|
||||
#theme
|
||||
onedarker
|
||||
|
||||
# LSP
|
||||
nvim-lspconfig
|
||||
# Languages
|
||||
vim-nix
|
||||
|
||||
# Eyecandy
|
||||
nvim-treesitter
|
||||
bufferline-nvim
|
||||
galaxyline-nvim
|
||||
nvim-colorizer-lua
|
||||
pears-nvim
|
||||
dusk-vim
|
||||
plenary-nvim
|
||||
|
||||
# Lsp and completion
|
||||
nvim-lspconfig
|
||||
nvim-compe
|
||||
|
||||
# Telescope
|
||||
#Telescope
|
||||
telescope-nvim
|
||||
|
||||
# Indent lines
|
||||
#indent-blankline-nvim
|
||||
];
|
||||
extraPackages = with pkgs; [
|
||||
gcc
|
||||
rnix-lsp
|
||||
tree-sitter
|
||||
sumneko-lua-language-server
|
||||
ripgrep
|
||||
nvim-web-devicons
|
||||
|
||||
|
||||
(nvim-treesitter.withPlugins (ps: with ps; [
|
||||
tree-sitter-nix
|
||||
tree-sitter-python
|
||||
]))
|
||||
|
||||
|
||||
bufferline-nvim
|
||||
nvim-colorizer-lua
|
||||
pears-nvim
|
||||
nvim-tree-lua
|
||||
|
||||
vim-lastplace
|
||||
vim-nix
|
||||
vim-nixhash
|
||||
vim-yaml
|
||||
vim-toml
|
||||
vim-airline
|
||||
vim-devicons
|
||||
zig-vim
|
||||
vim-scriptease
|
||||
semshi
|
||||
coc-sql
|
||||
coc-prettier
|
||||
coc-rust-analyzer
|
||||
rust-vim
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [ rust-analyzer rnix-lsp ];
|
||||
|
||||
extraConfig = ''
|
||||
luafile ${./lua}/lsp.lua
|
||||
luafile ${./lua}/nvim-tree.lua
|
||||
luafile ${./lua}/galaxyline.lua
|
||||
luafile ${./lua}/settings.lua
|
||||
luafile ${./settings.lua}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
214
home-manager-modules/neovim/default.nix.bak
Normal file
214
home-manager-modules/neovim/default.nix.bak
Normal file
|
@ -0,0 +1,214 @@
|
|||
{ pkgs, home, ... }:
|
||||
{
|
||||
home.sessionVariables = { EDITOR = "vim"; };
|
||||
|
||||
home.packages = with pkgs; [ nixfmt git ];
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
|
||||
coc.enable = true;
|
||||
|
||||
withPython3 = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
#theme
|
||||
dracula-vim
|
||||
|
||||
# LSP
|
||||
nvim-lspconfig
|
||||
plenary-nvim
|
||||
|
||||
#Telescope
|
||||
telescope-nvim
|
||||
|
||||
nvim-web-devicons
|
||||
|
||||
|
||||
(nvim-treesitter.withPlugins (ps: with ps; [
|
||||
tree-sitter-nix
|
||||
tree-sitter-python
|
||||
tree-sitter-svelte
|
||||
]))
|
||||
|
||||
|
||||
bufferline-nvim
|
||||
galaxyline-nvim
|
||||
nvim-colorizer-lua
|
||||
pears-nvim
|
||||
# dusk-vim
|
||||
nvim-tree-lua
|
||||
|
||||
vim-lastplace
|
||||
vim-nix
|
||||
lean-nvim
|
||||
vim-nixhash
|
||||
vim-yaml
|
||||
vim-toml
|
||||
vim-airline
|
||||
vim-devicons
|
||||
zig-vim
|
||||
vim-scriptease
|
||||
semshi
|
||||
coc-nvim
|
||||
coc-rust-analyzer
|
||||
rust-vim
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [ rust-analyzer ];
|
||||
|
||||
extraConfig = ''
|
||||
syntax on
|
||||
" This has to be defined at the top of the file
|
||||
let maplocalleader = "\<Space>\<Space>"
|
||||
let mapleader = "\<Space>"
|
||||
|
||||
colorscheme dracula
|
||||
|
||||
set scrolloff=4
|
||||
|
||||
" noswapfile
|
||||
" nobackup
|
||||
" undodir=~/.vim/undodir
|
||||
" undofile
|
||||
" spell
|
||||
|
||||
" Search case sensitivity
|
||||
set smartcase
|
||||
set ignorecase
|
||||
|
||||
" No error bells
|
||||
set noerrorbells
|
||||
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
" Flex
|
||||
nnoremap <C-s> gg0<C-v>G$y<C-v>G$r Go<esc>0"_Dp$pgg$p
|
||||
|
||||
" Correct my typos
|
||||
command W :w
|
||||
command Wq :wq
|
||||
command WQ :wq
|
||||
|
||||
" Move text arround
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
inoremap <C-j> <esc>:m .+1<CR>==i
|
||||
inoremap <C-k> <esc>:m .-2<CR>==i
|
||||
nnoremap <leader>j :m .+1<CR>==
|
||||
nnoremap <leader>k :m .-2<CR>==
|
||||
|
||||
" Completion
|
||||
set wildmenu
|
||||
set completeopt=longest,menuone
|
||||
|
||||
" Completion in command bar
|
||||
set wmnu
|
||||
set wildmode=list:longest,list:full
|
||||
set wildignore=*.o
|
||||
|
||||
" Command bar
|
||||
set history=2000
|
||||
|
||||
" Search
|
||||
set incsearch
|
||||
set nohlsearch
|
||||
|
||||
" No mouse
|
||||
" set mouse=
|
||||
|
||||
" Encoding
|
||||
set encoding=utf-8
|
||||
set fileencoding=utf-8
|
||||
|
||||
" Make neovim more powerfull
|
||||
set nocompatible
|
||||
|
||||
" Allow backspace in insert mode
|
||||
set backspace=indent,eol,start
|
||||
|
||||
" Highlight the current line
|
||||
set cursorline
|
||||
hi CursorLine term=bold cterm=bold ctermbg=darkgrey
|
||||
|
||||
" Line numbers
|
||||
set number
|
||||
set relativenumber
|
||||
|
||||
" Tabs vs spaces
|
||||
set tabstop=2
|
||||
set softtabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
|
||||
" Auto indent
|
||||
set smartindent
|
||||
set autoindent
|
||||
|
||||
" Ctrl-T for new tab
|
||||
nnoremap <C-t> :tabnew<cr>
|
||||
|
||||
" Delete tralling whitespace on save
|
||||
autocmd BufWritePre * %s/\s\+$//e
|
||||
|
||||
" Spell-check
|
||||
map <F6> :setlocal spell! spelllang=en_us<CR>
|
||||
map <F7> :setlocal spell! spelllang=fr<CR>
|
||||
|
||||
" Line and word count
|
||||
map <F3> :!wc <C-R>%<CR>
|
||||
|
||||
" Lean
|
||||
lua<<EOF
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
|
||||
end
|
||||
require("nvim-tree").setup()
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', 'ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', 'fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', 'fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', 'fh', builtin.help_tags, {})
|
||||
|
||||
require'nvim-web-devicons'.setup()
|
||||
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
@ -1,204 +0,0 @@
|
|||
-- This file configures galaxyline, a fast and small statusline for nvim.
|
||||
-- The configuration was taken from github.com/siduck76/neovim-dotfiles/
|
||||
-- All I did was change the colors. Full credit goes to siduck76
|
||||
|
||||
local gl = require("galaxyline")
|
||||
local gls = gl.section
|
||||
|
||||
gl.short_line_list = {" "} -- keeping this table { } as empty will show inactive statuslines
|
||||
|
||||
local colors = {
|
||||
bg = "#2e303e",
|
||||
line_bg = "#2e303e",
|
||||
fg = "#e3e6ee",
|
||||
green = "#29d398",
|
||||
orange = "#efb993",
|
||||
red = "#e95678",
|
||||
lightbg = "#2e303e",
|
||||
lightbasdfg = "#393b4d",
|
||||
nord = "#9699b7",
|
||||
greenYel = "#efb993"
|
||||
}
|
||||
|
||||
gls.left[1] = {
|
||||
leftRounded = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.nord, colors.bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[2] = {
|
||||
statusIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.fg, colors.bg},
|
||||
separator = " ",
|
||||
separator_highlight = {colors.lightbg, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[3] = {
|
||||
FileIcon = {
|
||||
provider = "FileIcon",
|
||||
condition = buffer_not_empty,
|
||||
highlight = {require("galaxyline.provider_fileinfo").get_file_icon_color, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[4] = {
|
||||
FileName = {
|
||||
provider = {"FileName", "FileSize"},
|
||||
condition = buffer_not_empty,
|
||||
highlight = {colors.fg, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[5] = {
|
||||
teech = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = " ",
|
||||
highlight = {colors.lightbg, colors.bg}
|
||||
}
|
||||
}
|
||||
|
||||
local checkwidth = function()
|
||||
local squeeze_width = vim.fn.winwidth(0) / 2
|
||||
if squeeze_width > 40 then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
gls.left[6] = {
|
||||
DiffAdd = {
|
||||
provider = "DiffAdd",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = {colors.greenYel, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[7] = {
|
||||
DiffModified = {
|
||||
provider = "DiffModified",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = {colors.orange, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[8] = {
|
||||
DiffRemove = {
|
||||
provider = "DiffRemove",
|
||||
condition = checkwidth,
|
||||
icon = " ",
|
||||
highlight = {colors.lightbg, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[9] = {
|
||||
LeftEnd = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = " ",
|
||||
separator_highlight = {colors.line_bg, colors.line_bg},
|
||||
highlight = {colors.line_bg, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[10] = {
|
||||
DiagnosticError = {
|
||||
provider = "DiagnosticError",
|
||||
icon = " ",
|
||||
highlight = {colors.red, colors.bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[11] = {
|
||||
Space = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.line_bg, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.left[12] = {
|
||||
DiagnosticWarn = {
|
||||
provider = "DiagnosticWarn",
|
||||
icon = " ",
|
||||
highlight = {colors.red, colors.bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[1] = {
|
||||
GitIcon = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
||||
highlight = {colors.green, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[2] = {
|
||||
GitBranch = {
|
||||
provider = "GitBranch",
|
||||
condition = require("galaxyline.provider_vcs").check_git_workspace,
|
||||
highlight = {colors.green, colors.line_bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[3] = {
|
||||
right_LeftRounded = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
separator = " ",
|
||||
separator_highlight = {colors.bg, colors.bg},
|
||||
highlight = {colors.lightbg, colors.bg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[4] = {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
local alias = {
|
||||
n = "NORMAL",
|
||||
i = "INSERT",
|
||||
c = "COMMAND",
|
||||
V = "VISUAL",
|
||||
[""] = "VISUAL",
|
||||
v = "VISUAL",
|
||||
R = "REPLACE"
|
||||
}
|
||||
return alias[vim.fn.mode()]
|
||||
end,
|
||||
highlight = {colors.fg, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[5] = {
|
||||
PerCent = {
|
||||
provider = "LinePercent",
|
||||
separator = " ",
|
||||
separator_highlight = {colors.lightbg, colors.lightbg},
|
||||
highlight = {colors.fg, colors.lightbg}
|
||||
}
|
||||
}
|
||||
|
||||
gls.right[6] = {
|
||||
rightRounded = {
|
||||
provider = function()
|
||||
return " "
|
||||
end,
|
||||
highlight = {colors.lightbg, colors.bg}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
-- This file sets up autocompletion for neovim's native lsp
|
||||
|
||||
-- This enables all the language servers I want on my system
|
||||
-- Change these to whatever languages you use
|
||||
|
||||
require'lspconfig'.rnix.setup{}
|
||||
require'lspconfig'.sumneko_lua.setup{}
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
-- Autocompletion setup
|
||||
require'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
debug = false;
|
||||
min_length = 1;
|
||||
preselect = 'enable';
|
||||
throttle_time = 80;
|
||||
source_timeout = 200;
|
||||
incomplete_delay = 400;
|
||||
max_abbr_width = 100;
|
||||
max_kind_width = 100;
|
||||
max_menu_width = 100;
|
||||
documentation = false;
|
||||
source = {
|
||||
path = true;
|
||||
buffer = true;
|
||||
nvim_lsp = true;
|
||||
treesitter = true;
|
||||
};
|
||||
}
|
||||
|
||||
-- Set tab to accept the autocompletion
|
||||
local t = function(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
end
|
||||
_G.tab_complete = function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return t "<C-n>"
|
||||
else
|
||||
return t "<S-Tab>"
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||
|
||||
|
||||
-- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use
|
||||
local sumneko_root_path = vim.fn.stdpath('cache')..'/lspconfig/sumneko_lua/lua-language-server'
|
||||
local sumneko_binary = "lua-language-server"
|
||||
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
table.insert(runtime_path, "lua/?/init.lua")
|
||||
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
path = runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
preloadFileSize = 120
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
-- following options are the default
|
||||
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
|
||||
require'nvim-tree'.setup {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
auto_close = false,
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
update_to_buf_dir = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
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 = {}
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
height = 30,
|
||||
hide_root_folder = false,
|
||||
side = 'left',
|
||||
auto_resize = false,
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {}
|
||||
},
|
||||
number = false,
|
||||
relativenumber = false
|
||||
},
|
||||
trash = {
|
||||
cmd = "trash",
|
||||
require_confirm = true
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
-- Lazy load everything!
|
||||
--
|
||||
--
|
||||
--dofile("lsp.lua")
|
||||
--dofile("galaxyline.lua")
|
||||
--dofile("nvim-tree.lua")
|
||||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
|
||||
|
||||
vim.cmd [[
|
||||
set nowrap
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
set noerrorbells
|
||||
set noswapfile
|
||||
|
||||
colorscheme dusk
|
||||
function! Preserve(command)
|
||||
let w = winsaveview()
|
||||
execute a:command
|
||||
call winrestview(w)
|
||||
endfunction
|
||||
autocmd FileType nix map <nowait> <leader>u :call Preserve("%!update-nix-fetchgit --location=" . line(".") . ":" . col("."))<CR>
|
||||
autocmd BufWinEnter NvimTree setlocal nonumber
|
||||
map ; :
|
||||
highlight IndentBlanklineChar guifg = #393b4d
|
||||
|
||||
]]
|
||||
|
||||
-- Enable plugins
|
||||
require('bufferline').setup{}
|
||||
require('pears').setup()
|
||||
require('colorizer').setup()
|
||||
|
||||
-- Treesitter settings
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
highlight = {
|
||||
enable = true
|
||||
},
|
||||
}
|
||||
|
||||
local map = vim.api.nvim_set_keymap
|
||||
options = { noremap = true }
|
||||
map('n', '<C-p>', ':NvimTreeToggle <CR>', options)
|
||||
map('n', '<C-f>', ':Telescope find_files <CR>', options)
|
||||
map('n', '<C-n>', ':Telescope live_grep <CR>', options)
|
||||
map('n', '<C-l>', ':noh <CR>', options)
|
||||
map('n', '<C-s>', ':!xclip -sel c -o | pygmentize -f html | xclip -sel c <CR> <CR>', options)
|
||||
vim.api.nvim_set_keymap('n', '0', "getline('.')[0 : col('.') - 2] =~# '^\\s\\+$' ? '0' : '^'", {silent = true, noremap = true, expr = true})
|
||||
g.mapleader = ' '
|
||||
|
||||
-- Indent line
|
||||
g.indent_blankline_char = '▏'
|
||||
|
||||
-- Performance
|
||||
opt.lazyredraw = true;
|
||||
opt.shell = "zsh"
|
||||
opt.shadafile = "NONE"
|
||||
|
||||
-- Colors
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Undo files
|
||||
opt.undofile = true
|
||||
|
||||
-- Indentation
|
||||
opt.smartindent = true
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.shiftround = true
|
||||
opt.expandtab = true
|
||||
opt.scrolloff = 3
|
||||
|
||||
-- Set clipboard to use system clipboard
|
||||
opt.clipboard = "unnamedplus"
|
||||
|
||||
-- Use mouse
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Nicer UI settings
|
||||
opt.cursorline = true
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
|
||||
-- Get rid of annoying viminfo file
|
||||
opt.viminfo = ""
|
||||
opt.viminfofile = "NONE"
|
||||
|
||||
-- Miscellaneous quality of life
|
||||
opt.ignorecase = true
|
||||
opt.ttimeoutlen = 5
|
||||
opt.compatible = false
|
||||
opt.hidden = true
|
||||
opt.shortmess = "atI"
|
76
home-manager-modules/neovim/settings.lua
Normal file
76
home-manager-modules/neovim/settings.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local opt = vim.opt
|
||||
local g = vim.g
|
||||
local keyset = vim.keymap.set
|
||||
|
||||
opt.backup = false
|
||||
opt.writebackup = false
|
||||
opt.updatetime = 300
|
||||
opt.signcolumn = "yes"
|
||||
|
||||
function _G.check_back_space()
|
||||
local col = vim.fn.col('.') - 1
|
||||
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s')
|
||||
end
|
||||
|
||||
local opts = {silent = true, noremap = true, expr = true}
|
||||
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||
|
||||
|
||||
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||
|
||||
function _G.show_docs()
|
||||
local cw = vim.fn.expand('<cword>')
|
||||
if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
|
||||
vim.api.nvim_command('h ' .. cw)
|
||||
elseif vim.api.nvim_eval('coc#rpc#ready()') then
|
||||
vim.fn.CocActionAsync('doHover')
|
||||
else
|
||||
vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
|
||||
end
|
||||
end
|
||||
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
|
||||
|
||||
|
||||
|
||||
vim.cmd [[
|
||||
syntax on
|
||||
set scrolloff=4
|
||||
set nocompatible
|
||||
set encoding=utf-8
|
||||
set fileencoding=utf-8
|
||||
|
||||
set smartindent
|
||||
set autoindent
|
||||
set number
|
||||
set relativenumber
|
||||
|
||||
colorscheme onedarker
|
||||
]]
|
||||
|
||||
|
||||
require("nvim-tree").setup()
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', 'ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', 'fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', 'fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', 'fh', builtin.help_tags, {})
|
||||
|
||||
require'nvim-web-devicons'.setup()
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
require("bufferline").setup{}
|
||||
|
||||
require('colorizer').setup()
|
||||
|
||||
-- Treesitter settings
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = "", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
highlight = {
|
||||
enable = true
|
||||
},
|
||||
}
|
Loading…
Add table
Reference in a new issue