Skip to content

Commit

Permalink
nvim: update
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Aug 7, 2024
1 parent d439fff commit cf8466c
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 74 deletions.
81 changes: 75 additions & 6 deletions modules/home-manager/terminal_environment/neovim/config-lua.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'calc' },
}, {
{ name = 'buffer' },
}),
Expand All @@ -97,7 +96,6 @@
nvim_lsp = "[LSP]",
vsnip = "[Snip]",
path = "[Path]",
calc = "[Calc]",
buffer = "[Buff]",
})[entry.source.name]
Expand All @@ -107,13 +105,84 @@
})
-- Fuzzy finding config
require('fzf-lua').setup{
require('fzf-lua').setup({
keymap = {
fzf = {
["tab"] = "down",
["shift-tab"] = "up",
}
}
}
},
},
})
-- Tree view config
vim.keymap.set('n', '<space>n', function()
require("neo-tree.command").execute({
action = "focus",
});
end
);
vim.keymap.set('n', '<space>N', function()
require("neo-tree.command").execute({
action = "close",
});
end
);
require("neo-tree").setup({
popup_border_style = "rounded",
default_component_configs = {
name = {
trainling_slash = true,
use_git_status_colors = false,
},
},
source_selector = {
winbar = true,
statusline = false,
},
filesystem = {
follow_current_file = {
enabled = true,
},
},
})
vim.cmd([[
highlight NeoTreeFloatNormal guifg=#ffffff guibg=#000000
highlight NeoTreeFloatTitle guifg=#ffffff guibg=#000000
highlight NeoTreeFloatBorder guifg=#ffffff guibg=#000000
]])
-- Status line config
require('lualine').setup({
options = {
icons_enabled = false,
theme = "base16",
section_separators = { left = "", right = "" },
component_separators = { left = "|", right = "|" },
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff'},
lualine_c = {'filename'},
lualine_x = {'filetype', 'encoding', 'fileformat'},
lualine_y = {'diagnostics'},
lualine_z = {'location'}
},
})
-- Treesitter config
require('nvim-treesitter.configs').setup({
highlight = {
enable = true,
},
indent = {
enable = true,
},
})
'';
}
31 changes: 2 additions & 29 deletions modules/home-manager/terminal_environment/neovim/config-vim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
""""""""""""""""""
filetype plugin indent on
syntax on
syntax off
" Use Space as Leader
let mapleader = " "
Expand All @@ -34,10 +34,6 @@
" Terminal title
set title
" Airline config
let g:airline_powerline_fonts = 1
let g:airline#extensions#ale#enabled = 1
set laststatus=2
set timeoutlen=500
Expand Down Expand Up @@ -77,17 +73,6 @@
" Highlight current line
set cursorline
" NERDTree config
let g:NERDTreeMinimalUI = 1
function! NERDTreeOpen()
if @% == ""
NERDTreeCWD
else
NERDTreeFind
endif
endfunction
"""""""""""""""""""""""""""""""
" MISC COMMANDS AND FUNCTIONS "
"""""""""""""""""""""""""""""""
Expand All @@ -108,26 +93,14 @@
map <Leader>S :SpellOff<CR>
" Find shortcuts
map <Leader>F :FzfLua<CR>
map <Leader>f :FzfLua git_files<CR>
map <Leader>b :FzfLua buffers<CR>
map <Leader>g :FzfLua live_grep<CR>
map <Leader>l :FzfLua lines<CR>
map <Leader>c :FzfLua commands<CR>
map <Leader>f :FzfLua<CR>
nmap cf :FzfLua lsp_finder<CR>
nmap ca :FzfLua lsp_code_actions<CR>
" easymotion word jumping
map <Leader>j <Plug>(easymotion-bd-w)
nmap <Leader>j <Plug>(easymotion-overwin-w)
" NERDTree
map <Leader>n :call NERDTreeOpen()<CR>
map <Leader>N :NERDTreeClose<CR>
" Toggle tagbar
map <Leader>t :TagbarToggle<CR>
" Easy indent/unindent
vmap < <gv
vmap > >gv
Expand Down
2 changes: 0 additions & 2 deletions modules/home-manager/terminal_environment/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
defaultEditor = true;

extraPackages = with pkgs; [
universal-ctags

# Language servers
marksman
nixd
Expand Down
61 changes: 24 additions & 37 deletions modules/home-manager/terminal_environment/neovim/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,56 @@
pkgs,
...
}: {
programs.neovim.plugins = with pkgs; [
programs.neovim.plugins = with pkgs.vimPlugins; [
# Colour scheme
(vimPlugins.base16-vim.overrideAttrs (
(base16-vim.overrideAttrs (
old: let
schemeFile = config.scheme inputs.base16-vim;
in {patchPhase = ''cp ${schemeFile} colors/base16-scheme.vim'';}
))

# Provides powerline style status line
vimPlugins.vim-airline
vimPlugins.vim-airline-themes

# Provides easy line/block comment toggling
vimPlugins.vim-commentary
vim-commentary

# Completion
vimPlugins.nvim-cmp
vimPlugins.vim-vsnip
vimPlugins.cmp-vsnip
vimPlugins.cmp-calc
vimPlugins.cmp-buffer
vimPlugins.cmp-nvim-lsp
vimPlugins.cmp-path
nvim-cmp
vim-vsnip
cmp-vsnip
cmp-buffer
cmp-nvim-lsp
cmp-path

# Used to format and make editing CSV files trivial
vimPlugins.csv
csv

# Fast jumping to markers in a file
vimPlugins.easymotion

# Applies formatting rules based on editorconfig files
vimPlugins.editorconfig-vim
easymotion

# Fuzzy finding
vimPlugins.fzf-lua
fzf-lua

# Status line
lualine-nvim

# Enhanced spelling and grammar checking
vimPlugins.vim-lexical
vim-lexical

# Language server client
vimPlugins.nvim-lspconfig
nvim-lspconfig

# Provides tree based file explorer
vimPlugins.nerdtree
# Tree based file explorer
neo-tree-nvim

# Restores cursor position on opening previously opened files
vimPlugins.restore-view-vim
restore-view-vim

# Format text into one line per sentence
vimPlugins.vim-sentence-chopper
vim-sentence-chopper

# Provides ctags based navigation of current file
vimPlugins.tagbar
# Treesitter
nvim-treesitter.withAllGrammars

# Query and insert unicode characters
vimPlugins.unicode-vim

# Icons (e.g. file types) for other plugins
vimPlugins.nvim-web-devicons

# Syntax highlighting
vimPlugins.vim-polyglot
vimPlugins.vim-openscad
vimPlugins.vim-nftables
unicode-vim
];
}

0 comments on commit cf8466c

Please sign in to comment.